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

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

Issue 1962953002: Storage of ComputedStyle separate from LayoutObject. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Elliott's comments Created 4 years, 4 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 | « no previous file | 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 ec0f9f4b18b730382cb721ea37aadbea645fe07b..c2f9e88615682c8eb34d42904d0a2aadd0e138a6 100644
--- a/third_party/WebKit/Source/core/dom/Node.h
+++ b/third_party/WebKit/Source/core/dom/Node.h
@@ -477,13 +477,19 @@ 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;
+ setFlag(static_cast<bool>(layoutObject), HasLayoutObjectFlag);
}
// Use these two methods with caution.
@@ -697,10 +703,12 @@ private:
V0CustomElementFlag = 1 << 28,
V0CustomElementUpgradedFlag = 1 << 29,
+ HasLayoutObjectFlag = 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); }
@@ -732,6 +740,7 @@ protected:
static void reattachWhitespaceSiblingsIfNeeded(Text* start);
+ bool hasLayoutObject() const { return getFlag(HasLayoutObjectFlag); }
bool hasRareData() const { return getFlag(HasRareDataFlag); }
NodeRareData* rareData() const;
@@ -786,6 +795,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 | « no previous file | third_party/WebKit/Source/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698