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

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

Issue 2459393003: Only promote fixed position elements on low dpi without transform or opacity. (Closed)
Patch Set: Reset tests which are no longer composited to old expectations. Created 4 years, 1 month 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 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 ASSERT_TRUE(frameDocument.view()->layoutViewItem().hasLayer()); 784 ASSERT_TRUE(frameDocument.view()->layoutViewItem().hasLayer());
785 // The width is 485 pixels due to the size of the scrollbar. 785 // The width is 485 pixels due to the size of the scrollbar.
786 EXPECT_RECT_EQ( 786 EXPECT_RECT_EQ(
787 IntRect(0, 0, 500, 7500), 787 IntRect(0, 0, 500, 7500),
788 recomputeInterestRect(frameDocument.view() 788 recomputeInterestRect(frameDocument.view()
789 ->layoutViewItem() 789 ->layoutViewItem()
790 .enclosingLayer() 790 .enclosingLayer()
791 ->graphicsLayerBackingForScrolling())); 791 ->graphicsLayerBackingForScrolling()));
792 } 792 }
793 793
794 TEST_P(CompositedLayerMappingTest, PromoteOpaqueFixedPosition) {
795 const bool preferCompositing =
796 document().frame()->settings()->preferCompositingToLCDTextEnabled();
797 document().frame()->settings()->setPreferCompositingToLCDTextEnabled(false);
798 ScopedCompositeFixedPositionForTest compositeFixedPosition(true);
799
800 setBodyInnerHTML(
801 "<div id='translucent' style='width: 20px; height: 20px; position: "
802 "fixed; top: 100px; left: 100px;'></div>"
803 "<div id='opaque' style='width: 20px; height: 20px; position: fixed; "
804 "top: 100px; left: 200px; background: white;'></div>"
805 "<div id='opaque-with-shadow' style='width: 20px; height: 20px; "
806 "position: fixed; top: 100px; left: 300px; background: white; "
807 "box-shadow: 10px 10px 5px #888888;'></div>"
808 "<div id='spacer' style='height: 2000px'></div>");
809
810 document().view()->updateAllLifecyclePhases();
811
812 // The translucent fixed box should not be promoted.
813 Element* element = document().getElementById("translucent");
814 PaintLayer* paintLayer =
815 toLayoutBoxModelObject(element->layoutObject())->layer();
816 EXPECT_EQ(NotComposited, paintLayer->compositingState());
817
818 // The opaque fixed box should be promoted and be opaque so that text will be
819 // drawn with subpixel anti-aliasing.
820 element = document().getElementById("opaque");
821 paintLayer = toLayoutBoxModelObject(element->layoutObject())->layer();
822 EXPECT_EQ(PaintsIntoOwnBacking, paintLayer->compositingState());
823 EXPECT_TRUE(paintLayer->graphicsLayerBacking()->contentsOpaque());
824
825 // The opaque fixed box with shadow should not be promoted because the layer
826 // will include the shadow which is not opaque.
827 element = document().getElementById("opaque-with-shadow");
828 paintLayer = toLayoutBoxModelObject(element->layoutObject())->layer();
829 EXPECT_EQ(NotComposited, paintLayer->compositingState());
830
831 document().frame()->settings()->setPreferCompositingToLCDTextEnabled(
832 preferCompositing);
833 }
834
835 TEST_P(CompositedLayerMappingTest, 794 TEST_P(CompositedLayerMappingTest,
836 ScrollingContentsAndForegroundLayerPaintingPhase) { 795 ScrollingContentsAndForegroundLayerPaintingPhase) {
837 document().frame()->settings()->setPreferCompositingToLCDTextEnabled(true); 796 document().frame()->settings()->setPreferCompositingToLCDTextEnabled(true);
838 setBodyInnerHTML( 797 setBodyInnerHTML(
839 "<div id='container' style='position: relative; z-index: 1; overflow: " 798 "<div id='container' style='position: relative; z-index: 1; overflow: "
840 "scroll; width: 300px; height: 300px'>" 799 "scroll; width: 300px; height: 300px'>"
841 " <div id='negative-composited-child' style='background-color: red; " 800 " <div id='negative-composited-child' style='background-color: red; "
842 "width: 1px; height: 1px; position: absolute; backface-visibility: " 801 "width: 1px; height: 1px; position: absolute; backface-visibility: "
843 "hidden; z-index: -1'></div>" 802 "hidden; z-index: -1'></div>"
844 " <div style='background-color: blue; width: 2000px; height: 2000px; " 803 " <div style='background-color: blue; width: 2000px; height: 2000px; "
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 document().view()->updateAllLifecyclePhases(); 1001 document().view()->updateAllLifecyclePhases();
1043 ASSERT_EQ(document().documentElement(), 1002 ASSERT_EQ(document().documentElement(),
1044 rootScrollerController.globalRootScroller()); 1003 rootScrollerController.globalRootScroller());
1045 1004
1046 EXPECT_TRUE(mapping3->clippingLayer()); 1005 EXPECT_TRUE(mapping3->clippingLayer());
1047 EXPECT_TRUE(mapping3->clippingLayer()->platformLayer()->masksToBounds()); 1006 EXPECT_TRUE(mapping3->clippingLayer()->platformLayer()->masksToBounds());
1048 } 1007 }
1049 } 1008 }
1050 1009
1051 } // namespace blink 1010 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/BUILD.gn ('k') | third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698