OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/compositing/CompositedLayerMapping.h" | 5 #include "core/layout/compositing/CompositedLayerMapping.h" |
6 | 6 |
7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.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/api/LayoutViewItem.h" | 10 #include "core/layout/api/LayoutViewItem.h" |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 | 634 |
635 TEST_F(CompositedLayerMappingTest, ShouldPaintBackgroundOntoScrollingContentsLay
er) | 635 TEST_F(CompositedLayerMappingTest, ShouldPaintBackgroundOntoScrollingContentsLay
er) |
636 { | 636 { |
637 document().frame()->settings()->setPreferCompositingToLCDTextEnabled(true); | 637 document().frame()->settings()->setPreferCompositingToLCDTextEnabled(true); |
638 setBodyInnerHTML( | 638 setBodyInnerHTML( |
639 "<style>.scroller { overflow: scroll; will-change: transform; width: 300
px; height: 300px;} .spacer { height: 1000px; }</style>" | 639 "<style>.scroller { overflow: scroll; will-change: transform; width: 300
px; height: 300px;} .spacer { height: 1000px; }</style>" |
640 "<div id='scroller1' class='scroller' style='background: white local;'>" | 640 "<div id='scroller1' class='scroller' style='background: white local;'>" |
641 " <div id='negative-composited-child' style='background-color: red; w
idth: 1px; height: 1px; position: absolute; backface-visibility: hidden; z-index
: -1'></div>" | 641 " <div id='negative-composited-child' style='background-color: red; w
idth: 1px; height: 1px; position: absolute; backface-visibility: hidden; z-index
: -1'></div>" |
642 " <div class='spacer'></div>" | 642 " <div class='spacer'></div>" |
643 "</div>" | 643 "</div>" |
644 "<div id='scroller2' class='scroller' style='background: white content-b
ox; padding: 10px;'>" | 644 "<div id='scroller2' class='scroller' style='background: white content-b
ox; padding: 10px;'><div class='spacer'></div></div>" |
645 " <div class='spacer'></div>" | 645 "<div id='scroller3' class='scroller' style='background: white local con
tent-box; padding: 10px;'><div class='spacer'></div></div>" |
646 "</div>" | 646 "<div id='scroller4' class='scroller' style='background: url(data:image/
png;base64,iVBORw0KGgoAAAANSUhEUg), white local;'><div class='spacer'></div></di
v>" |
647 "<div id='scroller3' class='scroller' style='background: white local con
tent-box; padding: 10px;'>" | 647 "<div id='scroller5' class='scroller' style='background: url(data:image/
png;base64,iVBORw0KGgoAAAANSUhEUg) local, white local;'><div class='spacer'></di
v></div>" |
648 " <div class='spacer'></div>" | 648 "<div id='scroller6' class='scroller' style='background: url(data:image/
png;base64,iVBORw0KGgoAAAANSUhEUg) local, white padding-box; padding: 10px;'><di
v class='spacer'></div></div>" |
649 "</div>" | 649 "<div id='scroller7' class='scroller' style='background: url(data:image/
png;base64,iVBORw0KGgoAAAANSUhEUg) local, white content-box; padding: 10px;'><di
v class='spacer'></div></div>" |
650 ); | 650 ); |
651 | 651 |
652 // First scroller cannot paint background into scrolling contents layer beca
use it has a negative z-index child. | 652 // First scroller cannot paint background into scrolling contents layer beca
use it has a negative z-index child. |
653 EXPECT_FALSE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller1")); | 653 EXPECT_FALSE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller1")); |
654 | 654 |
655 // Second scroller cannot paint background into scrolling contents layer bec
ause it has a content-box clip without local attachment. | 655 // Second scroller cannot paint background into scrolling contents layer bec
ause it has a content-box clip without local attachment. |
656 EXPECT_FALSE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller2")); | 656 EXPECT_FALSE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller2")); |
657 | 657 |
658 // Third scroller can paint background into scrolling contents layer. | 658 // Third scroller can paint background into scrolling contents layer. |
659 EXPECT_TRUE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller3")); | 659 EXPECT_TRUE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller3")); |
| 660 |
| 661 // Fourth scroller cannot paint background into scrolling contents layer bec
ause the background image is not locally attached. |
| 662 EXPECT_FALSE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller4")); |
| 663 |
| 664 // Fifth scroller can paint background into scrolling contents layer because
both the image and color are locally attached. |
| 665 EXPECT_TRUE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller5")); |
| 666 |
| 667 // Sixth scroller can paint background into scrolling contents layer because
the image is locally attached and even though |
| 668 // the color is not, it is filled to the padding box so it will be drawn the
same as a locally attached background. |
| 669 EXPECT_TRUE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller6")); |
| 670 |
| 671 // Seventh scroller cannot paint background into scrolling contents layer be
cause the color is filled to the content |
| 672 // box and we have padding so it is not equivalent to a locally attached bac
kground. |
| 673 EXPECT_FALSE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller7")); |
660 } | 674 } |
661 | 675 |
662 } // namespace blink | 676 } // namespace blink |
OLD | NEW |