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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
632 EXPECT_FALSE(mapping->foregroundLayer()); | 632 EXPECT_FALSE(mapping->foregroundLayer()); |
633 } | 633 } |
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>" | |
643 "</div>" | 642 "</div>" |
644 "<div id='scroller2' class='scroller' style='background: white content-b ox; padding: 10px;'>" | 643 "<div id='scroller2' class='scroller' style='background: white content-b ox; padding: 10px;'></div>" |
645 " <div class='spacer'></div>" | 644 "<div id='scroller3' class='scroller' style='background: white local con tent-box; padding: 10px;'></div>" |
646 "</div>" | 645 "<div id='scroller4' class='scroller' style='background: url(data:image/ png;base64,iVBORw0KGgoAAAANSUhEUg), white local;'></div>" |
647 "<div id='scroller3' class='scroller' style='background: white local con tent-box; padding: 10px;'>" | 646 "<div id='scroller5' class='scroller' style='background: url(data:image/ png;base64,iVBORw0KGgoAAAANSUhEUg) local, white local;'></div>" |
648 " <div class='spacer'></div>" | 647 "<div id='scroller6' class='scroller' style='background: url(data:image/ png;base64,iVBORw0KGgoAAAANSUhEUg) local, white padding-box; padding: 10px;'></d iv>" |
649 "</div>" | 648 "<div id='scroller7' class='scroller' style='background: url(data:image/ png;base64,iVBORw0KGgoAAAANSUhEUg) local, white content-box; padding: 10px;'></d iv>" |
650 ); | 649 ); |
651 | 650 |
652 // First scroller cannot paint background into scrolling contents layer beca use it has a negative z-index child. | 651 // First scroller cannot paint background into scrolling contents layer beca use it has a negative z-index child. |
653 EXPECT_FALSE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller1")); | 652 EXPECT_FALSE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller1")); |
654 | 653 |
655 // Second scroller cannot paint background into scrolling contents layer bec ause it has a content-box clip without local attachment. | 654 // 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")); | 655 EXPECT_FALSE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller2")); |
657 | 656 |
658 // Third scroller can paint background into scrolling contents layer. | 657 // Third scroller can paint background into scrolling contents layer. |
659 EXPECT_TRUE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller3")); | 658 EXPECT_TRUE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller3")); |
659 | |
660 // Fourth scroller cannot paint background into scrolling contents layer bec ause the background image is not locally attached. | |
chrishtr
2016/08/12 17:03:00
You said "cannot" but have EXPECT_TRUE below.
flackr
2016/08/16 17:52:51
Oops, fixed.
| |
661 EXPECT_TRUE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller4")); | |
662 | |
663 // Fifth scroller can paint background into scrolling contents layer because both the image and color are locally attached. | |
664 EXPECT_TRUE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller5")); | |
665 | |
666 // Sixth scroller can paint background into scrolling contents layer because the image is locally attached and even though | |
667 // the color is not, it is filled to the padding box so it will be drawn the same as a locally attached background. | |
668 EXPECT_TRUE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller6")); | |
669 | |
670 // Seventh scroller cannot paint background into scrolling contents layer be cause the color is filled to the content | |
671 // box and we have padding so it is not equivalent to a locally attached bac kground. | |
672 EXPECT_FALSE(shouldPaintBackgroundOntoScrollingContentsLayer("scroller7")); | |
660 } | 673 } |
661 | 674 |
662 } // namespace blink | 675 } // namespace blink |
OLD | NEW |