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

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

Issue 2680953002: Remove GraphicsLayer::didScroll and directly call ScrollableArea::didScroll (Closed)
Patch Set: Remove unneeded tests from parent patch Created 3 years, 10 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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 6751 matching lines...) Expand 10 before | Expand all | Expand 10 after
6762 DocumentLoader::InitialScrollState& initialScrollState = 6762 DocumentLoader::InitialScrollState& initialScrollState =
6763 frameImpl->frame()->loader().documentLoader()->initialScrollState(); 6763 frameImpl->frame()->loader().documentLoader()->initialScrollState();
6764 GraphicsLayer* frameViewLayer = frameImpl->frameView()->layerForScrolling(); 6764 GraphicsLayer* frameViewLayer = frameImpl->frameView()->layerForScrolling();
6765 6765
6766 EXPECT_FALSE(client.wasFrameScrolled()); 6766 EXPECT_FALSE(client.wasFrameScrolled());
6767 EXPECT_FALSE(initialScrollState.wasScrolledByUser); 6767 EXPECT_FALSE(initialScrollState.wasScrolledByUser);
6768 6768
6769 // Do a compositor scroll, verify that this is counted as a user scroll. 6769 // Do a compositor scroll, verify that this is counted as a user scroll.
6770 frameViewLayer->platformLayer()->setScrollPositionDouble( 6770 frameViewLayer->platformLayer()->setScrollPositionDouble(
6771 WebDoublePoint(0, 1)); 6771 WebDoublePoint(0, 1));
6772 frameViewLayer->didScroll(); 6772 auto* scrollableArea = frameImpl->frameView()->layoutViewportScrollableArea();
6773 scrollableArea->didScroll(gfx::ScrollOffset(0, 1));
6773 webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), 6774 webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(),
6774 WebFloatSize(), 1.7f, 0); 6775 WebFloatSize(), 1.7f, 0);
6775 EXPECT_TRUE(client.wasFrameScrolled()); 6776 EXPECT_TRUE(client.wasFrameScrolled());
6776 EXPECT_TRUE(initialScrollState.wasScrolledByUser); 6777 EXPECT_TRUE(initialScrollState.wasScrolledByUser);
6777 6778
6778 client.reset(); 6779 client.reset();
6779 initialScrollState.wasScrolledByUser = false; 6780 initialScrollState.wasScrolledByUser = false;
6780 6781
6781 // The page scale 1.0f and scroll. 6782 // The page scale 1.0f and scroll.
6782 frameViewLayer->platformLayer()->setScrollPositionDouble( 6783 frameViewLayer->platformLayer()->setScrollPositionDouble(
6783 WebDoublePoint(0, 2)); 6784 WebDoublePoint(0, 2));
6784 frameViewLayer->didScroll(); 6785 scrollableArea->didScroll(gfx::ScrollOffset(0, 2));
6785 webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), 6786 webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(),
6786 WebFloatSize(), 1.0f, 0); 6787 WebFloatSize(), 1.0f, 0);
6787 EXPECT_TRUE(client.wasFrameScrolled()); 6788 EXPECT_TRUE(client.wasFrameScrolled());
6788 EXPECT_TRUE(initialScrollState.wasScrolledByUser); 6789 EXPECT_TRUE(initialScrollState.wasScrolledByUser);
6789 client.reset(); 6790 client.reset();
6790 initialScrollState.wasScrolledByUser = false; 6791 initialScrollState.wasScrolledByUser = false;
6791 6792
6792 // No scroll event if there is no scroll delta. 6793 // No scroll event if there is no scroll delta.
6793 frameViewLayer->didScroll(); 6794 scrollableArea->didScroll(gfx::ScrollOffset(0, 2));
6794 webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), 6795 webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(),
6795 WebFloatSize(), 1.0f, 0); 6796 WebFloatSize(), 1.0f, 0);
6796 EXPECT_FALSE(client.wasFrameScrolled()); 6797 EXPECT_FALSE(client.wasFrameScrolled());
6797 EXPECT_FALSE(initialScrollState.wasScrolledByUser); 6798 EXPECT_FALSE(initialScrollState.wasScrolledByUser);
6798 client.reset(); 6799 client.reset();
6799 6800
6800 // Non zero page scale and scroll. 6801 // Non zero page scale and scroll.
6801 frameViewLayer->platformLayer()->setScrollPositionDouble( 6802 frameViewLayer->platformLayer()->setScrollPositionDouble(
6802 WebDoublePoint(9, 15)); 6803 WebDoublePoint(9, 15));
6803 frameViewLayer->didScroll(); 6804 scrollableArea->didScroll(gfx::ScrollOffset(9, 15));
6804 webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), 6805 webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(),
6805 WebFloatSize(), 0.6f, 0); 6806 WebFloatSize(), 0.6f, 0);
6806 EXPECT_TRUE(client.wasFrameScrolled()); 6807 EXPECT_TRUE(client.wasFrameScrolled());
6807 EXPECT_TRUE(initialScrollState.wasScrolledByUser); 6808 EXPECT_TRUE(initialScrollState.wasScrolledByUser);
6808 client.reset(); 6809 client.reset();
6809 initialScrollState.wasScrolledByUser = false; 6810 initialScrollState.wasScrolledByUser = false;
6810 6811
6811 // Programmatic scroll. 6812 // Programmatic scroll.
6812 frameImpl->executeScript(WebScriptSource("window.scrollTo(0, 20);")); 6813 frameImpl->executeScript(WebScriptSource("window.scrollTo(0, 20);"));
6813 EXPECT_TRUE(client.wasFrameScrolled()); 6814 EXPECT_TRUE(client.wasFrameScrolled());
(...skipping 4513 matching lines...) Expand 10 before | Expand all | Expand 10 after
11327 11328
11328 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); 11329 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached());
11329 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); 11330 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading());
11330 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); 11331 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad());
11331 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); 11332 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents());
11332 11333
11333 webViewHelper.reset(); 11334 webViewHelper.reset();
11334 } 11335 }
11335 11336
11336 } // namespace blink 11337 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698