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 dd976b77bff4aa2411b104588939d6ac91b35734..734f1e7682549ceafcfaf68a4514890a55b8b926 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; |
pdr.
2015/10/15 23:50:50
Please doc what this is for.
|
+static ObjectPaintPropertiesMap* objectPaintPropertiesMap = nullptr; |
+ |
void* LayoutObject::operator new(size_t sz) |
{ |
ASSERT(isMainThread()); |
@@ -2513,6 +2517,11 @@ void LayoutObject::willBeDestroyed() |
if (selectionPaintInvalidationMap) |
selectionPaintInvalidationMap->remove(this); |
+ if (objectPaintPropertiesMap) { |
+ ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
+ clearObjectPaintProperties(); |
+ } |
+ |
clearLayoutRootIfNeeded(); |
if (m_style) { |
@@ -3440,6 +3449,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 |