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

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

Issue 1990553002: Remove RenderViewImpl::GetFocusedElement. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Made Windows happy and brought back bool return because fake tests. Created 4 years, 7 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 930 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 941
942 // Move the visual viewport over and make the selection in the same 942 // Move the visual viewport over and make the selection in the same
943 // screen-space location. The selection should change to two characters to 943 // screen-space location. The selection should change to two characters to
944 // the right and down one line. 944 // the right and down one line.
945 VisualViewport& visualViewport = frame()->page()->frameHost().visualViewport (); 945 VisualViewport& visualViewport = frame()->page()->frameHost().visualViewport ();
946 visualViewport.move(FloatPoint(60, 25)); 946 visualViewport.move(FloatPoint(60, 25));
947 mainFrame->moveRangeSelection(initialPoint, endPoint); 947 mainFrame->moveRangeSelection(initialPoint, endPoint);
948 EXPECT_EQ("t ", mainFrame->selectionAsText().utf8()); 948 EXPECT_EQ("t ", mainFrame->selectionAsText().utf8());
949 } 949 }
950 950
951 // Test that the scrollFocusedNodeIntoRect method works with the visual viewport . 951 // Test that the scrollFocusedEditableElementIntoRect method works with the visu al viewport.
952 TEST_P(ParameterizedVisualViewportTest, DISABLED_TestScrollFocusedNodeIntoRect) 952 TEST_P(ParameterizedVisualViewportTest, DISABLED_TestScrollFocusedEditableElemen tIntoRect)
953 { 953 {
954 initializeWithDesktopSettings(); 954 initializeWithDesktopSettings();
955 webViewImpl()->resize(IntSize(500, 300)); 955 webViewImpl()->resize(IntSize(500, 300));
956 956
957 registerMockedHttpURLLoad("pinch-viewport-input-field.html"); 957 registerMockedHttpURLLoad("pinch-viewport-input-field.html");
958 navigateTo(m_baseURL + "pinch-viewport-input-field.html"); 958 navigateTo(m_baseURL + "pinch-viewport-input-field.html");
959 959
960 VisualViewport& visualViewport = frame()->page()->frameHost().visualViewport (); 960 VisualViewport& visualViewport = frame()->page()->frameHost().visualViewport ();
961 webViewImpl()->resizeVisualViewport(IntSize(200, 100)); 961 webViewImpl()->resizeVisualViewport(IntSize(200, 100));
962 webViewImpl()->setInitialFocus(false); 962 webViewImpl()->setInitialFocus(false);
963 visualViewport.setLocation(FloatPoint()); 963 visualViewport.setLocation(FloatPoint());
964 webViewImpl()->scrollFocusedNodeIntoRect(IntRect(0, 0, 500, 200)); 964 webViewImpl()->scrollFocusedEditableElementIntoRect(IntRect(0, 0, 500, 200)) ;
965 965
966 EXPECT_POINT_EQ(IntPoint(0, frame()->view()->maximumScrollPosition().y()), 966 EXPECT_POINT_EQ(IntPoint(0, frame()->view()->maximumScrollPosition().y()),
967 frame()->view()->scrollPosition()); 967 frame()->view()->scrollPosition());
968 EXPECT_FLOAT_POINT_EQ(FloatPoint(150, 200), visualViewport.visibleRect().loc ation()); 968 EXPECT_FLOAT_POINT_EQ(FloatPoint(150, 200), visualViewport.visibleRect().loc ation());
969 969
970 // Try it again but with the page zoomed in 970 // Try it again but with the page zoomed in
971 frame()->view()->setScrollPosition(IntPoint(0, 0), ProgrammaticScroll); 971 frame()->view()->setScrollPosition(IntPoint(0, 0), ProgrammaticScroll);
972 webViewImpl()->resizeVisualViewport(IntSize(500, 300)); 972 webViewImpl()->resizeVisualViewport(IntSize(500, 300));
973 visualViewport.setLocation(FloatPoint(0, 0)); 973 visualViewport.setLocation(FloatPoint(0, 0));
974 974
975 webViewImpl()->setPageScaleFactor(2); 975 webViewImpl()->setPageScaleFactor(2);
976 webViewImpl()->scrollFocusedNodeIntoRect(IntRect(0, 0, 500, 200)); 976 webViewImpl()->scrollFocusedEditableElementIntoRect(IntRect(0, 0, 500, 200)) ;
977 EXPECT_POINT_EQ(IntPoint(0, frame()->view()->maximumScrollPosition().y()), 977 EXPECT_POINT_EQ(IntPoint(0, frame()->view()->maximumScrollPosition().y()),
978 frame()->view()->scrollPosition()); 978 frame()->view()->scrollPosition());
979 EXPECT_FLOAT_POINT_EQ(FloatPoint(125, 150), visualViewport.visibleRect().loc ation()); 979 EXPECT_FLOAT_POINT_EQ(FloatPoint(125, 150), visualViewport.visibleRect().loc ation());
980 980
981 // Once more but make sure that we don't move the visual viewport unless nec essary. 981 // Once more but make sure that we don't move the visual viewport unless nec essary.
982 registerMockedHttpURLLoad("pinch-viewport-input-field-long-and-wide.html"); 982 registerMockedHttpURLLoad("pinch-viewport-input-field-long-and-wide.html");
983 navigateTo(m_baseURL + "pinch-viewport-input-field-long-and-wide.html"); 983 navigateTo(m_baseURL + "pinch-viewport-input-field-long-and-wide.html");
984 webViewImpl()->setInitialFocus(false); 984 webViewImpl()->setInitialFocus(false);
985 visualViewport.setLocation(FloatPoint()); 985 visualViewport.setLocation(FloatPoint());
986 frame()->view()->setScrollPosition(IntPoint(0, 0), ProgrammaticScroll); 986 frame()->view()->setScrollPosition(IntPoint(0, 0), ProgrammaticScroll);
987 webViewImpl()->resizeVisualViewport(IntSize(500, 300)); 987 webViewImpl()->resizeVisualViewport(IntSize(500, 300));
988 visualViewport.setLocation(FloatPoint(30, 50)); 988 visualViewport.setLocation(FloatPoint(30, 50));
989 989
990 webViewImpl()->setPageScaleFactor(2); 990 webViewImpl()->setPageScaleFactor(2);
991 webViewImpl()->scrollFocusedNodeIntoRect(IntRect(0, 0, 500, 200)); 991 webViewImpl()->scrollFocusedEditableElementIntoRect(IntRect(0, 0, 500, 200)) ;
992 EXPECT_POINT_EQ(IntPoint(200-30-75, 600-50-65), frame()->view()->scrollPosit ion()); 992 EXPECT_POINT_EQ(IntPoint(200-30-75, 600-50-65), frame()->view()->scrollPosit ion());
993 EXPECT_FLOAT_POINT_EQ(FloatPoint(30, 50), visualViewport.visibleRect().locat ion()); 993 EXPECT_FLOAT_POINT_EQ(FloatPoint(30, 50), visualViewport.visibleRect().locat ion());
994 } 994 }
995 995
996 // Test that resizing the WebView causes ViewportConstrained objects to relayout . 996 // Test that resizing the WebView causes ViewportConstrained objects to relayout .
997 TEST_P(ParameterizedVisualViewportTest, TestWebViewResizeCausesViewportConstrain edLayout) 997 TEST_P(ParameterizedVisualViewportTest, TestWebViewResizeCausesViewportConstrain edLayout)
998 { 998 {
999 initializeWithDesktopSettings(); 999 initializeWithDesktopSettings();
1000 webViewImpl()->resize(IntSize(500, 300)); 1000 webViewImpl()->resize(IntSize(500, 300));
1001 1001
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
1853 webViewImpl()->handleInputEvent(pinchUpdate); 1853 webViewImpl()->handleInputEvent(pinchUpdate);
1854 1854
1855 VisualViewport& visualViewport = webViewImpl()->page()->frameHost().visualVi ewport(); 1855 VisualViewport& visualViewport = webViewImpl()->page()->frameHost().visualVi ewport();
1856 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); 1856 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView();
1857 1857
1858 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), visualViewport.location()); 1858 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), visualViewport.location());
1859 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble()); 1859 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble());
1860 } 1860 }
1861 1861
1862 } // namespace 1862 } // namespace
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.cpp ('k') | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698