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

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: Sending for Bugs' input 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 | « third_party/WebKit/Source/core/dom/Node.h ('k') | third_party/WebKit/Source/core/style/ComputedStyle.h » ('j') | 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..c15ba97ea4495a4ee7efa92686d23f0244cdce5c 100644
--- a/third_party/WebKit/Source/core/dom/NodeComputedStyle.h
+++ b/third_party/WebKit/Source/core/dom/NodeComputedStyle.h
@@ -59,6 +59,34 @@ inline ComputedStyle* Node::mutableComputedStyle() const
return m_data.m_computedStyle;
}
+inline void Node::setComputedStyle(PassRefPtr<ComputedStyle> computedStyle)
+{
+ // printf("In Node::setComputedStyle nodeName %s hasRareData %d hasLayoutObject %d computedStyle %p\n", nodeName().ascii().data(), hasRareData(), hasLayoutObject(), mutableComputedStyle());
Bugs Nash 2016/08/23 02:37:52 forgot to delete this?
+ if (hasRareData() && hasLayoutObject()) {
+ // If the DataUnion is a NodeRareDataBase and has a LayoutObject - set the ComputedStyle on that LayoutObject.
+ if (computedStyle->hasImage())
+ m_data.m_rareData->layoutObject()->setStyle(computedStyle);
+ else
+ 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.
Bugs Nash 2016/08/23 02:37:52 should be 'a NodeRareDataBase' and 'set the Comput
+ NodeRareData* rareData = this->rareData();
+ if (rareData->isElementRareData())
Bugs Nash 2016/08/23 02:37:52 This should be a DCHECK. Since setComputedStyle is
+ static_cast<ElementRareData*>(rareData)->setComputedStyle(computedStyle);
+ } else if (!hasRareData() && hasLayoutObject()) {
+ // If the DataUnion is a LayoutObject - set the ComputedStyle on that LayoutObject.
+ if (computedStyle->hasImage())
+ m_data.m_layoutObject->setStyle(computedStyle);
+ else
+ m_data.m_layoutObject->setStyleInternal(computedStyle);
+ } else {
+ // If the DataUnion is a ComputedStyle - make it point to the new ComputedStyle passed in.
Bugs Nash 2016/08/23 02:40:20 this case also covers the DataUnion being null
+ 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') | third_party/WebKit/Source/core/style/ComputedStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698