OLD | NEW |
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 class Event; | 52 class Event; |
53 class EventDispatchMediator; | 53 class EventDispatchMediator; |
54 class EventListener; | 54 class EventListener; |
55 class ExceptionState; | 55 class ExceptionState; |
56 class FloatPoint; | 56 class FloatPoint; |
57 class LocalFrame; | 57 class LocalFrame; |
58 class HTMLQualifiedName; | 58 class HTMLQualifiedName; |
59 class IntRect; | 59 class IntRect; |
60 class KeyboardEvent; | 60 class KeyboardEvent; |
61 class NSResolver; | 61 class NSResolver; |
62 class NamedNodeMap; | |
63 class NodeEventContext; | 62 class NodeEventContext; |
64 class NodeList; | 63 class NodeList; |
65 class NodeRareData; | 64 class NodeRareData; |
66 class PlatformGestureEvent; | 65 class PlatformGestureEvent; |
67 class PlatformKeyboardEvent; | 66 class PlatformKeyboardEvent; |
68 class PlatformMouseEvent; | 67 class PlatformMouseEvent; |
69 class PlatformWheelEvent; | 68 class PlatformWheelEvent; |
70 class QualifiedName; | 69 class QualifiedName; |
71 class RegisteredEventListener; | 70 class RegisteredEventListener; |
72 class RenderBox; | 71 class RenderBox; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 class Node : NODE_BASE_CLASSES { | 112 class Node : NODE_BASE_CLASSES { |
114 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(TreeShared<Node>); | 113 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(TreeShared<Node>); |
115 DEFINE_WRAPPERTYPEINFO(); | 114 DEFINE_WRAPPERTYPEINFO(); |
116 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Node); | 115 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Node); |
117 friend class Document; | 116 friend class Document; |
118 friend class TreeScope; | 117 friend class TreeScope; |
119 friend class TreeScopeAdopter; | 118 friend class TreeScopeAdopter; |
120 public: | 119 public: |
121 enum NodeType { | 120 enum NodeType { |
122 ELEMENT_NODE = 1, | 121 ELEMENT_NODE = 1, |
123 ATTRIBUTE_NODE = 2, | |
124 TEXT_NODE = 3, | 122 TEXT_NODE = 3, |
125 DOCUMENT_NODE = 9, | 123 DOCUMENT_NODE = 9, |
126 DOCUMENT_FRAGMENT_NODE = 11, | 124 DOCUMENT_FRAGMENT_NODE = 11, |
127 }; | 125 }; |
128 | 126 |
129 enum DocumentPosition { | 127 enum DocumentPosition { |
130 DOCUMENT_POSITION_EQUIVALENT = 0x00, | 128 DOCUMENT_POSITION_EQUIVALENT = 0x00, |
131 DOCUMENT_POSITION_DISCONNECTED = 0x01, | 129 DOCUMENT_POSITION_DISCONNECTED = 0x01, |
132 DOCUMENT_POSITION_PRECEDING = 0x02, | 130 DOCUMENT_POSITION_PRECEDING = 0x02, |
133 DOCUMENT_POSITION_FOLLOWING = 0x04, | 131 DOCUMENT_POSITION_FOLLOWING = 0x04, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 Upgraded = 1 << 1 | 195 Upgraded = 1 << 1 |
198 }; | 196 }; |
199 CustomElementState customElementState() const | 197 CustomElementState customElementState() const |
200 { | 198 { |
201 return isCustomElement() | 199 return isCustomElement() |
202 ? (getFlag(CustomElementUpgradedFlag) ? Upgraded : WaitingForUpgrade
) | 200 ? (getFlag(CustomElementUpgradedFlag) ? Upgraded : WaitingForUpgrade
) |
203 : NotCustomElement; | 201 : NotCustomElement; |
204 } | 202 } |
205 void setCustomElementState(CustomElementState newState); | 203 void setCustomElementState(CustomElementState newState); |
206 | 204 |
207 virtual bool isAttributeNode() const { return false; } | |
208 virtual bool isCharacterDataNode() const { return false; } | 205 virtual bool isCharacterDataNode() const { return false; } |
209 | 206 |
210 // StyledElements allow inline style (style="border: 1px"), presentational a
ttributes (ex. color), | 207 // StyledElements allow inline style (style="border: 1px"), presentational a
ttributes (ex. color), |
211 // class names (ex. class="foo bar") and other non-basic styling features. T
hey and also control | 208 // class names (ex. class="foo bar") and other non-basic styling features. T
hey and also control |
212 // if this element can participate in style sharing. | 209 // if this element can participate in style sharing. |
213 // | 210 // |
214 // FIXME: The only things that ever go through StyleResolver that aren't Sty
ledElements are | 211 // FIXME: The only things that ever go through StyleResolver that aren't Sty
ledElements are |
215 // PseudoElements and VTTElements. It's possible we can just eliminate all t
he checks | 212 // PseudoElements and VTTElements. It's possible we can just eliminate all t
he checks |
216 // since those elements will never have class names, inline style, or other
things that | 213 // since those elements will never have class names, inline style, or other
things that |
217 // this apparently guards against. | 214 // this apparently guards against. |
218 bool isStyledElement() const { return isHTMLElement(); } | 215 bool isStyledElement() const { return isHTMLElement(); } |
219 | 216 |
220 bool isDocumentNode() const; | 217 bool isDocumentNode() const; |
221 bool isTreeScope() const; | 218 bool isTreeScope() const; |
222 bool isDocumentFragment() const { return getFlag(IsDocumentFragmentFlag); } | 219 bool isDocumentFragment() const { return getFlag(IsDocumentFragmentFlag); } |
223 bool isShadowRoot() const { return isDocumentFragment() && isTreeScope(); } | 220 bool isShadowRoot() const { return isDocumentFragment() && isTreeScope(); } |
224 bool isInsertionPoint() const { return getFlag(IsInsertionPointFlag); } | 221 bool isInsertionPoint() const { return getFlag(IsInsertionPointFlag); } |
225 | 222 |
226 bool hasCustomStyleCallbacks() const { return getFlag(HasCustomStyleCallback
sFlag); } | 223 bool hasCustomStyleCallbacks() const { return getFlag(HasCustomStyleCallback
sFlag); } |
227 | 224 |
228 bool hasSyntheticAttrChildNodes() const { return getFlag(HasSyntheticAttrChi
ldNodesFlag); } | |
229 void setHasSyntheticAttrChildNodes(bool flag) { setFlag(flag, HasSyntheticAt
trChildNodesFlag); } | |
230 | |
231 // If this node is in a shadow tree, returns its shadow host. Otherwise, ret
urns 0. | 225 // If this node is in a shadow tree, returns its shadow host. Otherwise, ret
urns 0. |
232 Element* shadowHost() const; | 226 Element* shadowHost() const; |
233 ShadowRoot* containingShadowRoot() const; | 227 ShadowRoot* containingShadowRoot() const; |
234 ShadowRoot* youngestShadowRoot() const; | 228 ShadowRoot* youngestShadowRoot() const; |
235 | 229 |
236 // Returns 0, a child of ShadowRoot, or a legacy shadow root. | 230 // Returns 0, a child of ShadowRoot, or a legacy shadow root. |
237 Node* nonBoundaryShadowTreeRootNode(); | 231 Node* nonBoundaryShadowTreeRootNode(); |
238 | 232 |
239 // Node's parent, shadow tree host. | 233 // Node's parent, shadow tree host. |
240 ContainerNode* parentOrShadowHostNode() const; | 234 ContainerNode* parentOrShadowHostNode() const; |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 ChildNeedsDistributionRecalcFlag = 1 << 17, | 618 ChildNeedsDistributionRecalcFlag = 1 << 17, |
625 ChildNeedsStyleRecalcFlag = 1 << 18, | 619 ChildNeedsStyleRecalcFlag = 1 << 18, |
626 StyleChangeMask = 1 << nodeStyleChangeShift | 1 << (nodeStyleChangeShift
+ 1), | 620 StyleChangeMask = 1 << nodeStyleChangeShift | 1 << (nodeStyleChangeShift
+ 1), |
627 | 621 |
628 CustomElementFlag = 1 << 21, | 622 CustomElementFlag = 1 << 21, |
629 CustomElementUpgradedFlag = 1 << 22, | 623 CustomElementUpgradedFlag = 1 << 22, |
630 | 624 |
631 IsEditingTextFlag = 1 << 23, | 625 IsEditingTextFlag = 1 << 23, |
632 HasWeakReferencesFlag = 1 << 24, | 626 HasWeakReferencesFlag = 1 << 24, |
633 V8CollectableDuringMinorGCFlag = 1 << 25, | 627 V8CollectableDuringMinorGCFlag = 1 << 25, |
634 HasSyntheticAttrChildNodesFlag = 1 << 26, | 628 HasEventTargetDataFlag = 1 << 26, |
635 HasEventTargetDataFlag = 1 << 27, | 629 AlreadySpellCheckedFlag = 1 << 27, |
636 AlreadySpellCheckedFlag = 1 << 28, | |
637 | 630 |
638 DefaultNodeFlags = IsFinishedParsingChildrenFlag | ChildNeedsStyleRecalc
Flag | NeedsReattachStyleChange | 631 DefaultNodeFlags = IsFinishedParsingChildrenFlag | ChildNeedsStyleRecalc
Flag | NeedsReattachStyleChange |
639 }; | 632 }; |
640 | 633 |
641 // 4 bits remaining. | 634 // 5 bits remaining. |
642 | 635 |
643 bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; } | 636 bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; } |
644 void setFlag(bool f, NodeFlags mask) { m_nodeFlags = (m_nodeFlags & ~mask) |
(-(int32_t)f & mask); } | 637 void setFlag(bool f, NodeFlags mask) { m_nodeFlags = (m_nodeFlags & ~mask) |
(-(int32_t)f & mask); } |
645 void setFlag(NodeFlags mask) { m_nodeFlags |= mask; } | 638 void setFlag(NodeFlags mask) { m_nodeFlags |= mask; } |
646 void clearFlag(NodeFlags mask) { m_nodeFlags &= ~mask; } | 639 void clearFlag(NodeFlags mask) { m_nodeFlags &= ~mask; } |
647 | 640 |
648 protected: | 641 protected: |
649 enum ConstructionType { | 642 enum ConstructionType { |
650 CreateOther = DefaultNodeFlags, | 643 CreateOther = DefaultNodeFlags, |
651 CreateText = DefaultNodeFlags | IsTextFlag, | 644 CreateText = DefaultNodeFlags | IsTextFlag, |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 } // namespace blink | 799 } // namespace blink |
807 | 800 |
808 #ifndef NDEBUG | 801 #ifndef NDEBUG |
809 // Outside the WebCore namespace for ease of invocation from gdb. | 802 // Outside the WebCore namespace for ease of invocation from gdb. |
810 void showNode(const blink::Node*); | 803 void showNode(const blink::Node*); |
811 void showTree(const blink::Node*); | 804 void showTree(const blink::Node*); |
812 void showNodePath(const blink::Node*); | 805 void showNodePath(const blink::Node*); |
813 #endif | 806 #endif |
814 | 807 |
815 #endif // Node_h | 808 #endif // Node_h |
OLD | NEW |