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

Unified Diff: Source/core/dom/Node.cpp

Issue 19900002: Use the two Custom Elements node bits to explicitly represent four states. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Play nice with MSVC. Created 7 years, 5 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
« no previous file with comments | « Source/core/dom/Node.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Node.cpp
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp
index 8860aeedebf7003f73e94578951e068bc0b95e47..8f63f06b799b44aefdb1a86ebe7e42968e260083 100644
--- a/Source/core/dom/Node.cpp
+++ b/Source/core/dom/Node.cpp
@@ -2681,17 +2681,34 @@ bool Node::isUserActionElementFocused() const
return document()->userActionElements().isFocused(this);
}
-void Node::setIsCustomElement()
+void Node::setCustomElementState(CustomElementState newState)
{
+ CustomElementState oldState = customElementState();
+
+ switch (newState) {
+ case NotCustomElement:
+ ASSERT_NOT_REACHED(); // Everything starts in this state
+ return;
+
+ case UpgradeCandidate:
+ ASSERT(NotCustomElement == oldState);
+ break;
+
+ case Defined:
+ ASSERT(UpgradeCandidate == oldState || NotCustomElement == oldState);
+ break;
+
+ case Upgraded:
+ ASSERT(Defined == oldState);
+ break;
+ }
+
ASSERT(isHTMLElement() || isSVGElement());
- setFlag(IsCustomElement);
-}
+ setFlag(newState & 1, CustomElementIsUpgradeCandidateOrUpgraded);
+ setFlag(newState & 2, CustomElementHasDefinitionOrIsUpgraded);
-void Node::setIsUpgradedCustomElement()
-{
- ASSERT(isCustomElement());
- setFlag(IsUpgradedCustomElement);
- setNeedsStyleRecalc(); // :unresolved has changed
+ if (oldState == NotCustomElement || newState == Upgraded)
+ setNeedsStyleRecalc(); // :unresolved has changed
}
} // namespace WebCore
« no previous file with comments | « Source/core/dom/Node.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698