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

Side by Side Diff: Source/web/tests/ScrollingCoordinatorChromiumTest.cpp

Issue 26110004: Defer the real work in updateCompositingLayers until it's really needed. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: almost there Created 7 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 m_webViewImpl->close(); 96 m_webViewImpl->close();
97 m_mainFrame->close(); 97 m_mainFrame->close();
98 } 98 }
99 99
100 void navigateTo(const std::string& url) 100 void navigateTo(const std::string& url)
101 { 101 {
102 FrameTestHelpers::loadFrame(m_webViewImpl->mainFrame(), url); 102 FrameTestHelpers::loadFrame(m_webViewImpl->mainFrame(), url);
103 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests( ); 103 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests( );
104 } 104 }
105 105
106 void forceFullCompositingUpdate()
107 {
108 RenderLayerCompositor* compositor = m_webViewImpl->mainFrameImpl()->fram e()->contentRenderer()->compositor();
109 compositor->updateCompositingLayers(CompositingUpdateFinishAllDeferredWo rk);
110 }
111
106 void registerMockedHttpURLLoad(const std::string& fileName) 112 void registerMockedHttpURLLoad(const std::string& fileName)
107 { 113 {
108 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseU RL.c_str()), WebString::fromUTF8(fileName.c_str())); 114 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseU RL.c_str()), WebString::fromUTF8(fileName.c_str()));
109 } 115 }
110 116
111 WebLayer* getRootScrollLayer() 117 WebLayer* getRootScrollLayer()
112 { 118 {
113 RenderLayerCompositor* compositor = m_webViewImpl->mainFrameImpl()->fram e()->contentRenderer()->compositor(); 119 RenderLayerCompositor* compositor = m_webViewImpl->mainFrameImpl()->fram e()->contentRenderer()->compositor();
114 ASSERT(compositor); 120 ASSERT(compositor);
115 ASSERT(compositor->scrollLayer()); 121 ASSERT(compositor->scrollLayer());
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 GraphicsLayer* graphicsLayer = compositedLayerMapping->mainGraphicsLayer(); 165 GraphicsLayer* graphicsLayer = compositedLayerMapping->mainGraphicsLayer();
160 if (!graphicsLayer) 166 if (!graphicsLayer)
161 return 0; 167 return 0;
162 return graphicsLayer->platformLayer(); 168 return graphicsLayer->platformLayer();
163 } 169 }
164 170
165 TEST_F(ScrollingCoordinatorChromiumTest, fastScrollingForFixedPosition) 171 TEST_F(ScrollingCoordinatorChromiumTest, fastScrollingForFixedPosition)
166 { 172 {
167 registerMockedHttpURLLoad("fixed-position.html"); 173 registerMockedHttpURLLoad("fixed-position.html");
168 navigateTo(m_baseURL + "fixed-position.html"); 174 navigateTo(m_baseURL + "fixed-position.html");
175 forceFullCompositingUpdate();
169 176
170 // Fixed position should not fall back to main thread scrolling. 177 // Fixed position should not fall back to main thread scrolling.
171 WebLayer* rootScrollLayer = getRootScrollLayer(); 178 WebLayer* rootScrollLayer = getRootScrollLayer();
172 ASSERT_FALSE(rootScrollLayer->shouldScrollOnMainThread()); 179 ASSERT_FALSE(rootScrollLayer->shouldScrollOnMainThread());
173 180
174 Document* document = m_webViewImpl->mainFrameImpl()->frame()->document(); 181 Document* document = m_webViewImpl->mainFrameImpl()->frame()->document();
175 { 182 {
176 Element* element = document->getElementById("div-tl"); 183 Element* element = document->getElementById("div-tl");
177 ASSERT_TRUE(element); 184 ASSERT_TRUE(element);
178 WebLayer* layer = webLayerFromElement(element); 185 WebLayer* layer = webLayerFromElement(element);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 navigateTo(m_baseURL + "clipped-body.html"); 280 navigateTo(m_baseURL + "clipped-body.html");
274 281
275 WebLayer* rootScrollLayer = getRootScrollLayer(); 282 WebLayer* rootScrollLayer = getRootScrollLayer();
276 ASSERT_EQ(0u, rootScrollLayer->nonFastScrollableRegion().size()); 283 ASSERT_EQ(0u, rootScrollLayer->nonFastScrollableRegion().size());
277 } 284 }
278 285
279 TEST_F(ScrollingCoordinatorChromiumTest, overflowScrolling) 286 TEST_F(ScrollingCoordinatorChromiumTest, overflowScrolling)
280 { 287 {
281 registerMockedHttpURLLoad("overflow-scrolling.html"); 288 registerMockedHttpURLLoad("overflow-scrolling.html");
282 navigateTo(m_baseURL + "overflow-scrolling.html"); 289 navigateTo(m_baseURL + "overflow-scrolling.html");
290 forceFullCompositingUpdate();
283 291
284 // Verify the properties of the accelerated scrolling element starting from the RenderObject 292 // Verify the properties of the accelerated scrolling element starting from the RenderObject
285 // all the way to the WebLayer. 293 // all the way to the WebLayer.
286 Element* scrollableElement = m_webViewImpl->mainFrameImpl()->frame()->docume nt()->getElementById("scrollable"); 294 Element* scrollableElement = m_webViewImpl->mainFrameImpl()->frame()->docume nt()->getElementById("scrollable");
287 ASSERT(scrollableElement); 295 ASSERT(scrollableElement);
288 296
289 RenderObject* renderer = scrollableElement->renderer(); 297 RenderObject* renderer = scrollableElement->renderer();
290 ASSERT_TRUE(renderer->isBoxModelObject()); 298 ASSERT_TRUE(renderer->isBoxModelObject());
291 ASSERT_TRUE(renderer->hasLayer()); 299 ASSERT_TRUE(renderer->hasLayer());
292 300
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 405
398 TEST_F(ScrollingCoordinatorChromiumTest, setupScrollbarLayerShouldNotCrash) 406 TEST_F(ScrollingCoordinatorChromiumTest, setupScrollbarLayerShouldNotCrash)
399 { 407 {
400 registerMockedHttpURLLoad("setup_scrollbar_layer_crash.html"); 408 registerMockedHttpURLLoad("setup_scrollbar_layer_crash.html");
401 navigateTo(m_baseURL + "setup_scrollbar_layer_crash.html"); 409 navigateTo(m_baseURL + "setup_scrollbar_layer_crash.html");
402 // This test document setup an iframe with scrollbars, then switch to 410 // This test document setup an iframe with scrollbars, then switch to
403 // an empty document by javascript. 411 // an empty document by javascript.
404 } 412 }
405 413
406 } // namespace 414 } // namespace
OLDNEW
« Source/core/rendering/RenderLayerCompositor.cpp ('K') | « Source/web/PageWidgetDelegate.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698