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

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

Issue 2936423003: Move Get/SetScrollOffset methods from WebFrame to WebLocalFrame. (Closed)
Patch Set: Use WebViewHelper::LocalMainFrame() where possible. Created 3 years, 6 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/BrowserControls.h" 8 #include "core/frame/BrowserControls.h"
9 #include "core/frame/FrameTestHelpers.h" 9 #include "core/frame/FrameTestHelpers.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 RegisterMockedHttpURLLoad("200-by-300.html"); 222 RegisterMockedHttpURLLoad("200-by-300.html");
223 NavigateTo(base_url_ + "200-by-300.html"); 223 NavigateTo(base_url_ + "200-by-300.html");
224 224
225 IntSize size = IntSize(150, 100); 225 IntSize size = IntSize(150, 100);
226 // Vertical scrollbar width and horizontal scrollbar height. 226 // Vertical scrollbar width and horizontal scrollbar height.
227 IntSize scrollbar_size = IntSize(15, 15); 227 IntSize scrollbar_size = IntSize(15, 15);
228 228
229 WebViewImpl()->Resize(size); 229 WebViewImpl()->Resize(size);
230 230
231 // Scroll layout viewport and verify visibleContentRect. 231 // Scroll layout viewport and verify visibleContentRect.
232 WebViewImpl()->MainFrame()->SetScrollOffset(WebSize(0, 50)); 232 WebViewImpl()->MainFrameImpl()->SetScrollOffset(WebSize(0, 50));
233 233
234 VisualViewport& visual_viewport = GetFrame()->GetPage()->GetVisualViewport(); 234 VisualViewport& visual_viewport = GetFrame()->GetPage()->GetVisualViewport();
235 EXPECT_EQ(IntRect(IntPoint(0, 0), size - scrollbar_size), 235 EXPECT_EQ(IntRect(IntPoint(0, 0), size - scrollbar_size),
236 visual_viewport.VisibleContentRect(kExcludeScrollbars)); 236 visual_viewport.VisibleContentRect(kExcludeScrollbars));
237 EXPECT_EQ(IntRect(IntPoint(0, 0), size), 237 EXPECT_EQ(IntRect(IntPoint(0, 0), size),
238 visual_viewport.VisibleContentRect(kIncludeScrollbars)); 238 visual_viewport.VisibleContentRect(kIncludeScrollbars));
239 239
240 WebViewImpl()->SetPageScaleFactor(2.0); 240 WebViewImpl()->SetPageScaleFactor(2.0);
241 241
242 // Scroll visual viewport and verify visibleContentRect. 242 // Scroll visual viewport and verify visibleContentRect.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 323
324 */ 324 */
325 InitializeWithAndroidSettings(); 325 InitializeWithAndroidSettings();
326 326
327 RegisterMockedHttpURLLoad("200-by-800-viewport.html"); 327 RegisterMockedHttpURLLoad("200-by-800-viewport.html");
328 NavigateTo(base_url_ + "200-by-800-viewport.html"); 328 NavigateTo(base_url_ + "200-by-800-viewport.html");
329 329
330 WebViewImpl()->Resize(IntSize(100, 200)); 330 WebViewImpl()->Resize(IntSize(100, 200));
331 331
332 // Scroll main frame to the bottom of the document 332 // Scroll main frame to the bottom of the document
333 WebViewImpl()->MainFrame()->SetScrollOffset(WebSize(0, 400)); 333 WebViewImpl()->MainFrameImpl()->SetScrollOffset(WebSize(0, 400));
334 EXPECT_SIZE_EQ( 334 EXPECT_SIZE_EQ(
335 ScrollOffset(0, 400), 335 ScrollOffset(0, 400),
336 GetFrame()->View()->LayoutViewportScrollableArea()->GetScrollOffset()); 336 GetFrame()->View()->LayoutViewportScrollableArea()->GetScrollOffset());
337 337
338 WebViewImpl()->SetPageScaleFactor(2.0); 338 WebViewImpl()->SetPageScaleFactor(2.0);
339 339
340 // Scroll visual viewport to the bottom of the main frame 340 // Scroll visual viewport to the bottom of the main frame
341 VisualViewport& visual_viewport = GetFrame()->GetPage()->GetVisualViewport(); 341 VisualViewport& visual_viewport = GetFrame()->GetPage()->GetVisualViewport();
342 visual_viewport.SetLocation(FloatPoint(0, 300)); 342 visual_viewport.SetLocation(FloatPoint(0, 300));
343 EXPECT_FLOAT_SIZE_EQ(FloatSize(0, 300), visual_viewport.GetScrollOffset()); 343 EXPECT_FLOAT_SIZE_EQ(FloatSize(0, 300), visual_viewport.GetScrollOffset());
(...skipping 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after
2420 " margin: 0px;" 2420 " margin: 0px;"
2421 " }" 2421 " }"
2422 " div { height:110vh; width: 110vw; }" 2422 " div { height:110vh; width: 110vw; }"
2423 "</style>" 2423 "</style>"
2424 "<div></div>", 2424 "<div></div>",
2425 base_url); 2425 base_url);
2426 } 2426 }
2427 2427
2428 } // namespace 2428 } // namespace
2429 } // namespace blink 2429 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/ProgrammaticScrollTest.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