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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp

Issue 2428513004: [SPv2] Create effect nodes for CSS filter (Closed)
Patch Set: remove DCHECK(layer) Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/layout/LayoutTestHelper.h" 5 #include "core/layout/LayoutTestHelper.h"
6 #include "core/layout/LayoutTreeAsText.h" 6 #include "core/layout/LayoutTreeAsText.h"
7 #include "core/layout/api/LayoutViewItem.h" 7 #include "core/layout/api/LayoutViewItem.h"
8 #include "core/paint/ObjectPaintProperties.h" 8 #include "core/paint/ObjectPaintProperties.h"
9 #include "core/paint/PaintPropertyTreePrinter.h" 9 #include "core/paint/PaintPropertyTreePrinter.h"
10 #include "platform/graphics/paint/GeometryMapper.h" 10 #include "platform/graphics/paint/GeometryMapper.h"
(...skipping 2842 matching lines...) Expand 10 before | Expand all | Expand 10 after
2853 " <div id=spanner style='column-span: all'>" 2853 " <div id=spanner style='column-span: all'>"
2854 " <div id=absolute style='position: absolute'>absolute</div>" 2854 " <div id=absolute style='position: absolute'>absolute</div>"
2855 " </div>" 2855 " </div>"
2856 " </span>" 2856 " </span>"
2857 "</div>"); 2857 "</div>");
2858 // There should be anonymous block created containing the inline "relative", 2858 // There should be anonymous block created containing the inline "relative",
2859 // serving as the container of "absolute". 2859 // serving as the container of "absolute".
2860 EXPECT_TRUE( 2860 EXPECT_TRUE(
2861 getLayoutObjectByElementId("absolute")->container()->isLayoutBlock()); 2861 getLayoutObjectByElementId("absolute")->container()->isLayoutBlock());
2862 } 2862 }
2863
2864 TEST_P(PaintPropertyTreeBuilderTest, SimpleFilter) {
2865 setBodyInnerHTML(
2866 "<div id='filter' style='filter:opacity(0.5); height:1000px;'>"
2867 "</div>");
2868 const ObjectPaintProperties* filterProperties =
2869 getLayoutObjectByElementId("filter")->paintProperties();
2870 EXPECT_TRUE(filterProperties->effect()->parent()->isRoot());
2871 EXPECT_EQ(frameScrollTranslation(),
2872 filterProperties->effect()->localTransformSpace());
2873 EXPECT_EQ(frameContentClip(), filterProperties->effect()->outputClip());
2874 }
2875
2876 TEST_P(PaintPropertyTreeBuilderTest, FilterReparentClips) {
2877 setBodyInnerHTML(
2878 "<div id='clip' style='overflow:hidden;'>"
2879 " <div id='filter' style='filter:opacity(0.5); height:1000px;'>"
2880 " <div id='child' style='position:fixed;'></div>"
2881 " </div>"
2882 "</div>");
2883 const ObjectPaintProperties* clipProperties =
2884 getLayoutObjectByElementId("clip")->paintProperties();
2885 const ObjectPaintProperties* filterProperties =
2886 getLayoutObjectByElementId("filter")->paintProperties();
2887 EXPECT_TRUE(filterProperties->effect()->parent()->isRoot());
2888 EXPECT_EQ(frameScrollTranslation(),
2889 filterProperties->effect()->localTransformSpace());
2890 EXPECT_EQ(clipProperties->overflowClip(),
2891 filterProperties->effect()->outputClip());
2892
2893 const ObjectPaintProperties* childProperties =
2894 getLayoutObjectByElementId("child")->paintProperties();
2895 const PropertyTreeState& childPaintState =
2896 childProperties->localBorderBoxProperties()->propertyTreeState;
2897 EXPECT_EQ(framePreTranslation(),
2898 childProperties->paintOffsetTranslation()->parent());
2899 EXPECT_EQ(childProperties->paintOffsetTranslation(),
2900 childPaintState.transform());
2901 // This will change once we added clip expansion node.
2902 EXPECT_EQ(filterProperties->effect()->outputClip(), childPaintState.clip());
2903 EXPECT_EQ(filterProperties->effect(), childPaintState.effect());
2904 }
2905
2863 } // namespace blink 2906 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698