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 d0ee8a6e2523a6946908c339f58cf6fc054cf7c1..f7dea5d17ce270cf587de6ed2316ff28751c905f 100644 |
| --- a/third_party/WebKit/Source/core/dom/Node.h |
| +++ b/third_party/WebKit/Source/core/dom/Node.h |
| @@ -97,21 +97,30 @@ enum class SlotChangeType { |
| kChained, |
| }; |
| -class NodeRareDataBase { |
| +class LayoutData { |
|
esprehn
2017/04/10 22:20:12
NodeLayoutData maybe? LayoutData is pretty generic
nainar
2017/04/13 00:10:22
Done.
|
| public: |
| + LayoutData(LayoutObject* layout_object) : layout_object_(layout_object) {} |
|
esprehn
2017/04/10 22:20:12
explicit on all single arg constructors unless you
nainar
2017/04/13 00:10:22
Done.
|
| LayoutObject* GetLayoutObject() const { return layout_object_; } |
| void SetLayoutObject(LayoutObject* layout_object) { |
| layout_object_ = layout_object; |
| } |
| + private: |
| + LayoutObject* layout_object_; |
| +}; |
| + |
| +class NodeRareDataBase { |
| + public: |
| + LayoutData* GetLayoutData() const { return layout_data_; } |
| + void SetLayoutData(LayoutData* layout_data) { layout_data_ = layout_data; } |
| + |
| protected: |
| - NodeRareDataBase(LayoutObject* layout_object) |
| - : layout_object_(layout_object) {} |
| + NodeRareDataBase(LayoutObject* layout_object) { |
| + layout_data_ = new LayoutData(layout_object); |
| + } |
| protected: |
| - // LayoutObjects are fully owned by their DOM node. See LayoutObject's |
| - // LIFETIME documentation section. |
| - LayoutObject* layout_object_; |
| + LayoutData* layout_data_; |
| }; |
| class Node; |
| @@ -563,14 +572,14 @@ class CORE_EXPORT Node : public EventTarget { |
| // Note that if a Node has a layoutObject, it's parentNode is guaranteed to |
| // have one as well. |
| LayoutObject* GetLayoutObject() const { |
| - return HasRareData() ? data_.rare_data_->GetLayoutObject() |
| - : data_.layout_object_; |
| + return HasRareData() ? data_.rare_data_->GetLayoutData()->GetLayoutObject() |
| + : data_.layout_data_->GetLayoutObject(); |
| } |
| void SetLayoutObject(LayoutObject* layout_object) { |
| if (HasRareData()) |
| - data_.rare_data_->SetLayoutObject(layout_object); |
| + data_.rare_data_->GetLayoutData()->SetLayoutObject(layout_object); |
| else |
| - data_.layout_object_ = layout_object; |
| + data_.layout_data_->SetLayoutObject(layout_object); |
| } |
| // Use these two methods with caution. |
| @@ -925,10 +934,10 @@ class CORE_EXPORT Node : public EventTarget { |
| Member<Node> next_; |
| // When a node has rare data we move the layoutObject into the rare data. |
| union DataUnion { |
| - DataUnion() : layout_object_(nullptr) {} |
| + DataUnion() : layout_data_(nullptr) {} |
| // LayoutObjects are fully owned by their DOM node. See LayoutObject's |
| // LIFETIME documentation section. |
| - LayoutObject* layout_object_; |
| + LayoutData* layout_data_; |
| NodeRareDataBase* rare_data_; |
| } data_; |
| }; |