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

Side by Side Diff: Source/core/dom/Node.h

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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/dom/Node.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 6 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 bool isContainerNode() const { return getFlag(IsContainerFlag); } 237 bool isContainerNode() const { return getFlag(IsContainerFlag); }
238 bool isTextNode() const { return getFlag(IsTextFlag); } 238 bool isTextNode() const { return getFlag(IsTextFlag); }
239 bool isHTMLElement() const { return getFlag(IsHTMLFlag); } 239 bool isHTMLElement() const { return getFlag(IsHTMLFlag); }
240 bool isSVGElement() const { return getFlag(IsSVGFlag); } 240 bool isSVGElement() const { return getFlag(IsSVGFlag); }
241 241
242 bool isPseudoElement() const { return pseudoId() != NOPSEUDO; } 242 bool isPseudoElement() const { return pseudoId() != NOPSEUDO; }
243 bool isBeforePseudoElement() const { return pseudoId() == BEFORE; } 243 bool isBeforePseudoElement() const { return pseudoId() == BEFORE; }
244 bool isAfterPseudoElement() const { return pseudoId() == AFTER; } 244 bool isAfterPseudoElement() const { return pseudoId() == AFTER; }
245 PseudoId pseudoId() const { return (isElementNode() && hasCustomStyleCallbac ks()) ? customPseudoId() : NOPSEUDO; } 245 PseudoId pseudoId() const { return (isElementNode() && hasCustomStyleCallbac ks()) ? customPseudoId() : NOPSEUDO; }
246 246
247 bool isCustomElement() const { return getFlag(IsCustomElement); } 247 enum CustomElementState {
248 void setIsCustomElement(); 248 NotCustomElement,
249 bool isUpgradedCustomElement() const { return getFlag(IsUpgradedCustomElemen t); } 249 UpgradeCandidate,
250 void setIsUpgradedCustomElement(); 250 Defined,
251 Upgraded
252 };
253 bool isCustomElement() const { return customElementState() != NotCustomEleme nt; }
254 CustomElementState customElementState() const { return CustomElementState((g etFlag(CustomElementHasDefinitionOrIsUpgraded) ? 2 : 0) | (getFlag(CustomElement IsUpgradeCandidateOrUpgraded) ? 1 : 0)); }
255 void setCustomElementState(CustomElementState newState);
251 256
252 virtual bool isMediaControlElement() const { return false; } 257 virtual bool isMediaControlElement() const { return false; }
253 virtual bool isMediaControls() const { return false; } 258 virtual bool isMediaControls() const { return false; }
254 virtual bool isWebVTTElement() const { return false; } 259 virtual bool isWebVTTElement() const { return false; }
255 virtual bool isAttributeNode() const { return false; } 260 virtual bool isAttributeNode() const { return false; }
256 virtual bool isCharacterDataNode() const { return false; } 261 virtual bool isCharacterDataNode() const { return false; }
257 virtual bool isFrameOwnerElement() const { return false; } 262 virtual bool isFrameOwnerElement() const { return false; }
258 virtual bool isPluginElement() const { return false; } 263 virtual bool isPluginElement() const { return false; }
259 264
260 // StyledElements allow inline style (style="border: 1px"), presentational a ttributes (ex. color), 265 // StyledElements allow inline style (style="border: 1px"), presentational a ttributes (ex. color),
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 HasNameOrIsEditingTextFlag = 1 << 17, 742 HasNameOrIsEditingTextFlag = 1 << 17,
738 743
739 InNamedFlowFlag = 1 << 18, 744 InNamedFlowFlag = 1 << 18,
740 HasSyntheticAttrChildNodesFlag = 1 << 19, 745 HasSyntheticAttrChildNodesFlag = 1 << 19,
741 HasCustomStyleCallbacksFlag = 1 << 20, 746 HasCustomStyleCallbacksFlag = 1 << 20,
742 HasScopedHTMLStyleChildFlag = 1 << 21, 747 HasScopedHTMLStyleChildFlag = 1 << 21,
743 HasEventTargetDataFlag = 1 << 22, 748 HasEventTargetDataFlag = 1 << 22,
744 V8CollectableDuringMinorGCFlag = 1 << 23, 749 V8CollectableDuringMinorGCFlag = 1 << 23,
745 IsInsertionPointFlag = 1 << 24, 750 IsInsertionPointFlag = 1 << 24,
746 IsInShadowTreeFlag = 1 << 25, 751 IsInShadowTreeFlag = 1 << 25,
747 IsCustomElement = 1 << 26,
748 752
749 NotifyRendererWithIdenticalStyles = 1 << 27, 753 NotifyRendererWithIdenticalStyles = 1 << 26,
750 754
751 IsUpgradedCustomElement = 1 << 28, 755 CustomElementIsUpgradeCandidateOrUpgraded = 1 << 27,
756 CustomElementHasDefinitionOrIsUpgraded = 1 << 28,
752 757
753 DefaultNodeFlags = IsParsingChildrenFinishedFlag 758 DefaultNodeFlags = IsParsingChildrenFinishedFlag
754 }; 759 };
755 760
756 // 3 bits remaining 761 // 3 bits remaining
757 762
758 bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; } 763 bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; }
759 void setFlag(bool f, NodeFlags mask) const { m_nodeFlags = (m_nodeFlags & ~m ask) | (-(int32_t)f & mask); } 764 void setFlag(bool f, NodeFlags mask) const { m_nodeFlags = (m_nodeFlags & ~m ask) | (-(int32_t)f & mask); }
760 void setFlag(NodeFlags mask) const { m_nodeFlags |= mask; } 765 void setFlag(NodeFlags mask) const { m_nodeFlags |= mask; }
761 void clearFlag(NodeFlags mask) const { m_nodeFlags &= ~mask; } 766 void clearFlag(NodeFlags mask) const { m_nodeFlags &= ~mask; }
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 940
936 } //namespace 941 } //namespace
937 942
938 #ifndef NDEBUG 943 #ifndef NDEBUG
939 // Outside the WebCore namespace for ease of invocation from gdb. 944 // Outside the WebCore namespace for ease of invocation from gdb.
940 void showTree(const WebCore::Node*); 945 void showTree(const WebCore::Node*);
941 void showNodePath(const WebCore::Node*); 946 void showNodePath(const WebCore::Node*);
942 #endif 947 #endif
943 948
944 #endif 949 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698