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

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

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: Fix README.md Created 4 years, 2 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "bindings/core/v8/ScriptController.h" 5 #include "bindings/core/v8/ScriptController.h"
6 #include "core/dom/Document.h" 6 #include "core/dom/Document.h"
7 #include "core/dom/Element.h" 7 #include "core/dom/Element.h"
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/frame/LocalFrame.h" 9 #include "core/frame/LocalFrame.h"
10 #include "core/html/HTMLIFrameElement.h" 10 #include "core/html/HTMLIFrameElement.h"
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 EXPECT_FALSE(frameElement->contentDocument()->view()->canThrottleRendering()); 319 EXPECT_FALSE(frameElement->contentDocument()->view()->canThrottleRendering());
320 compositeFrame(); 320 compositeFrame();
321 EXPECT_TRUE(frameElement->contentDocument()->view()->canThrottleRendering()); 321 EXPECT_TRUE(frameElement->contentDocument()->view()->canThrottleRendering());
322 322
323 // Scroll down to unthrottle the frame. The first frame we composite after 323 // Scroll down to unthrottle the frame. The first frame we composite after
324 // scrolling won't contain the frame yet, but will schedule another repaint. 324 // scrolling won't contain the frame yet, but will schedule another repaint.
325 webView() 325 webView()
326 .mainFrameImpl() 326 .mainFrameImpl()
327 ->frameView() 327 ->frameView()
328 ->layoutViewportScrollableArea() 328 ->layoutViewportScrollableArea()
329 ->setScrollPosition(DoublePoint(0, 480), ProgrammaticScroll); 329 ->setScrollOffset(ScrollOffset(0, 480), ProgrammaticScroll);
330 auto displayItems = compositeFrame(); 330 auto displayItems = compositeFrame();
331 EXPECT_FALSE(displayItems.contains(SimCanvas::Rect, "green")); 331 EXPECT_FALSE(displayItems.contains(SimCanvas::Rect, "green"));
332 332
333 // Now the frame contents should be visible again. 333 // Now the frame contents should be visible again.
334 auto displayItems2 = compositeFrame(); 334 auto displayItems2 = compositeFrame();
335 EXPECT_TRUE(displayItems2.contains(SimCanvas::Rect, "green")); 335 EXPECT_TRUE(displayItems2.contains(SimCanvas::Rect, "green"));
336 } 336 }
337 337
338 TEST_F(FrameThrottlingTest, UnthrottlingTriggersRepaintInCompositedChild) { 338 TEST_F(FrameThrottlingTest, UnthrottlingTriggersRepaintInCompositedChild) {
339 // Create a hidden frame with a composited child layer. 339 // Create a hidden frame with a composited child layer.
(...skipping 18 matching lines...) Expand all
358 EXPECT_FALSE(frameElement->contentDocument()->view()->canThrottleRendering()); 358 EXPECT_FALSE(frameElement->contentDocument()->view()->canThrottleRendering());
359 compositeFrame(); 359 compositeFrame();
360 EXPECT_TRUE(frameElement->contentDocument()->view()->canThrottleRendering()); 360 EXPECT_TRUE(frameElement->contentDocument()->view()->canThrottleRendering());
361 361
362 // Scroll down to unthrottle the frame. The first frame we composite after 362 // Scroll down to unthrottle the frame. The first frame we composite after
363 // scrolling won't contain the frame yet, but will schedule another repaint. 363 // scrolling won't contain the frame yet, but will schedule another repaint.
364 webView() 364 webView()
365 .mainFrameImpl() 365 .mainFrameImpl()
366 ->frameView() 366 ->frameView()
367 ->layoutViewportScrollableArea() 367 ->layoutViewportScrollableArea()
368 ->setScrollPosition(DoublePoint(0, 480), ProgrammaticScroll); 368 ->setScrollOffset(ScrollOffset(0, 480), ProgrammaticScroll);
369 auto displayItems = compositeFrame(); 369 auto displayItems = compositeFrame();
370 EXPECT_FALSE(displayItems.contains(SimCanvas::Rect, "green")); 370 EXPECT_FALSE(displayItems.contains(SimCanvas::Rect, "green"));
371 371
372 // Now the composited child contents should be visible again. 372 // Now the composited child contents should be visible again.
373 auto displayItems2 = compositeFrame(); 373 auto displayItems2 = compositeFrame();
374 EXPECT_TRUE(displayItems2.contains(SimCanvas::Rect, "green")); 374 EXPECT_TRUE(displayItems2.contains(SimCanvas::Rect, "green"));
375 } 375 }
376 376
377 TEST_F(FrameThrottlingTest, ChangeStyleInThrottledFrame) { 377 TEST_F(FrameThrottlingTest, ChangeStyleInThrottledFrame) {
378 // Create a hidden frame which is throttled. 378 // Create a hidden frame which is throttled.
(...skipping 13 matching lines...) Expand all
392 392
393 // Change the background color of the frame's contents from red to green. 393 // Change the background color of the frame's contents from red to green.
394 frameElement->contentDocument()->body()->setAttribute(styleAttr, 394 frameElement->contentDocument()->body()->setAttribute(styleAttr,
395 "background: green"); 395 "background: green");
396 396
397 // Scroll down to unthrottle the frame. 397 // Scroll down to unthrottle the frame.
398 webView() 398 webView()
399 .mainFrameImpl() 399 .mainFrameImpl()
400 ->frameView() 400 ->frameView()
401 ->layoutViewportScrollableArea() 401 ->layoutViewportScrollableArea()
402 ->setScrollPosition(DoublePoint(0, 480), ProgrammaticScroll); 402 ->setScrollOffset(ScrollOffset(0, 480), ProgrammaticScroll);
403 auto displayItems = compositeFrame(); 403 auto displayItems = compositeFrame();
404 EXPECT_FALSE(displayItems.contains(SimCanvas::Rect, "red")); 404 EXPECT_FALSE(displayItems.contains(SimCanvas::Rect, "red"));
405 EXPECT_FALSE(displayItems.contains(SimCanvas::Rect, "green")); 405 EXPECT_FALSE(displayItems.contains(SimCanvas::Rect, "green"));
406 406
407 // Make sure the new style shows up instead of the old one. 407 // Make sure the new style shows up instead of the old one.
408 auto displayItems2 = compositeFrame(); 408 auto displayItems2 = compositeFrame();
409 EXPECT_TRUE(displayItems2.contains(SimCanvas::Rect, "green")); 409 EXPECT_TRUE(displayItems2.contains(SimCanvas::Rect, "green"));
410 } 410 }
411 411
412 TEST_F(FrameThrottlingTest, ThrottledFrameWithFocus) { 412 TEST_F(FrameThrottlingTest, ThrottledFrameWithFocus) {
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 localFrame->script().executeScriptInMainWorld( 868 localFrame->script().executeScriptInMainWorld(
869 "window.requestAnimationFrame(function() {\n" 869 "window.requestAnimationFrame(function() {\n"
870 " var throttledFrame = window.parent.frames.first;\n" 870 " var throttledFrame = window.parent.frames.first;\n"
871 " throttledFrame.document.documentElement.style = 'margin: 50px';\n" 871 " throttledFrame.document.documentElement.style = 'margin: 50px';\n"
872 " throttledFrame.document.querySelector('#d').getBoundingClientRect();\n" 872 " throttledFrame.document.querySelector('#d').getBoundingClientRect();\n"
873 "});\n"); 873 "});\n");
874 compositeFrame(); 874 compositeFrame();
875 } 875 }
876 876
877 } // namespace blink 877 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.cpp ('k') | third_party/WebKit/Source/web/tests/ProgrammaticScrollTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698