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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/Node.cpp
diff --git a/third_party/WebKit/Source/core/dom/Node.cpp b/third_party/WebKit/Source/core/dom/Node.cpp
index 9565e1f766926b92b9cf56ffaf5b471310b59f08..8927e6ff5c9b2b2089685e1557e3e1db323eb732 100644
--- a/third_party/WebKit/Source/core/dom/Node.cpp
+++ b/third_party/WebKit/Source/core/dom/Node.cpp
@@ -2342,15 +2342,21 @@ void Node::setCustomElementState(CustomElementState newState)
DCHECK(isHTMLElement());
DCHECK_NE(V0Upgraded, getV0CustomElementState());
+#if DCHECK_IS_ON()
+ bool wasDefined = toElement(this)->isDefined();
+#endif
setFlag(CustomElementFlag);
if (newState == CustomElementState::Custom)
setFlag(CustomElementCustomFlag);
DCHECK(newState == getCustomElementState());
- // TODO(kojii): Should fire pseudoStateChanged() when :defined selector is
- // ready.
- // toElement(this)->pseudoStateChanged(CSSSelector::PseudoDefined);
+ // When the state goes from Uncustomized to Undefined, and then to Custom,
+ // isDefined is always flipped.
+#if DCHECK_IS_ON()
+ DCHECK_NE(wasDefined, toElement(this)->isDefined());
+#endif
+ toElement(this)->pseudoStateChanged(CSSSelector::PseudoDefined);
}
void Node::setV0CustomElementState(V0CustomElementState newState)

Powered by Google App Engine
This is Rietveld 408576698