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

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

Issue 2318243002: Promote opaque fixed position elements. (Closed)
Patch Set: Use ScopedRuntimeEnabledFeatureForTest. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
index c11f680b01acfb761d6694d30e1f3bba896c1ea8..d3e7b57907db45bfed0bbb7427fcbdb4c123ca99 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
@@ -10,6 +10,7 @@
#include "core/layout/api/LayoutViewItem.h"
#include "core/page/scrolling/TopDocumentRootScrollerController.h"
#include "core/paint/PaintLayer.h"
+#include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace blink {
@@ -620,6 +621,42 @@ TEST_F(CompositedLayerMappingTest, InterestRectOfIframeWithContentBoxOffset)
EXPECT_RECT_EQ(IntRect(0, 0, 500, 7500), recomputeInterestRect(frameDocument.view()->layoutViewItem().enclosingLayer()->graphicsLayerBacking()));
}
+TEST_F(CompositedLayerMappingTest, PromoteOpaqueFixedPosition)
+{
+ const bool preferCompositing = document().frame()->settings()->preferCompositingToLCDTextEnabled();
+ document().frame()->settings()->setPreferCompositingToLCDTextEnabled(false);
+ ScopedCompositeFixedPositionForTest compositeFixedPosition(true);
+
+ setBodyInnerHTML(
+ "<div id='translucent' style='width: 20px; height: 20px; position: fixed; top: 100px; left: 100px;'></div>"
+ "<div id='opaque' style='width: 20px; height: 20px; position: fixed; top: 100px; left: 200px; background: white;'></div>"
+ "<div id='opaque-with-shadow' style='width: 20px; height: 20px; position: fixed; top: 100px; left: 300px; background: white; box-shadow: 10px 10px 5px #888888;'></div>"
+ "<div id='spacer' style='height: 2000px'></div>");
+
+ document().view()->updateAllLifecyclePhases();
+
+ // The translucent fixed box should not be promoted.
+ Element* element = document().getElementById("translucent");
+ PaintLayer* paintLayer = toLayoutBoxModelObject(element->layoutObject())->layer();
+ EXPECT_EQ(NotComposited, paintLayer->compositingState());
+
+ // The opaque fixed box should be promoted and be opaque so that text will be drawn
+ // with subpixel anti-aliasing.
+ element = document().getElementById("opaque");
+ paintLayer = toLayoutBoxModelObject(element->layoutObject())->layer();
+ EXPECT_EQ(PaintsIntoOwnBacking, paintLayer->compositingState());
+ EXPECT_TRUE(paintLayer->graphicsLayerBacking()->contentsOpaque());
+
+ // The opaque fixed box with shadow should not be promoted because the layer will
+ // include the shadow which is not opaque.
+ element = document().getElementById("opaque-with-shadow");
+ paintLayer = toLayoutBoxModelObject(element->layoutObject())->layer();
+ EXPECT_EQ(NotComposited, paintLayer->compositingState());
+
+ document().frame()->settings()->setPreferCompositingToLCDTextEnabled(preferCompositing);
+}
+
+
TEST_F(CompositedLayerMappingTest, ScrollingContentsAndForegroundLayerPaintingPhase)
{
document().frame()->settings()->setPreferCompositingToLCDTextEnabled(true);
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698