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

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: Fix DCHECK 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 b6a7a56d31ed645f6b99c6b0f2a1318f155af947..3454897bbc798c792c8c4960ef9d20cc233b2b15 100644
--- a/third_party/WebKit/Source/core/dom/Node.cpp
+++ b/third_party/WebKit/Source/core/dom/Node.cpp
@@ -2341,15 +2341,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