Chromium Code Reviews| 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 |