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

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

Issue 2173623003: Add "Failed" custom element state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Avoid multiple toElement Created 4 years, 4 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 class SVGQualifiedName; 85 class SVGQualifiedName;
86 class ShadowRoot; 86 class ShadowRoot;
87 template <typename NodeType> class StaticNodeTypeList; 87 template <typename NodeType> class StaticNodeTypeList;
88 using StaticNodeList = StaticNodeTypeList<Node>; 88 using StaticNodeList = StaticNodeTypeList<Node>;
89 class StyleChangeReasonForTracing; 89 class StyleChangeReasonForTracing;
90 class TagCollection; 90 class TagCollection;
91 class Text; 91 class Text;
92 class TouchEvent; 92 class TouchEvent;
93 93
94 const int nodeStyleChangeShift = 19; 94 const int nodeStyleChangeShift = 19;
95 const int nodeCustomElementShift = 21;
95 96
96 enum StyleChangeType { 97 enum StyleChangeType {
97 NoStyleChange = 0, 98 NoStyleChange = 0,
98 LocalStyleChange = 1 << nodeStyleChangeShift, 99 LocalStyleChange = 1 << nodeStyleChangeShift,
99 SubtreeStyleChange = 2 << nodeStyleChangeShift, 100 SubtreeStyleChange = 2 << nodeStyleChangeShift,
100 NeedsReattachStyleChange = 3 << nodeStyleChangeShift, 101 NeedsReattachStyleChange = 3 << nodeStyleChangeShift,
101 }; 102 };
102 103
103 enum class CustomElementState { 104 enum class CustomElementState {
105 // https://dom.spec.whatwg.org/#concept-element-custom-element-state
104 Uncustomized = 0, 106 Uncustomized = 0,
105 Custom = 1, 107 Custom = 1 << nodeCustomElementShift,
106 Undefined = 2, 108 Undefined = 2 << nodeCustomElementShift,
109 Failed = 3 << nodeCustomElementShift,
110
111 NotDefinedFlag = 2 << nodeCustomElementShift,
107 }; 112 };
108 113
109 CORE_EXPORT std::ostream& operator<<(std::ostream&, CustomElementState);
110
111 class NodeRareDataBase { 114 class NodeRareDataBase {
112 public: 115 public:
113 LayoutObject* layoutObject() const { return m_layoutObject; } 116 LayoutObject* layoutObject() const { return m_layoutObject; }
114 void setLayoutObject(LayoutObject* layoutObject) { m_layoutObject = layoutOb ject; } 117 void setLayoutObject(LayoutObject* layoutObject) { m_layoutObject = layoutOb ject; }
115 118
116 protected: 119 protected:
117 NodeRareDataBase(LayoutObject* layoutObject) 120 NodeRareDataBase(LayoutObject* layoutObject)
118 : m_layoutObject(layoutObject) 121 : m_layoutObject(layoutObject)
119 { } 122 { }
120 123
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 bool isTextNode() const { return getFlag(IsTextFlag); } 251 bool isTextNode() const { return getFlag(IsTextFlag); }
249 bool isHTMLElement() const { return getFlag(IsHTMLFlag); } 252 bool isHTMLElement() const { return getFlag(IsHTMLFlag); }
250 bool isSVGElement() const { return getFlag(IsSVGFlag); } 253 bool isSVGElement() const { return getFlag(IsSVGFlag); }
251 254
252 bool isPseudoElement() const { return getPseudoId() != PseudoIdNone; } 255 bool isPseudoElement() const { return getPseudoId() != PseudoIdNone; }
253 bool isBeforePseudoElement() const { return getPseudoId() == PseudoIdBefore; } 256 bool isBeforePseudoElement() const { return getPseudoId() == PseudoIdBefore; }
254 bool isAfterPseudoElement() const { return getPseudoId() == PseudoIdAfter; } 257 bool isAfterPseudoElement() const { return getPseudoId() == PseudoIdAfter; }
255 bool isFirstLetterPseudoElement() const { return getPseudoId() == PseudoIdFi rstLetter; } 258 bool isFirstLetterPseudoElement() const { return getPseudoId() == PseudoIdFi rstLetter; }
256 virtual PseudoId getPseudoId() const { return PseudoIdNone; } 259 virtual PseudoId getPseudoId() const { return PseudoIdNone; }
257 260
258 bool isCustomElement() const { return getFlag(CustomElementFlag); } 261 CustomElementState getCustomElementState() const { return static_cast<Custom ElementState>(m_nodeFlags & CustomElementStateMask); }
259 CustomElementState getCustomElementState() const;
260 void setCustomElementState(CustomElementState); 262 void setCustomElementState(CustomElementState);
261 bool isV0CustomElement() const { return getFlag(V0CustomElementFlag); } 263 bool isV0CustomElement() const { return getFlag(V0CustomElementFlag); }
262 enum V0CustomElementState { 264 enum V0CustomElementState {
263 V0NotCustomElement = 0, 265 V0NotCustomElement = 0,
264 V0WaitingForUpgrade = 1 << 0, 266 V0WaitingForUpgrade = 1 << 0,
265 V0Upgraded = 1 << 1 267 V0Upgraded = 1 << 1
266 }; 268 };
267 V0CustomElementState getV0CustomElementState() const 269 V0CustomElementState getV0CustomElementState() const
268 { 270 {
269 return isV0CustomElement() 271 return isV0CustomElement()
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 690
689 // Flags related to recalcStyle. 691 // Flags related to recalcStyle.
690 SVGFilterNeedsLayerUpdateFlag = 1 << 13, 692 SVGFilterNeedsLayerUpdateFlag = 1 << 13,
691 HasCustomStyleCallbacksFlag = 1 << 14, 693 HasCustomStyleCallbacksFlag = 1 << 14,
692 ChildNeedsStyleInvalidationFlag = 1 << 15, 694 ChildNeedsStyleInvalidationFlag = 1 << 15,
693 NeedsStyleInvalidationFlag = 1 << 16, 695 NeedsStyleInvalidationFlag = 1 << 16,
694 ChildNeedsDistributionRecalcFlag = 1 << 17, 696 ChildNeedsDistributionRecalcFlag = 1 << 17,
695 ChildNeedsStyleRecalcFlag = 1 << 18, 697 ChildNeedsStyleRecalcFlag = 1 << 18,
696 StyleChangeMask = 1 << nodeStyleChangeShift | 1 << (nodeStyleChangeShift + 1), 698 StyleChangeMask = 1 << nodeStyleChangeShift | 1 << (nodeStyleChangeShift + 1),
697 699
698 CustomElementFlag = 1 << 21, 700 CustomElementStateMask = 0x3 << nodeCustomElementShift,
699 CustomElementCustomFlag = 1 << 22,
700 701
701 HasNameOrIsEditingTextFlag = 1 << 23, 702 HasNameOrIsEditingTextFlag = 1 << 23,
702 HasWeakReferencesFlag = 1 << 24, 703 HasWeakReferencesFlag = 1 << 24,
703 V8CollectableDuringMinorGCFlag = 1 << 25, 704 V8CollectableDuringMinorGCFlag = 1 << 25,
704 HasEventTargetDataFlag = 1 << 26, 705 HasEventTargetDataFlag = 1 << 26,
705 AlreadySpellCheckedFlag = 1 << 27, 706 AlreadySpellCheckedFlag = 1 << 27,
706 707
707 V0CustomElementFlag = 1 << 28, 708 V0CustomElementFlag = 1 << 28,
708 V0CustomElementUpgradedFlag = 1 << 29, 709 V0CustomElementUpgradedFlag = 1 << 29,
709 710
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 } // namespace blink 884 } // namespace blink
884 885
885 #ifndef NDEBUG 886 #ifndef NDEBUG
886 // Outside the WebCore namespace for ease of invocation from gdb. 887 // Outside the WebCore namespace for ease of invocation from gdb.
887 void showNode(const blink::Node*); 888 void showNode(const blink::Node*);
888 void showTree(const blink::Node*); 889 void showTree(const blink::Node*);
889 void showNodePath(const blink::Node*); 890 void showNodePath(const blink::Node*);
890 #endif 891 #endif
891 892
892 #endif // Node_h 893 #endif // Node_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.cpp ('k') | third_party/WebKit/Source/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698