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

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

Issue 58543002: Use a boolean hasCompositedLayerMapping() accessor instead of the pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update comment for hasCompositedLayerMapping Created 7 years, 1 month 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
« no previous file with comments | « Source/web/LinkHighlight.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 static WebLayer* webLayerFromElement(Element* element) 153 static WebLayer* webLayerFromElement(Element* element)
154 { 154 {
155 if (!element) 155 if (!element)
156 return 0; 156 return 0;
157 RenderObject* renderer = element->renderer(); 157 RenderObject* renderer = element->renderer();
158 if (!renderer || !renderer->isBoxModelObject()) 158 if (!renderer || !renderer->isBoxModelObject())
159 return 0; 159 return 0;
160 RenderLayer* layer = toRenderBoxModelObject(renderer)->layer(); 160 RenderLayer* layer = toRenderBoxModelObject(renderer)->layer();
161 if (!layer) 161 if (!layer)
162 return 0; 162 return 0;
163 CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMappi ng(); 163 if (!layer->hasCompositedLayerMapping())
164 if (!compositedLayerMapping)
165 return 0; 164 return 0;
165 CompositedLayerMappingPtr compositedLayerMapping = layer->compositedLayerMap ping();
166 GraphicsLayer* graphicsLayer = compositedLayerMapping->mainGraphicsLayer(); 166 GraphicsLayer* graphicsLayer = compositedLayerMapping->mainGraphicsLayer();
167 if (!graphicsLayer) 167 if (!graphicsLayer)
168 return 0; 168 return 0;
169 return graphicsLayer->platformLayer(); 169 return graphicsLayer->platformLayer();
170 } 170 }
171 171
172 TEST_F(ScrollingCoordinatorChromiumTest, fastScrollingForFixedPosition) 172 TEST_F(ScrollingCoordinatorChromiumTest, fastScrollingForFixedPosition)
173 { 173 {
174 registerMockedHttpURLLoad("fixed-position.html"); 174 registerMockedHttpURLLoad("fixed-position.html");
175 navigateTo(m_baseURL + "fixed-position.html"); 175 navigateTo(m_baseURL + "fixed-position.html");
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 ASSERT(scrollableElement); 299 ASSERT(scrollableElement);
300 300
301 RenderObject* renderer = scrollableElement->renderer(); 301 RenderObject* renderer = scrollableElement->renderer();
302 ASSERT_TRUE(renderer->isBox()); 302 ASSERT_TRUE(renderer->isBox());
303 ASSERT_TRUE(renderer->hasLayer()); 303 ASSERT_TRUE(renderer->hasLayer());
304 304
305 RenderBox* box = toRenderBox(renderer); 305 RenderBox* box = toRenderBox(renderer);
306 ASSERT_TRUE(box->usesCompositedScrolling()); 306 ASSERT_TRUE(box->usesCompositedScrolling());
307 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState()); 307 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState());
308 308
309 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay erMapping(); 309 CompositedLayerMappingPtr compositedLayerMapping = box->layer()->compositedL ayerMapping();
310 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); 310 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer());
311 ASSERT(compositedLayerMapping->scrollingContentsLayer()); 311 ASSERT(compositedLayerMapping->scrollingContentsLayer());
312 312
313 GraphicsLayer* graphicsLayer = compositedLayerMapping->scrollingContentsLaye r(); 313 GraphicsLayer* graphicsLayer = compositedLayerMapping->scrollingContentsLaye r();
314 ASSERT_EQ(box->layer()->scrollableArea(), graphicsLayer->scrollableArea()); 314 ASSERT_EQ(box->layer()->scrollableArea(), graphicsLayer->scrollableArea());
315 315
316 WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()- >platformLayer(); 316 WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()- >platformLayer();
317 ASSERT_TRUE(webScrollLayer->scrollable()); 317 ASSERT_TRUE(webScrollLayer->scrollable());
318 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal()); 318 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal());
319 ASSERT_TRUE(webScrollLayer->userScrollableVertical()); 319 ASSERT_TRUE(webScrollLayer->userScrollableVertical());
(...skipping 19 matching lines...) Expand all
339 ASSERT(overflowElement); 339 ASSERT(overflowElement);
340 340
341 RenderObject* renderer = overflowElement->renderer(); 341 RenderObject* renderer = overflowElement->renderer();
342 ASSERT_TRUE(renderer->isBox()); 342 ASSERT_TRUE(renderer->isBox());
343 ASSERT_TRUE(renderer->hasLayer()); 343 ASSERT_TRUE(renderer->hasLayer());
344 344
345 RenderBox* box = toRenderBox(renderer); 345 RenderBox* box = toRenderBox(renderer);
346 ASSERT_TRUE(box->usesCompositedScrolling()); 346 ASSERT_TRUE(box->usesCompositedScrolling());
347 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState()); 347 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState());
348 348
349 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay erMapping(); 349 CompositedLayerMappingPtr compositedLayerMapping = box->layer()->compositedL ayerMapping();
350 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); 350 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer());
351 ASSERT(compositedLayerMapping->scrollingContentsLayer()); 351 ASSERT(compositedLayerMapping->scrollingContentsLayer());
352 352
353 GraphicsLayer* graphicsLayer = compositedLayerMapping->scrollingContentsLaye r(); 353 GraphicsLayer* graphicsLayer = compositedLayerMapping->scrollingContentsLaye r();
354 ASSERT_EQ(box->layer()->scrollableArea(), graphicsLayer->scrollableArea()); 354 ASSERT_EQ(box->layer()->scrollableArea(), graphicsLayer->scrollableArea());
355 355
356 WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()- >platformLayer(); 356 WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()- >platformLayer();
357 ASSERT_TRUE(webScrollLayer->scrollable()); 357 ASSERT_TRUE(webScrollLayer->scrollable());
358 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal()); 358 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal());
359 ASSERT_FALSE(webScrollLayer->userScrollableVertical()); 359 ASSERT_FALSE(webScrollLayer->userScrollableVertical());
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 TEST_F(ScrollingCoordinatorChromiumTest, setupScrollbarLayerShouldNotCrash) 469 TEST_F(ScrollingCoordinatorChromiumTest, setupScrollbarLayerShouldNotCrash)
470 { 470 {
471 registerMockedHttpURLLoad("setup_scrollbar_layer_crash.html"); 471 registerMockedHttpURLLoad("setup_scrollbar_layer_crash.html");
472 navigateTo(m_baseURL + "setup_scrollbar_layer_crash.html"); 472 navigateTo(m_baseURL + "setup_scrollbar_layer_crash.html");
473 forceFullCompositingUpdate(); 473 forceFullCompositingUpdate();
474 // This test document setup an iframe with scrollbars, then switch to 474 // This test document setup an iframe with scrollbars, then switch to
475 // an empty document by javascript. 475 // an empty document by javascript.
476 } 476 }
477 477
478 } // namespace 478 } // namespace
OLDNEW
« no previous file with comments | « Source/web/LinkHighlight.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698