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

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

Issue 2821193003: Store nonAttachedStyle on NodeLayoutData instead of on HashMap in Document. (Closed)
Patch Set: Revert back to rune@'s lgtmed patch 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/Element.cpp ('k') | third_party/WebKit/Source/core/dom/Node.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8f02fe261763f23513a64e3eb67537488e49b267..ed0245a8c3095c72c3cc8f62b93fbd71f1528113 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"
@@ -100,9 +101,13 @@ enum class SlotChangeType {
};
class NodeLayoutData {
+ WTF_MAKE_NONCOPYABLE(NodeLayoutData);
+
public:
- explicit NodeLayoutData(LayoutObject* layout_object)
- : layout_object_(layout_object) {}
+ explicit NodeLayoutData(LayoutObject* layout_object,
+ RefPtr<ComputedStyle> non_attached_style)
+ : layout_object_(layout_object),
+ non_attached_style_(non_attached_style) {}
~NodeLayoutData() { CHECK(!layout_object_); }
LayoutObject* GetLayoutObject() const { return layout_object_; }
@@ -110,14 +115,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 +279,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); }
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.cpp ('k') | third_party/WebKit/Source/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698