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, 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 protected: | 103 protected: |
104 NodeRareDataBase(RenderObject* renderer) | 104 NodeRareDataBase(RenderObject* renderer) |
105 : m_renderer(renderer) | 105 : m_renderer(renderer) |
106 { } | 106 { } |
107 | 107 |
108 private: | 108 private: |
109 RenderObject* m_renderer; | 109 RenderObject* m_renderer; |
110 }; | 110 }; |
111 | 111 |
112 class Node : public TreeShared<Node>, public EventTarget, public ScriptWrappable
{ | 112 class Node : public TreeSharedWillBeRefCountedGarbageCollected<Node>, public Eve
ntTarget, public ScriptWrappable { |
113 friend class Document; | 113 friend class Document; |
114 friend class TreeScope; | 114 friend class TreeScope; |
115 friend class TreeScopeAdopter; | 115 friend class TreeScopeAdopter; |
116 | 116 |
117 DEFINE_EVENT_TARGET_REFCOUNTING(TreeShared<Node>); | 117 DEFINE_EVENT_TARGET_REFCOUNTING(TreeSharedWillBeRefCountedGarbageCollected<N
ode>); |
118 public: | 118 public: |
119 enum NodeType { | 119 enum NodeType { |
120 ELEMENT_NODE = 1, | 120 ELEMENT_NODE = 1, |
121 ATTRIBUTE_NODE = 2, | 121 ATTRIBUTE_NODE = 2, |
122 TEXT_NODE = 3, | 122 TEXT_NODE = 3, |
123 CDATA_SECTION_NODE = 4, | 123 CDATA_SECTION_NODE = 4, |
124 PROCESSING_INSTRUCTION_NODE = 7, | 124 PROCESSING_INSTRUCTION_NODE = 7, |
125 COMMENT_NODE = 8, | 125 COMMENT_NODE = 8, |
126 DOCUMENT_NODE = 9, | 126 DOCUMENT_NODE = 9, |
127 DOCUMENT_TYPE_NODE = 10, | 127 DOCUMENT_TYPE_NODE = 10, |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 CreateDocumentFragment = CreateContainer | IsDocumentFragmentFlag, | 748 CreateDocumentFragment = CreateContainer | IsDocumentFragmentFlag, |
749 CreateHTMLElement = CreateElement | IsHTMLFlag, | 749 CreateHTMLElement = CreateElement | IsHTMLFlag, |
750 CreateSVGElement = CreateElement | IsSVGFlag, | 750 CreateSVGElement = CreateElement | IsSVGFlag, |
751 CreateDocument = CreateContainer | InDocumentFlag, | 751 CreateDocument = CreateContainer | InDocumentFlag, |
752 CreateInsertionPoint = CreateHTMLElement | IsInsertionPointFlag, | 752 CreateInsertionPoint = CreateHTMLElement | IsInsertionPointFlag, |
753 CreateEditingText = CreateText | HasNameOrIsEditingTextFlag, | 753 CreateEditingText = CreateText | HasNameOrIsEditingTextFlag, |
754 }; | 754 }; |
755 | 755 |
756 Node(TreeScope* treeScope, ConstructionType type) | 756 Node(TreeScope* treeScope, ConstructionType type) |
757 : m_nodeFlags(type) | 757 : m_nodeFlags(type) |
758 , m_parentOrShadowHostNode(0) | 758 , m_parentOrShadowHostNode(nullptr) |
759 , m_treeScope(treeScope) | 759 , m_treeScope(treeScope) |
760 , m_previous(0) | 760 , m_previous(nullptr) |
761 , m_next(0) | 761 , m_next(nullptr) |
762 { | 762 { |
763 ASSERT(m_treeScope || type == CreateDocument || type == CreateShadowRoot
); | 763 ASSERT(m_treeScope || type == CreateDocument || type == CreateShadowRoot
); |
764 ScriptWrappable::init(this); | 764 ScriptWrappable::init(this); |
765 #if !ENABLE(OILPAN) | 765 #if !ENABLE(OILPAN) |
766 if (m_treeScope) | 766 if (m_treeScope) |
767 m_treeScope->guardRef(); | 767 m_treeScope->guardRef(); |
768 #endif | 768 #endif |
769 | 769 |
770 #if !defined(NDEBUG) || (defined(DUMP_NODE_STATISTICS) && DUMP_NODE_STATISTICS) | 770 #if !defined(NDEBUG) || (defined(DUMP_NODE_STATISTICS) && DUMP_NODE_STATISTICS) |
771 trackForDebugging(); | 771 trackForDebugging(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 private: | 807 private: |
808 friend class TreeShared<Node>; | 808 friend class TreeShared<Node>; |
809 friend class WeakNodeMap; | 809 friend class WeakNodeMap; |
810 | 810 |
811 virtual PseudoId customPseudoId() const | 811 virtual PseudoId customPseudoId() const |
812 { | 812 { |
813 ASSERT(hasCustomStyleCallbacks()); | 813 ASSERT(hasCustomStyleCallbacks()); |
814 return NOPSEUDO; | 814 return NOPSEUDO; |
815 } | 815 } |
816 | 816 |
| 817 #if !ENABLE(OILPAN) |
817 void removedLastRef(); | 818 void removedLastRef(); |
| 819 #endif |
818 bool hasTreeSharedParent() const { return !!parentOrShadowHostNode(); } | 820 bool hasTreeSharedParent() const { return !!parentOrShadowHostNode(); } |
819 | 821 |
820 enum EditableLevel { Editable, RichlyEditable }; | 822 enum EditableLevel { Editable, RichlyEditable }; |
821 bool rendererIsEditable(EditableLevel, UserSelectAllTreatment = UserSelectAl
lIsAlwaysNonEditable) const; | 823 bool rendererIsEditable(EditableLevel, UserSelectAllTreatment = UserSelectAl
lIsAlwaysNonEditable) const; |
822 bool isEditableToAccessibility(EditableLevel) const; | 824 bool isEditableToAccessibility(EditableLevel) const; |
823 | 825 |
824 bool isUserActionElementActive() const; | 826 bool isUserActionElementActive() const; |
825 bool isUserActionElementInActiveChain() const; | 827 bool isUserActionElementInActiveChain() const; |
826 bool isUserActionElementHovered() const; | 828 bool isUserActionElementHovered() const; |
827 bool isUserActionElementFocused() const; | 829 bool isUserActionElementFocused() const; |
828 | 830 |
829 void traceStyleChange(StyleChangeType); | 831 void traceStyleChange(StyleChangeType); |
830 void traceStyleChangeIfNeeded(StyleChangeType); | 832 void traceStyleChangeIfNeeded(StyleChangeType); |
831 void setStyleChange(StyleChangeType); | 833 void setStyleChange(StyleChangeType); |
832 | 834 |
833 virtual RenderStyle* nonRendererStyle() const { return 0; } | 835 virtual RenderStyle* nonRendererStyle() const { return 0; } |
834 | 836 |
835 virtual RenderStyle* virtualComputedStyle(PseudoId = NOPSEUDO); | 837 virtual RenderStyle* virtualComputedStyle(PseudoId = NOPSEUDO); |
836 | 838 |
837 void trackForDebugging(); | 839 void trackForDebugging(); |
838 | 840 |
839 WillBeHeapVector<OwnPtrWillBeMember<MutationObserverRegistration> >* mutatio
nObserverRegistry(); | 841 WillBeHeapVector<OwnPtrWillBeMember<MutationObserverRegistration> >* mutatio
nObserverRegistry(); |
840 WillBeHeapHashSet<RawPtrWillBeMember<MutationObserverRegistration> >* transi
entMutationObserverRegistry(); | 842 WillBeHeapHashSet<RawPtrWillBeMember<MutationObserverRegistration> >* transi
entMutationObserverRegistry(); |
841 | 843 |
842 mutable uint32_t m_nodeFlags; | 844 mutable uint32_t m_nodeFlags; |
843 ContainerNode* m_parentOrShadowHostNode; | 845 RawPtrWillBeMember<ContainerNode> m_parentOrShadowHostNode; |
844 RawPtrWillBeMember<TreeScope> m_treeScope; | 846 RawPtrWillBeMember<TreeScope> m_treeScope; |
845 Node* m_previous; | 847 RawPtrWillBeMember<Node> m_previous; |
846 Node* m_next; | 848 RawPtrWillBeMember<Node> m_next; |
847 // When a node has rare data we move the renderer into the rare data. | 849 // When a node has rare data we move the renderer into the rare data. |
848 union DataUnion { | 850 union DataUnion { |
849 DataUnion() : m_renderer(0) { } | 851 DataUnion() : m_renderer(0) { } |
850 RenderObject* m_renderer; | 852 RenderObject* m_renderer; |
851 NodeRareDataBase* m_rareData; | 853 NodeRareDataBase* m_rareData; |
852 } m_data; | 854 } m_data; |
853 }; | 855 }; |
854 | 856 |
855 inline void Node::setParentOrShadowHostNode(ContainerNode* parent) | 857 inline void Node::setParentOrShadowHostNode(ContainerNode* parent) |
856 { | 858 { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 } // namespace WebCore | 925 } // namespace WebCore |
924 | 926 |
925 #ifndef NDEBUG | 927 #ifndef NDEBUG |
926 // Outside the WebCore namespace for ease of invocation from gdb. | 928 // Outside the WebCore namespace for ease of invocation from gdb. |
927 void showNode(const WebCore::Node*); | 929 void showNode(const WebCore::Node*); |
928 void showTree(const WebCore::Node*); | 930 void showTree(const WebCore::Node*); |
929 void showNodePath(const WebCore::Node*); | 931 void showNodePath(const WebCore::Node*); |
930 #endif | 932 #endif |
931 | 933 |
932 #endif | 934 #endif |
OLD | NEW |