| 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 virtual String nodeName() const = 0; | 203 virtual String nodeName() const = 0; |
| 204 virtual String nodeValue() const; | 204 virtual String nodeValue() const; |
| 205 virtual void setNodeValue(const String&); | 205 virtual void setNodeValue(const String&); |
| 206 virtual NodeType getNodeType() const = 0; | 206 virtual NodeType getNodeType() const = 0; |
| 207 ContainerNode* parentNode() const; | 207 ContainerNode* parentNode() const; |
| 208 Element* parentElement() const; | 208 Element* parentElement() const; |
| 209 ContainerNode* parentElementOrShadowRoot() const; | 209 ContainerNode* parentElementOrShadowRoot() const; |
| 210 ContainerNode* parentElementOrDocumentFragment() const; | 210 ContainerNode* parentElementOrDocumentFragment() const; |
| 211 Node* previousSibling() const { return m_previous; } | 211 Node* previousSibling() const { return m_previous; } |
| 212 Node* nextSibling() const { return m_next; } | 212 Node* nextSibling() const { return m_next; } |
| 213 PassRefPtrWillBeRawPtr<NodeList> childNodes(); | 213 RawPtr<NodeList> childNodes(); |
| 214 Node* firstChild() const; | 214 Node* firstChild() const; |
| 215 Node* lastChild() const; | 215 Node* lastChild() const; |
| 216 Node& treeRoot() const; | 216 Node& treeRoot() const; |
| 217 | 217 |
| 218 void remove(ExceptionState& = ASSERT_NO_EXCEPTION); | 218 void remove(ExceptionState& = ASSERT_NO_EXCEPTION); |
| 219 | 219 |
| 220 Node* pseudoAwareNextSibling() const; | 220 Node* pseudoAwareNextSibling() const; |
| 221 Node* pseudoAwarePreviousSibling() const; | 221 Node* pseudoAwarePreviousSibling() const; |
| 222 Node* pseudoAwareFirstChild() const; | 222 Node* pseudoAwareFirstChild() const; |
| 223 Node* pseudoAwareLastChild() const; | 223 Node* pseudoAwareLastChild() const; |
| 224 | 224 |
| 225 const KURL& baseURI() const; | 225 const KURL& baseURI() const; |
| 226 | 226 |
| 227 PassRefPtrWillBeRawPtr<Node> insertBefore(PassRefPtrWillBeRawPtr<Node> newCh
ild, Node* refChild, ExceptionState& = ASSERT_NO_EXCEPTION); | 227 RawPtr<Node> insertBefore(RawPtr<Node> newChild, Node* refChild, ExceptionSt
ate& = ASSERT_NO_EXCEPTION); |
| 228 PassRefPtrWillBeRawPtr<Node> replaceChild(PassRefPtrWillBeRawPtr<Node> newCh
ild, PassRefPtrWillBeRawPtr<Node> oldChild, ExceptionState& = ASSERT_NO_EXCEPTIO
N); | 228 RawPtr<Node> replaceChild(RawPtr<Node> newChild, RawPtr<Node> oldChild, Exce
ptionState& = ASSERT_NO_EXCEPTION); |
| 229 PassRefPtrWillBeRawPtr<Node> removeChild(PassRefPtrWillBeRawPtr<Node> child,
ExceptionState& = ASSERT_NO_EXCEPTION); | 229 RawPtr<Node> removeChild(RawPtr<Node> child, ExceptionState& = ASSERT_NO_EXC
EPTION); |
| 230 PassRefPtrWillBeRawPtr<Node> appendChild(PassRefPtrWillBeRawPtr<Node> newChi
ld, ExceptionState& = ASSERT_NO_EXCEPTION); | 230 RawPtr<Node> appendChild(RawPtr<Node> newChild, ExceptionState& = ASSERT_NO_
EXCEPTION); |
| 231 | 231 |
| 232 bool hasChildren() const { return firstChild(); } | 232 bool hasChildren() const { return firstChild(); } |
| 233 virtual PassRefPtrWillBeRawPtr<Node> cloneNode(bool deep) = 0; | 233 virtual RawPtr<Node> cloneNode(bool deep) = 0; |
| 234 void normalize(); | 234 void normalize(); |
| 235 | 235 |
| 236 bool isEqualNode(Node*) const; | 236 bool isEqualNode(Node*) const; |
| 237 bool isSameNode(Node* other) const { return this == other; } | 237 bool isSameNode(Node* other) const { return this == other; } |
| 238 bool isDefaultNamespace(const AtomicString& namespaceURI) const; | 238 bool isDefaultNamespace(const AtomicString& namespaceURI) const; |
| 239 const AtomicString& lookupPrefix(const AtomicString& namespaceURI) const; | 239 const AtomicString& lookupPrefix(const AtomicString& namespaceURI) const; |
| 240 const AtomicString& lookupNamespaceURI(const String& prefix) const; | 240 const AtomicString& lookupNamespaceURI(const String& prefix) const; |
| 241 | 241 |
| 242 String textContent(bool convertBRsToNewlines = false) const; | 242 String textContent(bool convertBRsToNewlines = false) const; |
| 243 void setTextContent(const String&); | 243 void setTextContent(const String&); |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 ExecutionContext* getExecutionContext() const final; | 628 ExecutionContext* getExecutionContext() const final; |
| 629 | 629 |
| 630 void removeAllEventListeners() override; | 630 void removeAllEventListeners() override; |
| 631 void removeAllEventListenersRecursively(); | 631 void removeAllEventListenersRecursively(); |
| 632 | 632 |
| 633 // Handlers to do/undo actions on the target node before an event is dispatc
hed to it and after the event | 633 // Handlers to do/undo actions on the target node before an event is dispatc
hed to it and after the event |
| 634 // has been dispatched. The data pointer is handed back by the preDispatch
and passed to postDispatch. | 634 // has been dispatched. The data pointer is handed back by the preDispatch
and passed to postDispatch. |
| 635 virtual void* preDispatchEventHandler(Event*) { return nullptr; } | 635 virtual void* preDispatchEventHandler(Event*) { return nullptr; } |
| 636 virtual void postDispatchEventHandler(Event*, void* /*dataFromPreDispatch*/)
{ } | 636 virtual void postDispatchEventHandler(Event*, void* /*dataFromPreDispatch*/)
{ } |
| 637 | 637 |
| 638 void dispatchScopedEvent(PassRefPtrWillBeRawPtr<Event>); | 638 void dispatchScopedEvent(RawPtr<Event>); |
| 639 | 639 |
| 640 virtual void handleLocalEvents(Event&); | 640 virtual void handleLocalEvents(Event&); |
| 641 | 641 |
| 642 void dispatchSubtreeModifiedEvent(); | 642 void dispatchSubtreeModifiedEvent(); |
| 643 DispatchEventResult dispatchDOMActivateEvent(int detail, PassRefPtrWillBeRaw
Ptr<Event> underlyingEvent); | 643 DispatchEventResult dispatchDOMActivateEvent(int detail, RawPtr<Event> under
lyingEvent); |
| 644 | 644 |
| 645 DispatchEventResult dispatchMouseEvent(const PlatformMouseEvent&, const Atom
icString& eventType, int clickCount = 0, Node* relatedTarget = nullptr); | 645 DispatchEventResult dispatchMouseEvent(const PlatformMouseEvent&, const Atom
icString& eventType, int clickCount = 0, Node* relatedTarget = nullptr); |
| 646 | 646 |
| 647 void dispatchSimulatedClick(Event* underlyingEvent, SimulatedClickMouseEvent
Options = SendNoEvents, SimulatedClickCreationScope = SimulatedClickCreationScop
e::FromUserAgent); | 647 void dispatchSimulatedClick(Event* underlyingEvent, SimulatedClickMouseEvent
Options = SendNoEvents, SimulatedClickCreationScope = SimulatedClickCreationScop
e::FromUserAgent); |
| 648 | 648 |
| 649 void dispatchInputEvent(); | 649 void dispatchInputEvent(); |
| 650 | 650 |
| 651 // Perform the default action for an event. | 651 // Perform the default action for an event. |
| 652 virtual void defaultEventHandler(Event*); | 652 virtual void defaultEventHandler(Event*); |
| 653 virtual void willCallDefaultEventHandler(const Event&); | 653 virtual void willCallDefaultEventHandler(const Event&); |
| 654 | 654 |
| 655 EventTargetData* eventTargetData() override; | 655 EventTargetData* eventTargetData() override; |
| 656 EventTargetData& ensureEventTargetData() override; | 656 EventTargetData& ensureEventTargetData() override; |
| 657 | 657 |
| 658 void getRegisteredMutationObserversOfType(WillBeHeapHashMap<RefPtrWillBeMemb
er<MutationObserver>, MutationRecordDeliveryOptions>&, MutationObserver::Mutatio
nType, const QualifiedName* attributeName); | 658 void getRegisteredMutationObserversOfType(HeapHashMap<Member<MutationObserve
r>, MutationRecordDeliveryOptions>&, MutationObserver::MutationType, const Quali
fiedName* attributeName); |
| 659 void registerMutationObserver(MutationObserver&, MutationObserverOptions, co
nst HashSet<AtomicString>& attributeFilter); | 659 void registerMutationObserver(MutationObserver&, MutationObserverOptions, co
nst HashSet<AtomicString>& attributeFilter); |
| 660 void unregisterMutationObserver(MutationObserverRegistration*); | 660 void unregisterMutationObserver(MutationObserverRegistration*); |
| 661 void registerTransientMutationObserver(MutationObserverRegistration*); | 661 void registerTransientMutationObserver(MutationObserverRegistration*); |
| 662 void unregisterTransientMutationObserver(MutationObserverRegistration*); | 662 void unregisterTransientMutationObserver(MutationObserverRegistration*); |
| 663 void notifyMutationObserversNodeWillDetach(); | 663 void notifyMutationObserversNodeWillDetach(); |
| 664 | 664 |
| 665 unsigned connectedSubframeCount() const; | 665 unsigned connectedSubframeCount() const; |
| 666 void incrementConnectedSubframeCount(); | 666 void incrementConnectedSubframeCount(); |
| 667 void decrementConnectedSubframeCount(); | 667 void decrementConnectedSubframeCount(); |
| 668 | 668 |
| 669 PassRefPtrWillBeRawPtr<StaticNodeList> getDestinationInsertionPoints(); | 669 RawPtr<StaticNodeList> getDestinationInsertionPoints(); |
| 670 HTMLSlotElement* assignedSlot() const; | 670 HTMLSlotElement* assignedSlot() const; |
| 671 HTMLSlotElement* assignedSlotForBinding(); | 671 HTMLSlotElement* assignedSlotForBinding(); |
| 672 | 672 |
| 673 void setAlreadySpellChecked(bool flag) { setFlag(flag, AlreadySpellCheckedFl
ag); } | 673 void setAlreadySpellChecked(bool flag) { setFlag(flag, AlreadySpellCheckedFl
ag); } |
| 674 bool isAlreadySpellChecked() { return getFlag(AlreadySpellCheckedFlag); } | 674 bool isAlreadySpellChecked() { return getFlag(AlreadySpellCheckedFlag); } |
| 675 | 675 |
| 676 bool isFinishedParsingChildren() const { return getFlag(IsFinishedParsingChi
ldrenFlag); } | 676 bool isFinishedParsingChildren() const { return getFlag(IsFinishedParsingChi
ldrenFlag); } |
| 677 | 677 |
| 678 DECLARE_VIRTUAL_TRACE(); | 678 DECLARE_VIRTUAL_TRACE(); |
| 679 | 679 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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*, ConstructionType); | 756 Node(TreeScope*, ConstructionType); |
| 757 | 757 |
| 758 virtual void didMoveToNewDocument(Document& oldDocument); | 758 virtual void didMoveToNewDocument(Document& oldDocument); |
| 759 | 759 |
| 760 bool addEventListenerInternal(const AtomicString& eventType, PassRefPtrWillB
eRawPtr<EventListener>, const EventListenerOptions&) override; | 760 bool addEventListenerInternal(const AtomicString& eventType, RawPtr<EventLis
tener>, const EventListenerOptions&) override; |
| 761 bool removeEventListenerInternal(const AtomicString& eventType, PassRefPtrWi
llBeRawPtr<EventListener>, const EventListenerOptions&) override; | 761 bool removeEventListenerInternal(const AtomicString& eventType, RawPtr<Event
Listener>, const EventListenerOptions&) override; |
| 762 DispatchEventResult dispatchEventInternal(PassRefPtrWillBeRawPtr<Event>) ove
rride; | 762 DispatchEventResult dispatchEventInternal(RawPtr<Event>) override; |
| 763 | 763 |
| 764 static void reattachWhitespaceSiblingsIfNeeded(Text* start); | 764 static void reattachWhitespaceSiblingsIfNeeded(Text* start); |
| 765 | 765 |
| 766 #if !ENABLE(OILPAN) | 766 #if !ENABLE(OILPAN) |
| 767 void willBeDeletedFromDocument(); | 767 void willBeDeletedFromDocument(); |
| 768 #endif | 768 #endif |
| 769 | 769 |
| 770 bool hasRareData() const { return getFlag(HasRareDataFlag); } | 770 bool hasRareData() const { return getFlag(HasRareDataFlag); } |
| 771 | 771 |
| 772 NodeRareData* rareData() const; | 772 NodeRareData* rareData() const; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 void recalcDistribution(); | 819 void recalcDistribution(); |
| 820 | 820 |
| 821 void setStyleChange(StyleChangeType); | 821 void setStyleChange(StyleChangeType); |
| 822 | 822 |
| 823 virtual ComputedStyle* nonLayoutObjectComputedStyle() const { return nullptr
; } | 823 virtual ComputedStyle* nonLayoutObjectComputedStyle() const { return nullptr
; } |
| 824 | 824 |
| 825 virtual const ComputedStyle* virtualEnsureComputedStyle(PseudoId = PseudoIdN
one); | 825 virtual const ComputedStyle* virtualEnsureComputedStyle(PseudoId = PseudoIdN
one); |
| 826 | 826 |
| 827 void trackForDebugging(); | 827 void trackForDebugging(); |
| 828 | 828 |
| 829 WillBeHeapVector<OwnPtrWillBeMember<MutationObserverRegistration>>* mutation
ObserverRegistry(); | 829 HeapVector<Member<MutationObserverRegistration>>* mutationObserverRegistry()
; |
| 830 WillBeHeapHashSet<RawPtrWillBeMember<MutationObserverRegistration>>* transie
ntMutationObserverRegistry(); | 830 HeapHashSet<Member<MutationObserverRegistration>>* transientMutationObserver
Registry(); |
| 831 | 831 |
| 832 uint32_t m_nodeFlags; | 832 uint32_t m_nodeFlags; |
| 833 RawPtrWillBeMember<ContainerNode> m_parentOrShadowHostNode; | 833 Member<ContainerNode> m_parentOrShadowHostNode; |
| 834 RawPtrWillBeMember<TreeScope> m_treeScope; | 834 Member<TreeScope> m_treeScope; |
| 835 RawPtrWillBeMember<Node> m_previous; | 835 Member<Node> m_previous; |
| 836 RawPtrWillBeMember<Node> m_next; | 836 Member<Node> m_next; |
| 837 // When a node has rare data we move the layoutObject into the rare data. | 837 // When a node has rare data we move the layoutObject into the rare data. |
| 838 union DataUnion { | 838 union DataUnion { |
| 839 DataUnion() : m_layoutObject(nullptr) { } | 839 DataUnion() : m_layoutObject(nullptr) { } |
| 840 // LayoutObjects are fully owned by their DOM node. See LayoutObject's | 840 // LayoutObjects are fully owned by their DOM node. See LayoutObject's |
| 841 // LIFETIME documentation section. | 841 // LIFETIME documentation section. |
| 842 LayoutObject* m_layoutObject; | 842 LayoutObject* m_layoutObject; |
| 843 NodeRareDataBase* m_rareData; | 843 NodeRareDataBase* m_rareData; |
| 844 } m_data; | 844 } m_data; |
| 845 }; | 845 }; |
| 846 | 846 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 #define DEFINE_NODE_TYPE_CASTS(thisType, predicate) \ | 904 #define DEFINE_NODE_TYPE_CASTS(thisType, predicate) \ |
| 905 template<typename T> inline thisType* to##thisType(const RefPtr<T>& node) {
return to##thisType(node.get()); } \ | 905 template<typename T> inline thisType* to##thisType(const RefPtr<T>& node) {
return to##thisType(node.get()); } \ |
| 906 DEFINE_TYPE_CASTS(thisType, Node, node, node->predicate, node.predicate) | 906 DEFINE_TYPE_CASTS(thisType, Node, node, node->predicate, node.predicate) |
| 907 | 907 |
| 908 // This requires isClassName(const Node&). | 908 // This requires isClassName(const Node&). |
| 909 #define DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(thisType) \ | 909 #define DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(thisType) \ |
| 910 template<typename T> inline thisType* to##thisType(const RefPtr<T>& node) {
return to##thisType(node.get()); } \ | 910 template<typename T> inline thisType* to##thisType(const RefPtr<T>& node) {
return to##thisType(node.get()); } \ |
| 911 DEFINE_TYPE_CASTS(thisType, Node, node, is##thisType(*node), is##thisType(no
de)) | 911 DEFINE_TYPE_CASTS(thisType, Node, node, is##thisType(*node), is##thisType(no
de)) |
| 912 | 912 |
| 913 #define DECLARE_NODE_FACTORY(T) \ | 913 #define DECLARE_NODE_FACTORY(T) \ |
| 914 static PassRefPtrWillBeRawPtr<T> create(Document&) | 914 static RawPtr<T> create(Document&) |
| 915 #define DEFINE_NODE_FACTORY(T) \ | 915 #define DEFINE_NODE_FACTORY(T) \ |
| 916 PassRefPtrWillBeRawPtr<T> T::create(Document& document) \ | 916 RawPtr<T> T::create(Document& document) \ |
| 917 { \ | 917 { \ |
| 918 return adoptRefWillBeNoop(new T(document)); \ | 918 return new T(document); \ |
| 919 } | 919 } |
| 920 | 920 |
| 921 CORE_EXPORT std::ostream& operator<<(std::ostream&, const Node&); | 921 CORE_EXPORT std::ostream& operator<<(std::ostream&, const Node&); |
| 922 CORE_EXPORT std::ostream& operator<<(std::ostream&, const Node*); | 922 CORE_EXPORT std::ostream& operator<<(std::ostream&, const Node*); |
| 923 | 923 |
| 924 } // namespace blink | 924 } // namespace blink |
| 925 | 925 |
| 926 #ifndef NDEBUG | 926 #ifndef NDEBUG |
| 927 // Outside the WebCore namespace for ease of invocation from gdb. | 927 // Outside the WebCore namespace for ease of invocation from gdb. |
| 928 void showNode(const blink::Node*); | 928 void showNode(const blink::Node*); |
| 929 void showTree(const blink::Node*); | 929 void showTree(const blink::Node*); |
| 930 void showNodePath(const blink::Node*); | 930 void showNodePath(const blink::Node*); |
| 931 #endif | 931 #endif |
| 932 | 932 |
| 933 #endif // Node_h | 933 #endif // Node_h |
| OLD | NEW |