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

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

Issue 2012823003: Move IME related functions from WebFrame to WebLocalFrame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add CHECK in TextInputController::HasMarkedText() Created 4 years, 5 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 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 WebRect baseRect; 932 WebRect baseRect;
933 WebRect extentRect; 933 WebRect extentRect;
934 934
935 webViewImpl()->setPageScaleFactor(2); 935 webViewImpl()->setPageScaleFactor(2);
936 WebFrame* mainFrame = webViewImpl()->mainFrame(); 936 WebFrame* mainFrame = webViewImpl()->mainFrame();
937 937
938 // Select some text and get the base and extent rects (that's the start of 938 // Select some text and get the base and extent rects (that's the start of
939 // the range and its end). Do a sanity check that the expected text is 939 // the range and its end). Do a sanity check that the expected text is
940 // selected 940 // selected
941 mainFrame->executeScript(WebScriptSource("selectRange();")); 941 mainFrame->executeScript(WebScriptSource("selectRange();"));
942 EXPECT_EQ("ir", mainFrame->selectionAsText().utf8()); 942 EXPECT_EQ("ir", mainFrame->toWebLocalFrame()->selectionAsText().utf8());
943 943
944 webViewImpl()->selectionBounds(baseRect, extentRect); 944 webViewImpl()->selectionBounds(baseRect, extentRect);
945 WebPoint initialPoint(baseRect.x, baseRect.y); 945 WebPoint initialPoint(baseRect.x, baseRect.y);
946 WebPoint endPoint(extentRect.x, extentRect.y); 946 WebPoint endPoint(extentRect.x, extentRect.y);
947 947
948 // Move the visual viewport over and make the selection in the same 948 // Move the visual viewport over and make the selection in the same
949 // screen-space location. The selection should change to two characters to 949 // screen-space location. The selection should change to two characters to
950 // the right and down one line. 950 // the right and down one line.
951 VisualViewport& visualViewport = frame()->page()->frameHost().visualViewport (); 951 VisualViewport& visualViewport = frame()->page()->frameHost().visualViewport ();
952 visualViewport.move(FloatPoint(60, 25)); 952 visualViewport.move(FloatPoint(60, 25));
953 mainFrame->moveRangeSelection(initialPoint, endPoint); 953 mainFrame->toWebLocalFrame()->moveRangeSelection(initialPoint, endPoint);
954 EXPECT_EQ("t ", mainFrame->selectionAsText().utf8()); 954 EXPECT_EQ("t ", mainFrame->toWebLocalFrame()->selectionAsText().utf8());
955 } 955 }
956 956
957 // Test that the scrollFocusedEditableElementIntoRect method works with the visu al viewport. 957 // Test that the scrollFocusedEditableElementIntoRect method works with the visu al viewport.
958 TEST_P(ParameterizedVisualViewportTest, DISABLED_TestScrollFocusedEditableElemen tIntoRect) 958 TEST_P(ParameterizedVisualViewportTest, DISABLED_TestScrollFocusedEditableElemen tIntoRect)
959 { 959 {
960 initializeWithDesktopSettings(); 960 initializeWithDesktopSettings();
961 webViewImpl()->resize(IntSize(500, 300)); 961 webViewImpl()->resize(IntSize(500, 300));
962 962
963 registerMockedHttpURLLoad("pinch-viewport-input-field.html"); 963 registerMockedHttpURLLoad("pinch-viewport-input-field.html");
964 navigateTo(m_baseURL + "pinch-viewport-input-field.html"); 964 navigateTo(m_baseURL + "pinch-viewport-input-field.html");
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after
1859 webViewImpl()->handleInputEvent(pinchUpdate); 1859 webViewImpl()->handleInputEvent(pinchUpdate);
1860 1860
1861 VisualViewport& visualViewport = webViewImpl()->page()->frameHost().visualVi ewport(); 1861 VisualViewport& visualViewport = webViewImpl()->page()->frameHost().visualVi ewport();
1862 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView(); 1862 FrameView& frameView = *webViewImpl()->mainFrameImpl()->frameView();
1863 1863
1864 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), visualViewport.location()); 1864 EXPECT_FLOAT_POINT_EQ(FloatPoint(50, 50), visualViewport.location());
1865 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble()); 1865 EXPECT_FLOAT_POINT_EQ(FloatPoint(0, 0), frameView.scrollPositionDouble());
1866 } 1866 }
1867 1867
1868 } // namespace 1868 } // 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