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

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: rune and dominicc review, test updated Created 4 years, 7 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 2324 matching lines...) Expand 10 before | Expand all | Expand 10 after
2335 DCHECK_EQ(CustomElementState::Uncustomized, oldState); 2335 DCHECK_EQ(CustomElementState::Uncustomized, oldState);
2336 break; 2336 break;
2337 2337
2338 case CustomElementState::Custom: 2338 case CustomElementState::Custom:
2339 DCHECK_EQ(CustomElementState::Undefined, oldState); 2339 DCHECK_EQ(CustomElementState::Undefined, oldState);
2340 break; 2340 break;
2341 } 2341 }
2342 2342
2343 DCHECK(isHTMLElement()); 2343 DCHECK(isHTMLElement());
2344 DCHECK_NE(V0Upgraded, getV0CustomElementState()); 2344 DCHECK_NE(V0Upgraded, getV0CustomElementState());
2345 #if DCHECK_IS_ON()
2346 bool wasDefined = toElement(this)->isDefined();
2347 #endif
2345 2348
2346 setFlag(CustomElementFlag); 2349 setFlag(CustomElementFlag);
2347 if (newState == CustomElementState::Custom) 2350 if (newState == CustomElementState::Custom)
2348 setFlag(CustomElementCustomFlag); 2351 setFlag(CustomElementCustomFlag);
2349 DCHECK(newState == getCustomElementState()); 2352 DCHECK(newState == getCustomElementState());
2350 2353
2351 // TODO(kojii): Should fire pseudoStateChanged() when :defined selector is 2354 // When the state goes from Uncustomized to Undefined, and then to Custom,
2352 // ready. 2355 // isDefined is always flipped.
2353 // toElement(this)->pseudoStateChanged(CSSSelector::PseudoDefined); 2356 #if DCHECK_IS_ON()
2357 DCHECK_NE(wasDefined, toElement(this)->isDefined());
2358 #endif
2359 toElement(this)->pseudoStateChanged(CSSSelector::PseudoDefined);
2354 } 2360 }
2355 2361
2356 void Node::setV0CustomElementState(V0CustomElementState newState) 2362 void Node::setV0CustomElementState(V0CustomElementState newState)
2357 { 2363 {
2358 V0CustomElementState oldState = getV0CustomElementState(); 2364 V0CustomElementState oldState = getV0CustomElementState();
2359 2365
2360 switch (newState) { 2366 switch (newState) {
2361 case V0NotCustomElement: 2367 case V0NotCustomElement:
2362 ASSERT_NOT_REACHED(); // Everything starts in this state 2368 ASSERT_NOT_REACHED(); // Everything starts in this state
2363 return; 2369 return;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
2475 2481
2476 void showNodePath(const blink::Node* node) 2482 void showNodePath(const blink::Node* node)
2477 { 2483 {
2478 if (node) 2484 if (node)
2479 node->showNodePathForThis(); 2485 node->showNodePathForThis();
2480 else 2486 else
2481 fprintf(stderr, "Cannot showNodePath for (nil)\n"); 2487 fprintf(stderr, "Cannot showNodePath for (nil)\n");
2482 } 2488 }
2483 2489
2484 #endif 2490 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698