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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 NeedsReattachStyleChange = 3 << nodeStyleChangeShift, | 93 NeedsReattachStyleChange = 3 << nodeStyleChangeShift, |
94 }; | 94 }; |
95 | 95 |
96 // If the style change is from the renderer then we'll call setStyle on the | 96 // If the style change is from the renderer then we'll call setStyle on the |
97 // renderer even if the style computed from CSS is identical. | 97 // renderer even if the style computed from CSS is identical. |
98 enum StyleChangeSource { | 98 enum StyleChangeSource { |
99 StyleChangeFromCSS, | 99 StyleChangeFromCSS, |
100 StyleChangeFromRenderer | 100 StyleChangeFromRenderer |
101 }; | 101 }; |
102 | 102 |
103 enum DynamicRestyleFlags { | |
104 ChildrenAffectedByFocus = 1 << 0, | |
105 ChildrenAffectedByHover = 1 << 1, | |
106 ChildrenAffectedByActive = 1 << 2, | |
107 ChildrenAffectedByDrag = 1 << 3, | |
108 ChildrenAffectedByFirstChildRules = 1 << 4, | |
109 ChildrenAffectedByLastChildRules = 1 << 5, | |
110 ChildrenAffectedByDirectAdjacentRules = 1 << 6, | |
111 ChildrenAffectedByIndirectAdjacentRules = 1 << 7, | |
112 ChildrenAffectedByForwardPositionalRules = 1 << 8, | |
113 ChildrenAffectedByBackwardPositionalRules = 1 << 9, | |
114 | |
115 NumberOfDynamicRestyleFlags = 10, | |
116 }; | |
117 | |
103 class NodeRareDataBase { | 118 class NodeRareDataBase { |
104 public: | 119 public: |
105 RenderObject* renderer() const { return m_renderer; } | 120 RenderObject* renderer() const { return m_renderer; } |
106 void setRenderer(RenderObject* renderer) { m_renderer = renderer; } | 121 void setRenderer(RenderObject* renderer) { m_renderer = renderer; } |
107 | 122 |
108 protected: | 123 protected: |
109 NodeRareDataBase(RenderObject* renderer) | 124 NodeRareDataBase(RenderObject* renderer) |
110 : m_renderer(renderer) | 125 : m_renderer(renderer) |
111 { } | 126 { } |
112 | 127 |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
370 void clearChildNeedsStyleInvalidation() { clearFlag(ChildNeedsStyleInvalida tion); } | 385 void clearChildNeedsStyleInvalidation() { clearFlag(ChildNeedsStyleInvalida tion); } |
371 void markAncestorsWithChildNeedsStyleInvalidation(); | 386 void markAncestorsWithChildNeedsStyleInvalidation(); |
372 bool needsStyleInvalidation() { return getFlag(NeedsStyleInvalidation); } | 387 bool needsStyleInvalidation() { return getFlag(NeedsStyleInvalidation); } |
373 void clearNeedsStyleInvalidation() { clearFlag(NeedsStyleInvalidation); } | 388 void clearNeedsStyleInvalidation() { clearFlag(NeedsStyleInvalidation); } |
374 void setNeedsStyleInvalidation(); | 389 void setNeedsStyleInvalidation(); |
375 | 390 |
376 void recalcDistribution(); | 391 void recalcDistribution(); |
377 | 392 |
378 bool shouldNotifyRendererWithIdenticalStyles() const { return getFlag(Notify RendererWithIdenticalStyles); } | 393 bool shouldNotifyRendererWithIdenticalStyles() const { return getFlag(Notify RendererWithIdenticalStyles); } |
379 | 394 |
395 bool childrenAffectedByFocus() const { return hasRestyleFlag(ChildrenAffecte dByFocus); } | |
ojan
2014/03/21 22:39:12
What isn't all this stuff on ContainerNode?
| |
396 void setChildrenAffectedByFocus() { setRestyleFlag(ChildrenAffectedByFocus); } | |
397 | |
398 bool childrenAffectedByHover() const { return hasRestyleFlag(ChildrenAffecte dByHover); } | |
399 void setChildrenAffectedByHover() { setRestyleFlag(ChildrenAffectedByHover); } | |
400 | |
401 bool childrenAffectedByActive() const { return hasRestyleFlag(ChildrenAffect edByActive); } | |
402 void setChildrenAffectedByActive() { setRestyleFlag(ChildrenAffectedByActive ); } | |
403 | |
404 bool childrenAffectedByDrag() const { return hasRestyleFlag(ChildrenAffected ByDrag); } | |
405 void setChildrenAffectedByDrag() { setRestyleFlag(ChildrenAffectedByDrag); } | |
406 | |
407 bool childrenAffectedByPositionalRules() const { return hasRestyleFlag(Child renAffectedByForwardPositionalRules) || hasRestyleFlag(ChildrenAffectedByBackwar dPositionalRules); } | |
408 | |
409 bool childrenAffectedByFirstChildRules() const { return hasRestyleFlag(Child renAffectedByFirstChildRules); } | |
410 void setChildrenAffectedByFirstChildRules() { setRestyleFlag(ChildrenAffecte dByFirstChildRules); } | |
411 | |
412 bool childrenAffectedByLastChildRules() const { return hasRestyleFlag(Childr enAffectedByLastChildRules); } | |
413 void setChildrenAffectedByLastChildRules() { setRestyleFlag(ChildrenAffected ByLastChildRules); } | |
414 | |
415 bool childrenAffectedByDirectAdjacentRules() const { return hasRestyleFlag(C hildrenAffectedByDirectAdjacentRules); } | |
416 void setChildrenAffectedByDirectAdjacentRules() { setRestyleFlag(ChildrenAff ectedByDirectAdjacentRules); } | |
417 | |
418 bool childrenAffectedByIndirectAdjacentRules() const { return hasRestyleFlag (ChildrenAffectedByIndirectAdjacentRules); } | |
419 void setChildrenAffectedByIndirectAdjacentRules() { setRestyleFlag(ChildrenA ffectedByIndirectAdjacentRules); } | |
420 | |
421 bool childrenAffectedByForwardPositionalRules() const { return hasRestyleFla g(ChildrenAffectedByForwardPositionalRules); } | |
422 void setChildrenAffectedByForwardPositionalRules() { setRestyleFlag(Children AffectedByForwardPositionalRules); } | |
423 | |
424 bool childrenAffectedByBackwardPositionalRules() const { return hasRestyleFl ag(ChildrenAffectedByBackwardPositionalRules); } | |
425 void setChildrenAffectedByBackwardPositionalRules() { setRestyleFlag(Childre nAffectedByBackwardPositionalRules); } | |
426 | |
380 void setIsLink(bool f); | 427 void setIsLink(bool f); |
381 | 428 |
382 bool hasScopedHTMLStyleChild() const { return getFlag(HasScopedHTMLStyleChil dFlag); } | 429 bool hasScopedHTMLStyleChild() const { return getFlag(HasScopedHTMLStyleChil dFlag); } |
383 void setHasScopedHTMLStyleChild(bool flag) { setFlag(flag, HasScopedHTMLStyl eChildFlag); } | 430 void setHasScopedHTMLStyleChild(bool flag) { setFlag(flag, HasScopedHTMLStyl eChildFlag); } |
384 | 431 |
385 bool hasEventTargetData() const { return getFlag(HasEventTargetDataFlag); } | 432 bool hasEventTargetData() const { return getFlag(HasEventTargetDataFlag); } |
386 void setHasEventTargetData(bool flag) { setFlag(flag, HasEventTargetDataFlag ); } | 433 void setHasEventTargetData(bool flag) { setFlag(flag, HasEventTargetDataFlag ); } |
387 | 434 |
388 bool isV8CollectableDuringMinorGC() const { return getFlag(V8CollectableDuri ngMinorGCFlag); } | 435 bool isV8CollectableDuringMinorGC() const { return getFlag(V8CollectableDuri ngMinorGCFlag); } |
389 void markV8CollectableDuringMinorGC() { setFlag(true, V8CollectableDuringMin orGCFlag); } | 436 void markV8CollectableDuringMinorGC() { setFlag(true, V8CollectableDuringMin orGCFlag); } |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
665 void incrementConnectedSubframeCount(unsigned amount = 1); | 712 void incrementConnectedSubframeCount(unsigned amount = 1); |
666 void decrementConnectedSubframeCount(unsigned amount = 1); | 713 void decrementConnectedSubframeCount(unsigned amount = 1); |
667 void updateAncestorConnectedSubframeCountForRemoval() const; | 714 void updateAncestorConnectedSubframeCountForRemoval() const; |
668 void updateAncestorConnectedSubframeCountForInsertion() const; | 715 void updateAncestorConnectedSubframeCountForInsertion() const; |
669 | 716 |
670 PassRefPtr<NodeList> getDestinationInsertionPoints(); | 717 PassRefPtr<NodeList> getDestinationInsertionPoints(); |
671 | 718 |
672 void setAlreadySpellChecked(bool flag) { setFlag(flag, AlreadySpellCheckedFl ag); } | 719 void setAlreadySpellChecked(bool flag) { setFlag(flag, AlreadySpellCheckedFl ag); } |
673 bool isAlreadySpellChecked() { return getFlag(AlreadySpellCheckedFlag); } | 720 bool isAlreadySpellChecked() { return getFlag(AlreadySpellCheckedFlag); } |
674 | 721 |
722 bool isFinishedParsingChildren() const { return getFlag(IsFinishedParsingChi ldrenFlag); } | |
723 bool childrenSupportStyleSharing() const { return !hasRestyleFlags(); } | |
724 | |
675 private: | 725 private: |
676 enum NodeFlags { | 726 enum NodeFlags { |
677 IsTextFlag = 1, | 727 IsTextFlag = 1, |
678 IsContainerFlag = 1 << 1, | 728 IsContainerFlag = 1 << 1, |
679 IsElementFlag = 1 << 2, | 729 IsElementFlag = 1 << 2, |
680 IsHTMLFlag = 1 << 3, | 730 IsHTMLFlag = 1 << 3, |
681 IsSVGFlag = 1 << 4, | 731 IsSVGFlag = 1 << 4, |
682 | 732 |
683 ChildNeedsDistributionRecalc = 1 << 5, | 733 ChildNeedsDistributionRecalc = 1 << 5, |
684 ChildNeedsStyleRecalcFlag = 1 << 6, | 734 ChildNeedsStyleRecalcFlag = 1 << 6, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
721 DefaultNodeFlags = IsFinishedParsingChildrenFlag | ChildNeedsStyleRecalc Flag | NeedsReattachStyleChange | 771 DefaultNodeFlags = IsFinishedParsingChildrenFlag | ChildNeedsStyleRecalc Flag | NeedsReattachStyleChange |
722 }; | 772 }; |
723 | 773 |
724 // 3 bits remaining. | 774 // 3 bits remaining. |
725 | 775 |
726 bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; } | 776 bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; } |
727 void setFlag(bool f, NodeFlags mask) const { m_nodeFlags = (m_nodeFlags & ~m ask) | (-(int32_t)f & mask); } | 777 void setFlag(bool f, NodeFlags mask) const { m_nodeFlags = (m_nodeFlags & ~m ask) | (-(int32_t)f & mask); } |
728 void setFlag(NodeFlags mask) const { m_nodeFlags |= mask; } | 778 void setFlag(NodeFlags mask) const { m_nodeFlags |= mask; } |
729 void clearFlag(NodeFlags mask) const { m_nodeFlags &= ~mask; } | 779 void clearFlag(NodeFlags mask) const { m_nodeFlags &= ~mask; } |
730 | 780 |
781 bool hasRestyleFlag(DynamicRestyleFlags mask) const { return hasRareData() & & hasRestyleFlagInternal(mask); } | |
782 bool hasRestyleFlags() const { return hasRareData() && hasRestyleFlagsIntern al(); } | |
783 void setRestyleFlag(DynamicRestyleFlags); | |
784 bool hasRestyleFlagInternal(DynamicRestyleFlags) const; | |
785 bool hasRestyleFlagsInternal() const; | |
786 | |
731 protected: | 787 protected: |
732 enum ConstructionType { | 788 enum ConstructionType { |
733 CreateOther = DefaultNodeFlags, | 789 CreateOther = DefaultNodeFlags, |
734 CreateText = DefaultNodeFlags | IsTextFlag, | 790 CreateText = DefaultNodeFlags | IsTextFlag, |
735 CreateContainer = DefaultNodeFlags | IsContainerFlag, | 791 CreateContainer = DefaultNodeFlags | IsContainerFlag, |
736 CreateElement = CreateContainer | IsElementFlag, | 792 CreateElement = CreateContainer | IsElementFlag, |
737 CreateShadowRoot = CreateContainer | IsDocumentFragmentFlag | IsInShadow TreeFlag, | 793 CreateShadowRoot = CreateContainer | IsDocumentFragmentFlag | IsInShadow TreeFlag, |
738 CreateDocumentFragment = CreateContainer | IsDocumentFragmentFlag, | 794 CreateDocumentFragment = CreateContainer | IsDocumentFragmentFlag, |
739 CreateHTMLElement = CreateElement | IsHTMLFlag, | 795 CreateHTMLElement = CreateElement | IsHTMLFlag, |
740 CreateSVGElement = CreateElement | IsSVGFlag, | 796 CreateSVGElement = CreateElement | IsSVGFlag, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
779 | 835 |
780 void setTreeScope(TreeScope* scope) { m_treeScope = scope; } | 836 void setTreeScope(TreeScope* scope) { m_treeScope = scope; } |
781 | 837 |
782 // isTreeScopeInitialized() can be false | 838 // isTreeScopeInitialized() can be false |
783 // - in the destruction of Document or ShadowRoot where m_treeScope is set t o null or | 839 // - in the destruction of Document or ShadowRoot where m_treeScope is set t o null or |
784 // - in the Node constructor called by these two classes where m_treeScope i s set by TreeScope ctor. | 840 // - in the Node constructor called by these two classes where m_treeScope i s set by TreeScope ctor. |
785 bool isTreeScopeInitialized() const { return m_treeScope; } | 841 bool isTreeScopeInitialized() const { return m_treeScope; } |
786 | 842 |
787 void markAncestorsWithChildNeedsStyleRecalc(); | 843 void markAncestorsWithChildNeedsStyleRecalc(); |
788 | 844 |
789 bool isFinishedParsingChildren() const { return getFlag(IsFinishedParsingChi ldrenFlag); } | |
790 void setIsFinishedParsingChildren(bool value) { setFlag(value, IsFinishedPar singChildrenFlag); } | 845 void setIsFinishedParsingChildren(bool value) { setFlag(value, IsFinishedPar singChildrenFlag); } |
791 | 846 |
792 private: | 847 private: |
793 friend class TreeShared<Node>; | 848 friend class TreeShared<Node>; |
794 | 849 |
795 virtual PseudoId customPseudoId() const | 850 virtual PseudoId customPseudoId() const |
796 { | 851 { |
797 ASSERT(hasCustomStyleCallbacks()); | 852 ASSERT(hasCustomStyleCallbacks()); |
798 return NOPSEUDO; | 853 return NOPSEUDO; |
799 } | 854 } |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
907 } // namespace WebCore | 962 } // namespace WebCore |
908 | 963 |
909 #ifndef NDEBUG | 964 #ifndef NDEBUG |
910 // Outside the WebCore namespace for ease of invocation from gdb. | 965 // Outside the WebCore namespace for ease of invocation from gdb. |
911 void showNode(const WebCore::Node*); | 966 void showNode(const WebCore::Node*); |
912 void showTree(const WebCore::Node*); | 967 void showTree(const WebCore::Node*); |
913 void showNodePath(const WebCore::Node*); | 968 void showNodePath(const WebCore::Node*); |
914 #endif | 969 #endif |
915 | 970 |
916 #endif | 971 #endif |
OLD | NEW |