| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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()->propertyTreeState.clip.get(); | 54 return document().view()->layoutView()->objectPaintProperties()->loc
alBorderBoxProperties()->geometryPropertyTreeState.clip.get(); |
| 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 Loading... |
| 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 PropertyTreeState contentsProperties; \ | 121 GeometryPropertyTreeState contentsProperties; \ |
| 122 (ancestorLayoutObject)->objectPaintProperties()->getContentsProperties(conte
ntsProperties); \ | 122 (ancestorLayoutObject)->objectPaintProperties()->getContentsProperties(conte
ntsProperties); \ |
| 123 FloatRect actual = geometryMapper.mapToVisualRectInDestinationSpace( \ | 123 FloatRect actual = geometryMapper.mapToVisualRectInDestinationSpace( \ |
| 124 FloatRect(source), \ | 124 FloatRect(source), \ |
| 125 (sourceLayoutObject)->objectPaintProperties()->localBorderBoxProperties(
)->propertyTreeState, \ | 125 (sourceLayoutObject)->objectPaintProperties()->localBorderBoxProperties(
)->geometryPropertyTreeState, \ |
| 126 contentsProperties, success); \ | 126 contentsProperties, success); \ |
| 127 ASSERT_TRUE(success); \ | 127 ASSERT_TRUE(success); \ |
| 128 EXPECT_EQ(expected, LayoutRect(actual)) << "GeometryMapper: expected: " << e
xpected.toString() << ", actual: " << actual.toString(); \ | 128 EXPECT_EQ(expected, LayoutRect(actual)) << "GeometryMapper: expected: " << e
xpected.toString() << ", actual: " << actual.toString(); \ |
| 129 \ | 129 \ |
| 130 if (slopFactor == LayoutUnit::max()) \ | 130 if (slopFactor == LayoutUnit::max()) \ |
| 131 break; \ | 131 break; \ |
| 132 LayoutRect slowPathRect = (sourceLayoutObject)->localOverflowRectForPaintInv
alidation(); \ | 132 LayoutRect slowPathRect = (sourceLayoutObject)->localOverflowRectForPaintInv
alidation(); \ |
| 133 (sourceLayoutObject)->mapToVisualRectInAncestorSpace(ancestorLayoutObject, s
lowPathRect); \ | 133 (sourceLayoutObject)->mapToVisualRectInAncestorSpace(ancestorLayoutObject, s
lowPathRect); \ |
| 134 if (slopFactor) { \ | 134 if (slopFactor) { \ |
| 135 LayoutRect inflatedActual = LayoutRect(actual); \ | 135 LayoutRect inflatedActual = LayoutRect(actual); \ |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 " <div style='height:10000px;'></div>" | 869 " <div style='height:10000px;'></div>" |
| 870 "</div>" | 870 "</div>" |
| 871 ); | 871 ); |
| 872 FrameView* frameView = document().view(); | 872 FrameView* frameView = document().view(); |
| 873 | 873 |
| 874 LayoutObject* scroller = document().getElementById("scroller")->layoutObject
(); | 874 LayoutObject* scroller = document().getElementById("scroller")->layoutObject
(); |
| 875 const ObjectPaintProperties* scrollerProperties = scroller->objectPaintPrope
rties(); | 875 const ObjectPaintProperties* scrollerProperties = scroller->objectPaintPrope
rties(); |
| 876 LayoutObject* child = document().getElementById("child")->layoutObject(); | 876 LayoutObject* child = document().getElementById("child")->layoutObject(); |
| 877 const ObjectPaintProperties* childProperties = child->objectPaintProperties(
); | 877 const ObjectPaintProperties* childProperties = child->objectPaintProperties(
); |
| 878 | 878 |
| 879 EXPECT_EQ(scrollerProperties->overflowClip(), childProperties->localBorderBo
xProperties()->propertyTreeState.clip); | 879 EXPECT_EQ(scrollerProperties->overflowClip(), childProperties->localBorderBo
xProperties()->geometryPropertyTreeState.clip); |
| 880 EXPECT_EQ(scrollerProperties->scrollTranslation(), childProperties->localBor
derBoxProperties()->propertyTreeState.transform); | 880 EXPECT_EQ(scrollerProperties->scrollTranslation(), childProperties->localBor
derBoxProperties()->geometryPropertyTreeState.transform); |
| 881 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->propertyTree
State.effect); | 881 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->geometryProp
ertyTreeState.effect); |
| 882 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 400, 300), scroller, frameView->lay
outView()); | 882 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()); | 883 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 100, 200), child, frameView->layout
View()); |
| 884 } | 884 } |
| 885 | 885 |
| 886 TEST_P(PaintPropertyTreeBuilderTest, TreeContextUnclipFromParentStackingContext) | 886 TEST_P(PaintPropertyTreeBuilderTest, TreeContextUnclipFromParentStackingContext) |
| 887 { | 887 { |
| 888 // This test verifies the tree builder correctly computes and records the pr
operty tree context | 888 // 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 | 889 // 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). | 890 // containing block (thus should not be scrolled by it). |
| 891 | 891 |
| 892 setBodyInnerHTML( | 892 setBodyInnerHTML( |
| 893 "<style>body { margin: 0; }</style>" | 893 "<style>body { margin: 0; }</style>" |
| 894 "<div id='scroller' style='overflow:scroll; opacity:0.5;'>" | 894 "<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>" | 895 " <div id='child' style='position:absolute; left:0; top:0; width: 100px
; height: 200px'></div>" |
| 896 " <div style='height:10000px;'></div>" | 896 " <div style='height:10000px;'></div>" |
| 897 "</div>" | 897 "</div>" |
| 898 ); | 898 ); |
| 899 | 899 |
| 900 LayoutObject& scroller = *document().getElementById("scroller")->layoutObjec
t(); | 900 LayoutObject& scroller = *document().getElementById("scroller")->layoutObjec
t(); |
| 901 const ObjectPaintProperties* scrollerProperties = scroller.objectPaintProper
ties(); | 901 const ObjectPaintProperties* scrollerProperties = scroller.objectPaintProper
ties(); |
| 902 LayoutObject& child = *document().getElementById("child")->layoutObject(); | 902 LayoutObject& child = *document().getElementById("child")->layoutObject(); |
| 903 const ObjectPaintProperties* childProperties = child.objectPaintProperties()
; | 903 const ObjectPaintProperties* childProperties = child.objectPaintProperties()
; |
| 904 | 904 |
| 905 EXPECT_EQ(frameContentClip(), childProperties->localBorderBoxProperties()->p
ropertyTreeState.clip); | 905 EXPECT_EQ(frameContentClip(), childProperties->localBorderBoxProperties()->g
eometryPropertyTreeState.clip); |
| 906 EXPECT_EQ(frameScrollTranslation(), childProperties->localBorderBoxPropertie
s()->propertyTreeState.transform); | 906 EXPECT_EQ(frameScrollTranslation(), childProperties->localBorderBoxPropertie
s()->geometryPropertyTreeState.transform); |
| 907 EXPECT_EQ(scrollerProperties->effect(), childProperties->localBorderBoxPrope
rties()->propertyTreeState.effect); | 907 EXPECT_EQ(scrollerProperties->effect(), childProperties->localBorderBoxPrope
rties()->geometryPropertyTreeState.effect); |
| 908 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 908 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 909 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 800, 10000), &scroller, documen
t().view()->layoutView()); | 909 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 800, 10000), &scroller, documen
t().view()->layoutView()); |
| 910 } | 910 } |
| 911 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 100, 200), &child, document().view(
)->layoutView()); | 911 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 100, 200), &child, document().view(
)->layoutView()); |
| 912 } | 912 } |
| 913 | 913 |
| 914 TEST_P(PaintPropertyTreeBuilderTest, TableCellLayoutLocation) | 914 TEST_P(PaintPropertyTreeBuilderTest, TableCellLayoutLocation) |
| 915 { | 915 { |
| 916 // This test verifies that the border box space of a table cell is being cor
rectly computed. | 916 // 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. | 917 // Table cells have weird location adjustment in our layout/paint implementa
tion. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 940 "<table>" | 940 "<table>" |
| 941 " <tr><td></td><td></td></tr>" | 941 " <tr><td></td><td></td></tr>" |
| 942 " <tr><td></td><td><div id='target'></div></td></tr>" | 942 " <tr><td></td><td><div id='target'></div></td></tr>" |
| 943 "</table>" | 943 "</table>" |
| 944 ); | 944 ); |
| 945 | 945 |
| 946 LayoutObject& target = *document().getElementById("target")->layoutObject(); | 946 LayoutObject& target = *document().getElementById("target")->layoutObject(); |
| 947 const ObjectPaintProperties* targetProperties = target.objectPaintProperties
(); | 947 const ObjectPaintProperties* targetProperties = target.objectPaintProperties
(); |
| 948 | 948 |
| 949 EXPECT_EQ(LayoutPoint(170, 170), targetProperties->localBorderBoxProperties(
)->paintOffset); | 949 EXPECT_EQ(LayoutPoint(170, 170), targetProperties->localBorderBoxProperties(
)->paintOffset); |
| 950 EXPECT_EQ(frameScrollTranslation(), targetProperties->localBorderBoxProperti
es()->propertyTreeState.transform); | 950 EXPECT_EQ(frameScrollTranslation(), targetProperties->localBorderBoxProperti
es()->geometryPropertyTreeState.transform); |
| 951 CHECK_EXACT_VISUAL_RECT(LayoutRect(170, 170, 100, 100), &target, document().
view()->layoutView()); | 951 CHECK_EXACT_VISUAL_RECT(LayoutRect(170, 170, 100, 100), &target, document().
view()->layoutView()); |
| 952 } | 952 } |
| 953 | 953 |
| 954 TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendant) | 954 TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendant) |
| 955 { | 955 { |
| 956 // This test verifies that clip tree hierarchy being generated correctly for
the hard case | 956 // 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. | 957 // such that a fixed position element getting clipped by an absolute positio
n CSS clip. |
| 958 setBodyInnerHTML( | 958 setBodyInnerHTML( |
| 959 "<style>" | 959 "<style>" |
| 960 " #clip {" | 960 " #clip {" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 983 const ObjectPaintProperties* clipProperties = clip.objectPaintProperties(); | 983 const ObjectPaintProperties* clipProperties = clip.objectPaintProperties(); |
| 984 EXPECT_EQ(frameContentClip(), clipProperties->cssClip()->parent()); | 984 EXPECT_EQ(frameContentClip(), clipProperties->cssClip()->parent()); |
| 985 EXPECT_EQ(frameScrollTranslation(), clipProperties->cssClip()->localTransfor
mSpace()); | 985 EXPECT_EQ(frameScrollTranslation(), clipProperties->cssClip()->localTransfor
mSpace()); |
| 986 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); | 986 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); |
| 987 CHECK_VISUAL_RECT(absoluteClipRect, &clip, document().view()->layoutView(), | 987 CHECK_VISUAL_RECT(absoluteClipRect, &clip, document().view()->layoutView(), |
| 988 // TODO(crbug.com/599939): mapToVisualRectInAncestorSpace() doesn't appl
y css clip on the object itself. | 988 // TODO(crbug.com/599939): mapToVisualRectInAncestorSpace() doesn't appl
y css clip on the object itself. |
| 989 LayoutUnit::max()); | 989 LayoutUnit::max()); |
| 990 | 990 |
| 991 LayoutObject* fixed = document().getElementById("fixed")->layoutObject(); | 991 LayoutObject* fixed = document().getElementById("fixed")->layoutObject(); |
| 992 const ObjectPaintProperties* fixedProperties = fixed->objectPaintProperties(
); | 992 const ObjectPaintProperties* fixedProperties = fixed->objectPaintProperties(
); |
| 993 EXPECT_EQ(clipProperties->cssClip(), fixedProperties->localBorderBoxProperti
es()->propertyTreeState.clip); | 993 EXPECT_EQ(clipProperties->cssClip(), fixedProperties->localBorderBoxProperti
es()->geometryPropertyTreeState.clip); |
| 994 EXPECT_EQ(framePreTranslation(), fixedProperties->localBorderBoxProperties()
->propertyTreeState.transform->parent()); | 994 EXPECT_EQ(framePreTranslation(), fixedProperties->localBorderBoxProperties()
->geometryPropertyTreeState.transform->parent()); |
| 995 EXPECT_EQ(TransformationMatrix().translate(654, 321), fixedProperties->local
BorderBoxProperties()->propertyTreeState.transform->matrix()); | 995 EXPECT_EQ(TransformationMatrix().translate(654, 321), fixedProperties->local
BorderBoxProperties()->geometryPropertyTreeState.transform->matrix()); |
| 996 EXPECT_EQ(LayoutPoint(), fixedProperties->localBorderBoxProperties()->paintO
ffset); | 996 EXPECT_EQ(LayoutPoint(), fixedProperties->localBorderBoxProperties()->paintO
ffset); |
| 997 CHECK_VISUAL_RECT(LayoutRect(), fixed, document().view()->layoutView(), | 997 CHECK_VISUAL_RECT(LayoutRect(), fixed, document().view()->layoutView(), |
| 998 // TODO(crbug.com/599939): CSS clip of fixed-position descendants is bro
ken in mapToVisualRectInAncestorSpace(). | 998 // TODO(crbug.com/599939): CSS clip of fixed-position descendants is bro
ken in mapToVisualRectInAncestorSpace(). |
| 999 LayoutUnit::max()); | 999 LayoutUnit::max()); |
| 1000 } | 1000 } |
| 1001 | 1001 |
| 1002 TEST_P(PaintPropertyTreeBuilderTest, CSSClipAbsPositionDescendant) | 1002 TEST_P(PaintPropertyTreeBuilderTest, CSSClipAbsPositionDescendant) |
| 1003 { | 1003 { |
| 1004 // This test verifies that clip tree hierarchy being generated correctly for
the hard case | 1004 // 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. | 1005 // such that a fixed position element getting clipped by an absolute positio
n CSS clip. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1031 const ObjectPaintProperties* clipProperties = clip->objectPaintProperties(); | 1031 const ObjectPaintProperties* clipProperties = clip->objectPaintProperties(); |
| 1032 EXPECT_EQ(frameContentClip(), clipProperties->cssClip()->parent()); | 1032 EXPECT_EQ(frameContentClip(), clipProperties->cssClip()->parent()); |
| 1033 EXPECT_EQ(frameScrollTranslation(), clipProperties->cssClip()->localTransfor
mSpace()); | 1033 EXPECT_EQ(frameScrollTranslation(), clipProperties->cssClip()->localTransfor
mSpace()); |
| 1034 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); | 1034 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); |
| 1035 CHECK_VISUAL_RECT(absoluteClipRect, clip, document().view()->layoutView(), | 1035 CHECK_VISUAL_RECT(absoluteClipRect, clip, document().view()->layoutView(), |
| 1036 // TODO(crbug.com/599939): mapToVisualRectInAncestorSpace() doesn't appl
y css clip on the object itself. | 1036 // TODO(crbug.com/599939): mapToVisualRectInAncestorSpace() doesn't appl
y css clip on the object itself. |
| 1037 LayoutUnit::max()); | 1037 LayoutUnit::max()); |
| 1038 | 1038 |
| 1039 LayoutObject* absolute = document().getElementById("absolute")->layoutObject
(); | 1039 LayoutObject* absolute = document().getElementById("absolute")->layoutObject
(); |
| 1040 const ObjectPaintProperties* absPosProperties = absolute->objectPaintPropert
ies(); | 1040 const ObjectPaintProperties* absPosProperties = absolute->objectPaintPropert
ies(); |
| 1041 EXPECT_EQ(clipProperties->cssClip(), absPosProperties->localBorderBoxPropert
ies()->propertyTreeState.clip); | 1041 EXPECT_EQ(clipProperties->cssClip(), absPosProperties->localBorderBoxPropert
ies()->geometryPropertyTreeState.clip); |
| 1042 EXPECT_EQ(framePreTranslation(), absPosProperties->localBorderBoxProperties(
)->propertyTreeState.transform->parent()); | 1042 EXPECT_EQ(framePreTranslation(), absPosProperties->localBorderBoxProperties(
)->geometryPropertyTreeState.transform->parent()); |
| 1043 EXPECT_EQ(LayoutPoint(123, 456), absPosProperties->localBorderBoxProperties(
)->paintOffset); | 1043 EXPECT_EQ(LayoutPoint(123, 456), absPosProperties->localBorderBoxProperties(
)->paintOffset); |
| 1044 CHECK_VISUAL_RECT(LayoutRect(), absolute, document().view()->layoutView(), | 1044 CHECK_VISUAL_RECT(LayoutRect(), absolute, document().view()->layoutView(), |
| 1045 // TODO(crbug.com/599939): CSS clip of fixed-position descendants is bro
ken in mapToVisualRectInAncestorSpace(). | 1045 // TODO(crbug.com/599939): CSS clip of fixed-position descendants is bro
ken in mapToVisualRectInAncestorSpace(). |
| 1046 LayoutUnit::max()); | 1046 LayoutUnit::max()); |
| 1047 } | 1047 } |
| 1048 | 1048 |
| 1049 TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendantNonShared) | 1049 TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendantNonShared) |
| 1050 { | 1050 { |
| 1051 // This test is similar to CSSClipFixedPositionDescendant above, except that | 1051 // 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. | 1052 // 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... |
| 1092 EXPECT_EQ(overflowProperties->overflowClip(), clipProperties->cssClip()->par
ent()); | 1092 EXPECT_EQ(overflowProperties->overflowClip(), clipProperties->cssClip()->par
ent()); |
| 1093 EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClip()
->localTransformSpace()); | 1093 EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClip()
->localTransformSpace()); |
| 1094 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); | 1094 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); |
| 1095 EXPECT_EQ(frameContentClip(), clipProperties->cssClipFixedPosition()->parent
()); | 1095 EXPECT_EQ(frameContentClip(), clipProperties->cssClipFixedPosition()->parent
()); |
| 1096 EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClipFi
xedPosition()->localTransformSpace()); | 1096 EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClipFi
xedPosition()->localTransformSpace()); |
| 1097 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
ClipFixedPosition()->clipRect()); | 1097 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
ClipFixedPosition()->clipRect()); |
| 1098 CHECK_EXACT_VISUAL_RECT(LayoutRect(), clip, document().view()->layoutView())
; | 1098 CHECK_EXACT_VISUAL_RECT(LayoutRect(), clip, document().view()->layoutView())
; |
| 1099 | 1099 |
| 1100 LayoutObject* fixed = document().getElementById("fixed")->layoutObject(); | 1100 LayoutObject* fixed = document().getElementById("fixed")->layoutObject(); |
| 1101 const ObjectPaintProperties* fixedProperties = fixed->objectPaintProperties(
); | 1101 const ObjectPaintProperties* fixedProperties = fixed->objectPaintProperties(
); |
| 1102 EXPECT_EQ(clipProperties->cssClipFixedPosition(), fixedProperties->localBord
erBoxProperties()->propertyTreeState.clip); | 1102 EXPECT_EQ(clipProperties->cssClipFixedPosition(), fixedProperties->localBord
erBoxProperties()->geometryPropertyTreeState.clip); |
| 1103 EXPECT_EQ(framePreTranslation(), fixedProperties->localBorderBoxProperties()
->propertyTreeState.transform->parent()); | 1103 EXPECT_EQ(framePreTranslation(), fixedProperties->localBorderBoxProperties()
->geometryPropertyTreeState.transform->parent()); |
| 1104 EXPECT_EQ(TransformationMatrix().translate(654, 321), fixedProperties->local
BorderBoxProperties()->propertyTreeState.transform->matrix()); | 1104 EXPECT_EQ(TransformationMatrix().translate(654, 321), fixedProperties->local
BorderBoxProperties()->geometryPropertyTreeState.transform->matrix()); |
| 1105 EXPECT_EQ(LayoutPoint(), fixedProperties->localBorderBoxProperties()->paintO
ffset); | 1105 EXPECT_EQ(LayoutPoint(), fixedProperties->localBorderBoxProperties()->paintO
ffset); |
| 1106 CHECK_VISUAL_RECT(LayoutRect(), fixed, document().view()->layoutView(), | 1106 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. | 1107 // TODO(crbug.com/599939): CSS clip of fixed-position descendants is bro
ken in geometry mapping. |
| 1108 LayoutUnit::max()); | 1108 LayoutUnit::max()); |
| 1109 } | 1109 } |
| 1110 | 1110 |
| 1111 TEST_P(PaintPropertyTreeBuilderTest, ColumnSpannerUnderRelativePositioned) | 1111 TEST_P(PaintPropertyTreeBuilderTest, ColumnSpannerUnderRelativePositioned) |
| 1112 { | 1112 { |
| 1113 setBodyInnerHTML( | 1113 setBodyInnerHTML( |
| 1114 "<div style='columns: 3; position: absolute; top: 44px; left: 55px;'>" | 1114 "<div style='columns: 3; position: absolute; top: 44px; left: 55px;'>" |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1641 "<div id='clipper' style='overflow:hidden; width:400px; height:300px;'>" | 1641 "<div id='clipper' style='overflow:hidden; width:400px; height:300px;'>" |
| 1642 " <div id='child' style='position:relative; width:500px; height: 600px;
'></div>" | 1642 " <div id='child' style='position:relative; width:500px; height: 600px;
'></div>" |
| 1643 "</div>" | 1643 "</div>" |
| 1644 ); | 1644 ); |
| 1645 | 1645 |
| 1646 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(document().getElement
ById("clipper")->layoutObject()); | 1646 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(document().getElement
ById("clipper")->layoutObject()); |
| 1647 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties
(); | 1647 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties
(); |
| 1648 LayoutObject* child = document().getElementById("child")->layoutObject(); | 1648 LayoutObject* child = document().getElementById("child")->layoutObject(); |
| 1649 const ObjectPaintProperties* childProperties = child->objectPaintProperties(
); | 1649 const ObjectPaintProperties* childProperties = child->objectPaintProperties(
); |
| 1650 | 1650 |
| 1651 EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties
()->propertyTreeState.transform); | 1651 EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties
()->geometryPropertyTreeState.transform); |
| 1652 EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->pr
opertyTreeState.clip); | 1652 EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->ge
ometryPropertyTreeState.clip); |
| 1653 | 1653 |
| 1654 PropertyTreeState contentsProperties; | 1654 GeometryPropertyTreeState contentsProperties; |
| 1655 clipProperties->getContentsProperties(contentsProperties); | 1655 clipProperties->getContentsProperties(contentsProperties); |
| 1656 EXPECT_EQ(frameScrollTranslation(), contentsProperties.transform); | 1656 EXPECT_EQ(frameScrollTranslation(), contentsProperties.transform); |
| 1657 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip); | 1657 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip); |
| 1658 | 1658 |
| 1659 EXPECT_EQ(frameScrollTranslation(), childProperties->localBorderBoxPropertie
s()->propertyTreeState.transform); | 1659 EXPECT_EQ(frameScrollTranslation(), childProperties->localBorderBoxPropertie
s()->geometryPropertyTreeState.transform); |
| 1660 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro
perties()->propertyTreeState.clip); | 1660 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro
perties()->geometryPropertyTreeState.clip); |
| 1661 | 1661 |
| 1662 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->propertyTree
State.effect); | 1662 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->geometryProp
ertyTreeState.effect); |
| 1663 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); | 1663 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); |
| 1664 } | 1664 } |
| 1665 | 1665 |
| 1666 TEST_P(PaintPropertyTreeBuilderTest, OverflowScrollContentsProperties) | 1666 TEST_P(PaintPropertyTreeBuilderTest, OverflowScrollContentsProperties) |
| 1667 { | 1667 { |
| 1668 // This test verifies the tree builder correctly computes and records the pr
operty tree context | 1668 // 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 | 1669 // for a (pseudo) stacking context that is scrolled by a containing block th
at is not one of |
| 1670 // the painting ancestors. | 1670 // the painting ancestors. |
| 1671 setBodyInnerHTML( | 1671 setBodyInnerHTML( |
| 1672 "<style>body { margin: 0; }</style>" | 1672 "<style>body { margin: 0; }</style>" |
| 1673 "<div id='clipper' style='overflow:scroll; width:400px; height:300px;'>" | 1673 "<div id='clipper' style='overflow:scroll; width:400px; height:300px;'>" |
| 1674 " <div id='child' style='position:relative; width:500px; height: 600px;
'></div>" | 1674 " <div id='child' style='position:relative; width:500px; height: 600px;
'></div>" |
| 1675 " <div style='width: 200px; height: 10000px'>" | 1675 " <div style='width: 200px; height: 10000px'>" |
| 1676 "</div>" | 1676 "</div>" |
| 1677 ); | 1677 ); |
| 1678 | 1678 |
| 1679 Element* clipperElement = document().getElementById("clipper"); | 1679 Element* clipperElement = document().getElementById("clipper"); |
| 1680 clipperElement->scrollTo(1, 2); | 1680 clipperElement->scrollTo(1, 2); |
| 1681 | 1681 |
| 1682 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(clipperElement->layou
tObject()); | 1682 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(clipperElement->layou
tObject()); |
| 1683 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties
(); | 1683 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties
(); |
| 1684 LayoutObject* child = document().getElementById("child")->layoutObject(); | 1684 LayoutObject* child = document().getElementById("child")->layoutObject(); |
| 1685 const ObjectPaintProperties* childProperties = child->objectPaintProperties(
); | 1685 const ObjectPaintProperties* childProperties = child->objectPaintProperties(
); |
| 1686 | 1686 |
| 1687 EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties
()->propertyTreeState.transform); | 1687 EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties
()->geometryPropertyTreeState.transform); |
| 1688 EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->pr
opertyTreeState.clip); | 1688 EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->ge
ometryPropertyTreeState.clip); |
| 1689 | 1689 |
| 1690 PropertyTreeState contentsProperties; | 1690 GeometryPropertyTreeState contentsProperties; |
| 1691 clipProperties->getContentsProperties(contentsProperties); | 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()->propertyTreeState.transform); | 1695 EXPECT_EQ(clipProperties->scrollTranslation(), childProperties->localBorderB
oxProperties()->geometryPropertyTreeState.transform); |
| 1696 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro
perties()->propertyTreeState.clip); | 1696 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro
perties()->geometryPropertyTreeState.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
()->propertyTreeState.transform); | 1717 EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties
()->geometryPropertyTreeState.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()->propertyTreeState.clip); | 1719 EXPECT_EQ(clipProperties->cssClip(), clipProperties->localBorderBoxPropertie
s()->geometryPropertyTreeState.clip); |
| 1720 | 1720 |
| 1721 PropertyTreeState contentsProperties; | 1721 GeometryPropertyTreeState contentsProperties; |
| 1722 clipProperties->getContentsProperties(contentsProperties); | 1722 clipProperties->getContentsProperties(contentsProperties); |
| 1723 EXPECT_EQ(frameScrollTranslation(), contentsProperties.transform); | 1723 EXPECT_EQ(frameScrollTranslation(), contentsProperties.transform); |
| 1724 EXPECT_EQ(clipProperties->cssClip(), contentsProperties.clip); | 1724 EXPECT_EQ(clipProperties->cssClip(), contentsProperties.clip); |
| 1725 | 1725 |
| 1726 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); | 1726 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); |
| 1727 } | 1727 } |
| 1728 | 1728 |
| 1729 TEST_P(PaintPropertyTreeBuilderTest, SvgLocalToBorderBoxTransformContentsPropert
ies) | 1729 TEST_P(PaintPropertyTreeBuilderTest, SvgLocalToBorderBoxTransformContentsPropert
ies) |
| 1730 { | 1730 { |
| 1731 setBodyInnerHTML( | 1731 setBodyInnerHTML( |
| 1732 "<style>" | 1732 "<style>" |
| 1733 " body {" | 1733 " body {" |
| 1734 " margin: 0px;" | 1734 " margin: 0px;" |
| 1735 " }" | 1735 " }" |
| 1736 " svg {" | 1736 " svg {" |
| 1737 " position: absolute;" | 1737 " position: absolute;" |
| 1738 " }" | 1738 " }" |
| 1739 " rect {" | 1739 " rect {" |
| 1740 " transform: translate(100px, 100px);" | 1740 " transform: translate(100px, 100px);" |
| 1741 " }" | 1741 " }" |
| 1742 "</style>" | 1742 "</style>" |
| 1743 "<svg id='svgWithViewBox' width='100px' height='100px' viewBox='50 50 10
0 100'>" | 1743 "<svg id='svgWithViewBox' width='100px' height='100px' viewBox='50 50 10
0 100'>" |
| 1744 " <rect id='rect' width='100px' height='100px' />" | 1744 " <rect id='rect' width='100px' height='100px' />" |
| 1745 "</svg>"); | 1745 "</svg>"); |
| 1746 | 1746 |
| 1747 LayoutObject& svgWithViewBox = *document().getElementById("svgWithViewBox")-
>layoutObject(); | 1747 LayoutObject& svgWithViewBox = *document().getElementById("svgWithViewBox")-
>layoutObject(); |
| 1748 const ObjectPaintProperties* svgWithViewBoxProperties = svgWithViewBox.objec
tPaintProperties(); | 1748 const ObjectPaintProperties* svgWithViewBoxProperties = svgWithViewBox.objec
tPaintProperties(); |
| 1749 | 1749 |
| 1750 EXPECT_EQ(frameScrollTranslation(), svgWithViewBoxProperties->localBorderBox
Properties()->propertyTreeState.transform); | 1750 EXPECT_EQ(frameScrollTranslation(), svgWithViewBoxProperties->localBorderBox
Properties()->geometryPropertyTreeState.transform); |
| 1751 | 1751 |
| 1752 PropertyTreeState contentsProperties; | 1752 GeometryPropertyTreeState contentsProperties; |
| 1753 svgWithViewBoxProperties->getContentsProperties(contentsProperties); | 1753 svgWithViewBoxProperties->getContentsProperties(contentsProperties); |
| 1754 EXPECT_EQ(svgWithViewBoxProperties->svgLocalToBorderBoxTransform(), contents
Properties.transform); | 1754 EXPECT_EQ(svgWithViewBoxProperties->svgLocalToBorderBoxTransform(), contents
Properties.transform); |
| 1755 } | 1755 } |
| 1756 | 1756 |
| 1757 TEST_P(PaintPropertyTreeBuilderTest, OverflowHiddenScrollProperties) | 1757 TEST_P(PaintPropertyTreeBuilderTest, OverflowHiddenScrollProperties) |
| 1758 { | 1758 { |
| 1759 setBodyInnerHTML( | 1759 setBodyInnerHTML( |
| 1760 "<style>" | 1760 "<style>" |
| 1761 " body {" | 1761 " body {" |
| 1762 " margin: 0px;" | 1762 " margin: 0px;" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1981 // The overflow child's scroll node should be a child of the parent's (overf
lowA) scroll node. | 1981 // The overflow child's scroll node should be a child of the parent's (overf
lowA) scroll node. |
| 1982 EXPECT_EQ(overflowAScrollProperties->scroll(), overflowBScrollProperties->sc
roll()->parent()); | 1982 EXPECT_EQ(overflowAScrollProperties->scroll(), overflowBScrollProperties->sc
roll()->parent()); |
| 1983 EXPECT_EQ(TransformationMatrix().translate(0, -41), overflowBScrollPropertie
s->scroll()->scrollOffsetTranslation()->matrix()); | 1983 EXPECT_EQ(TransformationMatrix().translate(0, -41), overflowBScrollPropertie
s->scroll()->scrollOffsetTranslation()->matrix()); |
| 1984 EXPECT_EQ(IntSize(5, 3), overflowBScrollProperties->scroll()->clip()); | 1984 EXPECT_EQ(IntSize(5, 3), overflowBScrollProperties->scroll()->clip()); |
| 1985 EXPECT_EQ(IntSize(5, 100), overflowBScrollProperties->scroll()->bounds()); | 1985 EXPECT_EQ(IntSize(5, 100), overflowBScrollProperties->scroll()->bounds()); |
| 1986 EXPECT_TRUE(overflowBScrollProperties->scroll()->userScrollableHorizontal())
; | 1986 EXPECT_TRUE(overflowBScrollProperties->scroll()->userScrollableHorizontal())
; |
| 1987 EXPECT_TRUE(overflowBScrollProperties->scroll()->userScrollableVertical()); | 1987 EXPECT_TRUE(overflowBScrollProperties->scroll()->userScrollableVertical()); |
| 1988 } | 1988 } |
| 1989 | 1989 |
| 1990 } // namespace blink | 1990 } // namespace blink |
| OLD | NEW |