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

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

Issue 2001453002: Set ComputedStyle on Node and use that in buildOwnLayout() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@storage
Patch Set: Remove any cases that are forcing the newStyle on the old LayoutObject Created 4 years, 3 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/Node.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d7345264df9b5a75a8206a69643b3dba166c56d9..27bcd0f912a68db1220ced8a11001da383bad1ac 100644
--- a/third_party/WebKit/Source/core/dom/NodeComputedStyle.h
+++ b/third_party/WebKit/Source/core/dom/NodeComputedStyle.h
@@ -59,6 +59,23 @@ inline ComputedStyle* Node::mutableComputedStyle() const
return m_data.m_computedStyle;
}
+inline void Node::setComputedStyle(PassRefPtr<ComputedStyle> computedStyle)
+{
+ // Note that if the DataUnion is a LayoutObject it is the old LayoutObject which will be detached in reattachLayoutTree.
+ // We don't want to associated the new ComputedStyle with the old LayoutObject. So we don't do anything at this stage.
+ if (hasRareData()) {
+ // If the DataUnion is an ElementRareData - set the ComputedStyle on that ElementRareData.
+ NodeRareData* rareData = this->rareData();
+ if (rareData->isElementRareData())
+ static_cast<ElementRareData*>(rareData)->setComputedStyle(computedStyle);
+ } else {
+ // If the DataUnion is a ComputedStyle - make it point to the new ComputedStyle passed in.
+ if (m_data.m_computedStyle)
+ m_data.m_computedStyle->deref();
+ m_data.m_computedStyle = computedStyle.leakRef();
+ }
+}
+
inline const ComputedStyle* Node::parentComputedStyle() const
{
if (isSlotOrActiveInsertionPoint())
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698