Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/Node.h |
| diff --git a/third_party/WebKit/Source/core/dom/Node.h b/third_party/WebKit/Source/core/dom/Node.h |
| index 369b8c5263bd8626f16ba3293971f3d4813db904..81c6b94f7c6594595ca6b7839082d546ce5f792b 100644 |
| --- a/third_party/WebKit/Source/core/dom/Node.h |
| +++ b/third_party/WebKit/Source/core/dom/Node.h |
| @@ -34,6 +34,7 @@ |
| #include "core/dom/TreeScope.h" |
| #include "core/editing/EditingBoundary.h" |
| #include "core/events/EventTarget.h" |
| +#include "core/style/ComputedStyle.h" |
| #include "core/style/ComputedStyleConstants.h" |
| #include "platform/geometry/LayoutRect.h" |
| #include "public/platform/WebFocusType.h" |
| @@ -101,8 +102,10 @@ enum class SlotChangeType { |
| class NodeLayoutData { |
| public: |
| - explicit NodeLayoutData(LayoutObject* layout_object) |
| - : layout_object_(layout_object) {} |
| + explicit NodeLayoutData(LayoutObject* layout_object, |
| + RefPtr<ComputedStyle> non_attached_style) |
|
rune
2017/04/19 20:34:52
Shouldn't this be a WTF_MAKE_NONCOPYABLE like e.g.
nainar
2017/04/19 23:43:41
You are right. Done.
|
| + : layout_object_(layout_object), |
| + non_attached_style_(non_attached_style) {} |
| ~NodeLayoutData() { CHECK(!layout_object_); } |
| LayoutObject* GetLayoutObject() const { return layout_object_; } |
| @@ -110,14 +113,24 @@ class NodeLayoutData { |
| DCHECK_NE(&SharedEmptyData(), this); |
| layout_object_ = layout_object; |
| } |
| + |
| + ComputedStyle* GetNonAttachedStyle() const { |
| + return non_attached_style_.Get(); |
| + } |
| + void SetNonAttachedStyle(RefPtr<ComputedStyle> non_attached_style) { |
| + DCHECK_NE(&SharedEmptyData(), this); |
| + non_attached_style_ = non_attached_style; |
| + } |
| + |
| static NodeLayoutData& SharedEmptyData() { |
| - DEFINE_STATIC_LOCAL(NodeLayoutData, shared_empty_data, (nullptr)); |
| + DEFINE_STATIC_LOCAL(NodeLayoutData, shared_empty_data, (nullptr, nullptr)); |
| return shared_empty_data; |
| } |
| bool IsSharedEmptyData() { return this == &SharedEmptyData(); } |
| private: |
| LayoutObject* layout_object_; |
| + RefPtr<ComputedStyle> non_attached_style_; |
| }; |
| class NodeRareDataBase { |
| @@ -264,6 +277,14 @@ class CORE_EXPORT Node : public EventTarget { |
| bool SupportsAltText(); |
| + void SetNonAttachedStyle(RefPtr<ComputedStyle> non_attached_style); |
| + |
| + ComputedStyle* GetNonAttachedStyle() const { |
| + return HasRareData() |
| + ? data_.rare_data_->GetNodeLayoutData()->GetNonAttachedStyle() |
| + : data_.node_layout_data_->GetNonAttachedStyle(); |
| + } |
| + |
| // Other methods (not part of DOM) |
| bool IsElementNode() const { return GetFlag(kIsElementFlag); } |