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

Unified Diff: third_party/WebKit/Source/platform/graphics/paint/EffectPaintPropertyNode.h

Issue 2428513004: [SPv2] Create effect nodes for CSS filter (Closed)
Patch Set: address pdr's comment Created 4 years, 2 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/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..0f09dabc0bec8da7a901b7be0f7c1a7b26322127 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,42 +15,81 @@
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,
+ PassRefPtr<const TransformPaintPropertyNode> localTransformSpace,
+ PassRefPtr<const ClipPaintPropertyNode> outputClip,
+ CompositorFilterOperations filter,
float opacity) {
- return adoptRef(new EffectPaintPropertyNode(std::move(parent), opacity));
+ return adoptRef(new EffectPaintPropertyNode(
+ std::move(parent), std::move(localTransformSpace),
+ std::move(outputClip), std::move(filter), opacity));
}
- void update(PassRefPtr<const EffectPaintPropertyNode> parent, float opacity) {
+ void update(PassRefPtr<const EffectPaintPropertyNode> parent,
+ PassRefPtr<const TransformPaintPropertyNode> localTransformSpace,
+ PassRefPtr<const ClipPaintPropertyNode> outputClip,
+ CompositorFilterOperations filter,
+ float opacity) {
DCHECK(!isRoot());
DCHECK(parent != this);
m_parent = parent;
+ m_localTransformSpace = localTransformSpace;
+ m_outputClip = outputClip;
+ m_filter = std::move(filter);
m_opacity = opacity;
}
+ 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(); }
bool isRoot() const { return !m_parent; }
private:
- EffectPaintPropertyNode(PassRefPtr<const EffectPaintPropertyNode> parent,
- float opacity)
- : m_parent(parent), m_opacity(opacity) {}
+ EffectPaintPropertyNode(
+ PassRefPtr<const EffectPaintPropertyNode> parent,
+ PassRefPtr<const TransformPaintPropertyNode> localTransformSpace,
+ PassRefPtr<const ClipPaintPropertyNode> outputClip,
+ CompositorFilterOperations filter,
+ float opacity)
+ : m_parent(parent),
+ m_localTransformSpace(localTransformSpace),
+ m_outputClip(outputClip),
+ m_filter(std::move(filter)),
+ m_opacity(opacity) {}
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 will be applied in the following order:
+ // === Begin of effects ===
+ CompositorFilterOperations m_filter;
float m_opacity;
+ // === End of effects ===
};
// Redeclared here to avoid ODR issues.

Powered by Google App Engine
This is Rietveld 408576698