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..8dba95a0da8eb79541b3a04a853740c5f27cc285 100644 |
| --- a/third_party/WebKit/Source/core/dom/Node.h |
| +++ b/third_party/WebKit/Source/core/dom/Node.h |
| @@ -97,23 +97,21 @@ enum class SlotChangeType { |
| kChained, |
| }; |
| -class NodeRareDataBase { |
| +class NodeLayoutData { |
| public: |
| + explicit NodeLayoutData(LayoutObject* layout_object) : layout_object_(layout_object) {} |
| LayoutObject* GetLayoutObject() const { return layout_object_; } |
| void SetLayoutObject(LayoutObject* layout_object) { |
| layout_object_ = layout_object; |
| } |
| - protected: |
| - NodeRareDataBase(LayoutObject* layout_object) |
| - : layout_object_(layout_object) {} |
| - |
| - protected: |
| - // LayoutObjects are fully owned by their DOM node. See LayoutObject's |
| - // LIFETIME documentation section. |
| + private: |
| LayoutObject* layout_object_; |
| }; |
| +class NodeRareDataBase { |
| +}; |
| + |
| class Node; |
| WILL_NOT_BE_EAGERLY_TRACED_CLASS(Node); |
| @@ -563,14 +561,10 @@ 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 data_.node_layout_data_ ? data_.node_layout_data_->GetLayoutObject() : nullptr; |
| } |
| void SetLayoutObject(LayoutObject* layout_object) { |
| - if (HasRareData()) |
| - data_.rare_data_->SetLayoutObject(layout_object); |
| - else |
| - data_.layout_object_ = layout_object; |
| + data_.node_layout_data_->SetLayoutObject(layout_object); |
| } |
| // Use these two methods with caution. |
| @@ -925,10 +919,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() : node_layout_data_(nullptr) {} |
| // LayoutObjects are fully owned by their DOM node. See LayoutObject's |
| // LIFETIME documentation section. |
| - LayoutObject* layout_object_; |
| + NodeLayoutData* node_layout_data_; |
|
nainar
2017/04/11 06:03:59
If the DataUnion is a NodeLayoutData we then have
|
| NodeRareDataBase* rare_data_; |
|
nainar
2017/04/11 06:03:59
However, if we have a NodeRareDataBase we don't ha
|
| } data_; |
| }; |