Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/ElementRareData.h |
| diff --git a/third_party/WebKit/Source/core/dom/ElementRareData.h b/third_party/WebKit/Source/core/dom/ElementRareData.h |
| index fe196fb89ed539bba4cafc5fc5375e87f58407c6..96c1c9dca4be1052fdee87c31cfc657ee67a9129 100644 |
| --- a/third_party/WebKit/Source/core/dom/ElementRareData.h |
| +++ b/third_party/WebKit/Source/core/dom/ElementRareData.h |
| @@ -91,9 +91,25 @@ public: |
| NamedNodeMap* attributeMap() const { return m_attributeMap.get(); } |
| void setAttributeMap(NamedNodeMap* attributeMap) { m_attributeMap = attributeMap; } |
| - ComputedStyle* computedStyle() const { return m_computedStyle.get(); } |
| - void setComputedStyle(PassRefPtr<ComputedStyle> computedStyle) { m_computedStyle = computedStyle; } |
| - void clearComputedStyle() { m_computedStyle = nullptr; } |
| + ComputedStyle* computedStyle() const |
| + { |
| + DCHECK(!(layoutObject() && m_computedStyle)); |
| + if (layoutObject()) |
| + return layoutObject()->mutableStyle(); |
| + return m_computedStyle.get(); |
| + } |
| + void setComputedStyle(PassRefPtr<ComputedStyle> computedStyle) |
| + { |
| + if (layoutObject()) |
| + layoutObject()->setStyleInternal(computedStyle); |
|
esprehn
2016/09/24 02:10:52
This case isn't reachable (outside your test which
|
| + else |
| + m_computedStyle = computedStyle; |
| + } |
| + void clearComputedStyleIfNoLayoutObject() |
| + { |
| + DCHECK(!(layoutObject() && m_computedStyle)); |
|
esprehn
2016/09/24 02:10:52
Plz run demorgans :D running it in my head is hard
|
| + m_computedStyle = nullptr; |
| + } |
| ClassList* classList() const { return m_classList.get(); } |
| void setClassList(ClassList* classList) { m_classList = classList; } |