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

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

Issue 2782343002: Store local border box property cache outside ObjectPaintProperties (Closed)
Patch Set: Rebase Created 3 years, 9 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.h
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.h b/third_party/WebKit/Source/core/layout/LayoutObject.h
index 76fbc890aad22bb48e02f75c967751a2475e9bd9..f59a44bbfcd08d3f4e903cbbc8425c825ebc048f 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.h
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.h
@@ -65,6 +65,7 @@ class LayoutFlowThread;
class LayoutGeometryMap;
class LayoutMultiColumnSpannerPlaceholder;
class LayoutView;
+class PropertyTreeState;
class ObjectPaintProperties;
class PaintInvalidationState;
class PaintLayer;
@@ -401,10 +402,27 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver,
return m_rarePaintData ? m_rarePaintData->paintProperties() : nullptr;
}
+ // The complete set of property nodes that should be used as a starting point
+ // to paint this LayoutObject. See: m_localBorderBoxProperties comment.
+ const PropertyTreeState* localBorderBoxProperties() const {
+ DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled());
+ if (m_rarePaintData)
+ return m_rarePaintData->localBorderBoxProperties();
+ return nullptr;
+ }
+
+ // The complete set of property nodes that should be used as a starting point
+ // to paint contents of this LayoutObject. See: m_contentsProperties comment.
+ const PropertyTreeState* contentsProperties() const {
+ DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled());
+ if (m_rarePaintData)
+ return m_rarePaintData->contentsProperties();
+ return nullptr;
+ }
+
private:
// This is for paint-related data that is not needed on all LayoutObjects.
// TODO(pdr): Store LayoutBoxModelObject's m_paintLayer in this structure.
- // TODO(pdr): Store ObjectPaintProperties::LocalBorderBoxProperties here.
class CORE_EXPORT RarePaintData {
WTF_MAKE_NONCOPYABLE(RarePaintData);
USING_FAST_MALLOC(RarePaintData);
@@ -418,9 +436,36 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver,
}
ObjectPaintProperties& ensurePaintProperties();
+ PropertyTreeState* localBorderBoxProperties() const {
+ return m_localBorderBoxProperties.get();
+ }
+
+ void clearLocalBorderBoxProperties();
+ void setLocalBorderBoxProperties(PropertyTreeState&);
+ const PropertyTreeState* contentsProperties() const;
+
private:
// Holds references to the paint property nodes created by this object.
std::unique_ptr<ObjectPaintProperties> m_paintProperties;
+
+ // This is a complete set of property nodes that should be used as a
+ // starting point to paint a LayoutObject. This data is cached because some
+ // properties inherit from the containing block chain instead of the
+ // painting parent and cannot be derived in O(1) during the paint walk.
+ //
+ // For example: <div style='opacity: 0.3;'/>
+ // The div's local border box properties would have an opacity 0.3 effect
+ // node. Even though the div has no transform, its local border box
+ // properties would have a transform node that points to the div's
+ // ancestor transform space.
+ std::unique_ptr<PropertyTreeState> m_localBorderBoxProperties;
+
+ // This is the complete set of property nodes that can be used to paint the
+ // contents of this object. It is similar to m_localBorderBoxProperties but
+ // includes properties (e.g., overflow clip, scroll translation) that apply
+ // to contents. This cached value is derived from m_localBorderBoxProperties
+ // and m_paintProperties and should be invalidated when these change.
+ mutable std::unique_ptr<PropertyTreeState> m_contentsProperties;
};
RarePaintData& ensureRarePaintData();
@@ -1801,8 +1846,8 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver,
FRIEND_TEST_ALL_PREFIXES(AnimationCompositorAnimationsTest,
canStartAnimationOnCompositorEffectSPv2);
- // The following two functions can be called from PaintPropertyTreeBuilder
- // only.
+ // The following non-const functions for ObjectPaintProperties should only
+ // be called from PaintPropertyTreeBuilder.
ObjectPaintProperties& ensurePaintProperties() {
return m_layoutObject.ensureRarePaintData().ensurePaintProperties();
}
@@ -1812,6 +1857,17 @@ class CORE_EXPORT LayoutObject : public ImageResourceObserver,
return nullptr;
}
+ // The following non-const functions for local border box properties should
+ // only be called from PaintPropertyTreeBuilder.
+ void clearLocalBorderBoxProperties() {
+ if (auto* paintData = m_layoutObject.rarePaintData())
+ paintData->clearLocalBorderBoxProperties();
+ }
+ void setLocalBorderBoxProperties(PropertyTreeState& localBorderBox) {
+ return m_layoutObject.ensureRarePaintData().setLocalBorderBoxProperties(
+ localBorderBox);
+ }
+
friend class LayoutObject;
MutableForPainting(const LayoutObject& layoutObject)
: m_layoutObject(const_cast<LayoutObject&>(layoutObject)) {}
« no previous file with comments | « third_party/WebKit/Source/core/frame/LocalFrame.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698