| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 class RenderBox; | 78 class RenderBox; |
| 79 class RenderBoxModelObject; | 79 class RenderBoxModelObject; |
| 80 class RenderObject; | 80 class RenderObject; |
| 81 class RenderStyle; | 81 class RenderStyle; |
| 82 class ShadowRoot; | 82 class ShadowRoot; |
| 83 class TagNodeList; | 83 class TagNodeList; |
| 84 class TouchEvent; | 84 class TouchEvent; |
| 85 | 85 |
| 86 typedef int ExceptionCode; | 86 typedef int ExceptionCode; |
| 87 | 87 |
| 88 const int nodeStyleChangeShift = 15; | 88 const int nodeStyleChangeShift = 14; |
| 89 | 89 |
| 90 enum StyleChangeType { | 90 enum StyleChangeType { |
| 91 NoStyleChange = 0, | 91 NoStyleChange = 0, |
| 92 LocalStyleChange = 1 << nodeStyleChangeShift, | 92 LocalStyleChange = 1 << nodeStyleChangeShift, |
| 93 SubtreeStyleChange = 2 << nodeStyleChangeShift, | 93 SubtreeStyleChange = 2 << 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 { |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 PseudoId pseudoId() const { return (isElementNode() && hasCustomStyleCallbac
ks()) ? customPseudoId() : NOPSEUDO; } | 251 PseudoId pseudoId() const { return (isElementNode() && hasCustomStyleCallbac
ks()) ? customPseudoId() : NOPSEUDO; } |
| 252 | 252 |
| 253 bool isCustomElement() const { return getFlag(IsCustomElement); } | 253 bool isCustomElement() const { return getFlag(IsCustomElement); } |
| 254 void setIsCustomElement(); | 254 void setIsCustomElement(); |
| 255 bool isUpgradedCustomElement() const { return getFlag(IsUpgradedCustomElemen
t); } | 255 bool isUpgradedCustomElement() const { return getFlag(IsUpgradedCustomElemen
t); } |
| 256 void setIsUpgradedCustomElement(); | 256 void setIsUpgradedCustomElement(); |
| 257 | 257 |
| 258 virtual bool isMediaControlElement() const { return false; } | 258 virtual bool isMediaControlElement() const { return false; } |
| 259 virtual bool isMediaControls() const { return false; } | 259 virtual bool isMediaControls() const { return false; } |
| 260 virtual bool isWebVTTElement() const { return false; } | 260 virtual bool isWebVTTElement() const { return false; } |
| 261 bool isStyledElement() const { return getFlag(IsStyledElementFlag); } | |
| 262 virtual bool isAttributeNode() const { return false; } | 261 virtual bool isAttributeNode() const { return false; } |
| 263 virtual bool isCharacterDataNode() const { return false; } | 262 virtual bool isCharacterDataNode() const { return false; } |
| 264 virtual bool isFrameOwnerElement() const { return false; } | 263 virtual bool isFrameOwnerElement() const { return false; } |
| 265 virtual bool isPluginElement() const { return false; } | 264 virtual bool isPluginElement() const { return false; } |
| 266 | 265 |
| 266 // StyledElements allow inline style (style="border: 1px"), presentational a
ttributes (ex. color), |
| 267 // class names (ex. class="foo bar") and other non-basic styling features. T
hey and also control |
| 268 // if this element can participate in style sharing. |
| 269 // |
| 270 // FIXME: The only things that ever go through StyleResolver that aren't Sty
ledElements are |
| 271 // PseudoElements and WebVTTElements. It's possible we can just eliminate al
l the checks |
| 272 // since those elements will never have class names, inline style, or other
things that |
| 273 // this apparently guards against. |
| 274 bool isStyledElement() const { return isHTMLElement() || isSVGElement(); } |
| 275 |
| 267 bool isDocumentNode() const; | 276 bool isDocumentNode() const; |
| 268 bool isTreeScope() const { return treeScope()->rootNode() == this; } | 277 bool isTreeScope() const { return treeScope()->rootNode() == this; } |
| 269 bool isDocumentFragment() const { return getFlag(IsDocumentFragmentFlag); } | 278 bool isDocumentFragment() const { return getFlag(IsDocumentFragmentFlag); } |
| 270 bool isShadowRoot() const { return isDocumentFragment() && isTreeScope(); } | 279 bool isShadowRoot() const { return isDocumentFragment() && isTreeScope(); } |
| 271 bool isInsertionPoint() const { return getFlag(IsInsertionPointFlag); } | 280 bool isInsertionPoint() const { return getFlag(IsInsertionPointFlag); } |
| 272 | 281 |
| 273 bool inNamedFlow() const { return getFlag(InNamedFlowFlag); } | 282 bool inNamedFlow() const { return getFlag(InNamedFlowFlag); } |
| 274 bool hasCustomStyleCallbacks() const { return getFlag(HasCustomStyleCallback
sFlag); } | 283 bool hasCustomStyleCallbacks() const { return getFlag(HasCustomStyleCallback
sFlag); } |
| 275 | 284 |
| 276 bool isRegisteredWithNamedFlow() const; | 285 bool isRegisteredWithNamedFlow() const; |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 void incrementConnectedSubframeCount(unsigned amount = 1); | 718 void incrementConnectedSubframeCount(unsigned amount = 1); |
| 710 void decrementConnectedSubframeCount(unsigned amount = 1); | 719 void decrementConnectedSubframeCount(unsigned amount = 1); |
| 711 void updateAncestorConnectedSubframeCountForRemoval() const; | 720 void updateAncestorConnectedSubframeCountForRemoval() const; |
| 712 void updateAncestorConnectedSubframeCountForInsertion() const; | 721 void updateAncestorConnectedSubframeCountForInsertion() const; |
| 713 | 722 |
| 714 private: | 723 private: |
| 715 enum NodeFlags { | 724 enum NodeFlags { |
| 716 IsTextFlag = 1, | 725 IsTextFlag = 1, |
| 717 IsContainerFlag = 1 << 1, | 726 IsContainerFlag = 1 << 1, |
| 718 IsElementFlag = 1 << 2, | 727 IsElementFlag = 1 << 2, |
| 719 IsStyledElementFlag = 1 << 3, | 728 IsHTMLFlag = 1 << 3, |
| 720 IsHTMLFlag = 1 << 4, | 729 IsSVGFlag = 1 << 4, |
| 721 IsSVGFlag = 1 << 5, | 730 IsAttachedFlag = 1 << 5, |
| 722 IsAttachedFlag = 1 << 6, | 731 ChildNeedsStyleRecalcFlag = 1 << 6, |
| 723 ChildNeedsStyleRecalcFlag = 1 << 7, | 732 InDocumentFlag = 1 << 7, |
| 724 InDocumentFlag = 1 << 8, | 733 IsLinkFlag = 1 << 8, |
| 725 IsLinkFlag = 1 << 9, | 734 IsUserActionElement = 1 << 9, |
| 726 IsUserActionElement = 1 << 10, | 735 HasRareDataFlag = 1 << 10, |
| 727 HasRareDataFlag = 1 << 11, | 736 IsDocumentFragmentFlag = 1 << 11, |
| 728 IsDocumentFragmentFlag = 1 << 12, | |
| 729 | 737 |
| 730 // These bits are used by derived classes, pulled up here so they can | 738 // These bits are used by derived classes, pulled up here so they can |
| 731 // be stored in the same memory word as the Node bits above. | 739 // be stored in the same memory word as the Node bits above. |
| 732 IsParsingChildrenFinishedFlag = 1 << 13, // Element | 740 IsParsingChildrenFinishedFlag = 1 << 12, // Element |
| 733 HasSVGRareDataFlag = 1 << 14, // SVGElement | 741 HasSVGRareDataFlag = 1 << 13, // SVGElement |
| 734 | 742 |
| 735 StyleChangeMask = 1 << nodeStyleChangeShift | 1 << (nodeStyleChangeShift
+ 1), | 743 StyleChangeMask = 1 << nodeStyleChangeShift | 1 << (nodeStyleChangeShift
+ 1), |
| 736 | 744 |
| 737 SelfOrAncestorHasDirAutoFlag = 1 << 17, | 745 SelfOrAncestorHasDirAutoFlag = 1 << 16, |
| 738 | 746 |
| 739 HasNameOrIsEditingTextFlag = 1 << 18, | 747 HasNameOrIsEditingTextFlag = 1 << 17, |
| 740 | 748 |
| 741 InNamedFlowFlag = 1 << 19, | 749 InNamedFlowFlag = 1 << 18, |
| 742 HasSyntheticAttrChildNodesFlag = 1 << 20, | 750 HasSyntheticAttrChildNodesFlag = 1 << 19, |
| 743 HasCustomStyleCallbacksFlag = 1 << 21, | 751 HasCustomStyleCallbacksFlag = 1 << 20, |
| 744 HasScopedHTMLStyleChildFlag = 1 << 22, | 752 HasScopedHTMLStyleChildFlag = 1 << 21, |
| 745 HasEventTargetDataFlag = 1 << 23, | 753 HasEventTargetDataFlag = 1 << 22, |
| 746 V8CollectableDuringMinorGCFlag = 1 << 24, | 754 V8CollectableDuringMinorGCFlag = 1 << 23, |
| 747 IsInsertionPointFlag = 1 << 25, | 755 IsInsertionPointFlag = 1 << 24, |
| 748 IsInShadowTreeFlag = 1 << 26, | 756 IsInShadowTreeFlag = 1 << 25, |
| 749 IsCustomElement = 1 << 27, | 757 IsCustomElement = 1 << 26, |
| 750 | 758 |
| 751 NotifyRendererWithIdenticalStyles = 1 << 28, | 759 NotifyRendererWithIdenticalStyles = 1 << 27, |
| 752 | 760 |
| 753 IsUpgradedCustomElement = 1 << 29, | 761 IsUpgradedCustomElement = 1 << 28, |
| 754 | 762 |
| 755 DefaultNodeFlags = IsParsingChildrenFinishedFlag | 763 DefaultNodeFlags = IsParsingChildrenFinishedFlag |
| 756 }; | 764 }; |
| 757 | 765 |
| 758 // 2 bits remaining | 766 // 3 bits remaining |
| 759 | 767 |
| 760 bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; } | 768 bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; } |
| 761 void setFlag(bool f, NodeFlags mask) const { m_nodeFlags = (m_nodeFlags & ~m
ask) | (-(int32_t)f & mask); } | 769 void setFlag(bool f, NodeFlags mask) const { m_nodeFlags = (m_nodeFlags & ~m
ask) | (-(int32_t)f & mask); } |
| 762 void setFlag(NodeFlags mask) const { m_nodeFlags |= mask; } | 770 void setFlag(NodeFlags mask) const { m_nodeFlags |= mask; } |
| 763 void clearFlag(NodeFlags mask) const { m_nodeFlags &= ~mask; } | 771 void clearFlag(NodeFlags mask) const { m_nodeFlags &= ~mask; } |
| 764 | 772 |
| 765 protected: | 773 protected: |
| 766 enum ConstructionType { | 774 enum ConstructionType { |
| 767 CreateOther = DefaultNodeFlags, | 775 CreateOther = DefaultNodeFlags, |
| 768 CreateText = DefaultNodeFlags | IsTextFlag, | 776 CreateText = DefaultNodeFlags | IsTextFlag, |
| 769 CreateContainer = DefaultNodeFlags | IsContainerFlag, | 777 CreateContainer = DefaultNodeFlags | IsContainerFlag, |
| 770 CreateElement = CreateContainer | IsElementFlag, | 778 CreateElement = CreateContainer | IsElementFlag, |
| 771 CreatePseudoElement = CreateElement | InDocumentFlag, | 779 CreatePseudoElement = CreateElement | InDocumentFlag, |
| 772 CreateShadowRoot = CreateContainer | IsDocumentFragmentFlag | IsInShadow
TreeFlag, | 780 CreateShadowRoot = CreateContainer | IsDocumentFragmentFlag | IsInShadow
TreeFlag, |
| 773 CreateDocumentFragment = CreateContainer | IsDocumentFragmentFlag, | 781 CreateDocumentFragment = CreateContainer | IsDocumentFragmentFlag, |
| 774 CreateStyledElement = CreateElement | IsStyledElementFlag, | 782 CreateHTMLElement = CreateElement | IsHTMLFlag, |
| 775 CreateHTMLElement = CreateStyledElement | IsHTMLFlag, | 783 CreateSVGElement = CreateElement | IsSVGFlag, |
| 776 CreateSVGElement = CreateStyledElement | IsSVGFlag, | |
| 777 CreateDocument = CreateContainer | InDocumentFlag, | 784 CreateDocument = CreateContainer | InDocumentFlag, |
| 778 CreateInsertionPoint = CreateHTMLElement | IsInsertionPointFlag, | 785 CreateInsertionPoint = CreateHTMLElement | IsInsertionPointFlag, |
| 779 CreateEditingText = CreateText | HasNameOrIsEditingTextFlag, | 786 CreateEditingText = CreateText | HasNameOrIsEditingTextFlag, |
| 780 }; | 787 }; |
| 781 | 788 |
| 782 Node(TreeScope* treeScope, ConstructionType type) | 789 Node(TreeScope* treeScope, ConstructionType type) |
| 783 : m_nodeFlags(type) | 790 : m_nodeFlags(type) |
| 784 , m_parentOrShadowHostNode(0) | 791 , m_parentOrShadowHostNode(0) |
| 785 , m_treeScope(treeScope) | 792 , m_treeScope(treeScope) |
| 786 , m_previous(0) | 793 , m_previous(0) |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 | 945 |
| 939 } //namespace | 946 } //namespace |
| 940 | 947 |
| 941 #ifndef NDEBUG | 948 #ifndef NDEBUG |
| 942 // Outside the WebCore namespace for ease of invocation from gdb. | 949 // Outside the WebCore namespace for ease of invocation from gdb. |
| 943 void showTree(const WebCore::Node*); | 950 void showTree(const WebCore::Node*); |
| 944 void showNodePath(const WebCore::Node*); | 951 void showNodePath(const WebCore::Node*); |
| 945 #endif | 952 #endif |
| 946 | 953 |
| 947 #endif | 954 #endif |
| OLD | NEW |