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

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

Issue 1962953002: Storage of ComputedStyle separate from LayoutObject. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added TODOs to remove redundant ComputedStyle members Created 4 years, 7 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/NodeRareData.cpp
diff --git a/third_party/WebKit/Source/core/dom/NodeRareData.cpp b/third_party/WebKit/Source/core/dom/NodeRareData.cpp
index 9b60294078ea8b616eea30788713dc43b17fbd64..5ce83ba0df7ad16f4fe8555dbc0467efd57a8219 100644
--- a/third_party/WebKit/Source/core/dom/NodeRareData.cpp
+++ b/third_party/WebKit/Source/core/dom/NodeRareData.cpp
@@ -34,12 +34,14 @@
#include "core/dom/Element.h"
#include "core/dom/ElementRareData.h"
#include "core/frame/FrameHost.h"
+#include "core/layout/LayoutObject.h"
#include "platform/heap/Handle.h"
namespace blink {
struct SameSizeAsNodeRareData {
void* m_pointer;
+ RefPtr<void*> m_refPtr;
Member<void*> m_willbeMember[2];
unsigned m_bitfields;
};
@@ -78,9 +80,25 @@ DEFINE_TRACE_WRAPPERS_AFTER_DISPATCH(NodeRareData)
visitor->traceWrappers(m_mutationObserverData);
}
+ComputedStyle* NodeRareData::computedStyle() const
+{
+ if (m_layoutObject)
+ return m_layoutObject->mutableStyle();
+ return m_computedStyle.get();
+}
+
+void NodeRareData::setComputedStyle(PassRefPtr<ComputedStyle> computedStyle)
+{
+ if (m_layoutObject)
+ m_layoutObject->setStyleInternal(computedStyle);
+ else
+ m_computedStyle = computedStyle;
+}
+
void NodeRareData::finalizeGarbageCollectedObject()
{
RELEASE_ASSERT(!layoutObject());
+ CHECK(!computedStyle());
if (m_isElementRareData)
static_cast<ElementRareData*>(this)->~ElementRareData();
else

Powered by Google App Engine
This is Rietveld 408576698