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

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

Issue 2144303002: Made layout viewport scroll updates from compositor work like ordinary layers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rootScrollerOnCompositor
Patch Set: 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 /* 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 5647 matching lines...) Expand 10 before | Expand all | Expand 10 after
5658 5658
5659 // Make sure we initialize to minimum scale, even if the window size 5659 // Make sure we initialize to minimum scale, even if the window size
5660 // only becomes available after the load begins. 5660 // only becomes available after the load begins.
5661 FrameTestHelpers::WebViewHelper webViewHelper; 5661 FrameTestHelpers::WebViewHelper webViewHelper;
5662 webViewHelper.initializeAndLoad(m_baseURL + "long_scroll.html", true, &clien t); 5662 webViewHelper.initializeAndLoad(m_baseURL + "long_scroll.html", true, &clien t);
5663 webViewHelper.resize(WebSize(1000, 1000)); 5663 webViewHelper.resize(WebSize(1000, 1000));
5664 5664
5665 WebLocalFrameImpl* frameImpl = webViewHelper.webViewImpl()->mainFrameImpl(); 5665 WebLocalFrameImpl* frameImpl = webViewHelper.webViewImpl()->mainFrameImpl();
5666 DocumentLoader::InitialScrollState& initialScrollState = 5666 DocumentLoader::InitialScrollState& initialScrollState =
5667 frameImpl->frame()->loader().documentLoader()->initialScrollState(); 5667 frameImpl->frame()->loader().documentLoader()->initialScrollState();
5668 GraphicsLayer* frameViewLayer = frameImpl->frameView()->layerForScrolling();
5668 5669
5669 EXPECT_FALSE(client.wasFrameScrolled()); 5670 EXPECT_FALSE(client.wasFrameScrolled());
5670 EXPECT_FALSE(initialScrollState.wasScrolledByUser); 5671 EXPECT_FALSE(initialScrollState.wasScrolledByUser);
5671 5672
5672 // Do a compositor scroll, verify that this is counted as a user scroll. 5673 // Do a compositor scroll, verify that this is counted as a user scroll.
5673 webViewHelper.webViewImpl()->applyViewportDeltas(WebFloatSize(), WebFloatSiz e(0, 1), WebFloatSize(), 1.7f, 0); 5674 frameViewLayer->platformLayer()->setScrollPositionDouble(WebDoublePoint(0, 1 ));
5675 frameViewLayer->didScroll();
5676 webViewHelper.webViewImpl()->applyViewportDeltas(WebFloatSize(), WebFloatSiz e(), WebFloatSize(), 1.7f, 0);
5674 EXPECT_TRUE(client.wasFrameScrolled()); 5677 EXPECT_TRUE(client.wasFrameScrolled());
5675 EXPECT_TRUE(initialScrollState.wasScrolledByUser); 5678 EXPECT_TRUE(initialScrollState.wasScrolledByUser);
5676 5679
5677 client.reset(); 5680 client.reset();
5678 initialScrollState.wasScrolledByUser = false; 5681 initialScrollState.wasScrolledByUser = false;
5679 5682
5680 // The page scale 1.0f and scroll. 5683 // The page scale 1.0f and scroll.
5681 webViewHelper.webViewImpl()->applyViewportDeltas(WebFloatSize(), WebFloatSiz e(0, 1), WebFloatSize(), 1.0f, 0); 5684 frameViewLayer->platformLayer()->setScrollPositionDouble(WebDoublePoint(0, 2 ));
5685 frameViewLayer->didScroll();
5686 webViewHelper.webViewImpl()->applyViewportDeltas(WebFloatSize(), WebFloatSiz e(), WebFloatSize(), 1.0f, 0);
5682 EXPECT_TRUE(client.wasFrameScrolled()); 5687 EXPECT_TRUE(client.wasFrameScrolled());
5683 EXPECT_TRUE(initialScrollState.wasScrolledByUser); 5688 EXPECT_TRUE(initialScrollState.wasScrolledByUser);
5684 client.reset(); 5689 client.reset();
5685 initialScrollState.wasScrolledByUser = false; 5690 initialScrollState.wasScrolledByUser = false;
5686 5691
5687 // No scroll event if there is no scroll delta. 5692 // No scroll event if there is no scroll delta.
5693 frameViewLayer->didScroll();
5688 webViewHelper.webViewImpl()->applyViewportDeltas(WebFloatSize(), WebFloatSiz e(), WebFloatSize(), 1.0f, 0); 5694 webViewHelper.webViewImpl()->applyViewportDeltas(WebFloatSize(), WebFloatSiz e(), WebFloatSize(), 1.0f, 0);
5689 EXPECT_FALSE(client.wasFrameScrolled()); 5695 EXPECT_FALSE(client.wasFrameScrolled());
5690 EXPECT_FALSE(initialScrollState.wasScrolledByUser); 5696 EXPECT_FALSE(initialScrollState.wasScrolledByUser);
5691 client.reset(); 5697 client.reset();
5692 5698
5693 // Non zero page scale and scroll. 5699 // Non zero page scale and scroll.
5694 webViewHelper.webViewImpl()->applyViewportDeltas(WebFloatSize(), WebFloatSiz e(9, 13), WebFloatSize(), 0.6f, 0); 5700 frameViewLayer->platformLayer()->setScrollPositionDouble(WebDoublePoint(9, 1 5));
5701 frameViewLayer->didScroll();
5702 webViewHelper.webViewImpl()->applyViewportDeltas(WebFloatSize(), WebFloatSiz e(), WebFloatSize(), 0.6f, 0);
5695 EXPECT_TRUE(client.wasFrameScrolled()); 5703 EXPECT_TRUE(client.wasFrameScrolled());
5696 EXPECT_TRUE(initialScrollState.wasScrolledByUser); 5704 EXPECT_TRUE(initialScrollState.wasScrolledByUser);
5697 client.reset(); 5705 client.reset();
5698 initialScrollState.wasScrolledByUser = false; 5706 initialScrollState.wasScrolledByUser = false;
5699 5707
5700 // Programmatic scroll. 5708 // Programmatic scroll.
5701 frameImpl->executeScript(WebScriptSource("window.scrollTo(0, 20);")); 5709 frameImpl->executeScript(WebScriptSource("window.scrollTo(0, 20);"));
5702 EXPECT_TRUE(client.wasFrameScrolled()); 5710 EXPECT_TRUE(client.wasFrameScrolled());
5703 EXPECT_FALSE(initialScrollState.wasScrolledByUser); 5711 EXPECT_FALSE(initialScrollState.wasScrolledByUser);
5704 client.reset(); 5712 client.reset();
(...skipping 3108 matching lines...) Expand 10 before | Expand all | Expand 10 after
8813 request.setRequestorOrigin(WebSecurityOrigin::createUnique()); 8821 request.setRequestorOrigin(WebSecurityOrigin::createUnique());
8814 helper.webViewImpl()->mainFrame()->toWebLocalFrame()->loadRequest(request); 8822 helper.webViewImpl()->mainFrame()->toWebLocalFrame()->loadRequest(request);
8815 8823
8816 // Normally, the result of the JS url replaces the existing contents on the 8824 // Normally, the result of the JS url replaces the existing contents on the
8817 // Document. However, if the JS triggers a navigation, the contents should 8825 // Document. However, if the JS triggers a navigation, the contents should
8818 // not be replaced. 8826 // not be replaced.
8819 EXPECT_EQ("", toLocalFrame(helper.webViewImpl()->page()->mainFrame())->docum ent()->documentElement()->innerText()); 8827 EXPECT_EQ("", toLocalFrame(helper.webViewImpl()->page()->mainFrame())->docum ent()->documentElement()->innerText());
8820 } 8828 }
8821 8829
8822 } // namespace blink 8830 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698