Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Unified Diff: third_party/WebKit/Source/core/dom/Node.h

Issue 2119263002: [DO NOT LAND: Dummy CL] Storage of ComputedStyle separate from LayoutObject. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.h ('k') | third_party/WebKit/Source/core/dom/Node.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e3b2c2b573e4bd6add47252f6d1ade75eaea115f..2edacd545d8999133561e6656acbfd4f79f0f2af 100644
--- a/third_party/WebKit/Source/core/dom/Node.h
+++ b/third_party/WebKit/Source/core/dom/Node.h
@@ -91,8 +91,8 @@ class TagCollection;
class Text;
class TouchEvent;
-const int nodeStyleChangeShift = 19;
-const int nodeCustomElementShift = 21;
+const int nodeStyleChangeShift = 20;
+const int nodeCustomElementShift = 22;
enum StyleChangeType {
NoStyleChange = 0,
@@ -488,13 +488,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.
@@ -662,56 +671,57 @@ 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.
- IsConnectedFlag = 1 << 10,
- IsInShadowTreeFlag = 1 << 11,
+ IsConnectedFlag = 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),
CustomElementStateMask = 0x3 << nodeCustomElementShift,
- 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); }
@@ -743,6 +753,7 @@ protected:
static void reattachWhitespaceSiblingsIfNeeded(Text* start);
+ bool hasLayoutObject() const { return getFlag(HasLayoutObjectFlag); }
bool hasRareData() const { return getFlag(HasRareDataFlag); }
NodeRareData* rareData() const;
@@ -797,6 +808,7 @@ private:
// When a node has rare data we move the layoutObject into the rare data.
union DataUnion {
DataUnion() : m_layoutObject(nullptr) { }
+ ComputedStyle* m_computedStyle;
// LayoutObjects are fully owned by their DOM node. See LayoutObject's
// LIFETIME documentation section.
LayoutObject* m_layoutObject;
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.h ('k') | third_party/WebKit/Source/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698