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

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

Issue 2293713002: Made ElementRareData store ComputedStyle on LayoutObject if possible. (Closed)
Patch Set: Added CORE_EXPORT to NodeRareDataBase Created 4 years, 3 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
Index: third_party/WebKit/Source/core/dom/ElementRareData.h
diff --git a/third_party/WebKit/Source/core/dom/ElementRareData.h b/third_party/WebKit/Source/core/dom/ElementRareData.h
index fe196fb89ed539bba4cafc5fc5375e87f58407c6..96c1c9dca4be1052fdee87c31cfc657ee67a9129 100644
--- a/third_party/WebKit/Source/core/dom/ElementRareData.h
+++ b/third_party/WebKit/Source/core/dom/ElementRareData.h
@@ -91,9 +91,25 @@ public:
NamedNodeMap* attributeMap() const { return m_attributeMap.get(); }
void setAttributeMap(NamedNodeMap* attributeMap) { m_attributeMap = attributeMap; }
- ComputedStyle* computedStyle() const { return m_computedStyle.get(); }
- void setComputedStyle(PassRefPtr<ComputedStyle> computedStyle) { m_computedStyle = computedStyle; }
- void clearComputedStyle() { m_computedStyle = nullptr; }
+ ComputedStyle* computedStyle() const
+ {
+ DCHECK(!(layoutObject() && m_computedStyle));
+ if (layoutObject())
+ return layoutObject()->mutableStyle();
+ return m_computedStyle.get();
+ }
+ void setComputedStyle(PassRefPtr<ComputedStyle> computedStyle)
+ {
+ if (layoutObject())
+ layoutObject()->setStyleInternal(computedStyle);
esprehn 2016/09/24 02:10:52 This case isn't reachable (outside your test which
+ else
+ m_computedStyle = computedStyle;
+ }
+ void clearComputedStyleIfNoLayoutObject()
+ {
+ DCHECK(!(layoutObject() && m_computedStyle));
esprehn 2016/09/24 02:10:52 Plz run demorgans :D running it in my head is hard
+ m_computedStyle = nullptr;
+ }
ClassList* classList() const { return m_classList.get(); }
void setClassList(ClassList* classList) { m_classList = classList; }
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.cpp ('k') | third_party/WebKit/Source/core/dom/ElementRareDataTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698