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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebViewTest.cpp

Issue 2695493003: Ensure FrameView scrollbars are updated when changing device emulation modes (Closed)
Patch Set: address comments Created 3 years, 10 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
« no previous file with comments | « third_party/WebKit/Source/core/frame/VisualViewport.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 4274 matching lines...) Expand 10 before | Expand all | Expand 10 after
4285 4285
4286 EXPECT_EQ(expectedWidth, vwElement->offsetWidth()); 4286 EXPECT_EQ(expectedWidth, vwElement->offsetWidth());
4287 EXPECT_EQ(expectedHeight, vwElement->offsetHeight()); 4287 EXPECT_EQ(expectedHeight, vwElement->offsetHeight());
4288 4288
4289 webView->resize(WebSize(800, 600)); 4289 webView->resize(WebSize(800, 600));
4290 frame->printEnd(); 4290 frame->printEnd();
4291 4291
4292 EXPECT_EQ(800, vwElement->offsetWidth()); 4292 EXPECT_EQ(800, vwElement->offsetWidth());
4293 } 4293 }
4294 4294
4295 TEST_P(WebViewTest, DeviceEmulationResetScrollbars) {
4296 WebViewImpl* webView = m_webViewHelper.initialize();
4297 webView->resize(WebSize(800, 600));
4298
4299 WebURL baseURL = URLTestHelpers::toKURL("http://example.com/");
4300 FrameTestHelpers::loadHTMLString(webView->mainFrame(),
4301 "<!doctype html>"
4302 "<meta name='viewport'"
4303 " content='width=device-width'>"
4304 "<style>"
4305 " body {margin: 0px; height:3000px;}"
4306 "</style>",
4307 baseURL);
4308
4309 WebLocalFrameImpl* frame = webView->mainFrameImpl();
4310 auto* frameView = frame->frameView();
4311 EXPECT_FALSE(frameView->visualViewportSuppliesScrollbars());
4312 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
4313 EXPECT_NE(nullptr,
4314 frameView->layoutViewportScrollableArea()->verticalScrollbar());
4315 } else {
4316 EXPECT_NE(nullptr, frameView->verticalScrollbar());
4317 }
4318
4319 WebDeviceEmulationParams params;
4320 params.screenPosition = WebDeviceEmulationParams::Mobile;
4321 params.deviceScaleFactor = 0;
4322 params.fitToView = false;
4323 params.offset = WebFloatPoint();
4324 params.scale = 1;
4325
4326 webView->enableDeviceEmulation(params);
4327
4328 // The visual viewport should now proivde the scrollbars instead of the view.
4329 EXPECT_TRUE(frameView->visualViewportSuppliesScrollbars());
4330 EXPECT_EQ(nullptr, frameView->verticalScrollbar());
4331
4332 webView->disableDeviceEmulation();
4333
4334 // The view should once again provide the scrollbars.
4335 EXPECT_FALSE(frameView->visualViewportSuppliesScrollbars());
4336 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
4337 EXPECT_NE(nullptr,
4338 frameView->layoutViewportScrollableArea()->verticalScrollbar());
4339 } else {
4340 EXPECT_NE(nullptr, frameView->verticalScrollbar());
4341 }
4342 }
4343
4295 } // namespace blink 4344 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/VisualViewport.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698