| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 224 |
| 225 TEST_P(PaintPropertyTreeBuilderTest, FrameScrollingTraditional) | 225 TEST_P(PaintPropertyTreeBuilderTest, FrameScrollingTraditional) |
| 226 { | 226 { |
| 227 setBodyInnerHTML("<style> body { height: 10000px; } </style>"); | 227 setBodyInnerHTML("<style> body { height: 10000px; } </style>"); |
| 228 | 228 |
| 229 document().domWindow()->scrollTo(0, 100); | 229 document().domWindow()->scrollTo(0, 100); |
| 230 | 230 |
| 231 FrameView* frameView = document().view(); | 231 FrameView* frameView = document().view(); |
| 232 frameView->updateAllLifecyclePhases(); | 232 frameView->updateAllLifecyclePhases(); |
| 233 EXPECT_EQ(TransformationMatrix(), framePreTranslation()->matrix()); | 233 EXPECT_EQ(TransformationMatrix(), framePreTranslation()->matrix()); |
| 234 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | 234 EXPECT_TRUE(framePreTranslation()->parent()->isRoot()); |
| 235 EXPECT_TRUE(framePreTranslation()->parent()->isRoot()); | |
| 236 | 235 |
| 237 EXPECT_EQ(TransformationMatrix().translate(0, -100), frameScrollTranslation(
)->matrix()); | 236 EXPECT_EQ(TransformationMatrix().translate(0, -100), frameScrollTranslation(
)->matrix()); |
| 238 EXPECT_EQ(framePreTranslation(), frameScrollTranslation()->parent()); | 237 EXPECT_EQ(framePreTranslation(), frameScrollTranslation()->parent()); |
| 239 EXPECT_EQ(framePreTranslation(), frameContentClip()->localTransformSpace()); | 238 EXPECT_EQ(framePreTranslation(), frameContentClip()->localTransformSpace()); |
| 240 EXPECT_EQ(FloatRoundedRect(0, 0, 800, 600), frameContentClip()->clipRect()); | 239 EXPECT_EQ(FloatRoundedRect(0, 0, 800, 600), frameContentClip()->clipRect()); |
| 241 EXPECT_TRUE(frameContentClip()->parent()->isRoot()); | 240 EXPECT_TRUE(frameContentClip()->parent()->isRoot()); |
| 242 | 241 |
| 243 LayoutViewItem layoutViewItem = document().layoutViewItem(); | 242 LayoutViewItem layoutViewItem = document().layoutViewItem(); |
| 244 const ObjectPaintProperties* layoutViewProperties = layoutViewItem.objectPai
ntProperties(); | 243 const ObjectPaintProperties* layoutViewProperties = layoutViewItem.objectPai
ntProperties(); |
| 245 // http://crbug.com/638415 | 244 // http://crbug.com/638415 |
| 246 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 245 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 247 EXPECT_EQ(nullptr, layoutViewProperties->scrollTranslation()); | 246 EXPECT_EQ(nullptr, layoutViewProperties->scrollTranslation()); |
| 248 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 784, 10000), document().body()-
>layoutObject(), frameView->layoutView()); | 247 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 784, 10000), document().body()-
>layoutObject(), frameView->layoutView()); |
| 249 } | 248 } |
| 250 } | 249 } |
| 251 | 250 |
| 252 TEST_P(PaintPropertyTreeBuilderTest, Perspective) | 251 TEST_P(PaintPropertyTreeBuilderTest, Perspective) |
| 253 { | 252 { |
| 254 loadTestData("perspective.html"); | 253 loadTestData("perspective.html"); |
| 255 | 254 |
| 256 Element* perspective = document().getElementById("perspective"); | 255 Element* perspective = document().getElementById("perspective"); |
| 257 const ObjectPaintProperties* perspectiveProperties = perspective->layoutObje
ct()->objectPaintProperties(); | 256 const ObjectPaintProperties* perspectiveProperties = perspective->layoutObje
ct()->objectPaintProperties(); |
| 258 EXPECT_EQ(TransformationMatrix().applyPerspective(100), perspectivePropertie
s->perspective()->matrix()); | 257 EXPECT_EQ(TransformationMatrix().applyPerspective(100), perspectivePropertie
s->perspective()->matrix()); |
| 259 // The perspective origin is the center of the border box plus accumulated p
aint offset. | 258 // The perspective origin is the center of the border box plus accumulated p
aint offset. |
| 260 EXPECT_EQ(FloatPoint3D(250, 250, 0), perspectiveProperties->perspective()->o
rigin()); | 259 EXPECT_EQ(FloatPoint3D(250, 250, 0), perspectiveProperties->perspective()->o
rigin()); |
| 261 EXPECT_EQ(frameScrollTranslation(), perspectiveProperties->perspective()->pa
rent()); | 260 EXPECT_EQ(framePreTranslation(), perspectiveProperties->perspective()->paren
t()); |
| 262 | 261 |
| 263 // Adding perspective doesn't clear paint offset. The paint offset will be p
assed down to children. | 262 // Adding perspective doesn't clear paint offset. The paint offset will be p
assed down to children. |
| 264 Element* inner = document().getElementById("inner"); | 263 Element* inner = document().getElementById("inner"); |
| 265 const ObjectPaintProperties* innerProperties = inner->layoutObject()->object
PaintProperties(); | 264 const ObjectPaintProperties* innerProperties = inner->layoutObject()->object
PaintProperties(); |
| 266 EXPECT_EQ(TransformationMatrix().translate(50, 100), innerProperties->paintO
ffsetTranslation()->matrix()); | 265 EXPECT_EQ(TransformationMatrix().translate(50, 100), innerProperties->paintO
ffsetTranslation()->matrix()); |
| 267 EXPECT_EQ(perspectiveProperties->perspective(), innerProperties->paintOffset
Translation()->parent()); | 266 EXPECT_EQ(perspectiveProperties->perspective(), innerProperties->paintOffset
Translation()->parent()); |
| 268 CHECK_EXACT_VISUAL_RECT(LayoutRect(50, 100, 100, 200), inner->layoutObject()
, document().view()->layoutView()); | 267 CHECK_EXACT_VISUAL_RECT(LayoutRect(50, 100, 100, 200), inner->layoutObject()
, document().view()->layoutView()); |
| 269 } | 268 } |
| 270 | 269 |
| 271 TEST_P(PaintPropertyTreeBuilderTest, Transform) | 270 TEST_P(PaintPropertyTreeBuilderTest, Transform) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 285 } | 284 } |
| 286 } | 285 } |
| 287 | 286 |
| 288 TEST_P(PaintPropertyTreeBuilderTest, RelativePositionInline) | 287 TEST_P(PaintPropertyTreeBuilderTest, RelativePositionInline) |
| 289 { | 288 { |
| 290 loadTestData("relative-position-inline.html"); | 289 loadTestData("relative-position-inline.html"); |
| 291 | 290 |
| 292 Element* inlineBlock = document().getElementById("inline-block"); | 291 Element* inlineBlock = document().getElementById("inline-block"); |
| 293 const ObjectPaintProperties* inlineBlockProperties = inlineBlock->layoutObje
ct()->objectPaintProperties(); | 292 const ObjectPaintProperties* inlineBlockProperties = inlineBlock->layoutObje
ct()->objectPaintProperties(); |
| 294 EXPECT_EQ(TransformationMatrix().translate(135, 490), inlineBlockProperties-
>paintOffsetTranslation()->matrix()); | 293 EXPECT_EQ(TransformationMatrix().translate(135, 490), inlineBlockProperties-
>paintOffsetTranslation()->matrix()); |
| 295 EXPECT_EQ(frameScrollTranslation(), inlineBlockProperties->paintOffsetTransl
ation()->parent()); | 294 EXPECT_EQ(framePreTranslation(), inlineBlockProperties->paintOffsetTranslati
on()->parent()); |
| 296 CHECK_EXACT_VISUAL_RECT(LayoutRect(135, 490, 10, 20), inlineBlock->layoutObj
ect(), document().view()->layoutView()); | 295 CHECK_EXACT_VISUAL_RECT(LayoutRect(135, 490, 10, 20), inlineBlock->layoutObj
ect(), document().view()->layoutView()); |
| 297 } | 296 } |
| 298 | 297 |
| 299 TEST_P(PaintPropertyTreeBuilderTest, NestedOpacityEffect) | 298 TEST_P(PaintPropertyTreeBuilderTest, NestedOpacityEffect) |
| 300 { | 299 { |
| 301 setBodyInnerHTML( | 300 setBodyInnerHTML( |
| 302 "<div id='nodeWithoutOpacity' style='width: 100px; height: 200px'>" | 301 "<div id='nodeWithoutOpacity' style='width: 100px; height: 200px'>" |
| 303 " <div id='childWithOpacity' style='opacity: 0.5; width: 50px; height:
60px;'>" | 302 " <div id='childWithOpacity' style='opacity: 0.5; width: 50px; height:
60px;'>" |
| 304 " <div id='grandChildWithoutOpacity' style='width: 20px; height: 30px
'>" | 303 " <div id='grandChildWithoutOpacity' style='width: 20px; height: 30px
'>" |
| 305 " <div id='greatGrandChildWithOpacity' style='opacity: 0.2; width:
10px; height: 15px'/>" | 304 " <div id='greatGrandChildWithOpacity' style='opacity: 0.2; width:
10px; height: 15px'/>" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 "<svg id='svgRootWith3dTransform' width='100px' height='100px'>" | 503 "<svg id='svgRootWith3dTransform' width='100px' height='100px'>" |
| 505 " <rect id='rectWith2dTransform' width='100px' height='100px' />" | 504 " <rect id='rectWith2dTransform' width='100px' height='100px' />" |
| 506 "</svg>"); | 505 "</svg>"); |
| 507 | 506 |
| 508 LayoutObject& svgRootWith3dTransform = *document().getElementById("svgRootWi
th3dTransform")->layoutObject(); | 507 LayoutObject& svgRootWith3dTransform = *document().getElementById("svgRootWi
th3dTransform")->layoutObject(); |
| 509 const ObjectPaintProperties* svgRootWith3dTransformProperties = svgRootWith3
dTransform.objectPaintProperties(); | 508 const ObjectPaintProperties* svgRootWith3dTransformProperties = svgRootWith3
dTransform.objectPaintProperties(); |
| 510 EXPECT_EQ(TransformationMatrix().translate3d(1, 2, 3), svgRootWith3dTransfor
mProperties->transform()->matrix()); | 509 EXPECT_EQ(TransformationMatrix().translate3d(1, 2, 3), svgRootWith3dTransfor
mProperties->transform()->matrix()); |
| 511 EXPECT_EQ(FloatPoint3D(50, 50, 0), svgRootWith3dTransformProperties->transfo
rm()->origin()); | 510 EXPECT_EQ(FloatPoint3D(50, 50, 0), svgRootWith3dTransformProperties->transfo
rm()->origin()); |
| 512 EXPECT_EQ(svgRootWith3dTransformProperties->paintOffsetTranslation(), svgRoo
tWith3dTransformProperties->transform()->parent()); | 511 EXPECT_EQ(svgRootWith3dTransformProperties->paintOffsetTranslation(), svgRoo
tWith3dTransformProperties->transform()->parent()); |
| 513 EXPECT_EQ(TransformationMatrix().translate(70, 25), svgRootWith3dTransformPr
operties->paintOffsetTranslation()->matrix()); | 512 EXPECT_EQ(TransformationMatrix().translate(70, 25), svgRootWith3dTransformPr
operties->paintOffsetTranslation()->matrix()); |
| 514 EXPECT_EQ(frameScrollTranslation(), svgRootWith3dTransformProperties->paintO
ffsetTranslation()->parent()); | 513 EXPECT_EQ(framePreTranslation(), svgRootWith3dTransformProperties->paintOffs
etTranslation()->parent()); |
| 515 | 514 |
| 516 LayoutObject& rectWith2dTransform = *document().getElementById("rectWith2dTr
ansform")->layoutObject(); | 515 LayoutObject& rectWith2dTransform = *document().getElementById("rectWith2dTr
ansform")->layoutObject(); |
| 517 const ObjectPaintProperties* rectWith2dTransformProperties = rectWith2dTrans
form.objectPaintProperties(); | 516 const ObjectPaintProperties* rectWith2dTransformProperties = rectWith2dTrans
form.objectPaintProperties(); |
| 518 TransformationMatrix matrix; | 517 TransformationMatrix matrix; |
| 519 matrix.translate(100, 100); | 518 matrix.translate(100, 100); |
| 520 matrix.rotate(45); | 519 matrix.rotate(45); |
| 521 // SVG's transform origin is baked into the transform. | 520 // SVG's transform origin is baked into the transform. |
| 522 matrix.applyTransformOrigin(50, 25, 0); | 521 matrix.applyTransformOrigin(50, 25, 0); |
| 523 EXPECT_EQ(matrix, rectWith2dTransformProperties->transform()->matrix()); | 522 EXPECT_EQ(matrix, rectWith2dTransformProperties->transform()->matrix()); |
| 524 EXPECT_EQ(FloatPoint3D(0, 0, 0), rectWith2dTransformProperties->transform()-
>origin()); | 523 EXPECT_EQ(FloatPoint3D(0, 0, 0), rectWith2dTransformProperties->transform()-
>origin()); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 { | 560 { |
| 562 setBodyInnerHTML( | 561 setBodyInnerHTML( |
| 563 "<style>body { margin: 0px; } </style>" | 562 "<style>body { margin: 0px; } </style>" |
| 564 "<svg id='svg' style='margin-left: 50px; margin-top: 25px; width: 100px;
height: 100px;' />"); | 563 "<svg id='svg' style='margin-left: 50px; margin-top: 25px; width: 100px;
height: 100px;' />"); |
| 565 | 564 |
| 566 LayoutObject& svg = *document().getElementById("svg")->layoutObject(); | 565 LayoutObject& svg = *document().getElementById("svg")->layoutObject(); |
| 567 const ObjectPaintProperties* svgProperties = svg.objectPaintProperties(); | 566 const ObjectPaintProperties* svgProperties = svg.objectPaintProperties(); |
| 568 // Ensure that a paint offset transform is not unnecessarily emitted. | 567 // Ensure that a paint offset transform is not unnecessarily emitted. |
| 569 EXPECT_EQ(nullptr, svgProperties->paintOffsetTranslation()); | 568 EXPECT_EQ(nullptr, svgProperties->paintOffsetTranslation()); |
| 570 EXPECT_EQ(TransformationMatrix().translate(50, 25), svgProperties->svgLocalT
oBorderBoxTransform()->matrix()); | 569 EXPECT_EQ(TransformationMatrix().translate(50, 25), svgProperties->svgLocalT
oBorderBoxTransform()->matrix()); |
| 571 EXPECT_EQ(frameScrollTranslation(), svgProperties->svgLocalToBorderBoxTransf
orm()->parent()); | 570 EXPECT_EQ(framePreTranslation(), svgProperties->svgLocalToBorderBoxTransform
()->parent()); |
| 572 } | 571 } |
| 573 | 572 |
| 574 TEST_P(PaintPropertyTreeBuilderTest, SVGRootLocalToBorderBoxTransformNode) | 573 TEST_P(PaintPropertyTreeBuilderTest, SVGRootLocalToBorderBoxTransformNode) |
| 575 { | 574 { |
| 576 setBodyInnerHTML( | 575 setBodyInnerHTML( |
| 577 "<style>" | 576 "<style>" |
| 578 " body { margin: 0px; }" | 577 " body { margin: 0px; }" |
| 579 " svg { margin-left: 2px; margin-top: 3px; transform: translate(5px, 7p
x); border: 11px solid green; }" | 578 " svg { margin-left: 2px; margin-top: 3px; transform: translate(5px, 7p
x); border: 11px solid green; }" |
| 580 "</style>" | 579 "</style>" |
| 581 "<svg id='svg' width='100px' height='100px' viewBox='0 0 13 13'>" | 580 "<svg id='svg' width='100px' height='100px' viewBox='0 0 13 13'>" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 " }" | 685 " }" |
| 687 " input {" | 686 " input {" |
| 688 " border-width: 5px;" | 687 " border-width: 5px;" |
| 689 " padding: 0;" | 688 " padding: 0;" |
| 690 " }" | 689 " }" |
| 691 "</style>" | 690 "</style>" |
| 692 "<input id='button' type='button' style='width:345px; height:123px' valu
e='some text'/>"); | 691 "<input id='button' type='button' style='width:345px; height:123px' valu
e='some text'/>"); |
| 693 | 692 |
| 694 LayoutObject& button = *document().getElementById("button")->layoutObject(); | 693 LayoutObject& button = *document().getElementById("button")->layoutObject(); |
| 695 const ObjectPaintProperties* buttonProperties = button.objectPaintProperties
(); | 694 const ObjectPaintProperties* buttonProperties = button.objectPaintProperties
(); |
| 696 EXPECT_EQ(frameScrollTranslation(), buttonProperties->overflowClip()->localT
ransformSpace()); | 695 // No scroll translation because the document does not scroll (not enough co
ntent). |
| 696 EXPECT_TRUE(!frameScrollTranslation()); |
| 697 EXPECT_EQ(framePreTranslation(), buttonProperties->overflowClip()->localTran
sformSpace()); |
| 697 EXPECT_EQ(FloatRoundedRect(5, 5, 335, 113), buttonProperties->overflowClip()
->clipRect()); | 698 EXPECT_EQ(FloatRoundedRect(5, 5, 335, 113), buttonProperties->overflowClip()
->clipRect()); |
| 698 EXPECT_EQ(frameContentClip(), buttonProperties->overflowClip()->parent()); | 699 EXPECT_EQ(frameContentClip(), buttonProperties->overflowClip()->parent()); |
| 699 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 345, 123), &button, document().view
()->layoutView()); | 700 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 345, 123), &button, document().view
()->layoutView()); |
| 700 } | 701 } |
| 701 | 702 |
| 702 TEST_P(PaintPropertyTreeBuilderTest, BorderRadiusClip) | 703 TEST_P(PaintPropertyTreeBuilderTest, BorderRadiusClip) |
| 703 { | 704 { |
| 704 setBodyInnerHTML( | 705 setBodyInnerHTML( |
| 705 "<style>" | 706 "<style>" |
| 706 " body {" | 707 " body {" |
| 707 " margin: 0px;" | 708 " margin: 0px;" |
| 708 " }" | 709 " }" |
| 709 " #div {" | 710 " #div {" |
| 710 " border-radius: 12px 34px 56px 78px;" | 711 " border-radius: 12px 34px 56px 78px;" |
| 711 " border-top: 45px solid;" | 712 " border-top: 45px solid;" |
| 712 " border-right: 50px solid;" | 713 " border-right: 50px solid;" |
| 713 " border-bottom: 55px solid;" | 714 " border-bottom: 55px solid;" |
| 714 " border-left: 60px solid;" | 715 " border-left: 60px solid;" |
| 715 " width: 500px;" | 716 " width: 500px;" |
| 716 " height: 400px;" | 717 " height: 400px;" |
| 717 " overflow: scroll;" | 718 " overflow: scroll;" |
| 718 " }" | 719 " }" |
| 719 "</style>" | 720 "</style>" |
| 720 "<div id='div'></div>"); | 721 "<div id='div'></div>"); |
| 721 | 722 |
| 722 LayoutObject& div = *document().getElementById("div")->layoutObject(); | 723 LayoutObject& div = *document().getElementById("div")->layoutObject(); |
| 723 const ObjectPaintProperties* divProperties = div.objectPaintProperties(); | 724 const ObjectPaintProperties* divProperties = div.objectPaintProperties(); |
| 724 EXPECT_EQ(frameScrollTranslation(), divProperties->overflowClip()->localTran
sformSpace()); | 725 // No scroll translation because the document does not scroll (not enough co
ntent). |
| 726 EXPECT_TRUE(!frameScrollTranslation()); |
| 727 EXPECT_EQ(framePreTranslation(), divProperties->overflowClip()->localTransfo
rmSpace()); |
| 725 // The overflow clip rect includes only the padding box. | 728 // The overflow clip rect includes only the padding box. |
| 726 // padding box = border box(500+60+50, 400+45+55) - border outset(60+50, 45+
55) - scrollbars(15, 15) | 729 // padding box = border box(500+60+50, 400+45+55) - border outset(60+50, 45+
55) - scrollbars(15, 15) |
| 727 EXPECT_EQ(FloatRoundedRect(60, 45, 500, 400), divProperties->overflowClip()-
>clipRect()); | 730 EXPECT_EQ(FloatRoundedRect(60, 45, 500, 400), divProperties->overflowClip()-
>clipRect()); |
| 728 const ClipPaintPropertyNode* borderRadiusClip = divProperties->overflowClip(
)->parent(); | 731 const ClipPaintPropertyNode* borderRadiusClip = divProperties->overflowClip(
)->parent(); |
| 729 EXPECT_EQ(frameScrollTranslation(), borderRadiusClip->localTransformSpace())
; | 732 EXPECT_EQ(framePreTranslation(), borderRadiusClip->localTransformSpace()); |
| 730 // The border radius clip is the area enclosed by inner border edge, includi
ng the scrollbars. | 733 // The border radius clip is the area enclosed by inner border edge, includi
ng the scrollbars. |
| 731 // As the border-radius is specified in outer radius, the inner radius is ca
lculated by: | 734 // As the border-radius is specified in outer radius, the inner radius is ca
lculated by: |
| 732 // inner radius = max(outer radius - border width, 0) | 735 // inner radius = max(outer radius - border width, 0) |
| 733 // In the case that two adjacent borders have different width, the inner rad
ius of the corner | 736 // In the case that two adjacent borders have different width, the inner rad
ius of the corner |
| 734 // may transition from one value to the other. i.e. being an ellipse. | 737 // may transition from one value to the other. i.e. being an ellipse. |
| 735 EXPECT_EQ( | 738 EXPECT_EQ( |
| 736 FloatRoundedRect( | 739 FloatRoundedRect( |
| 737 FloatRect(60, 45, 500, 400), // = border box(610, 500) - border outs
et(110, 100) | 740 FloatRect(60, 45, 500, 400), // = border box(610, 500) - border outs
et(110, 100) |
| 738 FloatSize(0, 0), // (top left) = max((12, 12) - (60, 45), (0,
0)) | 741 FloatSize(0, 0), // (top left) = max((12, 12) - (60, 45), (0,
0)) |
| 739 FloatSize(0, 0), // (top right) = max((34, 34) - (50, 45), (0,
0)) | 742 FloatSize(0, 0), // (top right) = max((34, 34) - (50, 45), (0,
0)) |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 "<table>" | 918 "<table>" |
| 916 " <tr><td></td><td></td></tr>" | 919 " <tr><td></td><td></td></tr>" |
| 917 " <tr><td></td><td><div id='target'></div></td></tr>" | 920 " <tr><td></td><td><div id='target'></div></td></tr>" |
| 918 "</table>" | 921 "</table>" |
| 919 ); | 922 ); |
| 920 | 923 |
| 921 LayoutObject& target = *document().getElementById("target")->layoutObject(); | 924 LayoutObject& target = *document().getElementById("target")->layoutObject(); |
| 922 const ObjectPaintProperties* targetProperties = target.objectPaintProperties
(); | 925 const ObjectPaintProperties* targetProperties = target.objectPaintProperties
(); |
| 923 | 926 |
| 924 EXPECT_EQ(LayoutPoint(170, 170), targetProperties->localBorderBoxProperties(
)->paintOffset); | 927 EXPECT_EQ(LayoutPoint(170, 170), targetProperties->localBorderBoxProperties(
)->paintOffset); |
| 925 EXPECT_EQ(frameScrollTranslation(), targetProperties->localBorderBoxProperti
es()->geometryPropertyTreeState.transform); | 928 EXPECT_EQ(framePreTranslation(), targetProperties->localBorderBoxProperties(
)->geometryPropertyTreeState.transform); |
| 926 CHECK_EXACT_VISUAL_RECT(LayoutRect(170, 170, 100, 100), &target, document().
view()->layoutView()); | 929 CHECK_EXACT_VISUAL_RECT(LayoutRect(170, 170, 100, 100), &target, document().
view()->layoutView()); |
| 927 } | 930 } |
| 928 | 931 |
| 929 TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendant) | 932 TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendant) |
| 930 { | 933 { |
| 931 // This test verifies that clip tree hierarchy being generated correctly for
the hard case | 934 // 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. | 935 // such that a fixed position element getting clipped by an absolute positio
n CSS clip. |
| 933 setBodyInnerHTML( | 936 setBodyInnerHTML( |
| 934 "<style>" | 937 "<style>" |
| 935 " #clip {" | 938 " #clip {" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 950 "</style>" | 953 "</style>" |
| 951 "<div id='clip'><div id='fixed'></div></div>" | 954 "<div id='clip'><div id='fixed'></div></div>" |
| 952 ); | 955 ); |
| 953 LayoutRect localClipRect(40, 10, 40, 60); | 956 LayoutRect localClipRect(40, 10, 40, 60); |
| 954 LayoutRect absoluteClipRect = localClipRect; | 957 LayoutRect absoluteClipRect = localClipRect; |
| 955 absoluteClipRect.move(123, 456); | 958 absoluteClipRect.move(123, 456); |
| 956 | 959 |
| 957 LayoutObject& clip = *document().getElementById("clip")->layoutObject(); | 960 LayoutObject& clip = *document().getElementById("clip")->layoutObject(); |
| 958 const ObjectPaintProperties* clipProperties = clip.objectPaintProperties(); | 961 const ObjectPaintProperties* clipProperties = clip.objectPaintProperties(); |
| 959 EXPECT_EQ(frameContentClip(), clipProperties->cssClip()->parent()); | 962 EXPECT_EQ(frameContentClip(), clipProperties->cssClip()->parent()); |
| 960 EXPECT_EQ(frameScrollTranslation(), clipProperties->cssClip()->localTransfor
mSpace()); | 963 EXPECT_EQ(framePreTranslation(), clipProperties->cssClip()->localTransformSp
ace()); |
| 961 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); | 964 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); |
| 962 CHECK_VISUAL_RECT(absoluteClipRect, &clip, document().view()->layoutView(), | 965 CHECK_VISUAL_RECT(absoluteClipRect, &clip, document().view()->layoutView(), |
| 963 // TODO(crbug.com/599939): mapToVisualRectInAncestorSpace() doesn't appl
y css clip on the object itself. | 966 // TODO(crbug.com/599939): mapToVisualRectInAncestorSpace() doesn't appl
y css clip on the object itself. |
| 964 LayoutUnit::max()); | 967 LayoutUnit::max()); |
| 965 | 968 |
| 966 LayoutObject* fixed = document().getElementById("fixed")->layoutObject(); | 969 LayoutObject* fixed = document().getElementById("fixed")->layoutObject(); |
| 967 const ObjectPaintProperties* fixedProperties = fixed->objectPaintProperties(
); | 970 const ObjectPaintProperties* fixedProperties = fixed->objectPaintProperties(
); |
| 968 EXPECT_EQ(clipProperties->cssClip(), fixedProperties->localBorderBoxProperti
es()->geometryPropertyTreeState.clip); | 971 EXPECT_EQ(clipProperties->cssClip(), fixedProperties->localBorderBoxProperti
es()->geometryPropertyTreeState.clip); |
| 969 EXPECT_EQ(framePreTranslation(), fixedProperties->localBorderBoxProperties()
->geometryPropertyTreeState.transform->parent()); | 972 EXPECT_EQ(framePreTranslation(), fixedProperties->localBorderBoxProperties()
->geometryPropertyTreeState.transform->parent()); |
| 970 EXPECT_EQ(TransformationMatrix().translate(654, 321), fixedProperties->local
BorderBoxProperties()->geometryPropertyTreeState.transform->matrix()); | 973 EXPECT_EQ(TransformationMatrix().translate(654, 321), fixedProperties->local
BorderBoxProperties()->geometryPropertyTreeState.transform->matrix()); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 991 " #abs {" | 994 " #abs {" |
| 992 " position: absolute;" | 995 " position: absolute;" |
| 993 " left: 654px;" | 996 " left: 654px;" |
| 994 " top: 321px;" | 997 " top: 321px;" |
| 995 " width: 10px;" | 998 " width: 10px;" |
| 996 " heght: 20px" | 999 " heght: 20px" |
| 997 " }" | 1000 " }" |
| 998 "</style>" | 1001 "</style>" |
| 999 "<div id='clip'><div id='absolute'></div></div>" | 1002 "<div id='clip'><div id='absolute'></div></div>" |
| 1000 ); | 1003 ); |
| 1004 |
| 1001 LayoutRect localClipRect(40, 10, 40, 60); | 1005 LayoutRect localClipRect(40, 10, 40, 60); |
| 1002 LayoutRect absoluteClipRect = localClipRect; | 1006 LayoutRect absoluteClipRect = localClipRect; |
| 1003 absoluteClipRect.move(123, 456); | 1007 absoluteClipRect.move(123, 456); |
| 1004 | 1008 |
| 1005 LayoutObject* clip = document().getElementById("clip")->layoutObject(); | 1009 LayoutObject* clip = document().getElementById("clip")->layoutObject(); |
| 1006 const ObjectPaintProperties* clipProperties = clip->objectPaintProperties(); | 1010 const ObjectPaintProperties* clipProperties = clip->objectPaintProperties(); |
| 1007 EXPECT_EQ(frameContentClip(), clipProperties->cssClip()->parent()); | 1011 EXPECT_EQ(frameContentClip(), clipProperties->cssClip()->parent()); |
| 1008 EXPECT_EQ(frameScrollTranslation(), clipProperties->cssClip()->localTransfor
mSpace()); | 1012 // No scroll translation because the document does not scroll (not enough co
ntent). |
| 1013 EXPECT_TRUE(!frameScrollTranslation()); |
| 1014 EXPECT_EQ(framePreTranslation(), clipProperties->cssClip()->localTransformSp
ace()); |
| 1009 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); | 1015 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); |
| 1010 CHECK_VISUAL_RECT(absoluteClipRect, clip, document().view()->layoutView(), | 1016 CHECK_VISUAL_RECT(absoluteClipRect, clip, document().view()->layoutView(), |
| 1011 // TODO(crbug.com/599939): mapToVisualRectInAncestorSpace() doesn't appl
y css clip on the object itself. | 1017 // TODO(crbug.com/599939): mapToVisualRectInAncestorSpace() doesn't appl
y css clip on the object itself. |
| 1012 LayoutUnit::max()); | 1018 LayoutUnit::max()); |
| 1013 | 1019 |
| 1014 LayoutObject* absolute = document().getElementById("absolute")->layoutObject
(); | 1020 LayoutObject* absolute = document().getElementById("absolute")->layoutObject
(); |
| 1015 const ObjectPaintProperties* absPosProperties = absolute->objectPaintPropert
ies(); | 1021 const ObjectPaintProperties* absPosProperties = absolute->objectPaintPropert
ies(); |
| 1016 EXPECT_EQ(clipProperties->cssClip(), absPosProperties->localBorderBoxPropert
ies()->geometryPropertyTreeState.clip); | 1022 EXPECT_EQ(clipProperties->cssClip(), absPosProperties->localBorderBoxPropert
ies()->geometryPropertyTreeState.clip); |
| 1017 EXPECT_EQ(framePreTranslation(), absPosProperties->localBorderBoxProperties(
)->geometryPropertyTreeState.transform->parent()); | 1023 EXPECT_EQ(framePreTranslation(), absPosProperties->localBorderBoxProperties(
)->geometryPropertyTreeState.transform); |
| 1018 EXPECT_EQ(LayoutPoint(123, 456), absPosProperties->localBorderBoxProperties(
)->paintOffset); | 1024 EXPECT_EQ(LayoutPoint(123, 456), absPosProperties->localBorderBoxProperties(
)->paintOffset); |
| 1019 CHECK_VISUAL_RECT(LayoutRect(), absolute, document().view()->layoutView(), | 1025 CHECK_VISUAL_RECT(LayoutRect(), absolute, document().view()->layoutView(), |
| 1020 // TODO(crbug.com/599939): CSS clip of fixed-position descendants is bro
ken in mapToVisualRectInAncestorSpace(). | 1026 // TODO(crbug.com/599939): CSS clip of fixed-position descendants is bro
ken in mapToVisualRectInAncestorSpace(). |
| 1021 LayoutUnit::max()); | 1027 LayoutUnit::max()); |
| 1022 } | 1028 } |
| 1023 | 1029 |
| 1024 TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendantNonShared) | 1030 TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendantNonShared) |
| 1025 { | 1031 { |
| 1026 // This test is similar to CSSClipFixedPositionDescendant above, except that | 1032 // 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. | 1033 // now we have a parent overflow clip that should be escaped by the fixed de
scendant. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1052 "</style>" | 1058 "</style>" |
| 1053 "<div id='overflow'><div id='clip'><div id='fixed'></div></div></div>" | 1059 "<div id='overflow'><div id='clip'><div id='fixed'></div></div></div>" |
| 1054 ); | 1060 ); |
| 1055 LayoutRect localClipRect(40, 10, 40, 60); | 1061 LayoutRect localClipRect(40, 10, 40, 60); |
| 1056 LayoutRect absoluteClipRect = localClipRect; | 1062 LayoutRect absoluteClipRect = localClipRect; |
| 1057 absoluteClipRect.move(123, 456); | 1063 absoluteClipRect.move(123, 456); |
| 1058 | 1064 |
| 1059 LayoutObject& overflow = *document().getElementById("overflow")->layoutObjec
t(); | 1065 LayoutObject& overflow = *document().getElementById("overflow")->layoutObjec
t(); |
| 1060 const ObjectPaintProperties* overflowProperties = overflow.objectPaintProper
ties(); | 1066 const ObjectPaintProperties* overflowProperties = overflow.objectPaintProper
ties(); |
| 1061 EXPECT_EQ(frameContentClip(), overflowProperties->overflowClip()->parent()); | 1067 EXPECT_EQ(frameContentClip(), overflowProperties->overflowClip()->parent()); |
| 1062 EXPECT_EQ(frameScrollTranslation(), overflowProperties->scrollTranslation()-
>parent()); | 1068 // No scroll translation because the document does not scroll (not enough co
ntent). |
| 1069 EXPECT_TRUE(!frameScrollTranslation()); |
| 1070 EXPECT_EQ(framePreTranslation(), overflowProperties->scrollTranslation()->pa
rent()); |
| 1063 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 50, 50), &overflow, document().view
()->layoutView()); | 1071 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 50, 50), &overflow, document().view
()->layoutView()); |
| 1064 | 1072 |
| 1065 LayoutObject* clip = document().getElementById("clip")->layoutObject(); | 1073 LayoutObject* clip = document().getElementById("clip")->layoutObject(); |
| 1066 const ObjectPaintProperties* clipProperties = clip->objectPaintProperties(); | 1074 const ObjectPaintProperties* clipProperties = clip->objectPaintProperties(); |
| 1067 EXPECT_EQ(overflowProperties->overflowClip(), clipProperties->cssClip()->par
ent()); | 1075 EXPECT_EQ(overflowProperties->overflowClip(), clipProperties->cssClip()->par
ent()); |
| 1068 EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClip()
->localTransformSpace()); | 1076 EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClip()
->localTransformSpace()); |
| 1069 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); | 1077 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
Clip()->clipRect()); |
| 1070 EXPECT_EQ(frameContentClip(), clipProperties->cssClipFixedPosition()->parent
()); | 1078 EXPECT_EQ(frameContentClip(), clipProperties->cssClipFixedPosition()->parent
()); |
| 1071 EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClipFi
xedPosition()->localTransformSpace()); | 1079 EXPECT_EQ(overflowProperties->scrollTranslation(), clipProperties->cssClipFi
xedPosition()->localTransformSpace()); |
| 1072 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
ClipFixedPosition()->clipRect()); | 1080 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), clipProperties->css
ClipFixedPosition()->clipRect()); |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1616 "<div id='clipper' style='overflow:hidden; width:400px; height:300px;'>" | 1624 "<div id='clipper' style='overflow:hidden; width:400px; height:300px;'>" |
| 1617 " <div id='child' style='position:relative; width:500px; height: 600px;
'></div>" | 1625 " <div id='child' style='position:relative; width:500px; height: 600px;
'></div>" |
| 1618 "</div>" | 1626 "</div>" |
| 1619 ); | 1627 ); |
| 1620 | 1628 |
| 1621 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(document().getElement
ById("clipper")->layoutObject()); | 1629 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(document().getElement
ById("clipper")->layoutObject()); |
| 1622 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties
(); | 1630 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties
(); |
| 1623 LayoutObject* child = document().getElementById("child")->layoutObject(); | 1631 LayoutObject* child = document().getElementById("child")->layoutObject(); |
| 1624 const ObjectPaintProperties* childProperties = child->objectPaintProperties(
); | 1632 const ObjectPaintProperties* childProperties = child->objectPaintProperties(
); |
| 1625 | 1633 |
| 1626 EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties
()->geometryPropertyTreeState.transform); | 1634 // No scroll translation because the document does not scroll (not enough co
ntent). |
| 1635 EXPECT_TRUE(!frameScrollTranslation()); |
| 1636 EXPECT_EQ(framePreTranslation(), clipProperties->localBorderBoxProperties()-
>geometryPropertyTreeState.transform); |
| 1627 EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->ge
ometryPropertyTreeState.clip); | 1637 EXPECT_EQ(frameContentClip(), clipProperties->localBorderBoxProperties()->ge
ometryPropertyTreeState.clip); |
| 1628 | 1638 |
| 1629 GeometryPropertyTreeState contentsProperties; | 1639 GeometryPropertyTreeState contentsProperties; |
| 1630 clipProperties->getContentsProperties(contentsProperties); | 1640 clipProperties->getContentsProperties(contentsProperties); |
| 1631 EXPECT_EQ(frameScrollTranslation(), contentsProperties.transform); | 1641 EXPECT_EQ(framePreTranslation(), contentsProperties.transform); |
| 1632 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip); | 1642 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip); |
| 1633 | 1643 |
| 1634 EXPECT_EQ(frameScrollTranslation(), childProperties->localBorderBoxPropertie
s()->geometryPropertyTreeState.transform); | 1644 EXPECT_EQ(framePreTranslation(), childProperties->localBorderBoxProperties()
->geometryPropertyTreeState.transform); |
| 1635 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro
perties()->geometryPropertyTreeState.clip); | 1645 EXPECT_EQ(clipProperties->overflowClip(), childProperties->localBorderBoxPro
perties()->geometryPropertyTreeState.clip); |
| 1636 | 1646 |
| 1637 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->geometryProp
ertyTreeState.effect); | 1647 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->geometryProp
ertyTreeState.effect); |
| 1638 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); | 1648 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); |
| 1639 } | 1649 } |
| 1640 | 1650 |
| 1641 TEST_P(PaintPropertyTreeBuilderTest, OverflowScrollContentsProperties) | 1651 TEST_P(PaintPropertyTreeBuilderTest, OverflowScrollContentsProperties) |
| 1642 { | 1652 { |
| 1643 // This test verifies the tree builder correctly computes and records the pr
operty tree context | 1653 // 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 | 1654 // for a (pseudo) stacking context that is scrolled by a containing block th
at is not one of |
| 1645 // the painting ancestors. | 1655 // the painting ancestors. |
| 1646 setBodyInnerHTML( | 1656 setBodyInnerHTML( |
| 1647 "<style>body { margin: 0; }</style>" | 1657 "<style>body { margin: 0; }</style>" |
| 1648 "<div id='clipper' style='overflow:scroll; width:400px; height:300px;'>" | 1658 "<div id='clipper' style='overflow:scroll; width:400px; height:300px;'>" |
| 1649 " <div id='child' style='position:relative; width:500px; height: 600px;
'></div>" | 1659 " <div id='child' style='position:relative; width:500px; height: 600px;
'></div>" |
| 1650 " <div style='width: 200px; height: 10000px'>" | 1660 " <div style='width: 200px; height: 10000px'></div>" |
| 1651 "</div>" | 1661 "</div>" |
| 1662 "<div id='forceScroll' style='height: 4000px;'></div>" |
| 1652 ); | 1663 ); |
| 1653 | 1664 |
| 1654 Element* clipperElement = document().getElementById("clipper"); | 1665 Element* clipperElement = document().getElementById("clipper"); |
| 1655 clipperElement->scrollTo(1, 2); | 1666 clipperElement->scrollTo(1, 2); |
| 1656 | 1667 |
| 1657 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(clipperElement->layou
tObject()); | 1668 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(clipperElement->layou
tObject()); |
| 1658 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties
(); | 1669 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties
(); |
| 1659 LayoutObject* child = document().getElementById("child")->layoutObject(); | 1670 LayoutObject* child = document().getElementById("child")->layoutObject(); |
| 1660 const ObjectPaintProperties* childProperties = child->objectPaintProperties(
); | 1671 const ObjectPaintProperties* childProperties = child->objectPaintProperties(
); |
| 1661 | 1672 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1682 "<style>body { margin: 0; }</style>" | 1693 "<style>body { margin: 0; }</style>" |
| 1683 "<div id='clipper' style='position: absolute; clip: rect(10px, 80px, 70p
x, 40px); width:400px; height:300px;'>" | 1694 "<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>" | 1695 " <div id='child' style='position:relative; width:500px; height: 600px;
'></div>" |
| 1685 "</div>" | 1696 "</div>" |
| 1686 ); | 1697 ); |
| 1687 | 1698 |
| 1688 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(document().getElement
ById("clipper")->layoutObject()); | 1699 LayoutBoxModelObject* clipper = toLayoutBoxModelObject(document().getElement
ById("clipper")->layoutObject()); |
| 1689 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties
(); | 1700 const ObjectPaintProperties* clipProperties = clipper->objectPaintProperties
(); |
| 1690 LayoutObject* child = document().getElementById("child")->layoutObject(); | 1701 LayoutObject* child = document().getElementById("child")->layoutObject(); |
| 1691 | 1702 |
| 1692 EXPECT_EQ(frameScrollTranslation(), clipProperties->localBorderBoxProperties
()->geometryPropertyTreeState.transform); | 1703 // No scroll translation because the document does not scroll (not enough co
ntent). |
| 1704 EXPECT_TRUE(!frameScrollTranslation()); |
| 1705 EXPECT_EQ(framePreTranslation(), clipProperties->localBorderBoxProperties()-
>geometryPropertyTreeState.transform); |
| 1693 // CSS clip on an element causes it to clip itself, not just descendants. | 1706 // CSS clip on an element causes it to clip itself, not just descendants. |
| 1694 EXPECT_EQ(clipProperties->cssClip(), clipProperties->localBorderBoxPropertie
s()->geometryPropertyTreeState.clip); | 1707 EXPECT_EQ(clipProperties->cssClip(), clipProperties->localBorderBoxPropertie
s()->geometryPropertyTreeState.clip); |
| 1695 | 1708 |
| 1696 GeometryPropertyTreeState contentsProperties; | 1709 GeometryPropertyTreeState contentsProperties; |
| 1697 clipProperties->getContentsProperties(contentsProperties); | 1710 clipProperties->getContentsProperties(contentsProperties); |
| 1698 EXPECT_EQ(frameScrollTranslation(), contentsProperties.transform); | 1711 EXPECT_EQ(framePreTranslation(), contentsProperties.transform); |
| 1699 EXPECT_EQ(clipProperties->cssClip(), contentsProperties.clip); | 1712 EXPECT_EQ(clipProperties->cssClip(), contentsProperties.clip); |
| 1700 | 1713 |
| 1701 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); | 1714 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); |
| 1702 } | 1715 } |
| 1703 | 1716 |
| 1704 TEST_P(PaintPropertyTreeBuilderTest, SvgLocalToBorderBoxTransformContentsPropert
ies) | 1717 TEST_P(PaintPropertyTreeBuilderTest, SvgLocalToBorderBoxTransformContentsPropert
ies) |
| 1705 { | 1718 { |
| 1706 setBodyInnerHTML( | 1719 setBodyInnerHTML( |
| 1707 "<style>" | 1720 "<style>" |
| 1708 " body {" | 1721 " body {" |
| 1709 " margin: 0px;" | 1722 " margin: 0px;" |
| 1710 " }" | 1723 " }" |
| 1711 " svg {" | 1724 " svg {" |
| 1712 " position: absolute;" | 1725 " position: absolute;" |
| 1713 " }" | 1726 " }" |
| 1714 " rect {" | 1727 " rect {" |
| 1715 " transform: translate(100px, 100px);" | 1728 " transform: translate(100px, 100px);" |
| 1716 " }" | 1729 " }" |
| 1717 "</style>" | 1730 "</style>" |
| 1718 "<svg id='svgWithViewBox' width='100px' height='100px' viewBox='50 50 10
0 100'>" | 1731 "<svg id='svgWithViewBox' width='100px' height='100px' viewBox='50 50 10
0 100'>" |
| 1719 " <rect id='rect' width='100px' height='100px' />" | 1732 " <rect id='rect' width='100px' height='100px' />" |
| 1720 "</svg>"); | 1733 "</svg>"); |
| 1721 | 1734 |
| 1722 LayoutObject& svgWithViewBox = *document().getElementById("svgWithViewBox")-
>layoutObject(); | 1735 LayoutObject& svgWithViewBox = *document().getElementById("svgWithViewBox")-
>layoutObject(); |
| 1723 const ObjectPaintProperties* svgWithViewBoxProperties = svgWithViewBox.objec
tPaintProperties(); | 1736 const ObjectPaintProperties* svgWithViewBoxProperties = svgWithViewBox.objec
tPaintProperties(); |
| 1724 | 1737 |
| 1725 EXPECT_EQ(frameScrollTranslation(), svgWithViewBoxProperties->localBorderBox
Properties()->geometryPropertyTreeState.transform); | 1738 EXPECT_EQ(framePreTranslation(), svgWithViewBoxProperties->localBorderBoxPro
perties()->geometryPropertyTreeState.transform); |
| 1726 | 1739 |
| 1727 GeometryPropertyTreeState contentsProperties; | 1740 GeometryPropertyTreeState contentsProperties; |
| 1728 svgWithViewBoxProperties->getContentsProperties(contentsProperties); | 1741 svgWithViewBoxProperties->getContentsProperties(contentsProperties); |
| 1729 EXPECT_EQ(svgWithViewBoxProperties->svgLocalToBorderBoxTransform(), contents
Properties.transform); | 1742 EXPECT_EQ(svgWithViewBoxProperties->svgLocalToBorderBoxTransform(), contents
Properties.transform); |
| 1730 } | 1743 } |
| 1731 | 1744 |
| 1732 TEST_P(PaintPropertyTreeBuilderTest, OverflowHiddenScrollProperties) | 1745 TEST_P(PaintPropertyTreeBuilderTest, OverflowHiddenScrollProperties) |
| 1733 { | 1746 { |
| 1734 setBodyInnerHTML( | 1747 setBodyInnerHTML( |
| 1735 "<style>" | 1748 "<style>" |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2106 | 2119 |
| 2107 // Removing a main thread scrolling reason should update the entire tree. | 2120 // Removing a main thread scrolling reason should update the entire tree. |
| 2108 overflowB->removeAttribute("class"); | 2121 overflowB->removeAttribute("class"); |
| 2109 document().view()->updateAllLifecyclePhases(); | 2122 document().view()->updateAllLifecyclePhases(); |
| 2110 EXPECT_FALSE(overflowA->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); | 2123 EXPECT_FALSE(overflowA->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); |
| 2111 EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); | 2124 EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->h
asMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackgroundAttachment
FixedObjects)); |
| 2112 EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->p
arent()->hasMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackground
AttachmentFixedObjects)); | 2125 EXPECT_FALSE(overflowB->layoutObject()->objectPaintProperties()->scroll()->p
arent()->hasMainThreadScrollingReasons(MainThreadScrollingReason::kHasBackground
AttachmentFixedObjects)); |
| 2113 } | 2126 } |
| 2114 | 2127 |
| 2115 } // namespace blink | 2128 } // namespace blink |
| OLD | NEW |