| OLD | NEW |
| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 Settings::setMockScrollbarsEnabled(false); | 88 Settings::setMockScrollbarsEnabled(false); |
| 89 } | 89 } |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 #define CHECK_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObject, sl
opFactor) \ | 92 #define CHECK_VISUAL_RECT(expected, sourceLayoutObject, ancestorLayoutObject, sl
opFactor) \ |
| 93 do { \ | 93 do { \ |
| 94 GeometryMapper geometryMapper; \ | 94 GeometryMapper geometryMapper; \ |
| 95 LayoutRect source((sourceLayoutObject)->localOverflowRectForPaintInvalidatio
n()); \ | 95 LayoutRect source((sourceLayoutObject)->localOverflowRectForPaintInvalidatio
n()); \ |
| 96 source.moveBy((sourceLayoutObject)->objectPaintProperties()->localBorderBoxP
roperties()->paintOffset); \ | 96 source.moveBy((sourceLayoutObject)->objectPaintProperties()->localBorderBoxP
roperties()->paintOffset); \ |
| 97 bool success = false; \ | 97 bool success = false; \ |
| 98 GeometryPropertyTreeState contentsProperties; \ | 98 const ObjectPaintProperties* ancestorProperies = (ancestorLayoutObject)->obj
ectPaintProperties(); \ |
| 99 (ancestorLayoutObject)->objectPaintProperties()->getContentsProperties(conte
ntsProperties); \ | 99 GeometryPropertyTreeState contentsProperties = ancestorProperies->getContent
sProperties(); \ |
| 100 const auto* sourceBorderBoxProperties = (sourceLayoutObject)->objectPaintPro
perties()->localBorderBoxProperties(); \ |
| 101 GeometryPropertyTreeState localBorderBoxProperties(sourceBorderBoxProperties
->propertyTreeState.transform, sourceBorderBoxProperties->propertyTreeState.clip
, sourceBorderBoxProperties->propertyTreeState.effect); \ |
| 100 FloatRect actual = geometryMapper.mapToVisualRectInDestinationSpace( \ | 102 FloatRect actual = geometryMapper.mapToVisualRectInDestinationSpace( \ |
| 101 FloatRect(source), \ | 103 FloatRect(source), \ |
| 102 (sourceLayoutObject)->objectPaintProperties()->localBorderBoxProperties(
)->geometryPropertyTreeState, \ | 104 localBorderBoxProperties, \ |
| 103 contentsProperties, success); \ | 105 contentsProperties, success); \ |
| 104 ASSERT_TRUE(success); \ | 106 ASSERT_TRUE(success); \ |
| 105 EXPECT_EQ(expected, LayoutRect(actual)) << "GeometryMapper: expected: " << e
xpected.toString() << ", actual: " << actual.toString(); \ | 107 EXPECT_EQ(expected, LayoutRect(actual)) << "GeometryMapper: expected: " << e
xpected.toString() << ", actual: " << actual.toString(); \ |
| 106 \ | 108 \ |
| 107 if (slopFactor == LayoutUnit::max()) \ | 109 if (slopFactor == LayoutUnit::max()) \ |
| 108 break; \ | 110 break; \ |
| 109 LayoutRect slowPathRect = (sourceLayoutObject)->localOverflowRectForPaintInv
alidation(); \ | 111 LayoutRect slowPathRect = (sourceLayoutObject)->localOverflowRectForPaintInv
alidation(); \ |
| 110 (sourceLayoutObject)->mapToVisualRectInAncestorSpace(ancestorLayoutObject, s
lowPathRect); \ | 112 (sourceLayoutObject)->mapToVisualRectInAncestorSpace(ancestorLayoutObject, s
lowPathRect); \ |
| 111 if (slopFactor) { \ | 113 if (slopFactor) { \ |
| 112 LayoutRect inflatedActual = LayoutRect(actual); \ | 114 LayoutRect inflatedActual = LayoutRect(actual); \ |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 " <div style='height:10000px;'></div>" | 846 " <div style='height:10000px;'></div>" |
| 845 "</div>" | 847 "</div>" |
| 846 ); | 848 ); |
| 847 FrameView* frameView = document().view(); | 849 FrameView* frameView = document().view(); |
| 848 | 850 |
| 849 LayoutObject* scroller = document().getElementById("scroller")->layoutObject
(); | 851 LayoutObject* scroller = document().getElementById("scroller")->layoutObject
(); |
| 850 const ObjectPaintProperties* scrollerProperties = scroller->objectPaintPrope
rties(); | 852 const ObjectPaintProperties* scrollerProperties = scroller->objectPaintPrope
rties(); |
| 851 LayoutObject* child = document().getElementById("child")->layoutObject(); | 853 LayoutObject* child = document().getElementById("child")->layoutObject(); |
| 852 const ObjectPaintProperties* childProperties = child->objectPaintProperties(
); | 854 const ObjectPaintProperties* childProperties = child->objectPaintProperties(
); |
| 853 | 855 |
| 854 EXPECT_EQ(scrollerProperties->overflowClip(), childProperties->localBorderBo
xProperties()->geometryPropertyTreeState.clip); | 856 EXPECT_EQ(scrollerProperties->overflowClip(), childProperties->localBorderBo
xProperties()->propertyTreeState.clip); |
| 855 EXPECT_EQ(scrollerProperties->scrollTranslation(), childProperties->localBor
derBoxProperties()->geometryPropertyTreeState.transform); | 857 EXPECT_EQ(scrollerProperties->scrollTranslation(), childProperties->localBor
derBoxProperties()->propertyTreeState.transform); |
| 856 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->geometryProp
ertyTreeState.effect); | 858 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->propertyTree
State.effect); |
| 857 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 400, 300), scroller, frameView->lay
outView()); | 859 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 400, 300), scroller, frameView->lay
outView()); |
| 858 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 100, 200), child, frameView->layout
View()); | 860 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 100, 200), child, frameView->layout
View()); |
| 859 } | 861 } |
| 860 | 862 |
| 861 TEST_P(PaintPropertyTreeBuilderTest, TreeContextUnclipFromParentStackingContext) | 863 TEST_P(PaintPropertyTreeBuilderTest, TreeContextUnclipFromParentStackingContext) |
| 862 { | 864 { |
| 863 // This test verifies the tree builder correctly computes and records the pr
operty tree context | 865 // This test verifies the tree builder correctly computes and records the pr
operty tree context |
| 864 // for a (pseudo) stacking context that has a scrolling painting ancestor th
at is not its | 866 // for a (pseudo) stacking context that has a scrolling painting ancestor th
at is not its |
| 865 // containing block (thus should not be scrolled by it). | 867 // containing block (thus should not be scrolled by it). |
| 866 | 868 |
| 867 setBodyInnerHTML( | 869 setBodyInnerHTML( |
| 868 "<style>body { margin: 0; }</style>" | 870 "<style>body { margin: 0; }</style>" |
| 869 "<div id='scroller' style='overflow:scroll; opacity:0.5;'>" | 871 "<div id='scroller' style='overflow:scroll; opacity:0.5;'>" |
| 870 " <div id='child' style='position:absolute; left:0; top:0; width: 100px
; height: 200px'></div>" | 872 " <div id='child' style='position:absolute; left:0; top:0; width: 100px
; height: 200px'></div>" |
| 871 " <div style='height:10000px;'></div>" | 873 " <div style='height:10000px;'></div>" |
| 872 "</div>" | 874 "</div>" |
| 873 ); | 875 ); |
| 874 | 876 |
| 875 LayoutObject& scroller = *document().getElementById("scroller")->layoutObjec
t(); | 877 LayoutObject& scroller = *document().getElementById("scroller")->layoutObjec
t(); |
| 876 const ObjectPaintProperties* scrollerProperties = scroller.objectPaintProper
ties(); | 878 const ObjectPaintProperties* scrollerProperties = scroller.objectPaintProper
ties(); |
| 877 LayoutObject& child = *document().getElementById("child")->layoutObject(); | 879 LayoutObject& child = *document().getElementById("child")->layoutObject(); |
| 878 const ObjectPaintProperties* childProperties = child.objectPaintProperties()
; | 880 const ObjectPaintProperties* childProperties = child.objectPaintProperties()
; |
| 879 | 881 |
| 880 EXPECT_EQ(frameContentClip(), childProperties->localBorderBoxProperties()->g
eometryPropertyTreeState.clip); | 882 EXPECT_EQ(frameContentClip(), childProperties->localBorderBoxProperties()->p
ropertyTreeState.clip); |
| 881 EXPECT_EQ(frameScrollTranslation(), childProperties->localBorderBoxPropertie
s()->geometryPropertyTreeState.transform); | 883 EXPECT_EQ(frameScrollTranslation(), childProperties->localBorderBoxPropertie
s()->propertyTreeState.transform); |
| 882 EXPECT_EQ(scrollerProperties->effect(), childProperties->localBorderBoxPrope
rties()->geometryPropertyTreeState.effect); | 884 EXPECT_EQ(scrollerProperties->effect(), childProperties->localBorderBoxPrope
rties()->propertyTreeState.effect); |
| 883 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 885 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 884 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 800, 10000), &scroller, documen
t().view()->layoutView()); | 886 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 800, 10000), &scroller, documen
t().view()->layoutView()); |
| 885 } | 887 } |
| 886 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 100, 200), &child, document().view(
)->layoutView()); | 888 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 100, 200), &child, document().view(
)->layoutView()); |
| 887 } | 889 } |
| 888 | 890 |
| 889 TEST_P(PaintPropertyTreeBuilderTest, TableCellLayoutLocation) | 891 TEST_P(PaintPropertyTreeBuilderTest, TableCellLayoutLocation) |
| 890 { | 892 { |
| 891 // This test verifies that the border box space of a table cell is being cor
rectly computed. | 893 // This test verifies that the border box space of a table cell is being cor
rectly computed. |
| 892 // Table cells have weird location adjustment in our layout/paint implementa
tion. | 894 // Table cells have weird location adjustment in our layout/paint implementa
tion. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 915 "<table>" | 917 "<table>" |
| 916 " <tr><td></td><td></td></tr>" | 918 " <tr><td></td><td></td></tr>" |
| 917 " <tr><td></td><td><div id='target'></div></td></tr>" | 919 " <tr><td></td><td><div id='target'></div></td></tr>" |
| 918 "</table>" | 920 "</table>" |
| 919 ); | 921 ); |
| 920 | 922 |
| 921 LayoutObject& target = *document().getElementById("target")->layoutObject(); | 923 LayoutObject& target = *document().getElementById("target")->layoutObject(); |
| 922 const ObjectPaintProperties* targetProperties = target.objectPaintProperties
(); | 924 const ObjectPaintProperties* targetProperties = target.objectPaintProperties
(); |
| 923 | 925 |
| 924 EXPECT_EQ(LayoutPoint(170, 170), targetProperties->localBorderBoxProperties(
)->paintOffset); | 926 EXPECT_EQ(LayoutPoint(170, 170), targetProperties->localBorderBoxProperties(
)->paintOffset); |
| 925 EXPECT_EQ(frameScrollTranslation(), targetProperties->localBorderBoxProperti
es()->geometryPropertyTreeState.transform); | 927 EXPECT_EQ(frameScrollTranslation(), targetProperties->localBorderBoxProperti
es()->propertyTreeState.transform); |
| 926 CHECK_EXACT_VISUAL_RECT(LayoutRect(170, 170, 100, 100), &target, document().
view()->layoutView()); | 928 CHECK_EXACT_VISUAL_RECT(LayoutRect(170, 170, 100, 100), &target, document().
view()->layoutView()); |
| 927 } | 929 } |
| 928 | 930 |
| 929 TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendant) | 931 TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendant) |
| 930 { | 932 { |
| 931 // This test verifies that clip tree hierarchy being generated correctly for
the hard case | 933 // This test verifies that clip tree hierarchy being generated correctly for
the hard case |
| 932 // such that a fixed position element getting clipped by an absolute positio
n CSS clip. | 934 // such that a fixed position element getting clipped by an absolute positio
n CSS clip. |
| 933 setBodyInnerHTML( | 935 setBodyInnerHTML( |
| 934 "<style>" | 936 "<style>" |
| 935 " #clip {" | 937 " #clip {" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 958 const ObjectPaintProperties* clipProperties = clip.objectPaintProperties(); | 960 const ObjectPaintProperties* clipProperties = clip.objectPaintProperties(); |
| 959 EXPECT_EQ(frameContentClip(), clipProperties->cssClip()->parent()); | 961 EXPECT_EQ(frameContentClip(), clipProperties->cssClip()->parent()); |
| 960 EXPECT_EQ(frameScrollTranslation(), clipProperties->cssClip()->localTransfor
mSpace()); | 962 EXPECT_EQ(frameScrollTranslation(), clipProperties->cssClip()->localTransfor
mSpace()); |
| 961 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); | 963 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); |
| 962 CHECK_VISUAL_RECT(absoluteClipRect, &clip, document().view()->layoutView(), | 964 CHECK_VISUAL_RECT(absoluteClipRect, &clip, document().view()->layoutView(), |
| 963 // TODO(crbug.com/599939): mapToVisualRectInAncestorSpace() doesn't appl
y css clip on the object itself. | 965 // TODO(crbug.com/599939): mapToVisualRectInAncestorSpace() doesn't appl
y css clip on the object itself. |
| 964 LayoutUnit::max()); | 966 LayoutUnit::max()); |
| 965 | 967 |
| 966 LayoutObject* fixed = document().getElementById("fixed")->layoutObject(); | 968 LayoutObject* fixed = document().getElementById("fixed")->layoutObject(); |
| 967 const ObjectPaintProperties* fixedProperties = fixed->objectPaintProperties(
); | 969 const ObjectPaintProperties* fixedProperties = fixed->objectPaintProperties(
); |
| 968 EXPECT_EQ(clipProperties->cssClip(), fixedProperties->localBorderBoxProperti
es()->geometryPropertyTreeState.clip); | 970 EXPECT_EQ(clipProperties->cssClip(), fixedProperties->localBorderBoxProperti
es()->propertyTreeState.clip); |
| 969 EXPECT_EQ(framePreTranslation(), fixedProperties->localBorderBoxProperties()
->geometryPropertyTreeState.transform->parent()); | 971 EXPECT_EQ(framePreTranslation(), fixedProperties->localBorderBoxProperties()
->propertyTreeState.transform->parent()); |
| 970 EXPECT_EQ(TransformationMatrix().translate(654, 321), fixedProperties->local
BorderBoxProperties()->geometryPropertyTreeState.transform->matrix()); | 972 EXPECT_EQ(TransformationMatrix().translate(654, 321), fixedProperties->local
BorderBoxProperties()->propertyTreeState.transform->matrix()); |
| 971 EXPECT_EQ(LayoutPoint(), fixedProperties->localBorderBoxProperties()->paintO
ffset); | 973 EXPECT_EQ(LayoutPoint(), fixedProperties->localBorderBoxProperties()->paintO
ffset); |
| 972 CHECK_VISUAL_RECT(LayoutRect(), fixed, document().view()->layoutView(), | 974 CHECK_VISUAL_RECT(LayoutRect(), fixed, document().view()->layoutView(), |
| 973 // TODO(crbug.com/599939): CSS clip of fixed-position descendants is bro
ken in mapToVisualRectInAncestorSpace(). | 975 // TODO(crbug.com/599939): CSS clip of fixed-position descendants is bro
ken in mapToVisualRectInAncestorSpace(). |
| 974 LayoutUnit::max()); | 976 LayoutUnit::max()); |
| 975 } | 977 } |
| 976 | 978 |
| 977 TEST_P(PaintPropertyTreeBuilderTest, CSSClipAbsPositionDescendant) | 979 TEST_P(PaintPropertyTreeBuilderTest, CSSClipAbsPositionDescendant) |
| 978 { | 980 { |
| 979 // This test verifies that clip tree hierarchy being generated correctly for
the hard case | 981 // This test verifies that clip tree hierarchy being generated correctly for
the hard case |
| 980 // such that a fixed position element getting clipped by an absolute positio
n CSS clip. | 982 // such that a fixed position element getting clipped by an absolute positio
n CSS clip. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1006 const ObjectPaintProperties* clipProperties = clip->objectPaintProperties(); | 1008 const ObjectPaintProperties* clipProperties = clip->objectPaintProperties(); |
| 1007 EXPECT_EQ(frameContentClip(), clipProperties->cssClip()->parent()); | 1009 EXPECT_EQ(frameContentClip(), clipProperties->cssClip()->parent()); |
| 1008 EXPECT_EQ(frameScrollTranslation(), clipProperties->cssClip()->localTransfor
mSpace()); | 1010 EXPECT_EQ(frameScrollTranslation(), clipProperties->cssClip()->localTransfor
mSpace()); |
| 1009 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); | 1011 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); |
| 1010 CHECK_VISUAL_RECT(absoluteClipRect, clip, document().view()->layoutView(), | 1012 CHECK_VISUAL_RECT(absoluteClipRect, clip, document().view()->layoutView(), |
| 1011 // TODO(crbug.com/599939): mapToVisualRectInAncestorSpace() doesn't appl
y css clip on the object itself. | 1013 // TODO(crbug.com/599939): mapToVisualRectInAncestorSpace() doesn't appl
y css clip on the object itself. |
| 1012 LayoutUnit::max()); | 1014 LayoutUnit::max()); |
| 1013 | 1015 |
| 1014 LayoutObject* absolute = document().getElementById("absolute")->layoutObject
(); | 1016 LayoutObject* absolute = document().getElementById("absolute")->layoutObject
(); |
| 1015 const ObjectPaintProperties* absPosProperties = absolute->objectPaintPropert
ies(); | 1017 const ObjectPaintProperties* absPosProperties = absolute->objectPaintPropert
ies(); |
| 1016 EXPECT_EQ(clipProperties->cssClip(), absPosProperties->localBorderBoxPropert
ies()->geometryPropertyTreeState.clip); | 1018 EXPECT_EQ(clipProperties->cssClip(), absPosProperties->localBorderBoxPropert
ies()->propertyTreeState.clip); |
| 1017 EXPECT_EQ(framePreTranslation(), absPosProperties->localBorderBoxProperties(
)->geometryPropertyTreeState.transform->parent()); | 1019 EXPECT_EQ(framePreTranslation(), absPosProperties->localBorderBoxProperties(
)->propertyTreeState.transform->parent()); |
| 1018 EXPECT_EQ(LayoutPoint(123, 456), absPosProperties->localBorderBoxProperties(
)->paintOffset); | 1020 EXPECT_EQ(LayoutPoint(123, 456), absPosProperties->localBorderBoxProperties(
)->paintOffset); |
| 1019 CHECK_VISUAL_RECT(LayoutRect(), absolute, document().view()->layoutView(), | 1021 CHECK_VISUAL_RECT(LayoutRect(), absolute, document().view()->layoutView(), |
| 1020 // TODO(crbug.com/599939): CSS clip of fixed-position descendants is bro
ken in mapToVisualRectInAncestorSpace(). | 1022 // TODO(crbug.com/599939): CSS clip of fixed-position descendants is bro
ken in mapToVisualRectInAncestorSpace(). |
| 1021 LayoutUnit::max()); | 1023 LayoutUnit::max()); |
| 1022 } | 1024 } |
| 1023 | 1025 |
| 1024 TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendantNonShared) | 1026 TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendantNonShared) |
| 1025 { | 1027 { |
| 1026 // This test is similar to CSSClipFixedPositionDescendant above, except that | 1028 // This test is similar to CSSClipFixedPositionDescendant above, except that |
| 1027 // now we have a parent overflow clip that should be escaped by the fixed de
scendant. | 1029 // 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 Loading... |
| 1067 EXPECT_EQ(overflowProperties->overflowClip(), clipProperties->cssClip()->par
ent()); | 1069 EXPECT_EQ(overflowProperties->overflowClip(), clipProperties->cssClip()->par
ent()); |
| 1068 EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClip()
->localTransformSpace()); | 1070 EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClip()
->localTransformSpace()); |
| 1069 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); | 1071 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); |
| 1070 EXPECT_EQ(frameContentClip(), clipProperties->cssClipFixedPosition()->parent
()); | 1072 EXPECT_EQ(frameContentClip(), clipProperties->cssClipFixedPosition()->parent
()); |
| 1071 EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClipFi
xedPosition()->localTransformSpace()); | 1073 EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClipFi
xedPosition()->localTransformSpace()); |
| 1072 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
ClipFixedPosition()->clipRect()); | 1074 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
ClipFixedPosition()->clipRect()); |
| 1073 CHECK_EXACT_VISUAL_RECT(LayoutRect(), clip, document().view()->layoutView())
; | 1075 CHECK_EXACT_VISUAL_RECT(LayoutRect(), clip, document().view()->layoutView())
; |
| 1074 | 1076 |
| 1075 LayoutObject* fixed = document().getElementById("fixed")->layoutObject(); | 1077 LayoutObject* fixed = document().getElementById("fixed")->layoutObject(); |
| 1076 const ObjectPaintProperties* fixedProperties = fixed->objectPaintProperties(
); | 1078 const ObjectPaintProperties* fixedProperties = fixed->objectPaintProperties(
); |
| 1077 EXPECT_EQ(clipProperties->cssClipFixedPosition(), fixedProperties->localBord
erBoxProperties()->geometryPropertyTreeState.clip); | 1079 EXPECT_EQ(clipProperties->cssClipFixedPosition(), fixedProperties->localBord
erBoxProperties()->propertyTreeState.clip); |
| 1078 EXPECT_EQ(framePreTranslation(), fixedProperties->localBorderBoxProperties()
->geometryPropertyTreeState.transform->parent()); | 1080 EXPECT_EQ(framePreTranslation(), fixedProperties->localBorderBoxProperties()
->propertyTreeState.transform->parent()); |
| 1079 EXPECT_EQ(TransformationMatrix().translate(654, 321), fixedProperties->local
BorderBoxProperties()->geometryPropertyTreeState.transform->matrix()); | 1081 EXPECT_EQ(TransformationMatrix().translate(654, 321), fixedProperties->local
BorderBoxProperties()->propertyTreeState.transform->matrix()); |
| 1080 EXPECT_EQ(LayoutPoint(), fixedProperties->localBorderBoxProperties()->paintO
ffset); | 1082 EXPECT_EQ(LayoutPoint(), fixedProperties->localBorderBoxProperties()->paintO
ffset); |
| 1081 CHECK_VISUAL_RECT(LayoutRect(), fixed, document().view()->layoutView(), | 1083 CHECK_VISUAL_RECT(LayoutRect(), fixed, document().view()->layoutView(), |
| 1082 // TODO(crbug.com/599939): CSS clip of fixed-position descendants is bro
ken in geometry mapping. | 1084 // TODO(crbug.com/599939): CSS clip of fixed-position descendants is bro
ken in geometry mapping. |
| 1083 LayoutUnit::max()); | 1085 LayoutUnit::max()); |
| 1084 } | 1086 } |
| 1085 | 1087 |
| 1086 TEST_P(PaintPropertyTreeBuilderTest, ColumnSpannerUnderRelativePositioned) | 1088 TEST_P(PaintPropertyTreeBuilderTest, ColumnSpannerUnderRelativePositioned) |
| 1087 { | 1089 { |
| 1088 setBodyInnerHTML( | 1090 setBodyInnerHTML( |
| 1089 "<div style='columns: 3; position: absolute; top: 44px; left: 55px;'>" | 1091 "<div style='columns: 3; position: absolute; top: 44px; left: 55px;'>" |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1616 "<div id='clipper' style='overflow:hidden; width:400px; height:300px;'>" | 1618 "<div id='clipper' style='overflow:hidden; width:400px; height:300px;'>" |
| 1617 " <div id='child' style='position:relative; width:500px; height: 600px;
'></div>" | 1619 " <div id='child' style='position:relative; width:500px; height: 600px;
'></div>" |
| 1618 "</div>" | 1620 "</div>" |
| 1619 ); | 1621 ); |
| 1620 | 1622 |
| 1621 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(document().getElement
ById("clipper")->layoutObject()); | 1623 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(document().getElement
ById("clipper")->layoutObject()); |
| 1622 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties
(); | 1624 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties
(); |
| 1623 LayoutObject* child = document().getElementById("child")->layoutObject(); | 1625 LayoutObject* child = document().getElementById("child")->layoutObject(); |
| 1624 const ObjectPaintProperties* childProperties = child->objectPaintProperties(
); | 1626 const ObjectPaintProperties* childProperties = child->objectPaintProperties(
); |
| 1625 | 1627 |
| 1626 EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties
()->geometryPropertyTreeState.transform); | 1628 EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties
()->propertyTreeState.transform); |
| 1627 EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->ge
ometryPropertyTreeState.clip); | 1629 EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->pr
opertyTreeState.clip); |
| 1628 | 1630 |
| 1629 GeometryPropertyTreeState contentsProperties; | 1631 GeometryPropertyTreeState contentsProperties = clipProperties->getContentsPr
operties(); |
| 1630 clipProperties->getContentsProperties(contentsProperties); | |
| 1631 EXPECT_EQ(frameScrollTranslation(), contentsProperties.transform); | 1632 EXPECT_EQ(frameScrollTranslation(), contentsProperties.transform); |
| 1632 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip); | 1633 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip); |
| 1633 | 1634 |
| 1634 EXPECT_EQ(frameScrollTranslation(), childProperties->localBorderBoxPropertie
s()->geometryPropertyTreeState.transform); | 1635 EXPECT_EQ(frameScrollTranslation(), childProperties->localBorderBoxPropertie
s()->propertyTreeState.transform); |
| 1635 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro
perties()->geometryPropertyTreeState.clip); | 1636 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro
perties()->propertyTreeState.clip); |
| 1636 | 1637 |
| 1637 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->geometryProp
ertyTreeState.effect); | 1638 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->propertyTree
State.effect); |
| 1638 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); | 1639 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); |
| 1639 } | 1640 } |
| 1640 | 1641 |
| 1641 TEST_P(PaintPropertyTreeBuilderTest, OverflowScrollContentsProperties) | 1642 TEST_P(PaintPropertyTreeBuilderTest, OverflowScrollContentsProperties) |
| 1642 { | 1643 { |
| 1643 // This test verifies the tree builder correctly computes and records the pr
operty tree context | 1644 // This test verifies the tree builder correctly computes and records the pr
operty tree context |
| 1644 // for a (pseudo) stacking context that is scrolled by a containing block th
at is not one of | 1645 // for a (pseudo) stacking context that is scrolled by a containing block th
at is not one of |
| 1645 // the painting ancestors. | 1646 // the painting ancestors. |
| 1646 setBodyInnerHTML( | 1647 setBodyInnerHTML( |
| 1647 "<style>body { margin: 0; }</style>" | 1648 "<style>body { margin: 0; }</style>" |
| 1648 "<div id='clipper' style='overflow:scroll; width:400px; height:300px;'>" | 1649 "<div id='clipper' style='overflow:scroll; width:400px; height:300px;'>" |
| 1649 " <div id='child' style='position:relative; width:500px; height: 600px;
'></div>" | 1650 " <div id='child' style='position:relative; width:500px; height: 600px;
'></div>" |
| 1650 " <div style='width: 200px; height: 10000px'>" | 1651 " <div style='width: 200px; height: 10000px'>" |
| 1651 "</div>" | 1652 "</div>" |
| 1652 ); | 1653 ); |
| 1653 | 1654 |
| 1654 Element* clipperElement = document().getElementById("clipper"); | 1655 Element* clipperElement = document().getElementById("clipper"); |
| 1655 clipperElement->scrollTo(1, 2); | 1656 clipperElement->scrollTo(1, 2); |
| 1656 | 1657 |
| 1657 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(clipperElement->layou
tObject()); | 1658 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(clipperElement->layou
tObject()); |
| 1658 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties
(); | 1659 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties
(); |
| 1659 LayoutObject* child = document().getElementById("child")->layoutObject(); | 1660 LayoutObject* child = document().getElementById("child")->layoutObject(); |
| 1660 const ObjectPaintProperties* childProperties = child->objectPaintProperties(
); | 1661 const ObjectPaintProperties* childProperties = child->objectPaintProperties(
); |
| 1661 | 1662 |
| 1662 EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties
()->geometryPropertyTreeState.transform); | 1663 EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties
()->propertyTreeState.transform); |
| 1663 EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->ge
ometryPropertyTreeState.clip); | 1664 EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->pr
opertyTreeState.clip); |
| 1664 | 1665 |
| 1665 GeometryPropertyTreeState contentsProperties; | 1666 GeometryPropertyTreeState contentsProperties = clipProperties->getContentsPr
operties(); |
| 1666 clipProperties->getContentsProperties(contentsProperties); | |
| 1667 EXPECT_EQ(clipProperties->scrollTranslation(), contentsProperties.transform)
; | 1667 EXPECT_EQ(clipProperties->scrollTranslation(), contentsProperties.transform)
; |
| 1668 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip); | 1668 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip); |
| 1669 | 1669 |
| 1670 EXPECT_EQ(clipProperties->scrollTranslation(), childProperties->localBorderB
oxProperties()->geometryPropertyTreeState.transform); | 1670 EXPECT_EQ(clipProperties->scrollTranslation(), childProperties->localBorderB
oxProperties()->propertyTreeState.transform); |
| 1671 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro
perties()->geometryPropertyTreeState.clip); | 1671 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro
perties()->propertyTreeState.clip); |
| 1672 | 1672 |
| 1673 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); | 1673 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); |
| 1674 } | 1674 } |
| 1675 | 1675 |
| 1676 TEST_P(PaintPropertyTreeBuilderTest, CssClipContentsProperties) | 1676 TEST_P(PaintPropertyTreeBuilderTest, CssClipContentsProperties) |
| 1677 { | 1677 { |
| 1678 // This test verifies the tree builder correctly computes and records the pr
operty tree context | 1678 // This test verifies the tree builder correctly computes and records the pr
operty tree context |
| 1679 // for a (pseudo) stacking context that is scrolled by a containing block th
at is not one of | 1679 // for a (pseudo) stacking context that is scrolled by a containing block th
at is not one of |
| 1680 // the painting ancestors. | 1680 // the painting ancestors. |
| 1681 setBodyInnerHTML( | 1681 setBodyInnerHTML( |
| 1682 "<style>body { margin: 0; }</style>" | 1682 "<style>body { margin: 0; }</style>" |
| 1683 "<div id='clipper' style='position: absolute; clip: rect(10px, 80px, 70p
x, 40px); width:400px; height:300px;'>" | 1683 "<div id='clipper' style='position: absolute; clip: rect(10px, 80px, 70p
x, 40px); width:400px; height:300px;'>" |
| 1684 " <div id='child' style='position:relative; width:500px; height: 600px;
'></div>" | 1684 " <div id='child' style='position:relative; width:500px; height: 600px;
'></div>" |
| 1685 "</div>" | 1685 "</div>" |
| 1686 ); | 1686 ); |
| 1687 | 1687 |
| 1688 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(document().getElement
ById("clipper")->layoutObject()); | 1688 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(document().getElement
ById("clipper")->layoutObject()); |
| 1689 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties
(); | 1689 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties
(); |
| 1690 LayoutObject* child = document().getElementById("child")->layoutObject(); | 1690 LayoutObject* child = document().getElementById("child")->layoutObject(); |
| 1691 | 1691 |
| 1692 EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties
()->geometryPropertyTreeState.transform); | 1692 EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties
()->propertyTreeState.transform); |
| 1693 // CSS clip on an element causes it to clip itself, not just descendants. | 1693 // CSS clip on an element causes it to clip itself, not just descendants. |
| 1694 EXPECT_EQ(clipProperties->cssClip(), clipProperties->localBorderBoxPropertie
s()->geometryPropertyTreeState.clip); | 1694 EXPECT_EQ(clipProperties->cssClip(), clipProperties->localBorderBoxPropertie
s()->propertyTreeState.clip); |
| 1695 | 1695 |
| 1696 GeometryPropertyTreeState contentsProperties; | 1696 GeometryPropertyTreeState contentsProperties = clipProperties->getContentsPr
operties(); |
| 1697 clipProperties->getContentsProperties(contentsProperties); | |
| 1698 EXPECT_EQ(frameScrollTranslation(), contentsProperties.transform); | 1697 EXPECT_EQ(frameScrollTranslation(), contentsProperties.transform); |
| 1699 EXPECT_EQ(clipProperties->cssClip(), contentsProperties.clip); | 1698 EXPECT_EQ(clipProperties->cssClip(), contentsProperties.clip); |
| 1700 | 1699 |
| 1701 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); | 1700 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); |
| 1702 } | 1701 } |
| 1703 | 1702 |
| 1704 TEST_P(PaintPropertyTreeBuilderTest, SvgLocalToBorderBoxTransformContentsPropert
ies) | 1703 TEST_P(PaintPropertyTreeBuilderTest, SvgLocalToBorderBoxTransformContentsPropert
ies) |
| 1705 { | 1704 { |
| 1706 setBodyInnerHTML( | 1705 setBodyInnerHTML( |
| 1707 "<style>" | 1706 "<style>" |
| 1708 " body {" | 1707 " body {" |
| 1709 " margin: 0px;" | 1708 " margin: 0px;" |
| 1710 " }" | 1709 " }" |
| 1711 " svg {" | 1710 " svg {" |
| 1712 " position: absolute;" | 1711 " position: absolute;" |
| 1713 " }" | 1712 " }" |
| 1714 " rect {" | 1713 " rect {" |
| 1715 " transform: translate(100px, 100px);" | 1714 " transform: translate(100px, 100px);" |
| 1716 " }" | 1715 " }" |
| 1717 "</style>" | 1716 "</style>" |
| 1718 "<svg id='svgWithViewBox' width='100px' height='100px' viewBox='50 50 10
0 100'>" | 1717 "<svg id='svgWithViewBox' width='100px' height='100px' viewBox='50 50 10
0 100'>" |
| 1719 " <rect id='rect' width='100px' height='100px' />" | 1718 " <rect id='rect' width='100px' height='100px' />" |
| 1720 "</svg>"); | 1719 "</svg>"); |
| 1721 | 1720 |
| 1722 LayoutObject& svgWithViewBox = *document().getElementById("svgWithViewBox")-
>layoutObject(); | 1721 LayoutObject& svgWithViewBox = *document().getElementById("svgWithViewBox")-
>layoutObject(); |
| 1723 const ObjectPaintProperties* svgWithViewBoxProperties = svgWithViewBox.objec
tPaintProperties(); | 1722 const ObjectPaintProperties* svgWithViewBoxProperties = svgWithViewBox.objec
tPaintProperties(); |
| 1724 | 1723 |
| 1725 EXPECT_EQ(frameScrollTranslation(), svgWithViewBoxProperties->localBorderBox
Properties()->geometryPropertyTreeState.transform); | 1724 EXPECT_EQ(frameScrollTranslation(), svgWithViewBoxProperties->localBorderBox
Properties()->propertyTreeState.transform); |
| 1726 | 1725 |
| 1727 GeometryPropertyTreeState contentsProperties; | 1726 GeometryPropertyTreeState contentsProperties = svgWithViewBoxProperties->get
ContentsProperties(); |
| 1728 svgWithViewBoxProperties->getContentsProperties(contentsProperties); | |
| 1729 EXPECT_EQ(svgWithViewBoxProperties->svgLocalToBorderBoxTransform(), contents
Properties.transform); | 1727 EXPECT_EQ(svgWithViewBoxProperties->svgLocalToBorderBoxTransform(), contents
Properties.transform); |
| 1730 } | 1728 } |
| 1731 | 1729 |
| 1732 TEST_P(PaintPropertyTreeBuilderTest, OverflowHiddenScrollProperties) | 1730 TEST_P(PaintPropertyTreeBuilderTest, OverflowHiddenScrollProperties) |
| 1733 { | 1731 { |
| 1734 setBodyInnerHTML( | 1732 setBodyInnerHTML( |
| 1735 "<style>" | 1733 "<style>" |
| 1736 " body {" | 1734 " body {" |
| 1737 " margin: 0px;" | 1735 " margin: 0px;" |
| 1738 " }" | 1736 " }" |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2106 | 2104 |
| 2107 // Removing a main thread scrolling reason should update the entire tree. | 2105 // Removing a main thread scrolling reason should update the entire tree. |
| 2108 overflowB->removeAttribute("class"); | 2106 overflowB->removeAttribute("class"); |
| 2109 document().view()->updateAllLifecyclePhases(); | 2107 document().view()->updateAllLifecyclePhases(); |
| 2110 EXPECT_FALSE(overflowA->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); | 2108 EXPECT_FALSE(overflowA->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); |
| 2111 EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); | 2109 EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); |
| 2112 EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->p
arent()->hasMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackground
AttachmentFixedObjects)); | 2110 EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->p
arent()->hasMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackground
AttachmentFixedObjects)); |
| 2113 } | 2111 } |
| 2114 | 2112 |
| 2115 } // namespace blink | 2113 } // namespace blink |
| OLD | NEW |