| OLD | NEW |
| 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 6743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6754 // Make sure we initialize to minimum scale, even if the window size | 6754 // Make sure we initialize to minimum scale, even if the window size |
| 6755 // only becomes available after the load begins. | 6755 // only becomes available after the load begins. |
| 6756 FrameTestHelpers::WebViewHelper webViewHelper; | 6756 FrameTestHelpers::WebViewHelper webViewHelper; |
| 6757 webViewHelper.initializeAndLoad(m_baseURL + "long_scroll.html", true, | 6757 webViewHelper.initializeAndLoad(m_baseURL + "long_scroll.html", true, |
| 6758 &client); | 6758 &client); |
| 6759 webViewHelper.resize(WebSize(1000, 1000)); | 6759 webViewHelper.resize(WebSize(1000, 1000)); |
| 6760 | 6760 |
| 6761 WebLocalFrameImpl* frameImpl = webViewHelper.webView()->mainFrameImpl(); | 6761 WebLocalFrameImpl* frameImpl = webViewHelper.webView()->mainFrameImpl(); |
| 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(); | |
| 6765 | 6764 |
| 6766 EXPECT_FALSE(client.wasFrameScrolled()); | 6765 EXPECT_FALSE(client.wasFrameScrolled()); |
| 6767 EXPECT_FALSE(initialScrollState.wasScrolledByUser); | 6766 EXPECT_FALSE(initialScrollState.wasScrolledByUser); |
| 6768 | 6767 |
| 6768 auto* scrollableArea = frameImpl->frameView()->layoutViewportScrollableArea(); |
| 6769 |
| 6769 // Do a compositor scroll, verify that this is counted as a user scroll. | 6770 // Do a compositor scroll, verify that this is counted as a user scroll. |
| 6770 frameViewLayer->platformLayer()->setScrollPositionDouble( | 6771 scrollableArea->didScroll(gfx::ScrollOffset(0, 1)); |
| 6771 WebDoublePoint(0, 1)); | |
| 6772 frameViewLayer->didScroll(); | |
| 6773 webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), | 6772 webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), |
| 6774 WebFloatSize(), 1.7f, 0); | 6773 WebFloatSize(), 1.7f, 0); |
| 6775 EXPECT_TRUE(client.wasFrameScrolled()); | 6774 EXPECT_TRUE(client.wasFrameScrolled()); |
| 6776 EXPECT_TRUE(initialScrollState.wasScrolledByUser); | 6775 EXPECT_TRUE(initialScrollState.wasScrolledByUser); |
| 6777 | 6776 |
| 6778 client.reset(); | 6777 client.reset(); |
| 6779 initialScrollState.wasScrolledByUser = false; | 6778 initialScrollState.wasScrolledByUser = false; |
| 6780 | 6779 |
| 6781 // The page scale 1.0f and scroll. | 6780 // The page scale 1.0f and scroll. |
| 6782 frameViewLayer->platformLayer()->setScrollPositionDouble( | 6781 scrollableArea->didScroll(gfx::ScrollOffset(0, 2)); |
| 6783 WebDoublePoint(0, 2)); | |
| 6784 frameViewLayer->didScroll(); | |
| 6785 webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), | 6782 webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), |
| 6786 WebFloatSize(), 1.0f, 0); | 6783 WebFloatSize(), 1.0f, 0); |
| 6787 EXPECT_TRUE(client.wasFrameScrolled()); | 6784 EXPECT_TRUE(client.wasFrameScrolled()); |
| 6788 EXPECT_TRUE(initialScrollState.wasScrolledByUser); | 6785 EXPECT_TRUE(initialScrollState.wasScrolledByUser); |
| 6789 client.reset(); | 6786 client.reset(); |
| 6790 initialScrollState.wasScrolledByUser = false; | 6787 initialScrollState.wasScrolledByUser = false; |
| 6791 | 6788 |
| 6792 // No scroll event if there is no scroll delta. | 6789 // No scroll event if there is no scroll delta. |
| 6793 frameViewLayer->didScroll(); | 6790 scrollableArea->didScroll(gfx::ScrollOffset(0, 2)); |
| 6794 webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), | 6791 webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), |
| 6795 WebFloatSize(), 1.0f, 0); | 6792 WebFloatSize(), 1.0f, 0); |
| 6796 EXPECT_FALSE(client.wasFrameScrolled()); | 6793 EXPECT_FALSE(client.wasFrameScrolled()); |
| 6797 EXPECT_FALSE(initialScrollState.wasScrolledByUser); | 6794 EXPECT_FALSE(initialScrollState.wasScrolledByUser); |
| 6798 client.reset(); | 6795 client.reset(); |
| 6799 | 6796 |
| 6800 // Non zero page scale and scroll. | 6797 // Non zero page scale and scroll. |
| 6801 frameViewLayer->platformLayer()->setScrollPositionDouble( | 6798 scrollableArea->didScroll(gfx::ScrollOffset(9, 15)); |
| 6802 WebDoublePoint(9, 15)); | |
| 6803 frameViewLayer->didScroll(); | |
| 6804 webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), | 6799 webViewHelper.webView()->applyViewportDeltas(WebFloatSize(), WebFloatSize(), |
| 6805 WebFloatSize(), 0.6f, 0); | 6800 WebFloatSize(), 0.6f, 0); |
| 6806 EXPECT_TRUE(client.wasFrameScrolled()); | 6801 EXPECT_TRUE(client.wasFrameScrolled()); |
| 6807 EXPECT_TRUE(initialScrollState.wasScrolledByUser); | 6802 EXPECT_TRUE(initialScrollState.wasScrolledByUser); |
| 6808 client.reset(); | 6803 client.reset(); |
| 6809 initialScrollState.wasScrolledByUser = false; | 6804 initialScrollState.wasScrolledByUser = false; |
| 6810 | 6805 |
| 6811 // Programmatic scroll. | 6806 // Programmatic scroll. |
| 6812 frameImpl->executeScript(WebScriptSource("window.scrollTo(0, 20);")); | 6807 frameImpl->executeScript(WebScriptSource("window.scrollTo(0, 20);")); |
| 6813 EXPECT_TRUE(client.wasFrameScrolled()); | 6808 EXPECT_TRUE(client.wasFrameScrolled()); |
| (...skipping 4527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11341 | 11336 |
| 11342 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); | 11337 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); |
| 11343 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); | 11338 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); |
| 11344 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); | 11339 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); |
| 11345 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); | 11340 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); |
| 11346 | 11341 |
| 11347 webViewHelper.reset(); | 11342 webViewHelper.reset(); |
| 11348 } | 11343 } |
| 11349 | 11344 |
| 11350 } // namespace blink | 11345 } // namespace blink |
| OLD | NEW |