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 78872cdcf125b3139e08a8e7752e6eda40cfea34..fb869ce3e7d067fd54ca8a1e39c8677f0b3b09c4 100644 |
--- a/third_party/WebKit/Source/core/dom/NodeComputedStyle.h |
+++ b/third_party/WebKit/Source/core/dom/NodeComputedStyle.h |
@@ -27,6 +27,7 @@ |
#include "core/dom/LayoutTreeBuilderTraversal.h" |
#include "core/dom/Node.h" |
+#include "core/dom/NodeRareData.h" |
#include "core/dom/shadow/InsertionPoint.h" |
#include "core/html/HTMLOptGroupElement.h" |
#include "core/layout/LayoutObject.h" |
@@ -41,14 +42,31 @@ inline const ComputedStyle* Node::computedStyle() const |
inline ComputedStyle* Node::mutableComputedStyle() const |
{ |
- if (LayoutObject* layoutObject = this->layoutObject()) |
- return layoutObject->mutableStyle(); |
+ if (hasLayoutObject()) |
+ return layoutObject()->mutableStyle(); |
// <option> and <optgroup> can be styled even if they don't get layout objects, |
// so they store their style internally and return it through nonLayoutObjectComputedStyle(). |
// We check here explicitly to avoid the virtual call in the common case. |
if (isHTMLOptGroupElement(*this) || isHTMLOptionElement(this)) |
return nonLayoutObjectComputedStyle(); |
- return 0; |
+ if (hasRareData()) |
+ return rareData()->computedStyle(); |
+ return m_data.m_computedStyle; |
+} |
+ |
+inline void Node::setComputedStyle(ComputedStyle* computedStyle) |
Timothy Loh
2016/06/01 07:36:38
should take PassRefPtr<ComputedStyle>
|
+{ |
+ if (hasRareData()) { |
+ rareData()->setComputedStyle(computedStyle); |
+ } else if (hasLayoutObject()) { |
+ m_data.m_layoutObject->setStyleInternal(computedStyle); |
+ } else { |
+ if (computedStyle) |
+ computedStyle->ref(); |
+ if (m_data.m_computedStyle) |
+ m_data.m_computedStyle->deref(); |
+ m_data.m_computedStyle = computedStyle; |
+ } |
} |
inline const ComputedStyle* Node::parentComputedStyle() const |