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

Unified Diff: third_party/WebKit/Source/platform/graphics/paint/PropertyTreeStateTest.cpp

Issue 2837183002: [SPv2] Apply effects before clips for when the effect does not move pixels (Closed)
Patch Set: none Created 3 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/PropertyTreeState.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/paint/PropertyTreeStateTest.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PropertyTreeStateTest.cpp b/third_party/WebKit/Source/platform/graphics/paint/PropertyTreeStateTest.cpp
index e1218a971199c71aa5aa6731a64ef964b404f97a..6b1e01d4e9fbb96d8f12d9ef90385a1cc9a41f6f 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/PropertyTreeStateTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/paint/PropertyTreeStateTest.cpp
@@ -10,6 +10,47 @@ namespace blink {
class PropertyTreeStateTest : public ::testing::Test {};
+TEST_F(PropertyTreeStateTest, ClipBelowOutputClipOfEffect) {
+ RefPtr<ClipPaintPropertyNode> clip = ClipPaintPropertyNode::Create(
+ ClipPaintPropertyNode::Root(), TransformPaintPropertyNode::Root(),
+ FloatRoundedRect());
+
+ RefPtr<EffectPaintPropertyNode> effect = EffectPaintPropertyNode::Create(
+ EffectPaintPropertyNode::Root(), TransformPaintPropertyNode::Root(),
+ ClipPaintPropertyNode::Root(), kColorFilterNone,
+ CompositorFilterOperations(), 1.0, SkBlendMode::kSrcOver);
+
+ PropertyTreeState state(TransformPaintPropertyNode::Root(), clip.Get(),
+ effect.Get());
+ EXPECT_EQ(PropertyTreeState::kEffect, state.GetInnermostNode());
+
+ PropertyTreeStateIterator iterator(state);
+ EXPECT_EQ(PropertyTreeState::kClip, iterator.Next()->GetInnermostNode());
+ EXPECT_EQ(PropertyTreeState::kNone, iterator.Next()->GetInnermostNode());
+}
+
+TEST_F(PropertyTreeStateTest, ClipBelowOutputClipOfEffectMovingPixels) {
+ RefPtr<ClipPaintPropertyNode> clip = ClipPaintPropertyNode::Create(
+ ClipPaintPropertyNode::Root(), TransformPaintPropertyNode::Root(),
+ FloatRoundedRect());
+
+ CompositorFilterOperations operations;
+ operations.AppendBlurFilter(2);
+ RefPtr<EffectPaintPropertyNode> effect = EffectPaintPropertyNode::Create(
+ EffectPaintPropertyNode::Root(), TransformPaintPropertyNode::Root(),
+ ClipPaintPropertyNode::Root(), kColorFilterNone, operations, 1.0,
+ SkBlendMode::kSrcOver);
+
+ PropertyTreeState state(TransformPaintPropertyNode::Root(), clip.Get(),
+ effect.Get());
+ // If the effect moves pixels, the clip must happen first.
+ EXPECT_EQ(PropertyTreeState::kClip, state.GetInnermostNode());
+
+ PropertyTreeStateIterator iterator(state);
+ EXPECT_EQ(PropertyTreeState::kEffect, iterator.Next()->GetInnermostNode());
+ EXPECT_EQ(PropertyTreeState::kNone, iterator.Next()->GetInnermostNode());
+}
+
TEST_F(PropertyTreeStateTest, TransformOnEffectOnClip) {
RefPtr<TransformPaintPropertyNode> transform =
TransformPaintPropertyNode::Create(TransformPaintPropertyNode::Root(),
@@ -79,24 +120,27 @@ TEST_F(PropertyTreeStateTest, ClipOnEffectOnTransform) {
CompositorFilterOperations(), 1.0, SkBlendMode::kSrcOver);
PropertyTreeState state(transform.Get(), clip.Get(), effect.Get());
- EXPECT_EQ(PropertyTreeState::kClip, state.GetInnermostNode());
+ EXPECT_EQ(PropertyTreeState::kEffect, state.GetInnermostNode());
PropertyTreeStateIterator iterator(state);
- EXPECT_EQ(PropertyTreeState::kEffect, iterator.Next()->GetInnermostNode());
+ EXPECT_EQ(PropertyTreeState::kClip, iterator.Next()->GetInnermostNode());
EXPECT_EQ(PropertyTreeState::kTransform, iterator.Next()->GetInnermostNode());
EXPECT_EQ(PropertyTreeState::kNone, iterator.Next()->GetInnermostNode());
}
TEST_F(PropertyTreeStateTest, ClipDescendantOfTransform) {
+ // CSS transform
RefPtr<TransformPaintPropertyNode> transform =
TransformPaintPropertyNode::Create(TransformPaintPropertyNode::Root(),
TransformationMatrix(),
FloatPoint3D());
+ // Scroll transform
RefPtr<TransformPaintPropertyNode> transform2 =
TransformPaintPropertyNode::Create(
transform.Get(), TransformationMatrix(), FloatPoint3D());
+ // CSS clip
RefPtr<ClipPaintPropertyNode> clip = ClipPaintPropertyNode::Create(
ClipPaintPropertyNode::Root(), transform2.Get(), FloatRoundedRect());
@@ -105,10 +149,11 @@ TEST_F(PropertyTreeStateTest, ClipDescendantOfTransform) {
ClipPaintPropertyNode::Root(), kColorFilterNone,
CompositorFilterOperations(), 1.0, SkBlendMode::kSrcOver);
- // Here the clip is inside of its own transform, but the transform is an
- // ancestor of the clip's transform. This models situations such as
- // a clip inside a scroller that applies to an absolute-positioned element
- // which escapes the scroll transform but not the clip.
+ // Here the clip is inside of its own transform, but the
+ // PropertyTreeState of the content is an ancestor of the clip's transform./
+ // This models situations such as a CSS clip inside a scroller that applies to
+ // an absolute-positioned element which escapes the scroll transforms but not
+ // the clip.
PropertyTreeState state(transform.Get(), clip.Get(), effect.Get());
EXPECT_EQ(PropertyTreeState::kClip, state.GetInnermostNode());
@@ -119,11 +164,6 @@ TEST_F(PropertyTreeStateTest, ClipDescendantOfTransform) {
}
TEST_F(PropertyTreeStateTest, EffectDescendantOfTransform) {
- RefPtr<TransformPaintPropertyNode> transform =
- TransformPaintPropertyNode::Create(TransformPaintPropertyNode::Root(),
- TransformationMatrix(),
- FloatPoint3D());
-
RefPtr<ClipPaintPropertyNode> clip = ClipPaintPropertyNode::Create(
ClipPaintPropertyNode::Root(), TransformPaintPropertyNode::Root(),
FloatRoundedRect());
@@ -138,11 +178,7 @@ TEST_F(PropertyTreeStateTest, EffectDescendantOfTransform) {
kColorFilterNone, CompositorFilterOperations(), 1.0,
SkBlendMode::kSrcOver);
- // Here the clip is inside of its own transform, but the transform is an
- // ancestor of the clip's transform. This models situations such as
- // a clip inside a scroller that applies to an absolute-positioned element
- // which escapes the scroll transform but not the clip.
- PropertyTreeState state(transform.Get(), clip.Get(), effect.Get());
+ PropertyTreeState state(transform2.Get(), clip.Get(), effect.Get());
EXPECT_EQ(PropertyTreeState::kEffect, state.GetInnermostNode());
PropertyTreeStateIterator iterator(state);
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/PropertyTreeState.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698