| 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/paint/PaintPropertyTreeBuilderTest.h" | 5 #include "core/paint/PaintPropertyTreeBuilderTest.h" |
| 6 | 6 |
| 7 #include "core/html/HTMLIFrameElement.h" | 7 #include "core/html/HTMLIFrameElement.h" |
| 8 #include "core/layout/LayoutTreeAsText.h" | 8 #include "core/layout/LayoutTreeAsText.h" |
| 9 #include "core/paint/ObjectPaintProperties.h" | 9 #include "core/paint/ObjectPaintProperties.h" |
| 10 #include "core/paint/PaintPropertyTreePrinter.h" | 10 #include "core/paint/PaintPropertyTreePrinter.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 Settings::setMockScrollbarsEnabled(false); | 75 Settings::setMockScrollbarsEnabled(false); |
| 76 } | 76 } |
| 77 | 77 |
| 78 #define CHECK_VISUAL_RECT(expected, sourceObject, ancestorObject, slopFactor) \ | 78 #define CHECK_VISUAL_RECT(expected, sourceObject, ancestorObject, slopFactor) \ |
| 79 do { \ | 79 do { \ |
| 80 if ((sourceObject)->hasLayer() && (ancestorObject)->hasLayer()) { \ | 80 if ((sourceObject)->hasLayer() && (ancestorObject)->hasLayer()) { \ |
| 81 auto geometryMapper = GeometryMapper::create(); \ | 81 auto geometryMapper = GeometryMapper::create(); \ |
| 82 LayoutRect source((sourceObject)->localVisualRect()); \ | 82 LayoutRect source((sourceObject)->localVisualRect()); \ |
| 83 source.moveBy((sourceObject)->paintOffset()); \ | 83 source.moveBy((sourceObject)->paintOffset()); \ |
| 84 const auto& contentsProperties = \ | 84 const auto& contentsProperties = \ |
| 85 *(ancestorObject)->paintProperties()->contentsProperties(); \ | 85 *(ancestorObject)->contentsProperties(); \ |
| 86 FloatRect actualFloatRect(source); \ | 86 FloatRect actualFloatRect(source); \ |
| 87 geometryMapper->sourceToDestinationVisualRect( \ | 87 geometryMapper->sourceToDestinationVisualRect( \ |
| 88 *(sourceObject)->paintProperties()->localBorderBoxProperties(), \ | 88 *(sourceObject)->localBorderBoxProperties(), contentsProperties, \ |
| 89 contentsProperties, actualFloatRect); \ | 89 actualFloatRect); \ |
| 90 LayoutRect actual(actualFloatRect); \ | 90 LayoutRect actual(actualFloatRect); \ |
| 91 actual.moveBy(-(ancestorObject)->paintOffset()); \ | 91 actual.moveBy(-(ancestorObject)->paintOffset()); \ |
| 92 SCOPED_TRACE("GeometryMapper: "); \ | 92 SCOPED_TRACE("GeometryMapper: "); \ |
| 93 EXPECT_EQ(expected, actual); \ | 93 EXPECT_EQ(expected, actual); \ |
| 94 } \ | 94 } \ |
| 95 \ | 95 \ |
| 96 if (slopFactor == LayoutUnit::max()) \ | 96 if (slopFactor == LayoutUnit::max()) \ |
| 97 break; \ | 97 break; \ |
| 98 LayoutRect slowPathRect = (sourceObject)->localVisualRect(); \ | 98 LayoutRect slowPathRect = (sourceObject)->localVisualRect(); \ |
| 99 (sourceObject) \ | 99 (sourceObject) \ |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 EXPECT_TRUE(framePreTranslation()->parent()->isRoot()); | 257 EXPECT_TRUE(framePreTranslation()->parent()->isRoot()); |
| 258 | 258 |
| 259 EXPECT_EQ(TransformationMatrix().translate(0, -100), | 259 EXPECT_EQ(TransformationMatrix().translate(0, -100), |
| 260 frameScrollTranslation()->matrix()); | 260 frameScrollTranslation()->matrix()); |
| 261 EXPECT_EQ(framePreTranslation(), frameScrollTranslation()->parent()); | 261 EXPECT_EQ(framePreTranslation(), frameScrollTranslation()->parent()); |
| 262 EXPECT_EQ(framePreTranslation(), frameContentClip()->localTransformSpace()); | 262 EXPECT_EQ(framePreTranslation(), frameContentClip()->localTransformSpace()); |
| 263 EXPECT_EQ(FloatRoundedRect(0, 0, 800, 600), frameContentClip()->clipRect()); | 263 EXPECT_EQ(FloatRoundedRect(0, 0, 800, 600), frameContentClip()->clipRect()); |
| 264 EXPECT_TRUE(frameContentClip()->parent()->isRoot()); | 264 EXPECT_TRUE(frameContentClip()->parent()->isRoot()); |
| 265 | 265 |
| 266 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 266 if (!RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 267 const auto* viewProperties = frameView->layoutView()->paintProperties(); | 267 // No scroll properties should be present. |
| 268 EXPECT_EQ(nullptr, viewProperties->scrollTranslation()); | 268 EXPECT_EQ(nullptr, frameView->layoutView()->paintProperties()); |
| 269 } | 269 } |
| 270 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 784, 10000), | 270 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 784, 10000), |
| 271 document().body()->layoutObject(), | 271 document().body()->layoutObject(), |
| 272 frameView->layoutView()); | 272 frameView->layoutView()); |
| 273 } | 273 } |
| 274 | 274 |
| 275 TEST_P(PaintPropertyTreeBuilderTest, Perspective) { | 275 TEST_P(PaintPropertyTreeBuilderTest, Perspective) { |
| 276 setBodyInnerHTML( | 276 setBodyInnerHTML( |
| 277 "<style>" | 277 "<style>" |
| 278 " #perspective {" | 278 " #perspective {" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 | 482 |
| 483 TEST_P(PaintPropertyTreeBuilderTest, WillChangeContents) { | 483 TEST_P(PaintPropertyTreeBuilderTest, WillChangeContents) { |
| 484 setBodyInnerHTML( | 484 setBodyInnerHTML( |
| 485 "<style> body { margin: 0 } </style>" | 485 "<style> body { margin: 0 } </style>" |
| 486 "<div id='transform' style='margin-left: 50px; margin-top: 100px;" | 486 "<div id='transform' style='margin-left: 50px; margin-top: 100px;" |
| 487 " width: 400px; height: 300px;" | 487 " width: 400px; height: 300px;" |
| 488 " will-change: transform, contents'>" | 488 " will-change: transform, contents'>" |
| 489 "</div>"); | 489 "</div>"); |
| 490 | 490 |
| 491 Element* transform = document().getElementById("transform"); | 491 Element* transform = document().getElementById("transform"); |
| 492 const ObjectPaintProperties* transformProperties = | 492 EXPECT_EQ(nullptr, transform->layoutObject()->paintProperties()); |
| 493 transform->layoutObject()->paintProperties(); | |
| 494 | |
| 495 EXPECT_EQ(nullptr, transformProperties->transform()); | |
| 496 EXPECT_EQ(nullptr, transformProperties->paintOffsetTranslation()); | |
| 497 | |
| 498 CHECK_EXACT_VISUAL_RECT(LayoutRect(50, 100, 400, 300), | 493 CHECK_EXACT_VISUAL_RECT(LayoutRect(50, 100, 400, 300), |
| 499 transform->layoutObject(), | 494 transform->layoutObject(), |
| 500 document().view()->layoutView()); | 495 document().view()->layoutView()); |
| 501 } | 496 } |
| 502 | 497 |
| 503 TEST_P(PaintPropertyTreeBuilderTest, RelativePositionInline) { | 498 TEST_P(PaintPropertyTreeBuilderTest, RelativePositionInline) { |
| 504 loadTestData("relative-position-inline.html"); | 499 loadTestData("relative-position-inline.html"); |
| 505 | 500 |
| 506 Element* inlineBlock = document().getElementById("inline-block"); | 501 Element* inlineBlock = document().getElementById("inline-block"); |
| 507 const ObjectPaintProperties* inlineBlockProperties = | 502 const ObjectPaintProperties* inlineBlockProperties = |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 EXPECT_EQ(0.6f, nodeWithOpacityProperties->effect()->opacity()); | 633 EXPECT_EQ(0.6f, nodeWithOpacityProperties->effect()->opacity()); |
| 639 EXPECT_NE(nullptr, nodeWithOpacityProperties->effect()->parent()); | 634 EXPECT_NE(nullptr, nodeWithOpacityProperties->effect()->parent()); |
| 640 EXPECT_EQ(nullptr, nodeWithOpacityProperties->transform()); | 635 EXPECT_EQ(nullptr, nodeWithOpacityProperties->transform()); |
| 641 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 100, 200), nodeWithOpacity, | 636 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 100, 200), nodeWithOpacity, |
| 642 document().view()->layoutView()); | 637 document().view()->layoutView()); |
| 643 | 638 |
| 644 LayoutObject* childWithStackingContext = | 639 LayoutObject* childWithStackingContext = |
| 645 document().getElementById("childWithStackingContext")->layoutObject(); | 640 document().getElementById("childWithStackingContext")->layoutObject(); |
| 646 const ObjectPaintProperties* childWithStackingContextProperties = | 641 const ObjectPaintProperties* childWithStackingContextProperties = |
| 647 childWithStackingContext->paintProperties(); | 642 childWithStackingContext->paintProperties(); |
| 648 EXPECT_EQ(nullptr, childWithStackingContextProperties->effect()); | 643 EXPECT_EQ(nullptr, childWithStackingContextProperties); |
| 649 EXPECT_EQ(nullptr, childWithStackingContextProperties->transform()); | |
| 650 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 50, 60), childWithStackingContext, | 644 CHECK_EXACT_VISUAL_RECT(LayoutRect(8, 8, 50, 60), childWithStackingContext, |
| 651 document().view()->layoutView()); | 645 document().view()->layoutView()); |
| 652 | 646 |
| 653 LayoutObject* grandChildWithOpacity = | 647 LayoutObject* grandChildWithOpacity = |
| 654 document().getElementById("grandChildWithOpacity")->layoutObject(); | 648 document().getElementById("grandChildWithOpacity")->layoutObject(); |
| 655 const ObjectPaintProperties* grandChildWithOpacityProperties = | 649 const ObjectPaintProperties* grandChildWithOpacityProperties = |
| 656 grandChildWithOpacity->paintProperties(); | 650 grandChildWithOpacity->paintProperties(); |
| 657 EXPECT_EQ(0.4f, grandChildWithOpacityProperties->effect()->opacity()); | 651 EXPECT_EQ(0.4f, grandChildWithOpacityProperties->effect()->opacity()); |
| 658 EXPECT_EQ(nodeWithOpacityProperties->effect(), | 652 EXPECT_EQ(nodeWithOpacityProperties->effect(), |
| 659 grandChildWithOpacityProperties->effect()->parent()); | 653 grandChildWithOpacityProperties->effect()->parent()); |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 LayoutObject& container = | 1022 LayoutObject& container = |
| 1029 *document().getElementById("container")->layoutObject(); | 1023 *document().getElementById("container")->layoutObject(); |
| 1030 const ObjectPaintProperties* containerProperties = | 1024 const ObjectPaintProperties* containerProperties = |
| 1031 container.paintProperties(); | 1025 container.paintProperties(); |
| 1032 EXPECT_EQ(TransformationMatrix().translate(20, 30), | 1026 EXPECT_EQ(TransformationMatrix().translate(20, 30), |
| 1033 containerProperties->transform()->matrix()); | 1027 containerProperties->transform()->matrix()); |
| 1034 EXPECT_EQ(svgProperties->transform(), | 1028 EXPECT_EQ(svgProperties->transform(), |
| 1035 containerProperties->transform()->parent()); | 1029 containerProperties->transform()->parent()); |
| 1036 | 1030 |
| 1037 Element* fixed = document().getElementById("fixed"); | 1031 Element* fixed = document().getElementById("fixed"); |
| 1038 const ObjectPaintProperties* fixedProperties = | |
| 1039 fixed->layoutObject()->paintProperties(); | |
| 1040 // Ensure the fixed position element is rooted at the nearest transform | 1032 // Ensure the fixed position element is rooted at the nearest transform |
| 1041 // container. | 1033 // container. |
| 1042 EXPECT_EQ(containerProperties->transform(), | 1034 EXPECT_EQ(containerProperties->transform(), |
| 1043 fixedProperties->localBorderBoxProperties()->transform()); | 1035 fixed->layoutObject()->localBorderBoxProperties()->transform()); |
| 1044 } | 1036 } |
| 1045 | 1037 |
| 1046 TEST_P(PaintPropertyTreeBuilderTest, ControlClip) { | 1038 TEST_P(PaintPropertyTreeBuilderTest, ControlClip) { |
| 1047 setBodyInnerHTML( | 1039 setBodyInnerHTML( |
| 1048 "<style>" | 1040 "<style>" |
| 1049 " body {" | 1041 " body {" |
| 1050 " margin: 0;" | 1042 " margin: 0;" |
| 1051 " }" | 1043 " }" |
| 1052 " input {" | 1044 " input {" |
| 1053 " border-width: 5px;" | 1045 " border-width: 5px;" |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1275 " <div id='child'" | 1267 " <div id='child'" |
| 1276 " style='position:relative; width:100px; height: 200px;'></div>" | 1268 " style='position:relative; width:100px; height: 200px;'></div>" |
| 1277 " <div style='height:10000px;'></div>" | 1269 " <div style='height:10000px;'></div>" |
| 1278 "</div>"); | 1270 "</div>"); |
| 1279 FrameView* frameView = document().view(); | 1271 FrameView* frameView = document().view(); |
| 1280 | 1272 |
| 1281 LayoutObject* scroller = | 1273 LayoutObject* scroller = |
| 1282 document().getElementById("scroller")->layoutObject(); | 1274 document().getElementById("scroller")->layoutObject(); |
| 1283 const ObjectPaintProperties* scrollerProperties = scroller->paintProperties(); | 1275 const ObjectPaintProperties* scrollerProperties = scroller->paintProperties(); |
| 1284 LayoutObject* child = document().getElementById("child")->layoutObject(); | 1276 LayoutObject* child = document().getElementById("child")->layoutObject(); |
| 1285 const ObjectPaintProperties* childProperties = child->paintProperties(); | |
| 1286 | 1277 |
| 1287 EXPECT_EQ(scrollerProperties->overflowClip(), | 1278 EXPECT_EQ(scrollerProperties->overflowClip(), |
| 1288 childProperties->localBorderBoxProperties()->clip()); | 1279 child->localBorderBoxProperties()->clip()); |
| 1289 EXPECT_EQ(scrollerProperties->scrollTranslation(), | 1280 EXPECT_EQ(scrollerProperties->scrollTranslation(), |
| 1290 childProperties->localBorderBoxProperties()->transform()); | 1281 child->localBorderBoxProperties()->transform()); |
| 1291 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->effect()); | 1282 EXPECT_NE(nullptr, child->localBorderBoxProperties()->effect()); |
| 1292 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 400, 300), scroller, | 1283 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 400, 300), scroller, |
| 1293 frameView->layoutView()); | 1284 frameView->layoutView()); |
| 1294 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 100, 200), child, | 1285 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 100, 200), child, |
| 1295 frameView->layoutView()); | 1286 frameView->layoutView()); |
| 1296 } | 1287 } |
| 1297 | 1288 |
| 1298 TEST_P(PaintPropertyTreeBuilderTest, | 1289 TEST_P(PaintPropertyTreeBuilderTest, |
| 1299 TreeContextUnclipFromParentStackingContext) { | 1290 TreeContextUnclipFromParentStackingContext) { |
| 1300 // This test verifies the tree builder correctly computes and records the | 1291 // This test verifies the tree builder correctly computes and records the |
| 1301 // property tree context for a (pseudo) stacking context that has a scrolling | 1292 // property tree context for a (pseudo) stacking context that has a scrolling |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1318 " }" | 1309 " }" |
| 1319 "</style>" | 1310 "</style>" |
| 1320 "<div id='scroller'>" | 1311 "<div id='scroller'>" |
| 1321 " <div id='child'></div>" | 1312 " <div id='child'></div>" |
| 1322 " <div id='forceScroll' style='height:10000px;'></div>" | 1313 " <div id='forceScroll' style='height:10000px;'></div>" |
| 1323 "</div>"); | 1314 "</div>"); |
| 1324 | 1315 |
| 1325 auto& scroller = *document().getElementById("scroller")->layoutObject(); | 1316 auto& scroller = *document().getElementById("scroller")->layoutObject(); |
| 1326 const ObjectPaintProperties* scrollerProperties = scroller.paintProperties(); | 1317 const ObjectPaintProperties* scrollerProperties = scroller.paintProperties(); |
| 1327 LayoutObject& child = *document().getElementById("child")->layoutObject(); | 1318 LayoutObject& child = *document().getElementById("child")->layoutObject(); |
| 1328 const ObjectPaintProperties* childProperties = child.paintProperties(); | |
| 1329 | 1319 |
| 1330 EXPECT_EQ(frameContentClip(), | 1320 EXPECT_EQ(frameContentClip(), child.localBorderBoxProperties()->clip()); |
| 1331 childProperties->localBorderBoxProperties()->clip()); | |
| 1332 EXPECT_EQ(frameScrollTranslation(), | 1321 EXPECT_EQ(frameScrollTranslation(), |
| 1333 childProperties->localBorderBoxProperties()->transform()); | 1322 child.localBorderBoxProperties()->transform()); |
| 1334 EXPECT_EQ(scrollerProperties->effect(), | 1323 EXPECT_EQ(scrollerProperties->effect(), |
| 1335 childProperties->localBorderBoxProperties()->effect()); | 1324 child.localBorderBoxProperties()->effect()); |
| 1336 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 800, 10000), &scroller, | 1325 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 800, 10000), &scroller, |
| 1337 document().view()->layoutView()); | 1326 document().view()->layoutView()); |
| 1338 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 100, 200), &child, | 1327 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 100, 200), &child, |
| 1339 document().view()->layoutView()); | 1328 document().view()->layoutView()); |
| 1340 } | 1329 } |
| 1341 | 1330 |
| 1342 TEST_P(PaintPropertyTreeBuilderTest, TableCellLayoutLocation) { | 1331 TEST_P(PaintPropertyTreeBuilderTest, TableCellLayoutLocation) { |
| 1343 // This test verifies that the border box space of a table cell is being | 1332 // This test verifies that the border box space of a table cell is being |
| 1344 // correctly computed. Table cells have weird location adjustment in our | 1333 // correctly computed. Table cells have weird location adjustment in our |
| 1345 // layout/paint implementation. | 1334 // layout/paint implementation. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1364 " width: 100px;" | 1353 " width: 100px;" |
| 1365 " height: 100px;" | 1354 " height: 100px;" |
| 1366 " }" | 1355 " }" |
| 1367 "</style>" | 1356 "</style>" |
| 1368 "<table>" | 1357 "<table>" |
| 1369 " <tr><td></td><td></td></tr>" | 1358 " <tr><td></td><td></td></tr>" |
| 1370 " <tr><td></td><td><div id='target'></div></td></tr>" | 1359 " <tr><td></td><td><div id='target'></div></td></tr>" |
| 1371 "</table>"); | 1360 "</table>"); |
| 1372 | 1361 |
| 1373 LayoutObject& target = *document().getElementById("target")->layoutObject(); | 1362 LayoutObject& target = *document().getElementById("target")->layoutObject(); |
| 1374 const ObjectPaintProperties* targetProperties = target.paintProperties(); | |
| 1375 | |
| 1376 EXPECT_EQ(LayoutPoint(170, 170), target.paintOffset()); | 1363 EXPECT_EQ(LayoutPoint(170, 170), target.paintOffset()); |
| 1377 EXPECT_EQ(framePreTranslation(), | 1364 EXPECT_EQ(framePreTranslation(), |
| 1378 targetProperties->localBorderBoxProperties()->transform()); | 1365 target.localBorderBoxProperties()->transform()); |
| 1379 CHECK_EXACT_VISUAL_RECT(LayoutRect(170, 170, 100, 100), &target, | 1366 CHECK_EXACT_VISUAL_RECT(LayoutRect(170, 170, 100, 100), &target, |
| 1380 document().view()->layoutView()); | 1367 document().view()->layoutView()); |
| 1381 } | 1368 } |
| 1382 | 1369 |
| 1383 TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendant) { | 1370 TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendant) { |
| 1384 // This test verifies that clip tree hierarchy being generated correctly for | 1371 // This test verifies that clip tree hierarchy being generated correctly for |
| 1385 // the hard case such that a fixed position element getting clipped by an | 1372 // the hard case such that a fixed position element getting clipped by an |
| 1386 // absolute position CSS clip. | 1373 // absolute position CSS clip. |
| 1387 setBodyInnerHTML( | 1374 setBodyInnerHTML( |
| 1388 "<style>" | 1375 "<style>" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1413 EXPECT_EQ(framePreTranslation(), | 1400 EXPECT_EQ(framePreTranslation(), |
| 1414 clipProperties->cssClip()->localTransformSpace()); | 1401 clipProperties->cssClip()->localTransformSpace()); |
| 1415 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), | 1402 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), |
| 1416 clipProperties->cssClip()->clipRect()); | 1403 clipProperties->cssClip()->clipRect()); |
| 1417 CHECK_VISUAL_RECT(absoluteClipRect, &clip, document().view()->layoutView(), | 1404 CHECK_VISUAL_RECT(absoluteClipRect, &clip, document().view()->layoutView(), |
| 1418 // TODO(crbug.com/599939): mapToVisualRectInAncestorSpace() | 1405 // TODO(crbug.com/599939): mapToVisualRectInAncestorSpace() |
| 1419 // doesn't apply css clip on the object itself. | 1406 // doesn't apply css clip on the object itself. |
| 1420 LayoutUnit::max()); | 1407 LayoutUnit::max()); |
| 1421 | 1408 |
| 1422 LayoutObject* fixed = document().getElementById("fixed")->layoutObject(); | 1409 LayoutObject* fixed = document().getElementById("fixed")->layoutObject(); |
| 1423 const ObjectPaintProperties* fixedProperties = fixed->paintProperties(); | |
| 1424 EXPECT_EQ(clipProperties->cssClip(), | 1410 EXPECT_EQ(clipProperties->cssClip(), |
| 1425 fixedProperties->localBorderBoxProperties()->clip()); | 1411 fixed->localBorderBoxProperties()->clip()); |
| 1426 EXPECT_EQ(framePreTranslation(), | 1412 EXPECT_EQ(framePreTranslation(), |
| 1427 fixedProperties->localBorderBoxProperties()->transform()); | 1413 fixed->localBorderBoxProperties()->transform()); |
| 1428 EXPECT_EQ(LayoutPoint(654, 321), fixed->paintOffset()); | 1414 EXPECT_EQ(LayoutPoint(654, 321), fixed->paintOffset()); |
| 1429 CHECK_VISUAL_RECT(LayoutRect(), fixed, document().view()->layoutView(), | 1415 CHECK_VISUAL_RECT(LayoutRect(), fixed, document().view()->layoutView(), |
| 1430 // TODO(crbug.com/599939): CSS clip of fixed-position | 1416 // TODO(crbug.com/599939): CSS clip of fixed-position |
| 1431 // descendants is broken in | 1417 // descendants is broken in |
| 1432 // mapToVisualRectInAncestorSpace(). | 1418 // mapToVisualRectInAncestorSpace(). |
| 1433 LayoutUnit::max()); | 1419 LayoutUnit::max()); |
| 1434 } | 1420 } |
| 1435 | 1421 |
| 1436 TEST_P(PaintPropertyTreeBuilderTest, CSSClipAbsPositionDescendant) { | 1422 TEST_P(PaintPropertyTreeBuilderTest, CSSClipAbsPositionDescendant) { |
| 1437 // This test verifies that clip tree hierarchy being generated correctly for | 1423 // This test verifies that clip tree hierarchy being generated correctly for |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1470 EXPECT_EQ(framePreTranslation(), | 1456 EXPECT_EQ(framePreTranslation(), |
| 1471 clipProperties->cssClip()->localTransformSpace()); | 1457 clipProperties->cssClip()->localTransformSpace()); |
| 1472 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), | 1458 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), |
| 1473 clipProperties->cssClip()->clipRect()); | 1459 clipProperties->cssClip()->clipRect()); |
| 1474 CHECK_VISUAL_RECT(absoluteClipRect, clip, document().view()->layoutView(), | 1460 CHECK_VISUAL_RECT(absoluteClipRect, clip, document().view()->layoutView(), |
| 1475 // TODO(crbug.com/599939): mapToVisualRectInAncestorSpace() | 1461 // TODO(crbug.com/599939): mapToVisualRectInAncestorSpace() |
| 1476 // doesn't apply css clip on the object itself. | 1462 // doesn't apply css clip on the object itself. |
| 1477 LayoutUnit::max()); | 1463 LayoutUnit::max()); |
| 1478 | 1464 |
| 1479 auto* absolute = document().getElementById("absolute")->layoutObject(); | 1465 auto* absolute = document().getElementById("absolute")->layoutObject(); |
| 1480 const ObjectPaintProperties* absPosProperties = absolute->paintProperties(); | |
| 1481 EXPECT_EQ(clipProperties->cssClip(), | 1466 EXPECT_EQ(clipProperties->cssClip(), |
| 1482 absPosProperties->localBorderBoxProperties()->clip()); | 1467 absolute->localBorderBoxProperties()->clip()); |
| 1483 EXPECT_EQ(framePreTranslation(), | 1468 EXPECT_EQ(framePreTranslation(), |
| 1484 absPosProperties->localBorderBoxProperties()->transform()); | 1469 absolute->localBorderBoxProperties()->transform()); |
| 1485 EXPECT_EQ(LayoutPoint(777, 777), absolute->paintOffset()); | 1470 EXPECT_EQ(LayoutPoint(777, 777), absolute->paintOffset()); |
| 1486 CHECK_VISUAL_RECT(LayoutRect(), absolute, document().view()->layoutView(), | 1471 CHECK_VISUAL_RECT(LayoutRect(), absolute, document().view()->layoutView(), |
| 1487 // TODO(crbug.com/599939): CSS clip of fixed-position | 1472 // TODO(crbug.com/599939): CSS clip of fixed-position |
| 1488 // descendants is broken in | 1473 // descendants is broken in |
| 1489 // mapToVisualRectInAncestorSpace(). | 1474 // mapToVisualRectInAncestorSpace(). |
| 1490 LayoutUnit::max()); | 1475 LayoutUnit::max()); |
| 1491 } | 1476 } |
| 1492 | 1477 |
| 1493 TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendantNonShared) { | 1478 TEST_P(PaintPropertyTreeBuilderTest, CSSClipFixedPositionDescendantNonShared) { |
| 1494 // This test is similar to CSSClipFixedPositionDescendant above, except that | 1479 // This test is similar to CSSClipFixedPositionDescendant above, except that |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1546 clipProperties->cssClip()->clipRect()); | 1531 clipProperties->cssClip()->clipRect()); |
| 1547 EXPECT_EQ(frameContentClip(), | 1532 EXPECT_EQ(frameContentClip(), |
| 1548 clipProperties->cssClipFixedPosition()->parent()); | 1533 clipProperties->cssClipFixedPosition()->parent()); |
| 1549 EXPECT_EQ(overflowProperties->scrollTranslation(), | 1534 EXPECT_EQ(overflowProperties->scrollTranslation(), |
| 1550 clipProperties->cssClipFixedPosition()->localTransformSpace()); | 1535 clipProperties->cssClipFixedPosition()->localTransformSpace()); |
| 1551 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), | 1536 EXPECT_EQ(FloatRoundedRect(FloatRect(absoluteClipRect)), |
| 1552 clipProperties->cssClipFixedPosition()->clipRect()); | 1537 clipProperties->cssClipFixedPosition()->clipRect()); |
| 1553 CHECK_EXACT_VISUAL_RECT(LayoutRect(), clip, document().view()->layoutView()); | 1538 CHECK_EXACT_VISUAL_RECT(LayoutRect(), clip, document().view()->layoutView()); |
| 1554 | 1539 |
| 1555 LayoutObject* fixed = document().getElementById("fixed")->layoutObject(); | 1540 LayoutObject* fixed = document().getElementById("fixed")->layoutObject(); |
| 1556 const ObjectPaintProperties* fixedProperties = fixed->paintProperties(); | |
| 1557 EXPECT_EQ(clipProperties->cssClipFixedPosition(), | 1541 EXPECT_EQ(clipProperties->cssClipFixedPosition(), |
| 1558 fixedProperties->localBorderBoxProperties()->clip()); | 1542 fixed->localBorderBoxProperties()->clip()); |
| 1559 EXPECT_EQ(framePreTranslation(), | 1543 EXPECT_EQ(framePreTranslation(), |
| 1560 fixedProperties->localBorderBoxProperties()->transform()); | 1544 fixed->localBorderBoxProperties()->transform()); |
| 1561 EXPECT_EQ(LayoutPoint(654, 321), fixed->paintOffset()); | 1545 EXPECT_EQ(LayoutPoint(654, 321), fixed->paintOffset()); |
| 1562 CHECK_VISUAL_RECT(LayoutRect(), fixed, document().view()->layoutView(), | 1546 CHECK_VISUAL_RECT(LayoutRect(), fixed, document().view()->layoutView(), |
| 1563 // TODO(crbug.com/599939): CSS clip of fixed-position | 1547 // TODO(crbug.com/599939): CSS clip of fixed-position |
| 1564 // descendants is broken in geometry mapping. | 1548 // descendants is broken in geometry mapping. |
| 1565 LayoutUnit::max()); | 1549 LayoutUnit::max()); |
| 1566 } | 1550 } |
| 1567 | 1551 |
| 1568 TEST_P(PaintPropertyTreeBuilderTest, ColumnSpannerUnderRelativePositioned) { | 1552 TEST_P(PaintPropertyTreeBuilderTest, ColumnSpannerUnderRelativePositioned) { |
| 1569 setBodyInnerHTML( | 1553 setBodyInnerHTML( |
| 1570 "<style>" | 1554 "<style>" |
| (...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2336 "<div id='clipper'" | 2320 "<div id='clipper'" |
| 2337 " style='overflow: hidden; width: 400px; height: 300px;'>" | 2321 " style='overflow: hidden; width: 400px; height: 300px;'>" |
| 2338 " <div id='child'" | 2322 " <div id='child'" |
| 2339 " style='position: relative; width: 500px; height: 600px;'></div>" | 2323 " style='position: relative; width: 500px; height: 600px;'></div>" |
| 2340 "</div>"); | 2324 "</div>"); |
| 2341 | 2325 |
| 2342 LayoutBoxModelObject* clipper = toLayoutBoxModelObject( | 2326 LayoutBoxModelObject* clipper = toLayoutBoxModelObject( |
| 2343 document().getElementById("clipper")->layoutObject()); | 2327 document().getElementById("clipper")->layoutObject()); |
| 2344 const ObjectPaintProperties* clipProperties = clipper->paintProperties(); | 2328 const ObjectPaintProperties* clipProperties = clipper->paintProperties(); |
| 2345 LayoutObject* child = document().getElementById("child")->layoutObject(); | 2329 LayoutObject* child = document().getElementById("child")->layoutObject(); |
| 2346 const ObjectPaintProperties* childProperties = child->paintProperties(); | |
| 2347 | 2330 |
| 2348 // No scroll translation because the document does not scroll (not enough | 2331 // No scroll translation because the document does not scroll (not enough |
| 2349 // content). | 2332 // content). |
| 2350 EXPECT_TRUE(!frameScrollTranslation()); | 2333 EXPECT_TRUE(!frameScrollTranslation()); |
| 2351 EXPECT_EQ(framePreTranslation(), | 2334 EXPECT_EQ(framePreTranslation(), |
| 2352 clipProperties->localBorderBoxProperties()->transform()); | 2335 clipper->localBorderBoxProperties()->transform()); |
| 2353 EXPECT_EQ(frameContentClip(), | 2336 EXPECT_EQ(frameContentClip(), clipper->localBorderBoxProperties()->clip()); |
| 2354 clipProperties->localBorderBoxProperties()->clip()); | |
| 2355 | 2337 |
| 2356 const auto& contentsProperties = *clipProperties->contentsProperties(); | 2338 const auto& contentsProperties = *clipper->contentsProperties(); |
| 2357 EXPECT_EQ(LayoutPoint(30, 20), clipper->paintOffset()); | 2339 EXPECT_EQ(LayoutPoint(30, 20), clipper->paintOffset()); |
| 2358 EXPECT_EQ(framePreTranslation(), contentsProperties.transform()); | 2340 EXPECT_EQ(framePreTranslation(), contentsProperties.transform()); |
| 2359 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip()); | 2341 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip()); |
| 2360 | 2342 |
| 2361 EXPECT_EQ(framePreTranslation(), | 2343 EXPECT_EQ(framePreTranslation(), |
| 2362 childProperties->localBorderBoxProperties()->transform()); | 2344 child->localBorderBoxProperties()->transform()); |
| 2363 EXPECT_EQ(clipProperties->overflowClip(), | 2345 EXPECT_EQ(clipProperties->overflowClip(), |
| 2364 childProperties->localBorderBoxProperties()->clip()); | 2346 child->localBorderBoxProperties()->clip()); |
| 2365 | 2347 |
| 2366 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->effect()); | 2348 EXPECT_NE(nullptr, child->localBorderBoxProperties()->effect()); |
| 2367 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); | 2349 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); |
| 2368 } | 2350 } |
| 2369 | 2351 |
| 2370 TEST_P(PaintPropertyTreeBuilderTest, ContainsPaintContentsTreeState) { | 2352 TEST_P(PaintPropertyTreeBuilderTest, ContainsPaintContentsTreeState) { |
| 2371 setBodyInnerHTML( | 2353 setBodyInnerHTML( |
| 2372 "<style>body { margin: 20px 30px; }</style>" | 2354 "<style>body { margin: 20px 30px; }</style>" |
| 2373 "<div id='clipper'" | 2355 "<div id='clipper'" |
| 2374 " style='contain: paint; width: 300px; height: 200px;'>" | 2356 " style='contain: paint; width: 300px; height: 200px;'>" |
| 2375 " <div id='child'" | 2357 " <div id='child'" |
| 2376 " style='position: relative; width: 400px; height: 500px;'></div>" | 2358 " style='position: relative; width: 400px; height: 500px;'></div>" |
| 2377 "</div>"); | 2359 "</div>"); |
| 2378 | 2360 |
| 2379 LayoutBoxModelObject* clipper = toLayoutBoxModelObject( | 2361 LayoutBoxModelObject* clipper = toLayoutBoxModelObject( |
| 2380 document().getElementById("clipper")->layoutObject()); | 2362 document().getElementById("clipper")->layoutObject()); |
| 2381 const ObjectPaintProperties* clipProperties = clipper->paintProperties(); | 2363 const ObjectPaintProperties* clipProperties = clipper->paintProperties(); |
| 2382 LayoutObject* child = document().getElementById("child")->layoutObject(); | 2364 LayoutObject* child = document().getElementById("child")->layoutObject(); |
| 2383 const ObjectPaintProperties* childProperties = child->paintProperties(); | |
| 2384 | 2365 |
| 2385 // No scroll translation because the document does not scroll (not enough | 2366 // No scroll translation because the document does not scroll (not enough |
| 2386 // content). | 2367 // content). |
| 2387 EXPECT_TRUE(!frameScrollTranslation()); | 2368 EXPECT_TRUE(!frameScrollTranslation()); |
| 2388 EXPECT_EQ(framePreTranslation(), | 2369 EXPECT_EQ(framePreTranslation(), |
| 2389 clipProperties->localBorderBoxProperties()->transform()); | 2370 clipper->localBorderBoxProperties()->transform()); |
| 2390 EXPECT_EQ(frameContentClip(), | 2371 EXPECT_EQ(frameContentClip(), clipper->localBorderBoxProperties()->clip()); |
| 2391 clipProperties->localBorderBoxProperties()->clip()); | |
| 2392 | 2372 |
| 2393 const auto& contentsProperties = *clipProperties->contentsProperties(); | 2373 const auto& contentsProperties = *clipper->contentsProperties(); |
| 2394 EXPECT_EQ(LayoutPoint(30, 20), clipper->paintOffset()); | 2374 EXPECT_EQ(LayoutPoint(30, 20), clipper->paintOffset()); |
| 2395 EXPECT_EQ(framePreTranslation(), contentsProperties.transform()); | 2375 EXPECT_EQ(framePreTranslation(), contentsProperties.transform()); |
| 2396 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip()); | 2376 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip()); |
| 2397 | 2377 |
| 2398 EXPECT_EQ(framePreTranslation(), | 2378 EXPECT_EQ(framePreTranslation(), |
| 2399 childProperties->localBorderBoxProperties()->transform()); | 2379 child->localBorderBoxProperties()->transform()); |
| 2400 EXPECT_EQ(clipProperties->overflowClip(), | 2380 EXPECT_EQ(clipProperties->overflowClip(), |
| 2401 childProperties->localBorderBoxProperties()->clip()); | 2381 child->localBorderBoxProperties()->clip()); |
| 2402 | 2382 |
| 2403 EXPECT_NE(nullptr, childProperties->localBorderBoxProperties()->effect()); | 2383 EXPECT_NE(nullptr, child->localBorderBoxProperties()->effect()); |
| 2404 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 400, 500), child, clipper); | 2384 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 400, 500), child, clipper); |
| 2405 } | 2385 } |
| 2406 | 2386 |
| 2407 TEST_P(PaintPropertyTreeBuilderTest, OverflowScrollContentsTreeState) { | 2387 TEST_P(PaintPropertyTreeBuilderTest, OverflowScrollContentsTreeState) { |
| 2408 // This test verifies the tree builder correctly computes and records the | 2388 // This test verifies the tree builder correctly computes and records the |
| 2409 // property tree context for a (pseudo) stacking context that is scrolled by a | 2389 // property tree context for a (pseudo) stacking context that is scrolled by a |
| 2410 // containing block that is not one of the painting ancestors. | 2390 // containing block that is not one of the painting ancestors. |
| 2411 setBodyInnerHTML( | 2391 setBodyInnerHTML( |
| 2412 "<style>body { margin: 20px 30px; }</style>" | 2392 "<style>body { margin: 20px 30px; }</style>" |
| 2413 "<div id='clipper' style='overflow:scroll; width:400px; height:300px;'>" | 2393 "<div id='clipper' style='overflow:scroll; width:400px; height:300px;'>" |
| 2414 " <div id='child'" | 2394 " <div id='child'" |
| 2415 " style='position:relative; width:500px; height: 600px;'></div>" | 2395 " style='position:relative; width:500px; height: 600px;'></div>" |
| 2416 " <div style='width: 200px; height: 10000px'></div>" | 2396 " <div style='width: 200px; height: 10000px'></div>" |
| 2417 "</div>" | 2397 "</div>" |
| 2418 "<div id='forceScroll' style='height: 4000px;'></div>"); | 2398 "<div id='forceScroll' style='height: 4000px;'></div>"); |
| 2419 | 2399 |
| 2420 Element* clipperElement = document().getElementById("clipper"); | 2400 Element* clipperElement = document().getElementById("clipper"); |
| 2421 clipperElement->scrollTo(1, 2); | 2401 clipperElement->scrollTo(1, 2); |
| 2422 | 2402 |
| 2423 LayoutBoxModelObject* clipper = | 2403 LayoutBoxModelObject* clipper = |
| 2424 toLayoutBoxModelObject(clipperElement->layoutObject()); | 2404 toLayoutBoxModelObject(clipperElement->layoutObject()); |
| 2425 const ObjectPaintProperties* clipProperties = clipper->paintProperties(); | 2405 const ObjectPaintProperties* clipProperties = clipper->paintProperties(); |
| 2426 LayoutObject* child = document().getElementById("child")->layoutObject(); | 2406 LayoutObject* child = document().getElementById("child")->layoutObject(); |
| 2427 const ObjectPaintProperties* childProperties = child->paintProperties(); | |
| 2428 | 2407 |
| 2429 EXPECT_EQ(frameScrollTranslation(), | 2408 EXPECT_EQ(frameScrollTranslation(), |
| 2430 clipProperties->localBorderBoxProperties()->transform()); | 2409 clipper->localBorderBoxProperties()->transform()); |
| 2431 EXPECT_EQ(frameContentClip(), | 2410 EXPECT_EQ(frameContentClip(), clipper->localBorderBoxProperties()->clip()); |
| 2432 clipProperties->localBorderBoxProperties()->clip()); | |
| 2433 | 2411 |
| 2434 const auto& contentsProperties = *clipProperties->contentsProperties(); | 2412 const auto& contentsProperties = *clipper->contentsProperties(); |
| 2435 EXPECT_EQ(LayoutPoint(30, 20), clipper->paintOffset()); | 2413 EXPECT_EQ(LayoutPoint(30, 20), clipper->paintOffset()); |
| 2436 EXPECT_EQ(clipProperties->scrollTranslation(), | 2414 EXPECT_EQ(clipProperties->scrollTranslation(), |
| 2437 contentsProperties.transform()); | 2415 contentsProperties.transform()); |
| 2438 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip()); | 2416 EXPECT_EQ(clipProperties->overflowClip(), contentsProperties.clip()); |
| 2439 | 2417 |
| 2440 EXPECT_EQ(clipProperties->scrollTranslation(), | 2418 EXPECT_EQ(clipProperties->scrollTranslation(), |
| 2441 childProperties->localBorderBoxProperties()->transform()); | 2419 child->localBorderBoxProperties()->transform()); |
| 2442 EXPECT_EQ(clipProperties->overflowClip(), | 2420 EXPECT_EQ(clipProperties->overflowClip(), |
| 2443 childProperties->localBorderBoxProperties()->clip()); | 2421 child->localBorderBoxProperties()->clip()); |
| 2444 | 2422 |
| 2445 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); | 2423 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 500, 600), child, clipper); |
| 2446 } | 2424 } |
| 2447 | 2425 |
| 2448 TEST_P(PaintPropertyTreeBuilderTest, OverflowScrollWithRoundedRect) { | 2426 TEST_P(PaintPropertyTreeBuilderTest, OverflowScrollWithRoundedRect) { |
| 2449 setBodyInnerHTML( | 2427 setBodyInnerHTML( |
| 2450 "<style>" | 2428 "<style>" |
| 2451 " * { margin: 0; }" | 2429 " * { margin: 0; }" |
| 2452 " ::-webkit-scrollbar {" | 2430 " ::-webkit-scrollbar {" |
| 2453 " width: 13px;" | 2431 " width: 13px;" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2504 | 2482 |
| 2505 LayoutBoxModelObject* clipper = toLayoutBoxModelObject( | 2483 LayoutBoxModelObject* clipper = toLayoutBoxModelObject( |
| 2506 document().getElementById("clipper")->layoutObject()); | 2484 document().getElementById("clipper")->layoutObject()); |
| 2507 const ObjectPaintProperties* clipProperties = clipper->paintProperties(); | 2485 const ObjectPaintProperties* clipProperties = clipper->paintProperties(); |
| 2508 LayoutObject* child = document().getElementById("child")->layoutObject(); | 2486 LayoutObject* child = document().getElementById("child")->layoutObject(); |
| 2509 | 2487 |
| 2510 // No scroll translation because the document does not scroll (not enough | 2488 // No scroll translation because the document does not scroll (not enough |
| 2511 // content). | 2489 // content). |
| 2512 EXPECT_TRUE(!frameScrollTranslation()); | 2490 EXPECT_TRUE(!frameScrollTranslation()); |
| 2513 EXPECT_EQ(framePreTranslation(), | 2491 EXPECT_EQ(framePreTranslation(), |
| 2514 clipProperties->localBorderBoxProperties()->transform()); | 2492 clipper->localBorderBoxProperties()->transform()); |
| 2515 // CSS clip on an element causes it to clip itself, not just descendants. | 2493 // CSS clip on an element causes it to clip itself, not just descendants. |
| 2516 EXPECT_EQ(clipProperties->cssClip(), | 2494 EXPECT_EQ(clipProperties->cssClip(), |
| 2517 clipProperties->localBorderBoxProperties()->clip()); | 2495 clipper->localBorderBoxProperties()->clip()); |
| 2518 | 2496 |
| 2519 const auto& contentsProperties = *clipProperties->contentsProperties(); | 2497 const auto& contentsProperties = *clipper->contentsProperties(); |
| 2520 EXPECT_EQ(LayoutPoint(30, 20), clipper->paintOffset()); | 2498 EXPECT_EQ(LayoutPoint(30, 20), clipper->paintOffset()); |
| 2521 EXPECT_EQ(framePreTranslation(), contentsProperties.transform()); | 2499 EXPECT_EQ(framePreTranslation(), contentsProperties.transform()); |
| 2522 EXPECT_EQ(clipProperties->cssClip(), contentsProperties.clip()); | 2500 EXPECT_EQ(clipProperties->cssClip(), contentsProperties.clip()); |
| 2523 | 2501 |
| 2524 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 400, 500), child, clipper); | 2502 CHECK_EXACT_VISUAL_RECT(LayoutRect(0, 0, 400, 500), child, clipper); |
| 2525 } | 2503 } |
| 2526 | 2504 |
| 2527 TEST_P(PaintPropertyTreeBuilderTest, | 2505 TEST_P(PaintPropertyTreeBuilderTest, |
| 2528 SvgLocalToBorderBoxTransformContentsTreeState) { | 2506 SvgLocalToBorderBoxTransformContentsTreeState) { |
| 2529 setBodyInnerHTML( | 2507 setBodyInnerHTML( |
| 2530 "<style>" | 2508 "<style>" |
| 2531 " body {" | 2509 " body {" |
| 2532 " margin: 20px 30px;" | 2510 " margin: 20px 30px;" |
| 2533 " }" | 2511 " }" |
| 2534 " svg {" | 2512 " svg {" |
| 2535 " position: absolute;" | 2513 " position: absolute;" |
| 2536 " }" | 2514 " }" |
| 2537 " rect {" | 2515 " rect {" |
| 2538 " transform: translate(100px, 100px);" | 2516 " transform: translate(100px, 100px);" |
| 2539 " }" | 2517 " }" |
| 2540 "</style>" | 2518 "</style>" |
| 2541 "<svg id='svgWithViewBox' width='100px' height='100px' viewBox='50 50 " | 2519 "<svg id='svgWithViewBox' width='100px' height='100px' viewBox='50 50 " |
| 2542 "100 100'>" | 2520 "100 100'>" |
| 2543 " <rect id='rect' width='100px' height='100px' />" | 2521 " <rect id='rect' width='100px' height='100px' />" |
| 2544 "</svg>"); | 2522 "</svg>"); |
| 2545 | 2523 |
| 2546 LayoutObject& svgWithViewBox = | 2524 LayoutObject& svgWithViewBox = |
| 2547 *document().getElementById("svgWithViewBox")->layoutObject(); | 2525 *document().getElementById("svgWithViewBox")->layoutObject(); |
| 2548 const ObjectPaintProperties* svgWithViewBoxProperties = | 2526 EXPECT_EQ(framePreTranslation(), |
| 2549 svgWithViewBox.paintProperties(); | 2527 svgWithViewBox.localBorderBoxProperties()->transform()); |
| 2550 | 2528 |
| 2551 EXPECT_EQ(framePreTranslation(), | |
| 2552 svgWithViewBoxProperties->localBorderBoxProperties()->transform()); | |
| 2553 | |
| 2554 const auto& contentsProperties = | |
| 2555 *svgWithViewBoxProperties->contentsProperties(); | |
| 2556 EXPECT_EQ(LayoutPoint(30, 20), svgWithViewBox.paintOffset()); | 2529 EXPECT_EQ(LayoutPoint(30, 20), svgWithViewBox.paintOffset()); |
| 2530 const auto& contentsProperties = *svgWithViewBox.contentsProperties(); |
| 2557 EXPECT_EQ(framePreTranslation(), contentsProperties.transform()); | 2531 EXPECT_EQ(framePreTranslation(), contentsProperties.transform()); |
| 2558 } | 2532 } |
| 2559 | 2533 |
| 2560 TEST_P(PaintPropertyTreeBuilderTest, OverflowHiddenScrollProperties) { | 2534 TEST_P(PaintPropertyTreeBuilderTest, OverflowHiddenScrollProperties) { |
| 2561 setBodyInnerHTML( | 2535 setBodyInnerHTML( |
| 2562 "<style>" | 2536 "<style>" |
| 2563 " body {" | 2537 " body {" |
| 2564 " margin: 0px;" | 2538 " margin: 0px;" |
| 2565 " }" | 2539 " }" |
| 2566 " #overflowHidden {" | 2540 " #overflowHidden {" |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2993 const ObjectPaintProperties* filterProperties = | 2967 const ObjectPaintProperties* filterProperties = |
| 2994 getLayoutObjectByElementId("filter")->paintProperties(); | 2968 getLayoutObjectByElementId("filter")->paintProperties(); |
| 2995 EXPECT_TRUE(filterProperties->filter()->parent()->isRoot()); | 2969 EXPECT_TRUE(filterProperties->filter()->parent()->isRoot()); |
| 2996 EXPECT_EQ(frameScrollTranslation(), | 2970 EXPECT_EQ(frameScrollTranslation(), |
| 2997 filterProperties->filter()->localTransformSpace()); | 2971 filterProperties->filter()->localTransformSpace()); |
| 2998 EXPECT_EQ(clipProperties->overflowClip(), | 2972 EXPECT_EQ(clipProperties->overflowClip(), |
| 2999 filterProperties->filter()->outputClip()); | 2973 filterProperties->filter()->outputClip()); |
| 3000 | 2974 |
| 3001 const PropertyTreeState& childPaintState = | 2975 const PropertyTreeState& childPaintState = |
| 3002 *getLayoutObjectByElementId("child") | 2976 *getLayoutObjectByElementId("child") |
| 3003 ->paintProperties() | |
| 3004 ->localBorderBoxProperties(); | 2977 ->localBorderBoxProperties(); |
| 3005 | 2978 |
| 3006 // This will change once we added clip expansion node. | 2979 // This will change once we added clip expansion node. |
| 3007 EXPECT_EQ(filterProperties->filter()->outputClip(), childPaintState.clip()); | 2980 EXPECT_EQ(filterProperties->filter()->outputClip(), childPaintState.clip()); |
| 3008 EXPECT_EQ(filterProperties->filter(), childPaintState.effect()); | 2981 EXPECT_EQ(filterProperties->filter(), childPaintState.effect()); |
| 3009 } | 2982 } |
| 3010 | 2983 |
| 3011 TEST_P(PaintPropertyTreeBuilderTest, TransformOriginWithAndWithoutTransform) { | 2984 TEST_P(PaintPropertyTreeBuilderTest, TransformOriginWithAndWithoutTransform) { |
| 3012 setBodyInnerHTML( | 2985 setBodyInnerHTML( |
| 3013 "<style>" | 2986 "<style>" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3084 " #ancestor { position: absolute; overflow: hidden }" | 3057 " #ancestor { position: absolute; overflow: hidden }" |
| 3085 " #descendant { position: absolute }" | 3058 " #descendant { position: absolute }" |
| 3086 "</style>" | 3059 "</style>" |
| 3087 "<div id='ancestor'>" | 3060 "<div id='ancestor'>" |
| 3088 " <div id='descendant'></div>" | 3061 " <div id='descendant'></div>" |
| 3089 "</div>"); | 3062 "</div>"); |
| 3090 | 3063 |
| 3091 LayoutObject* ancestor = getLayoutObjectByElementId("ancestor"); | 3064 LayoutObject* ancestor = getLayoutObjectByElementId("ancestor"); |
| 3092 LayoutObject* descendant = getLayoutObjectByElementId("descendant"); | 3065 LayoutObject* descendant = getLayoutObjectByElementId("descendant"); |
| 3093 EXPECT_EQ(ancestor->paintProperties()->overflowClip(), | 3066 EXPECT_EQ(ancestor->paintProperties()->overflowClip(), |
| 3094 descendant->paintProperties()->localBorderBoxProperties()->clip()); | 3067 descendant->localBorderBoxProperties()->clip()); |
| 3095 | 3068 |
| 3096 toElement(ancestor->node()) | 3069 toElement(ancestor->node()) |
| 3097 ->setAttribute(HTMLNames::styleAttr, "position: static"); | 3070 ->setAttribute(HTMLNames::styleAttr, "position: static"); |
| 3098 document().view()->updateAllLifecyclePhases(); | 3071 document().view()->updateAllLifecyclePhases(); |
| 3099 EXPECT_NE(ancestor->paintProperties()->overflowClip(), | 3072 EXPECT_NE(ancestor->paintProperties()->overflowClip(), |
| 3100 descendant->paintProperties()->localBorderBoxProperties()->clip()); | 3073 descendant->localBorderBoxProperties()->clip()); |
| 3101 } | 3074 } |
| 3102 | 3075 |
| 3103 TEST_P(PaintPropertyTreeBuilderTest, | 3076 TEST_P(PaintPropertyTreeBuilderTest, |
| 3104 TransformNodeNotAnimatedHasNoCompositorElementId) { | 3077 TransformNodeNotAnimatedHasNoCompositorElementId) { |
| 3105 setBodyInnerHTML("<div id='target' style='transform: translateX(2em)'></div"); | 3078 setBodyInnerHTML("<div id='target' style='transform: translateX(2em)'></div"); |
| 3106 const ObjectPaintProperties* properties = paintPropertiesForElement("target"); | 3079 const ObjectPaintProperties* properties = paintPropertiesForElement("target"); |
| 3107 EXPECT_TRUE(properties->transform()); | 3080 EXPECT_TRUE(properties->transform()); |
| 3108 EXPECT_EQ(CompositorElementId(), | 3081 EXPECT_EQ(CompositorElementId(), |
| 3109 properties->transform()->compositorElementId()); | 3082 properties->transform()->compositorElementId()); |
| 3110 } | 3083 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3145 " </div>" | 3118 " </div>" |
| 3146 " </span>" | 3119 " </span>" |
| 3147 "</div>"); | 3120 "</div>"); |
| 3148 | 3121 |
| 3149 LayoutObject* span = getLayoutObjectByElementId("span"); | 3122 LayoutObject* span = getLayoutObjectByElementId("span"); |
| 3150 const auto* effect = span->paintProperties()->effect(); | 3123 const auto* effect = span->paintProperties()->effect(); |
| 3151 ASSERT_TRUE(effect); | 3124 ASSERT_TRUE(effect); |
| 3152 EXPECT_EQ(0.5f, effect->opacity()); | 3125 EXPECT_EQ(0.5f, effect->opacity()); |
| 3153 | 3126 |
| 3154 LayoutObject* target = getLayoutObjectByElementId("target"); | 3127 LayoutObject* target = getLayoutObjectByElementId("target"); |
| 3155 const auto* localBorderBoxProperties = | 3128 ASSERT_TRUE(target->localBorderBoxProperties()); |
| 3156 target->paintProperties()->localBorderBoxProperties(); | |
| 3157 ASSERT_TRUE(localBorderBoxProperties); | |
| 3158 EXPECT_EQ(LayoutPoint(66, 55), target->paintOffset()); | 3129 EXPECT_EQ(LayoutPoint(66, 55), target->paintOffset()); |
| 3159 EXPECT_EQ(effect, localBorderBoxProperties->effect()); | 3130 EXPECT_EQ(effect, target->localBorderBoxProperties()->effect()); |
| 3160 } | 3131 } |
| 3161 | 3132 |
| 3162 TEST_P(PaintPropertyTreeBuilderTest, ScrollTranslationHasCompositorElementId) { | 3133 TEST_P(PaintPropertyTreeBuilderTest, ScrollTranslationHasCompositorElementId) { |
| 3163 setBodyInnerHTML( | 3134 setBodyInnerHTML( |
| 3164 "<div id='target' style='overflow: auto; width: 100px; height: 100px'>" | 3135 "<div id='target' style='overflow: auto; width: 100px; height: 100px'>" |
| 3165 " <div style='width: 200px; height: 200px'></div>" | 3136 " <div style='width: 200px; height: 200px'></div>" |
| 3166 "</div>"); | 3137 "</div>"); |
| 3167 | 3138 |
| 3168 const ObjectPaintProperties* properties = paintPropertiesForElement("target"); | 3139 const ObjectPaintProperties* properties = paintPropertiesForElement("target"); |
| 3169 EXPECT_NE(CompositorElementId(), | 3140 EXPECT_NE(CompositorElementId(), |
| (...skipping 20 matching lines...) Expand all Loading... |
| 3190 TEST_P(PaintPropertyTreeBuilderTest, MaskSimple) { | 3161 TEST_P(PaintPropertyTreeBuilderTest, MaskSimple) { |
| 3191 setBodyInnerHTML( | 3162 setBodyInnerHTML( |
| 3192 "<div id='target' style='width:300px; height:200px; " | 3163 "<div id='target' style='width:300px; height:200px; " |
| 3193 "-webkit-mask:linear-gradient(red,red)'>" | 3164 "-webkit-mask:linear-gradient(red,red)'>" |
| 3194 " Lorem ipsum" | 3165 " Lorem ipsum" |
| 3195 "</div>"); | 3166 "</div>"); |
| 3196 | 3167 |
| 3197 const ObjectPaintProperties* properties = paintPropertiesForElement("target"); | 3168 const ObjectPaintProperties* properties = paintPropertiesForElement("target"); |
| 3198 const ClipPaintPropertyNode* outputClip = properties->maskClip(); | 3169 const ClipPaintPropertyNode* outputClip = properties->maskClip(); |
| 3199 | 3170 |
| 3200 EXPECT_EQ(outputClip, properties->localBorderBoxProperties()->clip()); | 3171 const auto* target = document().getElementById("target")->layoutObject(); |
| 3172 EXPECT_EQ(outputClip, target->localBorderBoxProperties()->clip()); |
| 3201 EXPECT_EQ(frameContentClip(), outputClip->parent()); | 3173 EXPECT_EQ(frameContentClip(), outputClip->parent()); |
| 3202 EXPECT_EQ(FloatRoundedRect(8, 8, 300, 200), outputClip->clipRect()); | 3174 EXPECT_EQ(FloatRoundedRect(8, 8, 300, 200), outputClip->clipRect()); |
| 3203 | 3175 |
| 3204 EXPECT_EQ(properties->effect(), | 3176 EXPECT_EQ(properties->effect(), target->localBorderBoxProperties()->effect()); |
| 3205 properties->localBorderBoxProperties()->effect()); | |
| 3206 EXPECT_TRUE(properties->effect()->parent()->isRoot()); | 3177 EXPECT_TRUE(properties->effect()->parent()->isRoot()); |
| 3207 EXPECT_EQ(SkBlendMode::kSrcOver, properties->effect()->blendMode()); | 3178 EXPECT_EQ(SkBlendMode::kSrcOver, properties->effect()->blendMode()); |
| 3208 EXPECT_EQ(outputClip, properties->effect()->outputClip()); | 3179 EXPECT_EQ(outputClip, properties->effect()->outputClip()); |
| 3209 | 3180 |
| 3210 EXPECT_EQ(properties->effect(), properties->mask()->parent()); | 3181 EXPECT_EQ(properties->effect(), properties->mask()->parent()); |
| 3211 EXPECT_EQ(SkBlendMode::kDstIn, properties->mask()->blendMode()); | 3182 EXPECT_EQ(SkBlendMode::kDstIn, properties->mask()->blendMode()); |
| 3212 EXPECT_EQ(outputClip, properties->mask()->outputClip()); | 3183 EXPECT_EQ(outputClip, properties->mask()->outputClip()); |
| 3213 } | 3184 } |
| 3214 | 3185 |
| 3215 TEST_P(PaintPropertyTreeBuilderTest, MaskEscapeClip) { | 3186 TEST_P(PaintPropertyTreeBuilderTest, MaskEscapeClip) { |
| 3216 // This test verifies an abs-pos element still escape the scroll of a | 3187 // This test verifies an abs-pos element still escape the scroll of a |
| 3217 // static-pos ancestor, but gets clipped due to the presence of a mask. | 3188 // static-pos ancestor, but gets clipped due to the presence of a mask. |
| 3218 setBodyInnerHTML( | 3189 setBodyInnerHTML( |
| 3219 "<div style='width:300px; height:200px; overflow:scroll;'>" | 3190 "<div style='width:300px; height:200px; overflow:scroll;'>" |
| 3220 " <div id='target' style='width:200px; height:300px; " | 3191 " <div id='target' style='width:200px; height:300px; " |
| 3221 "-webkit-mask:linear-gradient(red,red); border:10px dashed black; " | 3192 "-webkit-mask:linear-gradient(red,red); border:10px dashed black; " |
| 3222 "overflow:hidden;'>" | 3193 "overflow:hidden;'>" |
| 3223 " <div id='absolute' style='position:absolute; left:0; top:0;'>Lorem " | 3194 " <div id='absolute' style='position:absolute; left:0; top:0;'>Lorem " |
| 3224 "ipsum</div>" | 3195 "ipsum</div>" |
| 3225 " </div>" | 3196 " </div>" |
| 3226 "</div>"); | 3197 "</div>"); |
| 3227 | 3198 |
| 3228 const ObjectPaintProperties* properties = paintPropertiesForElement("target"); | 3199 const ObjectPaintProperties* properties = paintPropertiesForElement("target"); |
| 3229 const ClipPaintPropertyNode* overflowClip1 = properties->maskClip()->parent(); | 3200 const ClipPaintPropertyNode* overflowClip1 = properties->maskClip()->parent(); |
| 3230 const ClipPaintPropertyNode* maskClip = properties->maskClip(); | 3201 const ClipPaintPropertyNode* maskClip = properties->maskClip(); |
| 3231 const ClipPaintPropertyNode* overflowClip2 = properties->overflowClip(); | 3202 const ClipPaintPropertyNode* overflowClip2 = properties->overflowClip(); |
| 3203 const auto* target = document().getElementById("target")->layoutObject(); |
| 3232 const TransformPaintPropertyNode* scrollTranslation = | 3204 const TransformPaintPropertyNode* scrollTranslation = |
| 3233 properties->localBorderBoxProperties()->transform(); | 3205 target->localBorderBoxProperties()->transform(); |
| 3234 | 3206 |
| 3235 EXPECT_EQ(frameContentClip(), overflowClip1->parent()); | 3207 EXPECT_EQ(frameContentClip(), overflowClip1->parent()); |
| 3236 EXPECT_EQ(FloatRoundedRect(8, 8, 300, 200), overflowClip1->clipRect()); | 3208 EXPECT_EQ(FloatRoundedRect(8, 8, 300, 200), overflowClip1->clipRect()); |
| 3237 EXPECT_EQ(framePreTranslation(), overflowClip1->localTransformSpace()); | 3209 EXPECT_EQ(framePreTranslation(), overflowClip1->localTransformSpace()); |
| 3238 | 3210 |
| 3239 EXPECT_EQ(maskClip, properties->localBorderBoxProperties()->clip()); | 3211 EXPECT_EQ(maskClip, target->localBorderBoxProperties()->clip()); |
| 3240 EXPECT_EQ(overflowClip1, maskClip->parent()); | 3212 EXPECT_EQ(overflowClip1, maskClip->parent()); |
| 3241 EXPECT_EQ(FloatRoundedRect(8, 8, 220, 320), maskClip->clipRect()); | 3213 EXPECT_EQ(FloatRoundedRect(8, 8, 220, 320), maskClip->clipRect()); |
| 3242 EXPECT_EQ(scrollTranslation, maskClip->localTransformSpace()); | 3214 EXPECT_EQ(scrollTranslation, maskClip->localTransformSpace()); |
| 3243 | 3215 |
| 3244 EXPECT_EQ(maskClip, overflowClip2->parent()); | 3216 EXPECT_EQ(maskClip, overflowClip2->parent()); |
| 3245 EXPECT_EQ(FloatRoundedRect(18, 18, 200, 300), overflowClip2->clipRect()); | 3217 EXPECT_EQ(FloatRoundedRect(18, 18, 200, 300), overflowClip2->clipRect()); |
| 3246 EXPECT_EQ(scrollTranslation, overflowClip2->localTransformSpace()); | 3218 EXPECT_EQ(scrollTranslation, overflowClip2->localTransformSpace()); |
| 3247 | 3219 |
| 3248 EXPECT_EQ(properties->effect(), | 3220 EXPECT_EQ(properties->effect(), target->localBorderBoxProperties()->effect()); |
| 3249 properties->localBorderBoxProperties()->effect()); | |
| 3250 EXPECT_TRUE(properties->effect()->parent()->isRoot()); | 3221 EXPECT_TRUE(properties->effect()->parent()->isRoot()); |
| 3251 EXPECT_EQ(SkBlendMode::kSrcOver, properties->effect()->blendMode()); | 3222 EXPECT_EQ(SkBlendMode::kSrcOver, properties->effect()->blendMode()); |
| 3252 EXPECT_EQ(maskClip, properties->effect()->outputClip()); | 3223 EXPECT_EQ(maskClip, properties->effect()->outputClip()); |
| 3253 | 3224 |
| 3254 EXPECT_EQ(properties->effect(), properties->mask()->parent()); | 3225 EXPECT_EQ(properties->effect(), properties->mask()->parent()); |
| 3255 EXPECT_EQ(SkBlendMode::kDstIn, properties->mask()->blendMode()); | 3226 EXPECT_EQ(SkBlendMode::kDstIn, properties->mask()->blendMode()); |
| 3256 EXPECT_EQ(maskClip, properties->mask()->outputClip()); | 3227 EXPECT_EQ(maskClip, properties->mask()->outputClip()); |
| 3257 | 3228 |
| 3258 const ObjectPaintProperties* properties2 = | 3229 const auto* absolute = document().getElementById("absolute")->layoutObject(); |
| 3259 paintPropertiesForElement("absolute"); | |
| 3260 EXPECT_EQ(framePreTranslation(), | 3230 EXPECT_EQ(framePreTranslation(), |
| 3261 properties2->localBorderBoxProperties()->transform()); | 3231 absolute->localBorderBoxProperties()->transform()); |
| 3262 EXPECT_EQ(maskClip, properties2->localBorderBoxProperties()->clip()); | 3232 EXPECT_EQ(maskClip, absolute->localBorderBoxProperties()->clip()); |
| 3263 } | 3233 } |
| 3264 | 3234 |
| 3265 TEST_P(PaintPropertyTreeBuilderTest, MaskInline) { | 3235 TEST_P(PaintPropertyTreeBuilderTest, MaskInline) { |
| 3266 loadAhem(); | 3236 loadAhem(); |
| 3267 // This test verifies CSS mask applied on an inline element is clipped to | 3237 // This test verifies CSS mask applied on an inline element is clipped to |
| 3268 // the line box of the said element. In this test the masked element has | 3238 // the line box of the said element. In this test the masked element has |
| 3269 // only one box, and one of the child element overflows the box. | 3239 // only one box, and one of the child element overflows the box. |
| 3270 setBodyInnerHTML( | 3240 setBodyInnerHTML( |
| 3271 "<style>* { font-family:Ahem; font-size:16px; }</style>" | 3241 "<style>* { font-family:Ahem; font-size:16px; }</style>" |
| 3272 "Lorem" | 3242 "Lorem" |
| 3273 "<span id='target' style='-webkit-mask:linear-gradient(red,red);'>" | 3243 "<span id='target' style='-webkit-mask:linear-gradient(red,red);'>" |
| 3274 " ipsum" | 3244 " ipsum" |
| 3275 " <span id='overflowing' style='position:relative; font-size:32px;'>" | 3245 " <span id='overflowing' style='position:relative; font-size:32px;'>" |
| 3276 " dolor" | 3246 " dolor" |
| 3277 " </span>" | 3247 " </span>" |
| 3278 " sit amet," | 3248 " sit amet," |
| 3279 "</span>"); | 3249 "</span>"); |
| 3280 | 3250 |
| 3281 const ObjectPaintProperties* properties = paintPropertiesForElement("target"); | 3251 const ObjectPaintProperties* properties = paintPropertiesForElement("target"); |
| 3282 const ClipPaintPropertyNode* outputClip = properties->maskClip(); | 3252 const ClipPaintPropertyNode* outputClip = properties->maskClip(); |
| 3253 const auto* target = document().getElementById("target")->layoutObject(); |
| 3283 | 3254 |
| 3284 EXPECT_EQ(outputClip, properties->localBorderBoxProperties()->clip()); | 3255 EXPECT_EQ(outputClip, target->localBorderBoxProperties()->clip()); |
| 3285 EXPECT_EQ(frameContentClip(), outputClip->parent()); | 3256 EXPECT_EQ(frameContentClip(), outputClip->parent()); |
| 3286 EXPECT_EQ(FloatRoundedRect(88, 21, 448, 16), outputClip->clipRect()); | 3257 EXPECT_EQ(FloatRoundedRect(88, 21, 448, 16), outputClip->clipRect()); |
| 3287 | 3258 |
| 3288 EXPECT_EQ(properties->effect(), | 3259 EXPECT_EQ(properties->effect(), target->localBorderBoxProperties()->effect()); |
| 3289 properties->localBorderBoxProperties()->effect()); | |
| 3290 EXPECT_TRUE(properties->effect()->parent()->isRoot()); | 3260 EXPECT_TRUE(properties->effect()->parent()->isRoot()); |
| 3291 EXPECT_EQ(SkBlendMode::kSrcOver, properties->effect()->blendMode()); | 3261 EXPECT_EQ(SkBlendMode::kSrcOver, properties->effect()->blendMode()); |
| 3292 EXPECT_EQ(outputClip, properties->effect()->outputClip()); | 3262 EXPECT_EQ(outputClip, properties->effect()->outputClip()); |
| 3293 | 3263 |
| 3294 EXPECT_EQ(properties->effect(), properties->mask()->parent()); | 3264 EXPECT_EQ(properties->effect(), properties->mask()->parent()); |
| 3295 EXPECT_EQ(SkBlendMode::kDstIn, properties->mask()->blendMode()); | 3265 EXPECT_EQ(SkBlendMode::kDstIn, properties->mask()->blendMode()); |
| 3296 EXPECT_EQ(outputClip, properties->mask()->outputClip()); | 3266 EXPECT_EQ(outputClip, properties->mask()->outputClip()); |
| 3297 | 3267 |
| 3298 const ObjectPaintProperties* properties2 = | 3268 const auto* overflowing = |
| 3299 paintPropertiesForElement("overflowing"); | 3269 document().getElementById("overflowing")->layoutObject(); |
| 3300 EXPECT_EQ(outputClip, properties2->localBorderBoxProperties()->clip()); | 3270 EXPECT_EQ(outputClip, overflowing->localBorderBoxProperties()->clip()); |
| 3301 EXPECT_EQ(properties->effect(), | 3271 EXPECT_EQ(properties->effect(), |
| 3302 properties2->localBorderBoxProperties()->effect()); | 3272 overflowing->localBorderBoxProperties()->effect()); |
| 3303 } | 3273 } |
| 3304 | 3274 |
| 3305 TEST_P(PaintPropertyTreeBuilderTest, MaskClipNodeInvalidation) { | 3275 TEST_P(PaintPropertyTreeBuilderTest, MaskClipNodeInvalidation) { |
| 3306 // This test verifies the clip node generated for mask's implicit clip | 3276 // This test verifies the clip node generated for mask's implicit clip |
| 3307 // is correctly invalidated when a box resizes. | 3277 // is correctly invalidated when a box resizes. |
| 3308 setBodyInnerHTML( | 3278 setBodyInnerHTML( |
| 3309 "<style>" | 3279 "<style>" |
| 3310 "#mask {" | 3280 "#mask {" |
| 3311 " width: 100px;" | 3281 " width: 100px;" |
| 3312 " height:100px;" | 3282 " height:100px;" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3403 "</svg>"); | 3373 "</svg>"); |
| 3404 | 3374 |
| 3405 LayoutObject& svgRoot = *document().getElementById("svgroot")->layoutObject(); | 3375 LayoutObject& svgRoot = *document().getElementById("svgroot")->layoutObject(); |
| 3406 const ObjectPaintProperties* svgRootProperties = svgRoot.paintProperties(); | 3376 const ObjectPaintProperties* svgRootProperties = svgRoot.paintProperties(); |
| 3407 EXPECT_TRUE(svgRootProperties->effect()); | 3377 EXPECT_TRUE(svgRootProperties->effect()); |
| 3408 EXPECT_EQ(EffectPaintPropertyNode::root(), | 3378 EXPECT_EQ(EffectPaintPropertyNode::root(), |
| 3409 svgRootProperties->effect()->parent()); | 3379 svgRootProperties->effect()->parent()); |
| 3410 } | 3380 } |
| 3411 | 3381 |
| 3412 } // namespace blink | 3382 } // namespace blink |
| OLD | NEW |