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

Unified Diff: content/renderer/render_view_browsertest.cc

Issue 2938393003: Convert the preferred size from Viewport coordinates to Window coordinates (Closed)
Patch Set: Convert the preferred size from Viewport coordinates to Window coordinates Created 3 years, 6 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 | content/renderer/render_view_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_view_browsertest.cc
diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc
index e5ca79656a9657d9035cbfd5af20dcdc6f377f36..6c6c31333451f201b64f592038fa546d4cb1d551 100644
--- a/content/renderer/render_view_browsertest.cc
+++ b/content/renderer/render_view_browsertest.cc
@@ -2206,6 +2206,25 @@ TEST_F(RenderViewImplTest, PreferredSizeZoomed) {
EXPECT_EQ(gfx::Size(800, 800), size);
}
+TEST_F(RenderViewImplScaleFactorTest, PreferredSizeWithScaleFactor) {
+ DoSetUp();
+ LoadHTML("<body style='margin:0;'><div style='display:inline-block; "
+ "width:400px; height:400px;'/></body>");
+ view()->webview()->MainFrame()->ToWebLocalFrame()->SetCanHaveScrollbars(
+ false);
+ EnablePreferredSizeMode();
+
+ gfx::Size size = GetPreferredSize();
+ EXPECT_EQ(gfx::Size(400, 400), size);
+
+ // The size is in DIP. Changing the scale factor should not change
+ // the preferred size. (Caveat: a page may apply different layout for
+ // high DPI, in which case, the size may differ.)
+ SetDeviceScaleFactor(2.f);
+ size = GetPreferredSize();
+ EXPECT_EQ(gfx::Size(400, 400), size);
+}
+
// Ensure the RenderViewImpl history list is properly updated when starting a
// new browser-initiated navigation.
TEST_F(RenderViewImplTest, HistoryIsProperlyUpdatedOnNavigation) {
« no previous file with comments | « no previous file | content/renderer/render_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698