Chromium Code Reviews| Index: third_party/WebKit/Source/platform/graphics/paint/EffectPaintPropertyNode.h |
| diff --git a/third_party/WebKit/Source/platform/graphics/paint/EffectPaintPropertyNode.h b/third_party/WebKit/Source/platform/graphics/paint/EffectPaintPropertyNode.h |
| index 94b9519480df322e950ba412367622d75bc60bf2..d10566e4d2493c9c9b86494a4f1afa24e05900c2 100644 |
| --- a/third_party/WebKit/Source/platform/graphics/paint/EffectPaintPropertyNode.h |
| +++ b/third_party/WebKit/Source/platform/graphics/paint/EffectPaintPropertyNode.h |
| @@ -6,6 +6,7 @@ |
| #define EffectPaintPropertyNode_h |
| #include "platform/PlatformExport.h" |
| +#include "platform/graphics/CompositorFilterOperations.h" |
| #include "wtf/PassRefPtr.h" |
| #include "wtf/RefCounted.h" |
| #include "wtf/RefPtr.h" |
| @@ -14,30 +15,40 @@ |
| namespace blink { |
| -// A paint effect created by the opacity css property along with a reference to |
| -// the parent effect for inherited effects. |
| +// Effect nodes are abstraction of isolated groups, along with optional effects |
| +// that can be applied to the composited output of the group. |
| // |
| // The effect tree is rooted at a node with no parent. This root node should |
| // not be modified. |
| -// |
| -// TODO(pdr): Support more effects than just opacity. |
| class PLATFORM_EXPORT EffectPaintPropertyNode |
| : public RefCounted<EffectPaintPropertyNode> { |
| public: |
| static PassRefPtr<EffectPaintPropertyNode> create( |
| PassRefPtr<const EffectPaintPropertyNode> parent, |
| - float opacity) { |
| - return adoptRef(new EffectPaintPropertyNode(std::move(parent), opacity)); |
| + PassRefPtr<const TransformPaintPropertyNode> localTransformSpace, |
| + PassRefPtr<const ClipPaintPropertyNode> outputClip, |
| + float opacity, CompositorFilterOperations filter) { |
| + return adoptRef(new EffectPaintPropertyNode(std::move(parent), std::move(localTransformSpace), std::move(outputClip), opacity, std::move(filter))); |
| } |
| - void update(PassRefPtr<const EffectPaintPropertyNode> parent, float opacity) { |
| + void update(PassRefPtr<const EffectPaintPropertyNode> parent, |
| + PassRefPtr<const TransformPaintPropertyNode> localTransformSpace, |
| + PassRefPtr<const ClipPaintPropertyNode> outputClip, |
| + float opacity, CompositorFilterOperations filter) { |
| DCHECK(!isRoot()); |
| DCHECK(parent != this); |
| m_parent = parent; |
| + m_localTransformSpace = localTransformSpace; |
| + m_outputClip = outputClip; |
| m_opacity = opacity; |
| + m_filter = std::move(filter); |
| } |
| + const TransformPaintPropertyNode* localTransformSpace() const { return m_localTransformSpace.get(); } |
| + const ClipPaintPropertyNode* outputClip() const { return m_outputClip.get(); } |
| + |
| float opacity() const { return m_opacity; } |
| + const CompositorFilterOperations& filter() const { return m_filter; } |
| // Parent effect or nullptr if this is the root effect. |
| const EffectPaintPropertyNode* parent() const { return m_parent.get(); } |
| @@ -45,11 +56,28 @@ class PLATFORM_EXPORT EffectPaintPropertyNode |
| private: |
| EffectPaintPropertyNode(PassRefPtr<const EffectPaintPropertyNode> parent, |
| - float opacity) |
| - : m_parent(parent), m_opacity(opacity) {} |
| + PassRefPtr<const TransformPaintPropertyNode> localTransformSpace, |
| + PassRefPtr<const ClipPaintPropertyNode> outputClip, |
| + float opacity, CompositorFilterOperations filter) |
| + : m_parent(parent), m_localTransformSpace(localTransformSpace), m_outputClip(outputClip), m_opacity(opacity), m_filter(std::move(filter)) {} |
| RefPtr<const EffectPaintPropertyNode> m_parent; |
| + // The local transform space serves two purposes: |
| + // 1. Assign a depth mapping for 3D depth sorting against other paint chunks |
| + // and effects under the same parent. |
| + // 2. Some effects are spatial (namely blur filter and reflection), the |
| + // effect parameters will be specified in the local space. |
| + RefPtr<const TransformPaintPropertyNode> m_localTransformSpace; |
| + // The output of the effect can be optionally clipped when composited onto |
| + // the current backdrop. |
| + RefPtr<const ClipPaintPropertyNode> m_outputClip; |
| + |
| + // Optionally a number of effects can be applied to the composited output. |
| + // The chain of effects are applied in reverse order of the following list: |
|
pdr.
2016/10/19 17:44:43
Nit: can we list these in order instead of reverse
trchen
2016/10/21 23:26:39
Done.
By the way every time we added a new proper
|
| + // === Begin of effects === |
| float m_opacity; |
| + CompositorFilterOperations m_filter; |
| + // === End of effects === |
| }; |
| // Redeclared here to avoid ODR issues. |