Chromium Code Reviews| 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); } | 261 bool isStyledElement() const { return isHTMLElement() || isSVGElement(); } |
|
eseidel
2013/07/12 06:31:32
How do you know this to be true? could you add a
| |
| 262 virtual bool isAttributeNode() const { return false; } | 262 virtual bool isAttributeNode() const { return false; } |
| 263 virtual bool isCharacterDataNode() const { return false; } | 263 virtual bool isCharacterDataNode() const { return false; } |
| 264 virtual bool isFrameOwnerElement() const { return false; } | 264 virtual bool isFrameOwnerElement() const { return false; } |
| 265 virtual bool isPluginElement() const { return false; } | 265 virtual bool isPluginElement() const { return false; } |
| 266 | 266 |
| 267 bool isDocumentNode() const; | 267 bool isDocumentNode() const; |
| 268 bool isTreeScope() const { return treeScope()->rootNode() == this; } | 268 bool isTreeScope() const { return treeScope()->rootNode() == this; } |
| 269 bool isDocumentFragment() const { return getFlag(IsDocumentFragmentFlag); } | 269 bool isDocumentFragment() const { return getFlag(IsDocumentFragmentFlag); } |
| 270 bool isShadowRoot() const { return isDocumentFragment() && isTreeScope(); } | 270 bool isShadowRoot() const { return isDocumentFragment() && isTreeScope(); } |
| 271 bool isInsertionPoint() const { return getFlag(IsInsertionPointFlag); } | 271 bool isInsertionPoint() const { return getFlag(IsInsertionPointFlag); } |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 709 void incrementConnectedSubframeCount(unsigned amount = 1); | 709 void incrementConnectedSubframeCount(unsigned amount = 1); |
| 710 void decrementConnectedSubframeCount(unsigned amount = 1); | 710 void decrementConnectedSubframeCount(unsigned amount = 1); |
| 711 void updateAncestorConnectedSubframeCountForRemoval() const; | 711 void updateAncestorConnectedSubframeCountForRemoval() const; |
| 712 void updateAncestorConnectedSubframeCountForInsertion() const; | 712 void updateAncestorConnectedSubframeCountForInsertion() const; |
| 713 | 713 |
| 714 private: | 714 private: |
| 715 enum NodeFlags { | 715 enum NodeFlags { |
| 716 IsTextFlag = 1, | 716 IsTextFlag = 1, |
| 717 IsContainerFlag = 1 << 1, | 717 IsContainerFlag = 1 << 1, |
| 718 IsElementFlag = 1 << 2, | 718 IsElementFlag = 1 << 2, |
| 719 IsStyledElementFlag = 1 << 3, | 719 IsHTMLFlag = 1 << 3, |
| 720 IsHTMLFlag = 1 << 4, | 720 IsSVGFlag = 1 << 4, |
| 721 IsSVGFlag = 1 << 5, | 721 IsAttachedFlag = 1 << 5, |
| 722 IsAttachedFlag = 1 << 6, | 722 ChildNeedsStyleRecalcFlag = 1 << 6, |
| 723 ChildNeedsStyleRecalcFlag = 1 << 7, | 723 InDocumentFlag = 1 << 7, |
| 724 InDocumentFlag = 1 << 8, | 724 IsLinkFlag = 1 << 8, |
| 725 IsLinkFlag = 1 << 9, | 725 IsUserActionElement = 1 << 9, |
| 726 IsUserActionElement = 1 << 10, | 726 HasRareDataFlag = 1 << 10, |
| 727 HasRareDataFlag = 1 << 11, | 727 IsDocumentFragmentFlag = 1 << 11, |
| 728 IsDocumentFragmentFlag = 1 << 12, | |
| 729 | 728 |
| 730 // These bits are used by derived classes, pulled up here so they can | 729 // 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. | 730 // be stored in the same memory word as the Node bits above. |
| 732 IsParsingChildrenFinishedFlag = 1 << 13, // Element | 731 IsParsingChildrenFinishedFlag = 1 << 12, // Element |
| 733 HasSVGRareDataFlag = 1 << 14, // SVGElement | 732 HasSVGRareDataFlag = 1 << 13, // SVGElement |
| 734 | 733 |
| 735 StyleChangeMask = 1 << nodeStyleChangeShift | 1 << (nodeStyleChangeShift + 1), | 734 StyleChangeMask = 1 << nodeStyleChangeShift | 1 << (nodeStyleChangeShift + 1), |
| 736 | 735 |
| 737 SelfOrAncestorHasDirAutoFlag = 1 << 17, | 736 SelfOrAncestorHasDirAutoFlag = 1 << 16, |
| 738 | 737 |
| 739 HasNameOrIsEditingTextFlag = 1 << 18, | 738 HasNameOrIsEditingTextFlag = 1 << 17, |
| 740 | 739 |
| 741 InNamedFlowFlag = 1 << 19, | 740 InNamedFlowFlag = 1 << 18, |
| 742 HasSyntheticAttrChildNodesFlag = 1 << 20, | 741 HasSyntheticAttrChildNodesFlag = 1 << 19, |
| 743 HasCustomStyleCallbacksFlag = 1 << 21, | 742 HasCustomStyleCallbacksFlag = 1 << 20, |
| 744 HasScopedHTMLStyleChildFlag = 1 << 22, | 743 HasScopedHTMLStyleChildFlag = 1 << 21, |
| 745 HasEventTargetDataFlag = 1 << 23, | 744 HasEventTargetDataFlag = 1 << 22, |
| 746 V8CollectableDuringMinorGCFlag = 1 << 24, | 745 V8CollectableDuringMinorGCFlag = 1 << 23, |
| 747 IsInsertionPointFlag = 1 << 25, | 746 IsInsertionPointFlag = 1 << 24, |
| 748 IsInShadowTreeFlag = 1 << 26, | 747 IsInShadowTreeFlag = 1 << 25, |
| 749 IsCustomElement = 1 << 27, | 748 IsCustomElement = 1 << 26, |
| 750 | 749 |
| 751 NotifyRendererWithIdenticalStyles = 1 << 28, | 750 NotifyRendererWithIdenticalStyles = 1 << 27, |
| 752 | 751 |
| 753 IsUpgradedCustomElement = 1 << 29, | 752 IsUpgradedCustomElement = 1 << 28, |
| 754 | 753 |
| 755 DefaultNodeFlags = IsParsingChildrenFinishedFlag | 754 DefaultNodeFlags = IsParsingChildrenFinishedFlag |
| 756 }; | 755 }; |
| 757 | 756 |
| 758 // 2 bits remaining | 757 // 3 bits remaining |
| 759 | 758 |
| 760 bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; } | 759 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); } | 760 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; } | 761 void setFlag(NodeFlags mask) const { m_nodeFlags |= mask; } |
| 763 void clearFlag(NodeFlags mask) const { m_nodeFlags &= ~mask; } | 762 void clearFlag(NodeFlags mask) const { m_nodeFlags &= ~mask; } |
| 764 | 763 |
| 765 protected: | 764 protected: |
| 766 enum ConstructionType { | 765 enum ConstructionType { |
| 767 CreateOther = DefaultNodeFlags, | 766 CreateOther = DefaultNodeFlags, |
| 768 CreateText = DefaultNodeFlags | IsTextFlag, | 767 CreateText = DefaultNodeFlags | IsTextFlag, |
| 769 CreateContainer = DefaultNodeFlags | IsContainerFlag, | 768 CreateContainer = DefaultNodeFlags | IsContainerFlag, |
| 770 CreateElement = CreateContainer | IsElementFlag, | 769 CreateElement = CreateContainer | IsElementFlag, |
| 771 CreatePseudoElement = CreateElement | InDocumentFlag, | 770 CreatePseudoElement = CreateElement | InDocumentFlag, |
| 772 CreateShadowRoot = CreateContainer | IsDocumentFragmentFlag | IsInShadow TreeFlag, | 771 CreateShadowRoot = CreateContainer | IsDocumentFragmentFlag | IsInShadow TreeFlag, |
| 773 CreateDocumentFragment = CreateContainer | IsDocumentFragmentFlag, | 772 CreateDocumentFragment = CreateContainer | IsDocumentFragmentFlag, |
| 774 CreateStyledElement = CreateElement | IsStyledElementFlag, | 773 CreateHTMLElement = CreateElement | IsHTMLFlag, |
| 775 CreateHTMLElement = CreateStyledElement | IsHTMLFlag, | 774 CreateSVGElement = CreateElement | IsSVGFlag, |
| 776 CreateSVGElement = CreateStyledElement | IsSVGFlag, | |
| 777 CreateDocument = CreateContainer | InDocumentFlag, | 775 CreateDocument = CreateContainer | InDocumentFlag, |
| 778 CreateInsertionPoint = CreateHTMLElement | IsInsertionPointFlag, | 776 CreateInsertionPoint = CreateHTMLElement | IsInsertionPointFlag, |
| 779 CreateEditingText = CreateText | HasNameOrIsEditingTextFlag, | 777 CreateEditingText = CreateText | HasNameOrIsEditingTextFlag, |
| 780 }; | 778 }; |
| 781 | 779 |
| 782 Node(TreeScope* treeScope, ConstructionType type) | 780 Node(TreeScope* treeScope, ConstructionType type) |
| 783 : m_nodeFlags(type) | 781 : m_nodeFlags(type) |
| 784 , m_parentOrShadowHostNode(0) | 782 , m_parentOrShadowHostNode(0) |
| 785 , m_treeScope(treeScope) | 783 , m_treeScope(treeScope) |
| 786 , m_previous(0) | 784 , m_previous(0) |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 938 | 936 |
| 939 } //namespace | 937 } //namespace |
| 940 | 938 |
| 941 #ifndef NDEBUG | 939 #ifndef NDEBUG |
| 942 // Outside the WebCore namespace for ease of invocation from gdb. | 940 // Outside the WebCore namespace for ease of invocation from gdb. |
| 943 void showTree(const WebCore::Node*); | 941 void showTree(const WebCore::Node*); |
| 944 void showNodePath(const WebCore::Node*); | 942 void showNodePath(const WebCore::Node*); |
| 945 #endif | 943 #endif |
| 946 | 944 |
| 947 #endif | 945 #endif |
| OLD | NEW |