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

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

Issue 1962953002: Storage of ComputedStyle separate from LayoutObject. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: compressed Node::setLayoutObject and added Node::setComputedStyle method Created 4 years, 7 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
Index: third_party/WebKit/Source/core/dom/NodeComputedStyle.h
diff --git a/third_party/WebKit/Source/core/dom/NodeComputedStyle.h b/third_party/WebKit/Source/core/dom/NodeComputedStyle.h
index 78872cdcf125b3139e08a8e7752e6eda40cfea34..a21c2953ee37e54a7f3ac4c6351c8ea6336762de 100644
--- a/third_party/WebKit/Source/core/dom/NodeComputedStyle.h
+++ b/third_party/WebKit/Source/core/dom/NodeComputedStyle.h
@@ -41,14 +41,26 @@ inline const ComputedStyle* Node::computedStyle() const
inline ComputedStyle* Node::mutableComputedStyle() const
{
- if (LayoutObject* layoutObject = this->layoutObject())
- return layoutObject->mutableStyle();
+ if (hasLayoutObject())
+ return this->layoutObject()->mutableStyle();
// <option> and <optgroup> can be styled even if they don't get layout objects,
// so they store their style internally and return it through nonLayoutObjectComputedStyle().
// We check here explicitly to avoid the virtual call in the common case.
if (isHTMLOptGroupElement(*this) || isHTMLOptionElement(this))
return nonLayoutObjectComputedStyle();
- return 0;
+ if (hasRareData())
+ return m_data.m_rareData->computedStyle();
+ return m_data.m_computedStyle;
+}
+
+inline void Node::setComputedStyle(ComputedStyle* computedStyle)
+{
+ if (hasRareData())
+ m_data.m_rareData->setComputedStyle(computedStyle);
+ else if (hasLayoutObject())
+ m_data.m_layoutObject->setStyleInternal(computedStyle);
+ else
+ m_data.m_computedStyle = computedStyle;
}
inline const ComputedStyle* Node::parentComputedStyle() const

Powered by Google App Engine
This is Rietveld 408576698