Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Side by Side Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp

Issue 2346883003: Only paint the background onto the scrolling contents layer if we have a scrolling contents layer. (Closed)
Patch Set: Merge with master Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 Element* negativeCompositedChild = document().getElementById("negative-compo sited-child"); 640 Element* negativeCompositedChild = document().getElementById("negative-compo sited-child");
641 negativeCompositedChild->parentNode()->removeChild(negativeCompositedChild); 641 negativeCompositedChild->parentNode()->removeChild(negativeCompositedChild);
642 document().view()->updateAllLifecyclePhases(); 642 document().view()->updateAllLifecyclePhases();
643 643
644 mapping = toLayoutBlock(getLayoutObjectByElementId("container"))->layer()->c ompositedLayerMapping(); 644 mapping = toLayoutBlock(getLayoutObjectByElementId("container"))->layer()->c ompositedLayerMapping();
645 ASSERT_TRUE(mapping->scrollingContentsLayer()); 645 ASSERT_TRUE(mapping->scrollingContentsLayer());
646 EXPECT_EQ(static_cast<GraphicsLayerPaintingPhase>(GraphicsLayerPaintOverflow Contents | GraphicsLayerPaintCompositedScroll | GraphicsLayerPaintForeground), m apping->scrollingContentsLayer()->paintingPhase()); 646 EXPECT_EQ(static_cast<GraphicsLayerPaintingPhase>(GraphicsLayerPaintOverflow Contents | GraphicsLayerPaintCompositedScroll | GraphicsLayerPaintForeground), m apping->scrollingContentsLayer()->paintingPhase());
647 EXPECT_FALSE(mapping->foregroundLayer()); 647 EXPECT_FALSE(mapping->foregroundLayer());
648 } 648 }
649 649
650 TEST_F(CompositedLayerMappingTest, BackgroundPaintedIntoGraphicsLayerIfNotCompos itedScrolling)
651 {
652 document().frame()->settings()->setPreferCompositingToLCDTextEnabled(true);
653 setBodyInnerHTML(
654 "<div id='container' style='overflow: scroll; width: 300px; height: 300p x; border-radius: 5px; background: white; will-change: transform;'>"
655 " <div style='background-color: blue; width: 2000px; height: 2000px;' ></div>"
656 "</div>");
657
658 PaintLayer* layer = toLayoutBlock(getLayoutObjectByElementId("container"))-> layer();
659 EXPECT_TRUE(layer->canPaintBackgroundOntoScrollingContentsLayer());
660
661 // We currently don't use composited scrolling when the container has a bord er-radius
662 // so even though we can paint the background onto the scrolling contents la yer we
663 // don't have a scrolling contents layer to paint into in this case.
664 CompositedLayerMapping* mapping = layer->compositedLayerMapping();
665 EXPECT_FALSE(mapping->hasScrollingLayer());
666 EXPECT_FALSE(mapping->backgroundPaintsOntoScrollingContentsLayer());
667 }
668
650 // Make sure that clipping layers are removed or their masking bit turned off 669 // Make sure that clipping layers are removed or their masking bit turned off
651 // when they're an ancestor of the root scroller element. 670 // when they're an ancestor of the root scroller element.
652 TEST_F(CompositedLayerMappingTest, RootScrollerAncestorsNotClipped) 671 TEST_F(CompositedLayerMappingTest, RootScrollerAncestorsNotClipped)
653 { 672 {
654 NonThrowableExceptionState nonThrow; 673 NonThrowableExceptionState nonThrow;
655 674
656 TopDocumentRootScrollerController& rootScrollerController = 675 TopDocumentRootScrollerController& rootScrollerController =
657 document().frameHost()->globalRootScrollerController(); 676 document().frameHost()->globalRootScrollerController();
658 677
659 setBodyInnerHTML( 678 setBodyInnerHTML(
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 document().setRootScroller(nullptr, nonThrow); 788 document().setRootScroller(nullptr, nonThrow);
770 document().view()->updateAllLifecyclePhases(); 789 document().view()->updateAllLifecyclePhases();
771 ASSERT_EQ(document().documentElement(), rootScrollerController.globalRoo tScroller()); 790 ASSERT_EQ(document().documentElement(), rootScrollerController.globalRoo tScroller());
772 791
773 EXPECT_TRUE(mapping3->clippingLayer()); 792 EXPECT_TRUE(mapping3->clippingLayer());
774 EXPECT_TRUE(mapping3->clippingLayer()->platformLayer()->masksToBounds()) ; 793 EXPECT_TRUE(mapping3->clippingLayer()->platformLayer()->masksToBounds()) ;
775 } 794 }
776 } 795 }
777 796
778 } // namespace blink 797 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698