Chromium Code Reviews| 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..07663500c0e3022a58e10055e2858cb4f2b7636b 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) |
| +{ |
| + if (hasRareData()) { |
|
sashab
2016/07/06 04:22:02
Is hasRareData() the check you want here? Maybe yo
nainar
2016/07/06 04:51:53
Yup. The ComputedStyle on Node can be stored in th
sashab
2016/07/06 05:10:40
Could you re-write this as a single if-statement w
|
| + if (hasLayoutObject()) { |
|
Bugs Nash
2016/07/06 04:30:42
this isn't necessary
nainar
2016/07/06 04:51:53
Agreed in a screen-to-screen conversation that:
Q
|
| + m_data.m_rareData->layoutObject()->setStyleInternal(computedStyle); |
| + } else { |
| + NodeRareData* rareData = this->rareData(); |
| + DCHECK(rareData->isElementRareData()); |
| + static_cast<ElementRareData*>(rareData)->setComputedStyle(computedStyle); |
| + } |
| + } else { |
| + if (hasLayoutObject()) { |
| + m_data.m_layoutObject->setStyleInternal(computedStyle); |
| + } else { |
| + if (m_data.m_computedStyle) |
| + m_data.m_computedStyle->deref(); |
| + m_data.m_computedStyle = computedStyle.leakRef(); |
| + } |
| + } |
| +} |
| + |
| inline const ComputedStyle* Node::parentComputedStyle() const |
| { |
| if (isSlotOrActiveInsertionPoint()) |