OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/PaintLayer.h" | 5 #include "core/paint/PaintLayer.h" |
6 | 6 |
7 #include "core/html/HTMLIFrameElement.h" | 7 #include "core/html/HTMLIFrameElement.h" |
8 #include "core/layout/LayoutBoxModelObject.h" | 8 #include "core/layout/LayoutBoxModelObject.h" |
9 #include "core/layout/LayoutTestHelper.h" | 9 #include "core/layout/LayoutTestHelper.h" |
10 #include "core/layout/LayoutView.h" | 10 #include "core/layout/LayoutView.h" |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 EXPECT_EQ(LayoutRect(0, 30, 50, 5), content->visualRect()); | 494 EXPECT_EQ(LayoutRect(0, 30, 50, 5), content->visualRect()); |
495 } | 495 } |
496 | 496 |
497 TEST_P(PaintLayerTest, CompositingContainerFloat) { | 497 TEST_P(PaintLayerTest, CompositingContainerFloat) { |
498 enableCompositing(); | 498 enableCompositing(); |
499 setBodyInnerHTML( | 499 setBodyInnerHTML( |
500 "<div id='compositedContainer' style='position: relative;" | 500 "<div id='compositedContainer' style='position: relative;" |
501 " will-change: transform'>" | 501 " will-change: transform'>" |
502 " <div id='containingBlock' style='position: relative; z-index: 0'>" | 502 " <div id='containingBlock' style='position: relative; z-index: 0'>" |
503 " <div style='backface-visibility: hidden'></div>" | 503 " <div style='backface-visibility: hidden'></div>" |
504 " <span style='clip-path: polygon(0px 15px, 0px 54px, 100px 0px)'>" | 504 " <span id='span'" |
| 505 " style='clip-path: polygon(0px 15px, 0px 54px, 100px 0px)'>" |
505 " <div id='target' style='float: right; position: relative'></div>" | 506 " <div id='target' style='float: right; position: relative'></div>" |
506 " </span>" | 507 " </span>" |
507 " </div>" | 508 " </div>" |
508 "</div>"); | 509 "</div>"); |
509 | 510 |
510 PaintLayer* target = | 511 PaintLayer* target = |
511 toLayoutBoxModelObject(getLayoutObjectByElementId("target"))->layer(); | 512 toLayoutBoxModelObject(getLayoutObjectByElementId("target"))->layer(); |
| 513 PaintLayer* span = |
| 514 toLayoutBoxModelObject(getLayoutObjectByElementId("span"))->layer(); |
| 515 EXPECT_EQ(span, target->compositingContainer()); |
| 516 PaintLayer* compositedContainer = |
| 517 toLayoutBoxModelObject(getLayoutObjectByElementId("compositedContainer")) |
| 518 ->layer(); |
| 519 |
| 520 // enclosingLayerWithCompositedLayerMapping is not needed or applicable to |
| 521 // SPv2. |
| 522 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 523 EXPECT_EQ(compositedContainer, |
| 524 target->enclosingLayerWithCompositedLayerMapping(ExcludeSelf)); |
| 525 } |
| 526 } |
| 527 |
| 528 TEST_P(PaintLayerTest, CompositingContainerFloatingIframe) { |
| 529 enableCompositing(); |
| 530 setBodyInnerHTML( |
| 531 "<div id='compositedContainer' style='position: relative;" |
| 532 " will-change: transform'>" |
| 533 " <div id='containingBlock' style='position: relative; z-index: 0'>" |
| 534 " <div style='backface-visibility: hidden'></div>" |
| 535 " <span id='span'" |
| 536 " style='clip-path: polygon(0px 15px, 0px 54px, 100px 0px)'>" |
| 537 " <iframe srcdoc='foo' id='target' style='float: right'></iframe>" |
| 538 " </span>" |
| 539 " </div>" |
| 540 "</div>"); |
| 541 |
| 542 PaintLayer* target = |
| 543 toLayoutBoxModelObject(getLayoutObjectByElementId("target"))->layer(); |
| 544 |
| 545 // A non-positioned iframe still gets a PaintLayer because PaintLayers are |
| 546 // forced for all LayoutPart objects. However, such PaintLayers are not |
| 547 // stacked. |
512 PaintLayer* containingBlock = | 548 PaintLayer* containingBlock = |
513 toLayoutBoxModelObject(getLayoutObjectByElementId("containingBlock")) | 549 toLayoutBoxModelObject(getLayoutObjectByElementId("containingBlock")) |
514 ->layer(); | 550 ->layer(); |
515 EXPECT_EQ(containingBlock, target->compositingContainer()); | 551 EXPECT_EQ(containingBlock, target->compositingContainer()); |
516 PaintLayer* compositedContainer = | 552 PaintLayer* compositedContainer = |
517 toLayoutBoxModelObject(getLayoutObjectByElementId("compositedContainer")) | 553 toLayoutBoxModelObject(getLayoutObjectByElementId("compositedContainer")) |
518 ->layer(); | 554 ->layer(); |
519 | 555 |
520 // enclosingLayerWithCompositedLayerMapping is not needed or applicable to | 556 // enclosingLayerWithCompositedLayerMapping is not needed or applicable to |
521 // SPv2. | 557 // SPv2. |
522 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 558 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
523 EXPECT_EQ(compositedContainer, | 559 EXPECT_EQ(compositedContainer, |
524 target->enclosingLayerWithCompositedLayerMapping(ExcludeSelf)); | 560 target->enclosingLayerWithCompositedLayerMapping(ExcludeSelf)); |
525 } | 561 } |
526 } | 562 } |
527 | 563 |
528 } // namespace blink | 564 } // namespace blink |
OLD | NEW |