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

Unified Diff: third_party/WebKit/Source/core/paint/ObjectPaintProperties.h

Issue 1651153003: [SPv2] Adds pre-computed paint property context to PaintLayer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: migrated the cache to ObjectPaintProperties Created 4 years, 11 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/paint/ObjectPaintProperties.h
diff --git a/third_party/WebKit/Source/core/paint/ObjectPaintProperties.h b/third_party/WebKit/Source/core/paint/ObjectPaintProperties.h
index 6048057f8bf45ca6b03a8d8d4e3967d9cb5f3968..bb112609b6e1317765774b536b4caa0da5d83121 100644
--- a/third_party/WebKit/Source/core/paint/ObjectPaintProperties.h
+++ b/third_party/WebKit/Source/core/paint/ObjectPaintProperties.h
@@ -5,8 +5,10 @@
#ifndef ObjectPaintProperties_h
#define ObjectPaintProperties_h
+#include "platform/geometry/LayoutPoint.h"
#include "platform/graphics/paint/ClipPaintPropertyNode.h"
#include "platform/graphics/paint/EffectPaintPropertyNode.h"
+#include "platform/graphics/paint/PaintChunkProperties.h"
#include "platform/graphics/paint/TransformPaintPropertyNode.h"
#include "wtf/PassOwnPtr.h"
#include "wtf/PassRefPtr.h"
@@ -27,15 +29,18 @@ class ObjectPaintProperties {
WTF_MAKE_NONCOPYABLE(ObjectPaintProperties);
USING_FAST_MALLOC(ObjectPaintProperties);
public:
+ struct PropertyTreeContext;
+
static PassOwnPtr<ObjectPaintProperties> create(
PassRefPtr<TransformPaintPropertyNode> paintOffsetTranslation,
PassRefPtr<TransformPaintPropertyNode> transform,
PassRefPtr<EffectPaintPropertyNode> effect,
PassRefPtr<ClipPaintPropertyNode> overflowClip,
PassRefPtr<TransformPaintPropertyNode> perspective,
- PassRefPtr<TransformPaintPropertyNode> scrollTranslation)
+ PassRefPtr<TransformPaintPropertyNode> scrollTranslation,
+ PassOwnPtr<PropertyTreeContext> propertyTreeContext)
{
- return adoptPtr(new ObjectPaintProperties(paintOffsetTranslation, transform, effect, overflowClip, perspective, scrollTranslation));
+ return adoptPtr(new ObjectPaintProperties(paintOffsetTranslation, transform, effect, overflowClip, perspective, scrollTranslation, propertyTreeContext));
}
// The hierarchy of transform subtree created by a LayoutObject.
@@ -57,6 +62,19 @@ public:
ClipPaintPropertyNode* overflowClip() const { return m_overflowClip.get(); }
+ // This is a complete set of property nodes that should be used as a starting point to paint
+ // this layout object. It is needed becauase some property inherits from the containing block,
+ // not painting parent, thus can't be derived in O(1) during paint walk.
+ // Note: If this layout object has transform or stacking-context effects, those are already
+ // baked into in the context here. However for properties that affects only children,
+ // for example, perspective and overflow clip, those should be applied by the painter
+ // at the right painting step.
+ struct PropertyTreeContext {
+ LayoutPoint paintOffset;
+ PaintChunkProperties properties;
+ };
+ PropertyTreeContext* propertyTreeContext() const { return m_propertyTreeContext.get(); }
+
private:
ObjectPaintProperties(
PassRefPtr<TransformPaintPropertyNode> paintOffsetTranslation,
@@ -64,13 +82,15 @@ private:
PassRefPtr<EffectPaintPropertyNode> effect,
PassRefPtr<ClipPaintPropertyNode> overflowClip,
PassRefPtr<TransformPaintPropertyNode> perspective,
- PassRefPtr<TransformPaintPropertyNode> scrollTranslation)
+ PassRefPtr<TransformPaintPropertyNode> scrollTranslation,
+ PassOwnPtr<PropertyTreeContext> propertyTreeContext)
: m_paintOffsetTranslation(paintOffsetTranslation)
, m_transform(transform)
, m_effect(effect)
, m_overflowClip(overflowClip)
, m_perspective(perspective)
- , m_scrollTranslation(scrollTranslation) { }
+ , m_scrollTranslation(scrollTranslation)
+ , m_propertyTreeContext(propertyTreeContext) { }
RefPtr<TransformPaintPropertyNode> m_paintOffsetTranslation;
RefPtr<TransformPaintPropertyNode> m_transform;
@@ -78,6 +98,8 @@ private:
RefPtr<ClipPaintPropertyNode> m_overflowClip;
RefPtr<TransformPaintPropertyNode> m_perspective;
RefPtr<TransformPaintPropertyNode> m_scrollTranslation;
+
+ OwnPtr<PropertyTreeContext> m_propertyTreeContext;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698