| Index: third_party/WebKit/Source/core/dom/Node.h
|
| diff --git a/third_party/WebKit/Source/core/dom/Node.h b/third_party/WebKit/Source/core/dom/Node.h
|
| index a9ee2d12e383f75c545bde438b64b46baec4f808..5ced46085c666a6f4d06e3255bb10a4c5d27b6a9 100644
|
| --- a/third_party/WebKit/Source/core/dom/Node.h
|
| +++ b/third_party/WebKit/Source/core/dom/Node.h
|
| @@ -90,7 +90,7 @@ class TagCollection;
|
| class Text;
|
| class TouchEvent;
|
|
|
| -const int nodeStyleChangeShift = 19;
|
| +const int nodeStyleChangeShift = 20;
|
|
|
| enum StyleChangeType {
|
| NoStyleChange = 0,
|
| @@ -513,13 +513,22 @@ public:
|
|
|
| // As layoutObject() includes a branch you should avoid calling it repeatedly in hot code paths.
|
| // Note that if a Node has a layoutObject, it's parentNode is guaranteed to have one as well.
|
| - LayoutObject* layoutObject() const { return hasRareData() ? m_data.m_rareData->layoutObject() : m_data.m_layoutObject; }
|
| + LayoutObject* layoutObject() const
|
| + {
|
| + if (hasRareData())
|
| + return m_data.m_rareData->layoutObject();
|
| + return hasLayoutObject() ? m_data.m_layoutObject : nullptr;
|
| + }
|
| void setLayoutObject(LayoutObject* layoutObject)
|
| {
|
| if (hasRareData())
|
| m_data.m_rareData->setLayoutObject(layoutObject);
|
| else
|
| m_data.m_layoutObject = layoutObject;
|
| + if (layoutObject)
|
| + setFlag(HasLayoutObjectFlag);
|
| + else
|
| + clearFlag(HasLayoutObjectFlag);
|
| }
|
|
|
| // Use these two methods with caution.
|
| @@ -553,6 +562,7 @@ public:
|
| // Wrapper for nodes that don't have a layoutObject, but still cache the style (like HTMLOptionElement).
|
| ComputedStyle* mutableComputedStyle() const;
|
| const ComputedStyle* computedStyle() const;
|
| + void setComputedStyle(PassRefPtr<ComputedStyle>);
|
| const ComputedStyle* parentComputedStyle() const;
|
|
|
| const ComputedStyle& computedStyleRef() const;
|
| @@ -687,57 +697,58 @@ public:
|
|
|
| private:
|
| enum NodeFlags {
|
| - HasRareDataFlag = 1,
|
| + HasLayoutObjectFlag = 1,
|
| + HasRareDataFlag = 1 << 1,
|
|
|
| // Node type flags. These never change once created.
|
| - IsTextFlag = 1 << 1,
|
| - IsContainerFlag = 1 << 2,
|
| - IsElementFlag = 1 << 3,
|
| - IsHTMLFlag = 1 << 4,
|
| - IsSVGFlag = 1 << 5,
|
| - IsDocumentFragmentFlag = 1 << 6,
|
| - IsInsertionPointFlag = 1 << 7,
|
| + IsTextFlag = 1 << 2,
|
| + IsContainerFlag = 1 << 3,
|
| + IsElementFlag = 1 << 4,
|
| + IsHTMLFlag = 1 << 5,
|
| + IsSVGFlag = 1 << 6,
|
| + IsDocumentFragmentFlag = 1 << 7,
|
| + IsInsertionPointFlag = 1 << 8,
|
|
|
| // Changes based on if the element should be treated like a link,
|
| // ex. When setting the href attribute on an <a>.
|
| - IsLinkFlag = 1 << 8,
|
| + IsLinkFlag = 1 << 9,
|
|
|
| // Changes based on :hover, :active and :focus state.
|
| - IsUserActionElementFlag = 1 << 9,
|
| + IsUserActionElementFlag = 1 << 10,
|
|
|
| // Tree state flags. These change when the element is added/removed
|
| // from a DOM tree.
|
| - InDocumentFlag = 1 << 10,
|
| - IsInShadowTreeFlag = 1 << 11,
|
| + InDocumentFlag = 1 << 11,
|
| + IsInShadowTreeFlag = 1 << 12,
|
|
|
| // Set by the parser when the children are done parsing.
|
| - IsFinishedParsingChildrenFlag = 1 << 12,
|
| + IsFinishedParsingChildrenFlag = 1 << 13,
|
|
|
| // Flags related to recalcStyle.
|
| - SVGFilterNeedsLayerUpdateFlag = 1 << 13,
|
| - HasCustomStyleCallbacksFlag = 1 << 14,
|
| - ChildNeedsStyleInvalidationFlag = 1 << 15,
|
| - NeedsStyleInvalidationFlag = 1 << 16,
|
| - ChildNeedsDistributionRecalcFlag = 1 << 17,
|
| - ChildNeedsStyleRecalcFlag = 1 << 18,
|
| + SVGFilterNeedsLayerUpdateFlag = 1 << 14,
|
| + HasCustomStyleCallbacksFlag = 1 << 15,
|
| + ChildNeedsStyleInvalidationFlag = 1 << 16,
|
| + NeedsStyleInvalidationFlag = 1 << 17,
|
| + ChildNeedsDistributionRecalcFlag = 1 << 18,
|
| + ChildNeedsStyleRecalcFlag = 1 << 19,
|
| StyleChangeMask = 1 << nodeStyleChangeShift | 1 << (nodeStyleChangeShift + 1),
|
|
|
| - CustomElementFlag = 1 << 21,
|
| - CustomElementCustomFlag = 1 << 22,
|
| + CustomElementFlag = 1 << 22,
|
| + CustomElementCustomFlag = 1 << 23,
|
|
|
| - HasNameOrIsEditingTextFlag = 1 << 23,
|
| - HasWeakReferencesFlag = 1 << 24,
|
| - V8CollectableDuringMinorGCFlag = 1 << 25,
|
| - HasEventTargetDataFlag = 1 << 26,
|
| - AlreadySpellCheckedFlag = 1 << 27,
|
| + HasNameOrIsEditingTextFlag = 1 << 24,
|
| + HasWeakReferencesFlag = 1 << 25,
|
| + V8CollectableDuringMinorGCFlag = 1 << 26,
|
| + HasEventTargetDataFlag = 1 << 27,
|
| + AlreadySpellCheckedFlag = 1 << 28,
|
|
|
| - V0CustomElementFlag = 1 << 28,
|
| - V0CustomElementUpgradedFlag = 1 << 29,
|
| + V0CustomElementFlag = 1 << 29,
|
| + V0CustomElementUpgradedFlag = 1 << 30,
|
|
|
| DefaultNodeFlags = IsFinishedParsingChildrenFlag | NeedsReattachStyleChange
|
| };
|
|
|
| - // 3 bits remaining.
|
| + // 1 bit remaining.
|
|
|
| bool getFlag(NodeFlags mask) const { return m_nodeFlags & mask; }
|
| void setFlag(bool f, NodeFlags mask) { m_nodeFlags = (m_nodeFlags & ~mask) | (-(int32_t)f & mask); }
|
| @@ -769,6 +780,7 @@ protected:
|
|
|
| static void reattachWhitespaceSiblingsIfNeeded(Text* start);
|
|
|
| + bool hasLayoutObject() const { return getFlag(HasLayoutObjectFlag); }
|
| bool hasRareData() const { return getFlag(HasRareDataFlag); }
|
|
|
| NodeRareData* rareData() const;
|
| @@ -826,7 +838,8 @@ private:
|
| Member<Node> m_next;
|
| // When a node has rare data we move the layoutObject into the rare data.
|
| union DataUnion {
|
| - DataUnion() : m_layoutObject(nullptr) { }
|
| + DataUnion() : m_computedStyle(nullptr) { }
|
| + ComputedStyle* m_computedStyle;
|
| // LayoutObjects are fully owned by their DOM node. See LayoutObject's
|
| // LIFETIME documentation section.
|
| LayoutObject* m_layoutObject;
|
|
|