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()) |