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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 Element* negativeCompositedChild = document().getElementById("negative-compo
sited-child"); | 639 Element* negativeCompositedChild = document().getElementById("negative-compo
sited-child"); |
640 negativeCompositedChild->parentNode()->removeChild(negativeCompositedChild); | 640 negativeCompositedChild->parentNode()->removeChild(negativeCompositedChild); |
641 document().view()->updateAllLifecyclePhases(); | 641 document().view()->updateAllLifecyclePhases(); |
642 | 642 |
643 mapping = toLayoutBlock(getLayoutObjectByElementId("container"))->layer()->c
ompositedLayerMapping(); | 643 mapping = toLayoutBlock(getLayoutObjectByElementId("container"))->layer()->c
ompositedLayerMapping(); |
644 ASSERT_TRUE(mapping->scrollingContentsLayer()); | 644 ASSERT_TRUE(mapping->scrollingContentsLayer()); |
645 EXPECT_EQ(static_cast<GraphicsLayerPaintingPhase>(GraphicsLayerPaintOverflow
Contents | GraphicsLayerPaintCompositedScroll | GraphicsLayerPaintForeground), m
apping->scrollingContentsLayer()->paintingPhase()); | 645 EXPECT_EQ(static_cast<GraphicsLayerPaintingPhase>(GraphicsLayerPaintOverflow
Contents | GraphicsLayerPaintCompositedScroll | GraphicsLayerPaintForeground), m
apping->scrollingContentsLayer()->paintingPhase()); |
646 EXPECT_FALSE(mapping->foregroundLayer()); | 646 EXPECT_FALSE(mapping->foregroundLayer()); |
647 } | 647 } |
648 | 648 |
| 649 TEST_F(CompositedLayerMappingTest, BackgroundPaintedIntoGraphicsLayerIfNotCompos
itedScrolling) |
| 650 { |
| 651 document().frame()->settings()->setPreferCompositingToLCDTextEnabled(true); |
| 652 setBodyInnerHTML( |
| 653 "<div id='container' style='overflow: scroll; width: 300px; height: 300p
x; border-radius: 5px; background: white; will-change: transform;'>" |
| 654 " <div style='background-color: blue; width: 2000px; height: 2000px;'
></div>" |
| 655 "</div>"); |
| 656 |
| 657 PaintLayer* layer = toLayoutBlock(getLayoutObjectByElementId("container"))->
layer(); |
| 658 EXPECT_TRUE(layer->canPaintBackgroundOntoScrollingContentsLayer()); |
| 659 |
| 660 // We currently don't use composited scrolling when the container has a bord
er-radius |
| 661 // so even though we can paint the background onto the scrolling contents la
yer we |
| 662 // don't have a scrolling contents layer to paint into in this case. |
| 663 CompositedLayerMapping* mapping = layer->compositedLayerMapping(); |
| 664 EXPECT_FALSE(mapping->hasScrollingLayer()); |
| 665 EXPECT_FALSE(mapping->backgroundPaintsOntoScrollingContentsLayer()); |
| 666 } |
| 667 |
649 } // namespace blink | 668 } // namespace blink |
OLD | NEW |