| 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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 virtual int maxCharacterOffset() const; | 513 virtual int maxCharacterOffset() const; |
| 514 | 514 |
| 515 // Whether or not a selection can be started in this object | 515 // Whether or not a selection can be started in this object |
| 516 virtual bool canStartSelection() const; | 516 virtual bool canStartSelection() const; |
| 517 | 517 |
| 518 // -------------------------------------------------------------------------
---- | 518 // -------------------------------------------------------------------------
---- |
| 519 // Integration with layout tree | 519 // Integration with layout tree |
| 520 | 520 |
| 521 // As layoutObject() includes a branch you should avoid calling it repeatedl
y in hot code paths. | 521 // As layoutObject() includes a branch you should avoid calling it repeatedl
y in hot code paths. |
| 522 // Note that if a Node has a layoutObject, it's parentNode is guaranteed to
have one as well. | 522 // Note that if a Node has a layoutObject, it's parentNode is guaranteed to
have one as well. |
| 523 LayoutObject* layoutObject() const { return hasRareData() ? m_data.m_rareDat
a->layoutObject() : m_data.m_layoutObject; } | 523 LayoutObject* layoutObject() const |
| 524 { |
| 525 if (hasRareData()) |
| 526 return m_data.m_rareData->layoutObject(); |
| 527 return hasLayoutObject() ? m_data.m_layoutObject : nullptr; |
| 528 } |
| 524 void setLayoutObject(LayoutObject* layoutObject) | 529 void setLayoutObject(LayoutObject* layoutObject) |
| 525 { | 530 { |
| 526 if (hasRareData()) | 531 if (hasRareData()) |
| 527 m_data.m_rareData->setLayoutObject(layoutObject); | 532 m_data.m_rareData->setLayoutObject(layoutObject); |
| 528 else | 533 else |
| 529 m_data.m_layoutObject = layoutObject; | 534 m_data.m_layoutObject = layoutObject; |
| 535 if (layoutObject) |
| 536 setFlag(HasLayoutObjectFlag); |
| 537 else |
| 538 clearFlag(HasLayoutObjectFlag); |
| 530 } | 539 } |
| 531 | 540 |
| 532 // Use these two methods with caution. | 541 // Use these two methods with caution. |
| 533 LayoutBox* layoutBox() const; | 542 LayoutBox* layoutBox() const; |
| 534 LayoutBoxModelObject* layoutBoxModelObject() const; | 543 LayoutBoxModelObject* layoutBoxModelObject() const; |
| 535 | 544 |
| 536 struct AttachContext { | 545 struct AttachContext { |
| 537 STACK_ALLOCATED(); | 546 STACK_ALLOCATED(); |
| 538 ComputedStyle* resolvedStyle = nullptr; | 547 ComputedStyle* resolvedStyle = nullptr; |
| 539 bool performingReattach = false; | 548 bool performingReattach = false; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 | 743 |
| 735 HasNameOrIsEditingTextFlag = 1 << 23, | 744 HasNameOrIsEditingTextFlag = 1 << 23, |
| 736 HasWeakReferencesFlag = 1 << 24, | 745 HasWeakReferencesFlag = 1 << 24, |
| 737 V8CollectableDuringMinorGCFlag = 1 << 25, | 746 V8CollectableDuringMinorGCFlag = 1 << 25, |
| 738 HasEventTargetDataFlag = 1 << 26, | 747 HasEventTargetDataFlag = 1 << 26, |
| 739 AlreadySpellCheckedFlag = 1 << 27, | 748 AlreadySpellCheckedFlag = 1 << 27, |
| 740 | 749 |
| 741 V0CustomElementFlag = 1 << 28, | 750 V0CustomElementFlag = 1 << 28, |
| 742 V0CustomElementUpgradedFlag = 1 << 29, | 751 V0CustomElementUpgradedFlag = 1 << 29, |
| 743 | 752 |
| 753 HasLayoutObjectFlag = 1 << 30, |
| 754 |
| 744 DefaultNodeFlags = IsFinishedParsingChildrenFlag | NeedsReattachStyleCha
nge | 755 DefaultNodeFlags = IsFinishedParsingChildrenFlag | NeedsReattachStyleCha
nge |
| 745 }; | 756 }; |
| 746 | 757 |
| 747 // 3 bits remaining. | 758 // 1 bit remaining. |
| 748 | 759 |
| 749 bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; } | 760 bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; } |
| 750 void setFlag(bool f, NodeFlags mask) { m_nodeFlags = (m_nodeFlags & ~mask) |
(-(int32_t)f & mask); } | 761 void setFlag(bool f, NodeFlags mask) { m_nodeFlags = (m_nodeFlags & ~mask) |
(-(int32_t)f & mask); } |
| 751 void setFlag(NodeFlags mask) { m_nodeFlags |= mask; } | 762 void setFlag(NodeFlags mask) { m_nodeFlags |= mask; } |
| 752 void clearFlag(NodeFlags mask) { m_nodeFlags &= ~mask; } | 763 void clearFlag(NodeFlags mask) { m_nodeFlags &= ~mask; } |
| 753 | 764 |
| 754 protected: | 765 protected: |
| 755 enum ConstructionType { | 766 enum ConstructionType { |
| 756 CreateOther = DefaultNodeFlags, | 767 CreateOther = DefaultNodeFlags, |
| 757 CreateText = DefaultNodeFlags | IsTextFlag, | 768 CreateText = DefaultNodeFlags | IsTextFlag, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 769 Node(TreeScope*, ConstructionType); | 780 Node(TreeScope*, ConstructionType); |
| 770 | 781 |
| 771 virtual void didMoveToNewDocument(Document& oldDocument); | 782 virtual void didMoveToNewDocument(Document& oldDocument); |
| 772 | 783 |
| 773 void addedEventListener(const AtomicString& eventType, RegisteredEventListen
er&) override; | 784 void addedEventListener(const AtomicString& eventType, RegisteredEventListen
er&) override; |
| 774 void removedEventListener(const AtomicString& eventType, const RegisteredEve
ntListener&) override; | 785 void removedEventListener(const AtomicString& eventType, const RegisteredEve
ntListener&) override; |
| 775 DispatchEventResult dispatchEventInternal(Event*) override; | 786 DispatchEventResult dispatchEventInternal(Event*) override; |
| 776 | 787 |
| 777 static void reattachWhitespaceSiblingsIfNeeded(Text* start); | 788 static void reattachWhitespaceSiblingsIfNeeded(Text* start); |
| 778 | 789 |
| 790 bool hasLayoutObject() const { return getFlag(HasLayoutObjectFlag); } |
| 779 bool hasRareData() const { return getFlag(HasRareDataFlag); } | 791 bool hasRareData() const { return getFlag(HasRareDataFlag); } |
| 780 | 792 |
| 781 NodeRareData* rareData() const; | 793 NodeRareData* rareData() const; |
| 782 NodeRareData& ensureRareData(); | 794 NodeRareData& ensureRareData(); |
| 783 | 795 |
| 784 void setHasCustomStyleCallbacks() { setFlag(true, HasCustomStyleCallbacksFla
g); } | 796 void setHasCustomStyleCallbacks() { setFlag(true, HasCustomStyleCallbacksFla
g); } |
| 785 | 797 |
| 786 void setTreeScope(TreeScope* scope) { m_treeScope = scope; } | 798 void setTreeScope(TreeScope* scope) { m_treeScope = scope; } |
| 787 | 799 |
| 788 // isTreeScopeInitialized() can be false | 800 // isTreeScopeInitialized() can be false |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 827 HeapHashSet<Member<MutationObserverRegistration>>* transientMutationObserver
Registry(); | 839 HeapHashSet<Member<MutationObserverRegistration>>* transientMutationObserver
Registry(); |
| 828 | 840 |
| 829 uint32_t m_nodeFlags; | 841 uint32_t m_nodeFlags; |
| 830 Member<ContainerNode> m_parentOrShadowHostNode; | 842 Member<ContainerNode> m_parentOrShadowHostNode; |
| 831 Member<TreeScope> m_treeScope; | 843 Member<TreeScope> m_treeScope; |
| 832 Member<Node> m_previous; | 844 Member<Node> m_previous; |
| 833 Member<Node> m_next; | 845 Member<Node> m_next; |
| 834 // When a node has rare data we move the layoutObject into the rare data. | 846 // When a node has rare data we move the layoutObject into the rare data. |
| 835 union DataUnion { | 847 union DataUnion { |
| 836 DataUnion() : m_layoutObject(nullptr) { } | 848 DataUnion() : m_layoutObject(nullptr) { } |
| 849 ComputedStyle* m_computedStyle; |
| 837 // LayoutObjects are fully owned by their DOM node. See LayoutObject's | 850 // LayoutObjects are fully owned by their DOM node. See LayoutObject's |
| 838 // LIFETIME documentation section. | 851 // LIFETIME documentation section. |
| 839 LayoutObject* m_layoutObject; | 852 LayoutObject* m_layoutObject; |
| 840 NodeRareDataBase* m_rareData; | 853 NodeRareDataBase* m_rareData; |
| 841 } m_data; | 854 } m_data; |
| 842 }; | 855 }; |
| 843 | 856 |
| 844 inline void Node::setParentOrShadowHostNode(ContainerNode* parent) | 857 inline void Node::setParentOrShadowHostNode(ContainerNode* parent) |
| 845 { | 858 { |
| 846 DCHECK(isMainThread()); | 859 DCHECK(isMainThread()); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 } // namespace blink | 934 } // namespace blink |
| 922 | 935 |
| 923 #ifndef NDEBUG | 936 #ifndef NDEBUG |
| 924 // Outside the WebCore namespace for ease of invocation from gdb. | 937 // Outside the WebCore namespace for ease of invocation from gdb. |
| 925 void showNode(const blink::Node*); | 938 void showNode(const blink::Node*); |
| 926 void showTree(const blink::Node*); | 939 void showTree(const blink::Node*); |
| 927 void showNodePath(const blink::Node*); | 940 void showNodePath(const blink::Node*); |
| 928 #endif | 941 #endif |
| 929 | 942 |
| 930 #endif // Node_h | 943 #endif // Node_h |
| OLD | NEW |