Index: third_party/WebKit/Source/core/dom/Node.cpp |
diff --git a/third_party/WebKit/Source/core/dom/Node.cpp b/third_party/WebKit/Source/core/dom/Node.cpp |
index a61464b7c7b714a55b57fa53ef6c8f894772ec11..9fc6d97fedbc98c82cf6fb686a7880e6418b4b96 100644 |
--- a/third_party/WebKit/Source/core/dom/Node.cpp |
+++ b/third_party/WebKit/Source/core/dom/Node.cpp |
@@ -605,7 +605,33 @@ void Node::SetLayoutObject(LayoutObject* layout_object) { |
// Swap the NodeLayoutData to point to a new NodeLayoutData instead of the |
// static SharedEmptyData instance. |
- node_layout_data = new NodeLayoutData(layout_object); |
+ node_layout_data = new NodeLayoutData( |
+ layout_object, node_layout_data->GetNonAttachedStyle()); |
nainar
2017/04/18 03:48:12
at this stage the GetNonAttachedStyle call should
esprehn
2017/04/18 21:31:10
Yeah can we make this a DCHECK and remove the cons
nainar
2017/04/19 01:38:34
Done.
|
+ if (HasRareData()) |
+ data_.rare_data_->SetNodeLayoutData(node_layout_data); |
+ else |
+ data_.node_layout_data_ = node_layout_data; |
+} |
+ |
+void Node::SetNonAttachedStyle(RefPtr<ComputedStyle> non_attached_style) { |
+ NodeLayoutData* node_layout_data = HasRareData() |
+ ? data_.rare_data_->GetNodeLayoutData() |
+ : data_.node_layout_data_; |
+ |
+ // Already pointing to a non empty NodeLayoutData so just set the pointer to |
+ // the new LayoutObject. |
+ if (!node_layout_data->IsSharedEmptyData()) { |
+ node_layout_data->SetNonAttachedStyle(non_attached_style); |
+ return; |
+ } |
+ |
+ if (!non_attached_style) |
+ return; |
+ |
+ // Swap the NodeLayoutData to point to a new NodeLayoutData instead of the |
+ // static SharedEmptyData instance. |
+ node_layout_data = new NodeLayoutData(node_layout_data->GetLayoutObject(), |
nainar
2017/04/18 03:48:12
at this stage the GetLayoutObject call should retu
nainar
2017/04/19 01:38:34
Done.
|
+ non_attached_style); |
if (HasRareData()) |
data_.rare_data_->SetNodeLayoutData(node_layout_data); |
else |