Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(862)

Side by Side Diff: third_party/WebKit/Source/core/dom/Node.cpp

Issue 1989343002: Implement :defined pseudo-class selector for Custom Elements (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ce-state
Patch Set: Fix DCHECK Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 2323 matching lines...) Expand 10 before | Expand all | Expand 10 after
2334 DCHECK_EQ(CustomElementState::Uncustomized, oldState); 2334 DCHECK_EQ(CustomElementState::Uncustomized, oldState);
2335 break; 2335 break;
2336 2336
2337 case CustomElementState::Custom: 2337 case CustomElementState::Custom:
2338 DCHECK_EQ(CustomElementState::Undefined, oldState); 2338 DCHECK_EQ(CustomElementState::Undefined, oldState);
2339 break; 2339 break;
2340 } 2340 }
2341 2341
2342 DCHECK(isHTMLElement()); 2342 DCHECK(isHTMLElement());
2343 DCHECK_NE(V0Upgraded, getV0CustomElementState()); 2343 DCHECK_NE(V0Upgraded, getV0CustomElementState());
2344 #if DCHECK_IS_ON()
2345 bool wasDefined = toElement(this)->isDefined();
2346 #endif
2344 2347
2345 setFlag(CustomElementFlag); 2348 setFlag(CustomElementFlag);
2346 if (newState == CustomElementState::Custom) 2349 if (newState == CustomElementState::Custom)
2347 setFlag(CustomElementCustomFlag); 2350 setFlag(CustomElementCustomFlag);
2348 DCHECK(newState == getCustomElementState()); 2351 DCHECK(newState == getCustomElementState());
2349 2352
2350 // TODO(kojii): Should fire pseudoStateChanged() when :defined selector is 2353 // When the state goes from Uncustomized to Undefined, and then to Custom,
2351 // ready. 2354 // isDefined is always flipped.
2352 // toElement(this)->pseudoStateChanged(CSSSelector::PseudoDefined); 2355 #if DCHECK_IS_ON()
2356 DCHECK_NE(wasDefined, toElement(this)->isDefined());
2357 #endif
2358 toElement(this)->pseudoStateChanged(CSSSelector::PseudoDefined);
2353 } 2359 }
2354 2360
2355 void Node::setV0CustomElementState(V0CustomElementState newState) 2361 void Node::setV0CustomElementState(V0CustomElementState newState)
2356 { 2362 {
2357 V0CustomElementState oldState = getV0CustomElementState(); 2363 V0CustomElementState oldState = getV0CustomElementState();
2358 2364
2359 switch (newState) { 2365 switch (newState) {
2360 case V0NotCustomElement: 2366 case V0NotCustomElement:
2361 ASSERT_NOT_REACHED(); // Everything starts in this state 2367 ASSERT_NOT_REACHED(); // Everything starts in this state
2362 return; 2368 return;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
2474 2480
2475 void showNodePath(const blink::Node* node) 2481 void showNodePath(const blink::Node* node)
2476 { 2482 {
2477 if (node) 2483 if (node)
2478 node->showNodePathForThis(); 2484 node->showNodePathForThis();
2479 else 2485 else
2480 fprintf(stderr, "Cannot showNodePath for (nil)\n"); 2486 fprintf(stderr, "Cannot showNodePath for (nil)\n");
2481 } 2487 }
2482 2488
2483 #endif 2489 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698