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

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

Issue 2215333002: Fix element visibility check for validation bubbles and SELECT popups. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename to visibleBoundsInVisualViewport(), etc. Created 4 years, 4 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 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 IntRect expectedBounds = bounds; 1537 IntRect expectedBounds = bounds;
1538 expectedBounds.scale(2.f); 1538 expectedBounds.scale(2.f);
1539 IntPoint expectedScrollDelta = scrollDelta; 1539 IntPoint expectedScrollDelta = scrollDelta;
1540 expectedScrollDelta.scale(2.f, 2.f); 1540 expectedScrollDelta.scale(2.f, 2.f);
1541 1541
1542 EXPECT_POINT_EQ(IntPoint(expectedBounds.location() - expectedScrollDelta), 1542 EXPECT_POINT_EQ(IntPoint(expectedBounds.location() - expectedScrollDelta),
1543 boundsInViewport.location()); 1543 boundsInViewport.location());
1544 EXPECT_SIZE_EQ(expectedBounds.size(), boundsInViewport.size()); 1544 EXPECT_SIZE_EQ(expectedBounds.size(), boundsInViewport.size());
1545 } 1545 }
1546 1546
1547 TEST_P(ParameterizedVisualViewportTest, ElementVisibleBoundsInVisualViewport)
1548 {
1549 initializeWithAndroidSettings();
1550 webViewImpl()->resize(IntSize(640, 1080));
1551 registerMockedHttpURLLoad("viewport-select.html");
1552 navigateTo(m_baseURL + "viewport-select.html");
1553
1554 ASSERT_EQ(2.0f, webViewImpl()->pageScaleFactor());
1555 webViewImpl()->setInitialFocus(false);
1556 Element* element = webViewImpl()->focusedElement();
1557 EXPECT_FALSE(element->visibleBoundsInVisualViewport().isEmpty());
1558
1559 webViewImpl()->setPageScaleFactor(4.0);
1560 EXPECT_TRUE(element->visibleBoundsInVisualViewport().isEmpty());
1561 }
1562
1547 // Test that the various window.scroll and document.body.scroll properties and 1563 // Test that the various window.scroll and document.body.scroll properties and
1548 // methods work unchanged from the pre-virtual viewport mode. 1564 // methods work unchanged from the pre-virtual viewport mode.
1549 TEST_P(ParameterizedVisualViewportTest, bodyAndWindowScrollPropertiesAccountForV iewport) 1565 TEST_P(ParameterizedVisualViewportTest, bodyAndWindowScrollPropertiesAccountForV iewport)
1550 { 1566 {
1551 initializeWithAndroidSettings(); 1567 initializeWithAndroidSettings();
1552 1568
1553 webViewImpl()->resize(IntSize(200, 300)); 1569 webViewImpl()->resize(IntSize(200, 300));
1554 1570
1555 // Load page with no main frame scrolling. 1571 // Load page with no main frame scrolling.
1556 registerMockedHttpURLLoad("200-by-300-viewport.html"); 1572 registerMockedHttpURLLoad("200-by-300-viewport.html");
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1839 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); 1855 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView();
1840 frameView.layoutViewportScrollableArea()->setScrollPosition(DoublePoint(700, 500), ProgrammaticScroll); 1856 frameView.layoutViewportScrollableArea()->setScrollPosition(DoublePoint(700, 500), ProgrammaticScroll);
1841 1857
1842 webViewImpl()->resize(IntSize(400, 300)); 1858 webViewImpl()->resize(IntSize(400, 300));
1843 EXPECT_POINT_EQ(DoublePoint(300, 200), frameView.layoutViewportScrollableAre a()->scrollPositionDouble()); 1859 EXPECT_POINT_EQ(DoublePoint(300, 200), frameView.layoutViewportScrollableAre a()->scrollPositionDouble());
1844 1860
1845 RuntimeEnabledFeatures::setScrollAnchoringEnabled(wasScrollAnchoringEnabled) ; 1861 RuntimeEnabledFeatures::setScrollAnchoringEnabled(wasScrollAnchoringEnabled) ;
1846 } 1862 }
1847 1863
1848 } // namespace 1864 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698