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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutObject.cpp

Issue 1407543003: Preliminary paint property walk implementation for SPv2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor bug fix (perspective does not clear paint offset). switch test to unit test style. add a few … Created 5 years, 2 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/layout/LayoutObject.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
index c315cbe789a331920d0e7dc6c21f7b659a6bfabd..b72ab3947176b6b766007e36e07b89730a5dfbfc 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -74,6 +74,7 @@
#include "core/layout/compositing/PaintLayerCompositor.h"
#include "core/page/AutoscrollController.h"
#include "core/page/Page.h"
+#include "core/paint/ObjectPaintProperties.h"
#include "core/paint/ObjectPainter.h"
#include "core/paint/PaintInfo.h"
#include "core/paint/PaintLayer.h"
@@ -148,6 +149,9 @@ bool LayoutObject::s_affectsParentBlock = false;
typedef HashMap<const LayoutObject*, LayoutRect> SelectionPaintInvalidationMap;
static SelectionPaintInvalidationMap* selectionPaintInvalidationMap = nullptr;
+typedef HashMap<const LayoutObject*, OwnPtr<ObjectPaintProperties>> ObjectPaintPropertiesMap;
+static ObjectPaintPropertiesMap* objectPaintPropertiesMap = nullptr;
+
pdr. 2015/10/20 22:02:30 To avoid having to create this map in ensureObject
trchen 2015/10/21 06:16:19 Done.
void* LayoutObject::operator new(size_t sz)
{
ASSERT(isMainThread());
@@ -2513,6 +2517,11 @@ void LayoutObject::willBeDestroyed()
if (selectionPaintInvalidationMap)
selectionPaintInvalidationMap->remove(this);
+ if (objectPaintPropertiesMap) {
pdr. 2015/10/20 22:02:30 We should check for the property here instead of t
jbroman 2015/10/20 23:50:13 We could just do it unconditionally (well, perhaps
trchen 2015/10/21 06:16:19 Done as jbroman's proposal. The check was to make
+ ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
+ clearObjectPaintProperties();
+ }
+
clearLayoutRootIfNeeded();
if (m_style) {
@@ -3458,6 +3467,38 @@ void LayoutObject::setIsSlowRepaintObject(bool isSlowRepaintObject)
frameView()->removeSlowRepaintObject();
}
+ObjectPaintProperties* LayoutObject::objectPaintProperties() const
+{
+ ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
+
+ if (!objectPaintPropertiesMap)
+ return nullptr;
+
+ return objectPaintPropertiesMap->get(this);
+}
+
+ObjectPaintProperties& LayoutObject::ensureObjectPaintProperties()
+{
+ ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
+
+ if (ObjectPaintProperties* properties = objectPaintProperties())
+ return *properties;
+
+ if (!objectPaintPropertiesMap)
+ objectPaintPropertiesMap = new ObjectPaintPropertiesMap;
+
+ return *objectPaintPropertiesMap->set(this, ObjectPaintProperties::create()).storedValue->value.get();
+}
+
+void LayoutObject::clearObjectPaintProperties()
+{
+ ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
+
+ if (!objectPaintPropertiesMap)
+ return;
+ objectPaintPropertiesMap->remove(this);
+}
+
} // namespace blink
#ifndef NDEBUG

Powered by Google App Engine
This is Rietveld 408576698