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

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: 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
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 4d7e9d6db263d9ab79aa80a8c2cc1f26f26cf6b5..5ac89aae7aaba214ba7a69610aa64ef2e586ad6b 100644
--- a/third_party/WebKit/Source/core/dom/NodeComputedStyle.h
+++ b/third_party/WebKit/Source/core/dom/NodeComputedStyle.h
@@ -58,6 +58,27 @@ inline ComputedStyle* Node::mutableComputedStyle() const
return m_data.m_computedStyle;
}
+inline void Node::setComputedStyle(PassRefPtr<ComputedStyle> computedStyle)
sashab 2016/07/07 01:20:35 This is SO much easier to read now, thx.
+{
+ if (hasRareData() && hasLayoutObject()) {
+ // If the DataUnion is a NodeRareDataBase and has a LayoutObject - set the ComputedStyle on that LayoutObject.
+ m_data.m_rareData->layoutObject()->setStyleInternal(computedStyle);
+ } else if (hasRareData() && !hasLayoutObject()) {
+ // If the DataUnion is an NodeRareDataBase (specifically an ElementRareData) without a LayoutObject- set the ComputedStyle on that LayoutObject.
+ NodeRareData* rareData = this->rareData();
+ DCHECK(rareData->isElementRareData());
+ static_cast<ElementRareData*>(rareData)->setComputedStyle(computedStyle);
+ } else if (!hasRareData() && hasLayoutObject()) {
+ // If the DataUnion is a LayoutObject - set the ComputedStyle on that LayoutObject.
+ m_data.m_layoutObject->setStyleInternal(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())
« third_party/WebKit/Source/core/dom/Node.cpp ('K') | « third_party/WebKit/Source/core/dom/Node.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698