Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Unified Diff: third_party/WebKit/Source/core/dom/Node.cpp

Issue 2821193003: Store nonAttachedStyle on NodeLayoutData instead of on HashMap in Document. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698