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

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

Issue 2351433002: Switch LocalBorderBoxProperties to store raw pointers (Closed)
Patch Set: Created 4 years, 3 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 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 { 44 {
45 FrameView* frameView = document().view(); 45 FrameView* frameView = document().view();
46 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) 46 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled())
47 return frameView->layoutView()->objectPaintProperties()->paintOffset Translation(); 47 return frameView->layoutView()->objectPaintProperties()->paintOffset Translation();
48 return frameView->rootTransform(); 48 return frameView->rootTransform();
49 } 49 }
50 50
51 const ClipPaintPropertyNode* rootClip() 51 const ClipPaintPropertyNode* rootClip()
52 { 52 {
53 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) 53 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled())
54 return document().view()->layoutView()->objectPaintProperties()->loc alBorderBoxProperties()->geometryPropertyTreeState.clip.get(); 54 return document().view()->layoutView()->objectPaintProperties()->loc alBorderBoxProperties()->clip;
55 return document().view()->rootClip(); 55 return document().view()->rootClip();
56 } 56 }
57 57
58 const ScrollPaintPropertyNode* rootScroll() 58 const ScrollPaintPropertyNode* rootScroll()
59 { 59 {
60 FrameView* frameView = document().view(); 60 FrameView* frameView = document().view();
61 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) 61 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled())
62 return frameView->layoutView()->objectPaintProperties()->scroll(); 62 return frameView->layoutView()->objectPaintProperties()->scroll();
63 return frameView->rootScroll(); 63 return frameView->rootScroll();
64 } 64 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 Settings::setMockScrollbarsEnabled(false); 111 Settings::setMockScrollbarsEnabled(false);
112 } 112 }
113 }; 113 };
114 114
115 #define CHECK_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObject, sl opFactor) \ 115 #define CHECK_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObject, sl opFactor) \
116 do { \ 116 do { \
117 GeometryMapper geometryMapper; \ 117 GeometryMapper geometryMapper; \
118 LayoutRect source((sourceLayoutObject)->localOverflowRectForPaintInvalidatio n()); \ 118 LayoutRect source((sourceLayoutObject)->localOverflowRectForPaintInvalidatio n()); \
119 source.moveBy((sourceLayoutObject)->objectPaintProperties()->localBorderBoxP roperties()->paintOffset); \ 119 source.moveBy((sourceLayoutObject)->objectPaintProperties()->localBorderBoxP roperties()->paintOffset); \
120 bool success = false; \ 120 bool success = false; \
121 GeometryPropertyTreeState contentsProperties; \ 121 const ObjectPaintProperties* ancestorProperies = (ancestorLayoutObject)->obj ectPaintProperties(); \
122 (ancestorLayoutObject)->objectPaintProperties()->getContentsProperties(conte ntsProperties); \ 122 GeometryPropertyTreeState contentsProperties = ancestorProperies->getContent sProperties(); \
123 const auto* sourceBorderBoxProperties = (sourceLayoutObject)->objectPaintPro perties()->localBorderBoxProperties(); \
124 GeometryPropertyTreeState localBorderBoxProperties(sourceBorderBoxProperties ->transform, sourceBorderBoxProperties->clip, sourceBorderBoxProperties->effect) ; \
123 FloatRect actual = geometryMapper.mapToVisualRectInDestinationSpace( \ 125 FloatRect actual = geometryMapper.mapToVisualRectInDestinationSpace( \
124 FloatRect(source), \ 126 FloatRect(source), \
125 (sourceLayoutObject)->objectPaintProperties()->localBorderBoxProperties( )->geometryPropertyTreeState, \ 127 localBorderBoxProperties, \
126 contentsProperties, success); \ 128 contentsProperties, success); \
127 ASSERT_TRUE(success); \ 129 ASSERT_TRUE(success); \
128 EXPECT_EQ(expected, LayoutRect(actual)) << "GeometryMapper: expected: " << e xpected.toString() << ", actual: " << actual.toString(); \ 130 EXPECT_EQ(expected, LayoutRect(actual)) << "GeometryMapper: expected: " << e xpected.toString() << ", actual: " << actual.toString(); \
129 \ 131 \
130 if (slopFactor == LayoutUnit::max()) \ 132 if (slopFactor == LayoutUnit::max()) \
131 break; \ 133 break; \
132 LayoutRect slowPathRect = (sourceLayoutObject)->localOverflowRectForPaintInv alidation(); \ 134 LayoutRect slowPathRect = (sourceLayoutObject)->localOverflowRectForPaintInv alidation(); \
133 (sourceLayoutObject)->mapToVisualRectInAncestorSpace(ancestorLayoutObject, s lowPathRect); \ 135 (sourceLayoutObject)->mapToVisualRectInAncestorSpace(ancestorLayoutObject, s lowPathRect); \
134 if (slopFactor) { \ 136 if (slopFactor) { \
135 LayoutRect inflatedActual = LayoutRect(actual); \ 137 LayoutRect inflatedActual = LayoutRect(actual); \
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 " <div style='height:10000px;'></div>" 871 " <div style='height:10000px;'></div>"
870 "</div>" 872 "</div>"
871 ); 873 );
872 FrameView* frameView = document().view(); 874 FrameView* frameView = document().view();
873 875
874 LayoutObject* scroller = document().getElementById("scroller")->layoutObject (); 876 LayoutObject* scroller = document().getElementById("scroller")->layoutObject ();
875 const ObjectPaintProperties* scrollerProperties = scroller->objectPaintPrope rties(); 877 const ObjectPaintProperties* scrollerProperties = scroller->objectPaintPrope rties();
876 LayoutObject* child = document().getElementById("child")->layoutObject(); 878 LayoutObject* child = document().getElementById("child")->layoutObject();
877 const ObjectPaintProperties* childProperties = child->objectPaintProperties( ); 879 const ObjectPaintProperties* childProperties = child->objectPaintProperties( );
878 880
879 EXPECT_EQ(scrollerProperties->overflowClip(), childProperties->localBorderBo xProperties()->geometryPropertyTreeState.clip); 881 EXPECT_EQ(scrollerProperties->overflowClip(), childProperties->localBorderBo xProperties()->clip);
880 EXPECT_EQ(scrollerProperties->scrollTranslation(), childProperties->localBor derBoxProperties()->geometryPropertyTreeState.transform); 882 EXPECT_EQ(scrollerProperties->scrollTranslation(), childProperties->localBor derBoxProperties()->transform);
881 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->geometryProp ertyTreeState.effect); 883 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->effect);
882 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 400, 300), scroller, frameView->lay outView()); 884 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 400, 300), scroller, frameView->lay outView());
883 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 100, 200), child, frameView->layout View()); 885 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 100, 200), child, frameView->layout View());
884 } 886 }
885 887
886 TEST_P(PaintPropertyTreeBuilderTest, TreeContextUnclipFromParentStackingContext) 888 TEST_P(PaintPropertyTreeBuilderTest, TreeContextUnclipFromParentStackingContext)
887 { 889 {
888 // This test verifies the tree builder correctly computes and records the pr operty tree context 890 // This test verifies the tree builder correctly computes and records the pr operty tree context
889 // for a (pseudo) stacking context that has a scrolling painting ancestor th at is not its 891 // for a (pseudo) stacking context that has a scrolling painting ancestor th at is not its
890 // containing block (thus should not be scrolled by it). 892 // containing block (thus should not be scrolled by it).
891 893
892 setBodyInnerHTML( 894 setBodyInnerHTML(
893 "<style>body { margin: 0; }</style>" 895 "<style>body { margin: 0; }</style>"
894 "<div id='scroller' style='overflow:scroll; opacity:0.5;'>" 896 "<div id='scroller' style='overflow:scroll; opacity:0.5;'>"
895 " <div id='child' style='position:absolute; left:0; top:0; width: 100px ; height: 200px'></div>" 897 " <div id='child' style='position:absolute; left:0; top:0; width: 100px ; height: 200px'></div>"
896 " <div style='height:10000px;'></div>" 898 " <div style='height:10000px;'></div>"
897 "</div>" 899 "</div>"
898 ); 900 );
899 901
900 LayoutObject& scroller = *document().getElementById("scroller")->layoutObjec t(); 902 LayoutObject& scroller = *document().getElementById("scroller")->layoutObjec t();
901 const ObjectPaintProperties* scrollerProperties = scroller.objectPaintProper ties(); 903 const ObjectPaintProperties* scrollerProperties = scroller.objectPaintProper ties();
902 LayoutObject& child = *document().getElementById("child")->layoutObject(); 904 LayoutObject& child = *document().getElementById("child")->layoutObject();
903 const ObjectPaintProperties* childProperties = child.objectPaintProperties() ; 905 const ObjectPaintProperties* childProperties = child.objectPaintProperties() ;
904 906
905 EXPECT_EQ(frameContentClip(), childProperties->localBorderBoxProperties()->g eometryPropertyTreeState.clip); 907 EXPECT_EQ(frameContentClip(), childProperties->localBorderBoxProperties()->c lip);
906 EXPECT_EQ(frameScrollTranslation(), childProperties->localBorderBoxPropertie s()->geometryPropertyTreeState.transform); 908 EXPECT_EQ(frameScrollTranslation(), childProperties->localBorderBoxPropertie s()->transform);
907 EXPECT_EQ(scrollerProperties->effect(), childProperties->localBorderBoxPrope rties()->geometryPropertyTreeState.effect); 909 EXPECT_EQ(scrollerProperties->effect(), childProperties->localBorderBoxPrope rties()->effect);
908 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { 910 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
909 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 800, 10000), &scroller, documen t().view()->layoutView()); 911 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 800, 10000), &scroller, documen t().view()->layoutView());
910 } 912 }
911 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 100, 200), &child, document().view( )->layoutView()); 913 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 100, 200), &child, document().view( )->layoutView());
912 } 914 }
913 915
914 TEST_P(PaintPropertyTreeBuilderTest, TableCellLayoutLocation) 916 TEST_P(PaintPropertyTreeBuilderTest, TableCellLayoutLocation)
915 { 917 {
916 // This test verifies that the border box space of a table cell is being cor rectly computed. 918 // This test verifies that the border box space of a table cell is being cor rectly computed.
917 // Table cells have weird location adjustment in our layout/paint implementa tion. 919 // Table cells have weird location adjustment in our layout/paint implementa tion.
(...skipping 22 matching lines...) Expand all
940 "<table>" 942 "<table>"
941 " <tr><td></td><td></td></tr>" 943 " <tr><td></td><td></td></tr>"
942 " <tr><td></td><td><div id='target'></div></td></tr>" 944 " <tr><td></td><td><div id='target'></div></td></tr>"
943 "</table>" 945 "</table>"
944 ); 946 );
945 947
946 LayoutObject& target = *document().getElementById("target")->layoutObject(); 948 LayoutObject& target = *document().getElementById("target")->layoutObject();
947 const ObjectPaintProperties* targetProperties = target.objectPaintProperties (); 949 const ObjectPaintProperties* targetProperties = target.objectPaintProperties ();
948 950
949 EXPECT_EQ(LayoutPoint(170, 170), targetProperties->localBorderBoxProperties( )->paintOffset); 951 EXPECT_EQ(LayoutPoint(170, 170), targetProperties->localBorderBoxProperties( )->paintOffset);
950 EXPECT_EQ(frameScrollTranslation(), targetProperties->localBorderBoxProperti es()->geometryPropertyTreeState.transform); 952 EXPECT_EQ(frameScrollTranslation(), targetProperties->localBorderBoxProperti es()->transform);
951 CHECK_EXACT_VISUAL_RECT(LayoutRect(170, 170, 100, 100), &target, document(). view()->layoutView()); 953 CHECK_EXACT_VISUAL_RECT(LayoutRect(170, 170, 100, 100), &target, document(). view()->layoutView());
952 } 954 }
953 955
954 TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendant) 956 TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendant)
955 { 957 {
956 // This test verifies that clip tree hierarchy being generated correctly for the hard case 958 // This test verifies that clip tree hierarchy being generated correctly for the hard case
957 // such that a fixed position element getting clipped by an absolute positio n CSS clip. 959 // such that a fixed position element getting clipped by an absolute positio n CSS clip.
958 setBodyInnerHTML( 960 setBodyInnerHTML(
959 "<style>" 961 "<style>"
960 " #clip {" 962 " #clip {"
(...skipping 22 matching lines...) Expand all
983 const ObjectPaintProperties* clipProperties = clip.objectPaintProperties(); 985 const ObjectPaintProperties* clipProperties = clip.objectPaintProperties();
984 EXPECT_EQ(frameContentClip(), clipProperties->cssClip()->parent()); 986 EXPECT_EQ(frameContentClip(), clipProperties->cssClip()->parent());
985 EXPECT_EQ(frameScrollTranslation(), clipProperties->cssClip()->localTransfor mSpace()); 987 EXPECT_EQ(frameScrollTranslation(), clipProperties->cssClip()->localTransfor mSpace());
986 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css Clip()->clipRect()); 988 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css Clip()->clipRect());
987 CHECK_VISUAL_RECT(absoluteClipRect, &clip, document().view()->layoutView(), 989 CHECK_VISUAL_RECT(absoluteClipRect, &clip, document().view()->layoutView(),
988 // TODO(crbug.com/599939): mapToVisualRectInAncestorSpace() doesn't appl y css clip on the object itself. 990 // TODO(crbug.com/599939): mapToVisualRectInAncestorSpace() doesn't appl y css clip on the object itself.
989 LayoutUnit::max()); 991 LayoutUnit::max());
990 992
991 LayoutObject* fixed = document().getElementById("fixed")->layoutObject(); 993 LayoutObject* fixed = document().getElementById("fixed")->layoutObject();
992 const ObjectPaintProperties* fixedProperties = fixed->objectPaintProperties( ); 994 const ObjectPaintProperties* fixedProperties = fixed->objectPaintProperties( );
993 EXPECT_EQ(clipProperties->cssClip(), fixedProperties->localBorderBoxProperti es()->geometryPropertyTreeState.clip); 995 EXPECT_EQ(clipProperties->cssClip(), fixedProperties->localBorderBoxProperti es()->clip);
994 EXPECT_EQ(framePreTranslation(), fixedProperties->localBorderBoxProperties() ->geometryPropertyTreeState.transform->parent()); 996 EXPECT_EQ(framePreTranslation(), fixedProperties->localBorderBoxProperties() ->transform->parent());
995 EXPECT_EQ(TransformationMatrix().translate(654, 321), fixedProperties->local BorderBoxProperties()->geometryPropertyTreeState.transform->matrix()); 997 EXPECT_EQ(TransformationMatrix().translate(654, 321), fixedProperties->local BorderBoxProperties()->transform->matrix());
996 EXPECT_EQ(LayoutPoint(), fixedProperties->localBorderBoxProperties()->paintO ffset); 998 EXPECT_EQ(LayoutPoint(), fixedProperties->localBorderBoxProperties()->paintO ffset);
997 CHECK_VISUAL_RECT(LayoutRect(), fixed, document().view()->layoutView(), 999 CHECK_VISUAL_RECT(LayoutRect(), fixed, document().view()->layoutView(),
998 // TODO(crbug.com/599939): CSS clip of fixed-position descendants is bro ken in mapToVisualRectInAncestorSpace(). 1000 // TODO(crbug.com/599939): CSS clip of fixed-position descendants is bro ken in mapToVisualRectInAncestorSpace().
999 LayoutUnit::max()); 1001 LayoutUnit::max());
1000 } 1002 }
1001 1003
1002 TEST_P(PaintPropertyTreeBuilderTest, CSSClipAbsPositionDescendant) 1004 TEST_P(PaintPropertyTreeBuilderTest, CSSClipAbsPositionDescendant)
1003 { 1005 {
1004 // This test verifies that clip tree hierarchy being generated correctly for the hard case 1006 // This test verifies that clip tree hierarchy being generated correctly for the hard case
1005 // such that a fixed position element getting clipped by an absolute positio n CSS clip. 1007 // such that a fixed position element getting clipped by an absolute positio n CSS clip.
(...skipping 25 matching lines...) Expand all
1031 const ObjectPaintProperties* clipProperties = clip->objectPaintProperties(); 1033 const ObjectPaintProperties* clipProperties = clip->objectPaintProperties();
1032 EXPECT_EQ(frameContentClip(), clipProperties->cssClip()->parent()); 1034 EXPECT_EQ(frameContentClip(), clipProperties->cssClip()->parent());
1033 EXPECT_EQ(frameScrollTranslation(), clipProperties->cssClip()->localTransfor mSpace()); 1035 EXPECT_EQ(frameScrollTranslation(), clipProperties->cssClip()->localTransfor mSpace());
1034 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css Clip()->clipRect()); 1036 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css Clip()->clipRect());
1035 CHECK_VISUAL_RECT(absoluteClipRect, clip, document().view()->layoutView(), 1037 CHECK_VISUAL_RECT(absoluteClipRect, clip, document().view()->layoutView(),
1036 // TODO(crbug.com/599939): mapToVisualRectInAncestorSpace() doesn't appl y css clip on the object itself. 1038 // TODO(crbug.com/599939): mapToVisualRectInAncestorSpace() doesn't appl y css clip on the object itself.
1037 LayoutUnit::max()); 1039 LayoutUnit::max());
1038 1040
1039 LayoutObject* absolute = document().getElementById("absolute")->layoutObject (); 1041 LayoutObject* absolute = document().getElementById("absolute")->layoutObject ();
1040 const ObjectPaintProperties* absPosProperties = absolute->objectPaintPropert ies(); 1042 const ObjectPaintProperties* absPosProperties = absolute->objectPaintPropert ies();
1041 EXPECT_EQ(clipProperties->cssClip(), absPosProperties->localBorderBoxPropert ies()->geometryPropertyTreeState.clip); 1043 EXPECT_EQ(clipProperties->cssClip(), absPosProperties->localBorderBoxPropert ies()->clip);
1042 EXPECT_EQ(framePreTranslation(), absPosProperties->localBorderBoxProperties( )->geometryPropertyTreeState.transform->parent()); 1044 EXPECT_EQ(framePreTranslation(), absPosProperties->localBorderBoxProperties( )->transform->parent());
1043 EXPECT_EQ(LayoutPoint(123, 456), absPosProperties->localBorderBoxProperties( )->paintOffset); 1045 EXPECT_EQ(LayoutPoint(123, 456), absPosProperties->localBorderBoxProperties( )->paintOffset);
1044 CHECK_VISUAL_RECT(LayoutRect(), absolute, document().view()->layoutView(), 1046 CHECK_VISUAL_RECT(LayoutRect(), absolute, document().view()->layoutView(),
1045 // TODO(crbug.com/599939): CSS clip of fixed-position descendants is bro ken in mapToVisualRectInAncestorSpace(). 1047 // TODO(crbug.com/599939): CSS clip of fixed-position descendants is bro ken in mapToVisualRectInAncestorSpace().
1046 LayoutUnit::max()); 1048 LayoutUnit::max());
1047 } 1049 }
1048 1050
1049 TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendantNonShared) 1051 TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendantNonShared)
1050 { 1052 {
1051 // This test is similar to CSSClipFixedPositionDescendant above, except that 1053 // This test is similar to CSSClipFixedPositionDescendant above, except that
1052 // now we have a parent overflow clip that should be escaped by the fixed de scendant. 1054 // now we have a parent overflow clip that should be escaped by the fixed de scendant.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 EXPECT_EQ(overflowProperties->overflowClip(), clipProperties->cssClip()->par ent()); 1094 EXPECT_EQ(overflowProperties->overflowClip(), clipProperties->cssClip()->par ent());
1093 EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClip() ->localTransformSpace()); 1095 EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClip() ->localTransformSpace());
1094 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css Clip()->clipRect()); 1096 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css Clip()->clipRect());
1095 EXPECT_EQ(frameContentClip(), clipProperties->cssClipFixedPosition()->parent ()); 1097 EXPECT_EQ(frameContentClip(), clipProperties->cssClipFixedPosition()->parent ());
1096 EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClipFi xedPosition()->localTransformSpace()); 1098 EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClipFi xedPosition()->localTransformSpace());
1097 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css ClipFixedPosition()->clipRect()); 1099 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css ClipFixedPosition()->clipRect());
1098 CHECK_EXACT_VISUAL_RECT(LayoutRect(), clip, document().view()->layoutView()) ; 1100 CHECK_EXACT_VISUAL_RECT(LayoutRect(), clip, document().view()->layoutView()) ;
1099 1101
1100 LayoutObject* fixed = document().getElementById("fixed")->layoutObject(); 1102 LayoutObject* fixed = document().getElementById("fixed")->layoutObject();
1101 const ObjectPaintProperties* fixedProperties = fixed->objectPaintProperties( ); 1103 const ObjectPaintProperties* fixedProperties = fixed->objectPaintProperties( );
1102 EXPECT_EQ(clipProperties->cssClipFixedPosition(), fixedProperties->localBord erBoxProperties()->geometryPropertyTreeState.clip); 1104 EXPECT_EQ(clipProperties->cssClipFixedPosition(), fixedProperties->localBord erBoxProperties()->clip);
1103 EXPECT_EQ(framePreTranslation(), fixedProperties->localBorderBoxProperties() ->geometryPropertyTreeState.transform->parent()); 1105 EXPECT_EQ(framePreTranslation(), fixedProperties->localBorderBoxProperties() ->transform->parent());
1104 EXPECT_EQ(TransformationMatrix().translate(654, 321), fixedProperties->local BorderBoxProperties()->geometryPropertyTreeState.transform->matrix()); 1106 EXPECT_EQ(TransformationMatrix().translate(654, 321), fixedProperties->local BorderBoxProperties()->transform->matrix());
1105 EXPECT_EQ(LayoutPoint(), fixedProperties->localBorderBoxProperties()->paintO ffset); 1107 EXPECT_EQ(LayoutPoint(), fixedProperties->localBorderBoxProperties()->paintO ffset);
1106 CHECK_VISUAL_RECT(LayoutRect(), fixed, document().view()->layoutView(), 1108 CHECK_VISUAL_RECT(LayoutRect(), fixed, document().view()->layoutView(),
1107 // TODO(crbug.com/599939): CSS clip of fixed-position descendants is bro ken in geometry mapping. 1109 // TODO(crbug.com/599939): CSS clip of fixed-position descendants is bro ken in geometry mapping.
1108 LayoutUnit::max()); 1110 LayoutUnit::max());
1109 } 1111 }
1110 1112
1111 TEST_P(PaintPropertyTreeBuilderTest, ColumnSpannerUnderRelativePositioned) 1113 TEST_P(PaintPropertyTreeBuilderTest, ColumnSpannerUnderRelativePositioned)
1112 { 1114 {
1113 setBodyInnerHTML( 1115 setBodyInnerHTML(
1114 "<div style='columns: 3; position: absolute; top: 44px; left: 55px;'>" 1116 "<div style='columns: 3; position: absolute; top: 44px; left: 55px;'>"
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
1641 "<div id='clipper' style='overflow:hidden; width:400px; height:300px;'>" 1643 "<div id='clipper' style='overflow:hidden; width:400px; height:300px;'>"
1642 " <div id='child' style='position:relative; width:500px; height: 600px; '></div>" 1644 " <div id='child' style='position:relative; width:500px; height: 600px; '></div>"
1643 "</div>" 1645 "</div>"
1644 ); 1646 );
1645 1647
1646 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(document().getElement ById("clipper")->layoutObject()); 1648 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(document().getElement ById("clipper")->layoutObject());
1647 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties (); 1649 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties ();
1648 LayoutObject* child = document().getElementById("child")->layoutObject(); 1650 LayoutObject* child = document().getElementById("child")->layoutObject();
1649 const ObjectPaintProperties* childProperties = child->objectPaintProperties( ); 1651 const ObjectPaintProperties* childProperties = child->objectPaintProperties( );
1650 1652
1651 EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties ()->geometryPropertyTreeState.transform); 1653 EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties ()->transform);
1652 EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->ge ometryPropertyTreeState.clip); 1654 EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->cl ip);
1653 1655
1654 GeometryPropertyTreeState contentsProperties; 1656 GeometryPropertyTreeState contentsProperties = clipProperties->getContentsPr operties();
1655 clipProperties->getContentsProperties(contentsProperties);
1656 EXPECT_EQ(frameScrollTranslation(), contentsProperties.transform); 1657 EXPECT_EQ(frameScrollTranslation(), contentsProperties.transform);
1657 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip); 1658 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip);
1658 1659
1659 EXPECT_EQ(frameScrollTranslation(), childProperties->localBorderBoxPropertie s()->geometryPropertyTreeState.transform); 1660 EXPECT_EQ(frameScrollTranslation(), childProperties->localBorderBoxPropertie s()->transform);
1660 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro perties()->geometryPropertyTreeState.clip); 1661 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro perties()->clip);
1661 1662
1662 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->geometryProp ertyTreeState.effect); 1663 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->effect);
1663 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); 1664 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper);
1664 } 1665 }
1665 1666
1666 TEST_P(PaintPropertyTreeBuilderTest, OverflowScrollContentsProperties) 1667 TEST_P(PaintPropertyTreeBuilderTest, OverflowScrollContentsProperties)
1667 { 1668 {
1668 // This test verifies the tree builder correctly computes and records the pr operty tree context 1669 // This test verifies the tree builder correctly computes and records the pr operty tree context
1669 // for a (pseudo) stacking context that is scrolled by a containing block th at is not one of 1670 // for a (pseudo) stacking context that is scrolled by a containing block th at is not one of
1670 // the painting ancestors. 1671 // the painting ancestors.
1671 setBodyInnerHTML( 1672 setBodyInnerHTML(
1672 "<style>body { margin: 0; }</style>" 1673 "<style>body { margin: 0; }</style>"
1673 "<div id='clipper' style='overflow:scroll; width:400px; height:300px;'>" 1674 "<div id='clipper' style='overflow:scroll; width:400px; height:300px;'>"
1674 " <div id='child' style='position:relative; width:500px; height: 600px; '></div>" 1675 " <div id='child' style='position:relative; width:500px; height: 600px; '></div>"
1675 " <div style='width: 200px; height: 10000px'>" 1676 " <div style='width: 200px; height: 10000px'>"
1676 "</div>" 1677 "</div>"
1677 ); 1678 );
1678 1679
1679 Element* clipperElement = document().getElementById("clipper"); 1680 Element* clipperElement = document().getElementById("clipper");
1680 clipperElement->scrollTo(1, 2); 1681 clipperElement->scrollTo(1, 2);
1681 1682
1682 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(clipperElement->layou tObject()); 1683 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(clipperElement->layou tObject());
1683 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties (); 1684 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties ();
1684 LayoutObject* child = document().getElementById("child")->layoutObject(); 1685 LayoutObject* child = document().getElementById("child")->layoutObject();
1685 const ObjectPaintProperties* childProperties = child->objectPaintProperties( ); 1686 const ObjectPaintProperties* childProperties = child->objectPaintProperties( );
1686 1687
1687 EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties ()->geometryPropertyTreeState.transform); 1688 EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties ()->transform);
1688 EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->ge ometryPropertyTreeState.clip); 1689 EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->cl ip);
1689 1690
1690 GeometryPropertyTreeState contentsProperties; 1691 GeometryPropertyTreeState contentsProperties = clipProperties->getContentsPr operties();
1691 clipProperties->getContentsProperties(contentsProperties);
1692 EXPECT_EQ(clipProperties->scrollTranslation(), contentsProperties.transform) ; 1692 EXPECT_EQ(clipProperties->scrollTranslation(), contentsProperties.transform) ;
1693 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip); 1693 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip);
1694 1694
1695 EXPECT_EQ(clipProperties->scrollTranslation(), childProperties->localBorderB oxProperties()->geometryPropertyTreeState.transform); 1695 EXPECT_EQ(clipProperties->scrollTranslation(), childProperties->localBorderB oxProperties()->transform);
1696 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro perties()->geometryPropertyTreeState.clip); 1696 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro perties()->clip);
1697 1697
1698 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); 1698 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper);
1699 } 1699 }
1700 1700
1701 TEST_P(PaintPropertyTreeBuilderTest, CssClipContentsProperties) 1701 TEST_P(PaintPropertyTreeBuilderTest, CssClipContentsProperties)
1702 { 1702 {
1703 // This test verifies the tree builder correctly computes and records the pr operty tree context 1703 // This test verifies the tree builder correctly computes and records the pr operty tree context
1704 // for a (pseudo) stacking context that is scrolled by a containing block th at is not one of 1704 // for a (pseudo) stacking context that is scrolled by a containing block th at is not one of
1705 // the painting ancestors. 1705 // the painting ancestors.
1706 setBodyInnerHTML( 1706 setBodyInnerHTML(
1707 "<style>body { margin: 0; }</style>" 1707 "<style>body { margin: 0; }</style>"
1708 "<div id='clipper' style='position: absolute; clip: rect(10px, 80px, 70p x, 40px); width:400px; height:300px;'>" 1708 "<div id='clipper' style='position: absolute; clip: rect(10px, 80px, 70p x, 40px); width:400px; height:300px;'>"
1709 " <div id='child' style='position:relative; width:500px; height: 600px; '></div>" 1709 " <div id='child' style='position:relative; width:500px; height: 600px; '></div>"
1710 "</div>" 1710 "</div>"
1711 ); 1711 );
1712 1712
1713 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(document().getElement ById("clipper")->layoutObject()); 1713 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(document().getElement ById("clipper")->layoutObject());
1714 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties (); 1714 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties ();
1715 LayoutObject* child = document().getElementById("child")->layoutObject(); 1715 LayoutObject* child = document().getElementById("child")->layoutObject();
1716 1716
1717 EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties ()->geometryPropertyTreeState.transform); 1717 EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties ()->transform);
1718 // CSS clip on an element causes it to clip itself, not just descendants. 1718 // CSS clip on an element causes it to clip itself, not just descendants.
1719 EXPECT_EQ(clipProperties->cssClip(), clipProperties->localBorderBoxPropertie s()->geometryPropertyTreeState.clip); 1719 EXPECT_EQ(clipProperties->cssClip(), clipProperties->localBorderBoxPropertie s()->clip);
1720 1720
1721 GeometryPropertyTreeState contentsProperties; 1721 GeometryPropertyTreeState contentsProperties = clipProperties->getContentsPr operties();
1722 clipProperties->getContentsProperties(contentsProperties);
1723 EXPECT_EQ(frameScrollTranslation(), contentsProperties.transform); 1722 EXPECT_EQ(frameScrollTranslation(), contentsProperties.transform);
1724 EXPECT_EQ(clipProperties->cssClip(), contentsProperties.clip); 1723 EXPECT_EQ(clipProperties->cssClip(), contentsProperties.clip);
1725 1724
1726 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); 1725 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper);
1727 } 1726 }
1728 1727
1729 TEST_P(PaintPropertyTreeBuilderTest, SvgLocalToBorderBoxTransformContentsPropert ies) 1728 TEST_P(PaintPropertyTreeBuilderTest, SvgLocalToBorderBoxTransformContentsPropert ies)
1730 { 1729 {
1731 setBodyInnerHTML( 1730 setBodyInnerHTML(
1732 "<style>" 1731 "<style>"
1733 " body {" 1732 " body {"
1734 " margin: 0px;" 1733 " margin: 0px;"
1735 " }" 1734 " }"
1736 " svg {" 1735 " svg {"
1737 " position: absolute;" 1736 " position: absolute;"
1738 " }" 1737 " }"
1739 " rect {" 1738 " rect {"
1740 " transform: translate(100px, 100px);" 1739 " transform: translate(100px, 100px);"
1741 " }" 1740 " }"
1742 "</style>" 1741 "</style>"
1743 "<svg id='svgWithViewBox' width='100px' height='100px' viewBox='50 50 10 0 100'>" 1742 "<svg id='svgWithViewBox' width='100px' height='100px' viewBox='50 50 10 0 100'>"
1744 " <rect id='rect' width='100px' height='100px' />" 1743 " <rect id='rect' width='100px' height='100px' />"
1745 "</svg>"); 1744 "</svg>");
1746 1745
1747 LayoutObject& svgWithViewBox = *document().getElementById("svgWithViewBox")- >layoutObject(); 1746 LayoutObject& svgWithViewBox = *document().getElementById("svgWithViewBox")- >layoutObject();
1748 const ObjectPaintProperties* svgWithViewBoxProperties = svgWithViewBox.objec tPaintProperties(); 1747 const ObjectPaintProperties* svgWithViewBoxProperties = svgWithViewBox.objec tPaintProperties();
1749 1748
1750 EXPECT_EQ(frameScrollTranslation(), svgWithViewBoxProperties->localBorderBox Properties()->geometryPropertyTreeState.transform); 1749 EXPECT_EQ(frameScrollTranslation(), svgWithViewBoxProperties->localBorderBox Properties()->transform);
1751 1750
1752 GeometryPropertyTreeState contentsProperties; 1751 GeometryPropertyTreeState contentsProperties = svgWithViewBoxProperties->get ContentsProperties();
1753 svgWithViewBoxProperties->getContentsProperties(contentsProperties);
1754 EXPECT_EQ(svgWithViewBoxProperties->svgLocalToBorderBoxTransform(), contents Properties.transform); 1752 EXPECT_EQ(svgWithViewBoxProperties->svgLocalToBorderBoxTransform(), contents Properties.transform);
1755 } 1753 }
1756 1754
1757 TEST_P(PaintPropertyTreeBuilderTest, OverflowHiddenScrollProperties) 1755 TEST_P(PaintPropertyTreeBuilderTest, OverflowHiddenScrollProperties)
1758 { 1756 {
1759 setBodyInnerHTML( 1757 setBodyInnerHTML(
1760 "<style>" 1758 "<style>"
1761 " body {" 1759 " body {"
1762 " margin: 0px;" 1760 " margin: 0px;"
1763 " }" 1761 " }"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
2003 { 2001 {
2004 setBodyInnerHTML( 2002 setBodyInnerHTML(
2005 "<svg id='svg' xmlns='http://www.w3.org/2000/svg' width='100px' height=' 100px' style='overflow: visible'>" 2003 "<svg id='svg' xmlns='http://www.w3.org/2000/svg' width='100px' height=' 100px' style='overflow: visible'>"
2006 " <rect width='200' height='200' fill='red' />" 2004 " <rect width='200' height='200' fill='red' />"
2007 "</svg>"); 2005 "</svg>");
2008 2006
2009 EXPECT_FALSE(getLayoutObjectByElementId("svg")->objectPaintProperties()->ove rflowClip()); 2007 EXPECT_FALSE(getLayoutObjectByElementId("svg")->objectPaintProperties()->ove rflowClip());
2010 } 2008 }
2011 2009
2012 } // namespace blink 2010 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698