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

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

Issue 1982973002: Add CustomElementState for Custom Elements v1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fix and UNREACHABLE -> NOTREACHED 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-2011, 2014 Apple Inc. All rights reserved. 5 * Copyright (C) 2004-2011, 2014 Apple Inc. All rights 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 const int nodeStyleChangeShift = 19; 93 const int nodeStyleChangeShift = 19;
94 94
95 enum StyleChangeType { 95 enum StyleChangeType {
96 NoStyleChange = 0, 96 NoStyleChange = 0,
97 LocalStyleChange = 1 << nodeStyleChangeShift, 97 LocalStyleChange = 1 << nodeStyleChangeShift,
98 SubtreeStyleChange = 2 << nodeStyleChangeShift, 98 SubtreeStyleChange = 2 << nodeStyleChangeShift,
99 NeedsReattachStyleChange = 3 << nodeStyleChangeShift, 99 NeedsReattachStyleChange = 3 << nodeStyleChangeShift,
100 }; 100 };
101 101
102 enum class CustomElementState {
103 Uncustomized = 0,
104 Custom = 1,
105 Undefined = 2,
106 };
107
108 CORE_EXPORT std::ostream& operator<<(std::ostream&, CustomElementState);
109
102 class NodeRareDataBase { 110 class NodeRareDataBase {
103 public: 111 public:
104 LayoutObject* layoutObject() const { return m_layoutObject; } 112 LayoutObject* layoutObject() const { return m_layoutObject; }
105 void setLayoutObject(LayoutObject* layoutObject) { m_layoutObject = layoutOb ject; } 113 void setLayoutObject(LayoutObject* layoutObject) { m_layoutObject = layoutOb ject; }
106 114
107 protected: 115 protected:
108 NodeRareDataBase(LayoutObject* layoutObject) 116 NodeRareDataBase(LayoutObject* layoutObject)
109 : m_layoutObject(layoutObject) 117 : m_layoutObject(layoutObject)
110 { } 118 { }
111 119
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 bool isTextNode() const { return getFlag(IsTextFlag); } 245 bool isTextNode() const { return getFlag(IsTextFlag); }
238 bool isHTMLElement() const { return getFlag(IsHTMLFlag); } 246 bool isHTMLElement() const { return getFlag(IsHTMLFlag); }
239 bool isSVGElement() const { return getFlag(IsSVGFlag); } 247 bool isSVGElement() const { return getFlag(IsSVGFlag); }
240 248
241 bool isPseudoElement() const { return getPseudoId() != PseudoIdNone; } 249 bool isPseudoElement() const { return getPseudoId() != PseudoIdNone; }
242 bool isBeforePseudoElement() const { return getPseudoId() == PseudoIdBefore; } 250 bool isBeforePseudoElement() const { return getPseudoId() == PseudoIdBefore; }
243 bool isAfterPseudoElement() const { return getPseudoId() == PseudoIdAfter; } 251 bool isAfterPseudoElement() const { return getPseudoId() == PseudoIdAfter; }
244 bool isFirstLetterPseudoElement() const { return getPseudoId() == PseudoIdFi rstLetter; } 252 bool isFirstLetterPseudoElement() const { return getPseudoId() == PseudoIdFi rstLetter; }
245 virtual PseudoId getPseudoId() const { return PseudoIdNone; } 253 virtual PseudoId getPseudoId() const { return PseudoIdNone; }
246 254
255 bool isCustomElement() const { return getFlag(CustomElementFlag); }
256 CustomElementState getCustomElementState() const;
257 void setCustomElementState(CustomElementState);
247 bool isV0CustomElement() const { return getFlag(V0CustomElementFlag); } 258 bool isV0CustomElement() const { return getFlag(V0CustomElementFlag); }
248 enum V0CustomElementState { 259 enum V0CustomElementState {
249 V0NotCustomElement = 0, 260 V0NotCustomElement = 0,
250 V0WaitingForUpgrade = 1 << 0, 261 V0WaitingForUpgrade = 1 << 0,
251 V0Upgraded = 1 << 1 262 V0Upgraded = 1 << 1
252 }; 263 };
253 V0CustomElementState getV0CustomElementState() const 264 V0CustomElementState getV0CustomElementState() const
254 { 265 {
255 return isV0CustomElement() 266 return isV0CustomElement()
256 ? (getFlag(V0CustomElementUpgradedFlag) ? V0Upgraded : V0WaitingForU pgrade) 267 ? (getFlag(V0CustomElementUpgradedFlag) ? V0Upgraded : V0WaitingForU pgrade)
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 717
707 // Flags related to recalcStyle. 718 // Flags related to recalcStyle.
708 SVGFilterNeedsLayerUpdateFlag = 1 << 13, 719 SVGFilterNeedsLayerUpdateFlag = 1 << 13,
709 HasCustomStyleCallbacksFlag = 1 << 14, 720 HasCustomStyleCallbacksFlag = 1 << 14,
710 ChildNeedsStyleInvalidationFlag = 1 << 15, 721 ChildNeedsStyleInvalidationFlag = 1 << 15,
711 NeedsStyleInvalidationFlag = 1 << 16, 722 NeedsStyleInvalidationFlag = 1 << 16,
712 ChildNeedsDistributionRecalcFlag = 1 << 17, 723 ChildNeedsDistributionRecalcFlag = 1 << 17,
713 ChildNeedsStyleRecalcFlag = 1 << 18, 724 ChildNeedsStyleRecalcFlag = 1 << 18,
714 StyleChangeMask = 1 << nodeStyleChangeShift | 1 << (nodeStyleChangeShift + 1), 725 StyleChangeMask = 1 << nodeStyleChangeShift | 1 << (nodeStyleChangeShift + 1),
715 726
716 V0CustomElementFlag = 1 << 21, 727 CustomElementFlag = 1 << 21,
717 V0CustomElementUpgradedFlag = 1 << 22, 728 CustomElementCustomFlag = 1 << 22,
718 729
719 HasNameOrIsEditingTextFlag = 1 << 23, 730 HasNameOrIsEditingTextFlag = 1 << 23,
720 HasWeakReferencesFlag = 1 << 24, 731 HasWeakReferencesFlag = 1 << 24,
721 V8CollectableDuringMinorGCFlag = 1 << 25, 732 V8CollectableDuringMinorGCFlag = 1 << 25,
722 HasEventTargetDataFlag = 1 << 26, 733 HasEventTargetDataFlag = 1 << 26,
723 AlreadySpellCheckedFlag = 1 << 27, 734 AlreadySpellCheckedFlag = 1 << 27,
724 735
736 V0CustomElementFlag = 1 << 28,
737 V0CustomElementUpgradedFlag = 1 << 29,
738
725 DefaultNodeFlags = IsFinishedParsingChildrenFlag | NeedsReattachStyleCha nge 739 DefaultNodeFlags = IsFinishedParsingChildrenFlag | NeedsReattachStyleCha nge
726 }; 740 };
727 741
728 // 3 bits remaining. 742 // 3 bits remaining.
729 743
730 bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; } 744 bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; }
731 void setFlag(bool f, NodeFlags mask) { m_nodeFlags = (m_nodeFlags & ~mask) | (-(int32_t)f & mask); } 745 void setFlag(bool f, NodeFlags mask) { m_nodeFlags = (m_nodeFlags & ~mask) | (-(int32_t)f & mask); }
732 void setFlag(NodeFlags mask) { m_nodeFlags |= mask; } 746 void setFlag(NodeFlags mask) { m_nodeFlags |= mask; }
733 void clearFlag(NodeFlags mask) { m_nodeFlags &= ~mask; } 747 void clearFlag(NodeFlags mask) { m_nodeFlags &= ~mask; }
734 748
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 } // namespace blink 914 } // namespace blink
901 915
902 #ifndef NDEBUG 916 #ifndef NDEBUG
903 // Outside the WebCore namespace for ease of invocation from gdb. 917 // Outside the WebCore namespace for ease of invocation from gdb.
904 void showNode(const blink::Node*); 918 void showNode(const blink::Node*);
905 void showTree(const blink::Node*); 919 void showTree(const blink::Node*);
906 void showNodePath(const blink::Node*); 920 void showNodePath(const blink::Node*);
907 #endif 921 #endif
908 922
909 #endif // Node_h 923 #endif // Node_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.h ('k') | third_party/WebKit/Source/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698