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

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

Issue 2339873002: Replace hide-scrollbars flag with a web setting. (Closed)
Patch Set: check for presence of settings using DCHECK + sync. 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/frame/VisualViewport.h" 5 #include "core/frame/VisualViewport.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/frame/FrameHost.h" 8 #include "core/frame/FrameHost.h"
9 #include "core/frame/FrameView.h" 9 #include "core/frame/FrameView.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 webViewImpl()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatS ize(), 1, -1); 1456 webViewImpl()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), WebFloatS ize(), 1, -1);
1457 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); 1457 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView();
1458 frameView.setScrollPosition(IntPoint(0, 10000), ProgrammaticScroll); 1458 frameView.setScrollPosition(IntPoint(0, 10000), ProgrammaticScroll);
1459 EXPECT_EQ(500, frameView.scrollPositionDouble().y()); 1459 EXPECT_EQ(500, frameView.scrollPositionDouble().y());
1460 1460
1461 // Now send the resize, make sure the scroll offset doesn't change. 1461 // Now send the resize, make sure the scroll offset doesn't change.
1462 webViewImpl()->resizeWithTopControls(WebSize(1000, 1500), 500, false); 1462 webViewImpl()->resizeWithTopControls(WebSize(1000, 1500), 500, false);
1463 EXPECT_EQ(500, frameView.scrollPositionDouble().y()); 1463 EXPECT_EQ(500, frameView.scrollPositionDouble().y());
1464 } 1464 }
1465 1465
1466 static void configureHiddenScrollbarsSettings(WebSettings* settings)
1467 {
1468 VisualViewportTest::configureAndroidSettings(settings);
1469 settings->setHideScrollbars(true);
1470 }
1471
1472 // Tests that scrollbar layers are not attached to the inner viewport container
1473 // layer when hideScrollbars WebSetting is true.
1474 TEST_F(VisualViewportTest, TestScrollbarsNotAttachedWhenHideScrollbarsSettingIsT rue)
1475 {
1476 initializeWithAndroidSettings(configureHiddenScrollbarsSettings);
1477 webViewImpl()->resize(IntSize(100, 150));
1478 navigateTo("about:blank");
1479
1480 VisualViewport& visualViewport = frame()->page()->frameHost().visualViewport ();
1481 EXPECT_FALSE(visualViewport.layerForHorizontalScrollbar()->parent());
1482 EXPECT_FALSE(visualViewport.layerForVerticalScrollbar()->parent());
1483 }
1484
1485 // Tests that scrollbar layers are attached to the inner viewport container
1486 // layer when hideScrollbars WebSetting is false.
1487 TEST_F(VisualViewportTest, TestScrollbarsAttachedWhenHideScrollbarsSettingIsFals e)
1488 {
1489 initializeWithAndroidSettings();
1490 webViewImpl()->resize(IntSize(100, 150));
1491 navigateTo("about:blank");
1492
1493 VisualViewport& visualViewport = frame()->page()->frameHost().visualViewport ();
1494 EXPECT_TRUE(visualViewport.layerForHorizontalScrollbar()->parent());
1495 EXPECT_TRUE(visualViewport.layerForVerticalScrollbar()->parent());
1496 }
1497
1466 // Tests that the layout viewport's scroll layer bounds are updated in a composi ting 1498 // Tests that the layout viewport's scroll layer bounds are updated in a composi ting
1467 // change update. crbug.com/423188. 1499 // change update. crbug.com/423188.
1468 TEST_P(ParameterizedVisualViewportTest, TestChangingContentSizeAffectsScrollBoun ds) 1500 TEST_P(ParameterizedVisualViewportTest, TestChangingContentSizeAffectsScrollBoun ds)
1469 { 1501 {
1470 initializeWithAndroidSettings(); 1502 initializeWithAndroidSettings();
1471 webViewImpl()->resize(IntSize(100, 150)); 1503 webViewImpl()->resize(IntSize(100, 150));
1472 1504
1473 registerMockedHttpURLLoad("content-width-1000.html"); 1505 registerMockedHttpURLLoad("content-width-1000.html");
1474 navigateTo(m_baseURL + "content-width-1000.html"); 1506 navigateTo(m_baseURL + "content-width-1000.html");
1475 1507
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
1918 1950
1919 EXPECT_POINT_EQ( 1951 EXPECT_POINT_EQ(
1920 DoublePoint(), 1952 DoublePoint(),
1921 frameView.layoutViewportScrollableArea()->scrollPositionDouble()); 1953 frameView.layoutViewportScrollableArea()->scrollPositionDouble());
1922 EXPECT_EQ(600, scroller->scrollTop()); 1954 EXPECT_EQ(600, scroller->scrollTop());
1923 1955
1924 RuntimeEnabledFeatures::setSetRootScrollerEnabled(wasRootScrollerEnabled); 1956 RuntimeEnabledFeatures::setSetRootScrollerEnabled(wasRootScrollerEnabled);
1925 } 1957 }
1926 1958
1927 } // namespace 1959 } // namespace
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebSettingsImpl.cpp ('k') | third_party/WebKit/public/web/WebRuntimeFeatures.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698