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

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

Issue 977113003: Rename renderer() to layoutObject(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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
« no previous file with comments | « Source/web/tests/PinchViewportTest.cpp ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 scrollableElement->setScrollTop(1.0); 156 scrollableElement->setScrollTop(1.0);
157 scrollableElement->setScrollLeft(1.0); 157 scrollableElement->setScrollLeft(1.0);
158 forceFullCompositingUpdate(); 158 forceFullCompositingUpdate();
159 159
160 // Make sure the fractional scroll offset change 1.0 -> 1.2 gets propagated 160 // Make sure the fractional scroll offset change 1.0 -> 1.2 gets propagated
161 // to compositor. 161 // to compositor.
162 scrollableElement->setScrollTop(1.2); 162 scrollableElement->setScrollTop(1.2);
163 scrollableElement->setScrollLeft(1.2); 163 scrollableElement->setScrollLeft(1.2);
164 forceFullCompositingUpdate(); 164 forceFullCompositingUpdate();
165 165
166 LayoutObject* renderer = scrollableElement->renderer(); 166 LayoutObject* renderer = scrollableElement->layoutObject();
167 ASSERT_TRUE(renderer->isBox()); 167 ASSERT_TRUE(renderer->isBox());
168 LayoutBox* box = toLayoutBox(renderer); 168 LayoutBox* box = toLayoutBox(renderer);
169 ASSERT_TRUE(box->usesCompositedScrolling()); 169 ASSERT_TRUE(box->usesCompositedScrolling());
170 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay erMapping(); 170 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay erMapping();
171 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); 171 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer());
172 ASSERT(compositedLayerMapping->scrollingContentsLayer()); 172 ASSERT(compositedLayerMapping->scrollingContentsLayer());
173 WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()- >platformLayer(); 173 WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()- >platformLayer();
174 ASSERT_TRUE(webScrollLayer); 174 ASSERT_TRUE(webScrollLayer);
175 ASSERT_NEAR(1.2, webScrollLayer->scrollPositionDouble().x, 0.01); 175 ASSERT_NEAR(1.2, webScrollLayer->scrollPositionDouble().x, 0.01);
176 ASSERT_NEAR(1.2, webScrollLayer->scrollPositionDouble().y, 0.01); 176 ASSERT_NEAR(1.2, webScrollLayer->scrollPositionDouble().y, 0.01);
177 } 177 }
178 178
179 static WebLayer* webLayerFromElement(Element* element) 179 static WebLayer* webLayerFromElement(Element* element)
180 { 180 {
181 if (!element) 181 if (!element)
182 return 0; 182 return 0;
183 LayoutObject* renderer = element->renderer(); 183 LayoutObject* renderer = element->layoutObject();
184 if (!renderer || !renderer->isBoxModelObject()) 184 if (!renderer || !renderer->isBoxModelObject())
185 return 0; 185 return 0;
186 Layer* layer = toLayoutBoxModelObject(renderer)->layer(); 186 Layer* layer = toLayoutBoxModelObject(renderer)->layer();
187 if (!layer) 187 if (!layer)
188 return 0; 188 return 0;
189 if (!layer->hasCompositedLayerMapping()) 189 if (!layer->hasCompositedLayerMapping())
190 return 0; 190 return 0;
191 CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMappi ng(); 191 CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMappi ng();
192 GraphicsLayer* graphicsLayer = compositedLayerMapping->mainGraphicsLayer(); 192 GraphicsLayer* graphicsLayer = compositedLayerMapping->mainGraphicsLayer();
193 if (!graphicsLayer) 193 if (!graphicsLayer)
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 { 346 {
347 registerMockedHttpURLLoad("overflow-scrolling.html"); 347 registerMockedHttpURLLoad("overflow-scrolling.html");
348 navigateTo(m_baseURL + "overflow-scrolling.html"); 348 navigateTo(m_baseURL + "overflow-scrolling.html");
349 forceFullCompositingUpdate(); 349 forceFullCompositingUpdate();
350 350
351 // Verify the properties of the accelerated scrolling element starting from the LayoutObject 351 // Verify the properties of the accelerated scrolling element starting from the LayoutObject
352 // all the way to the WebLayer. 352 // all the way to the WebLayer.
353 Element* scrollableElement = frame()->document()->getElementById("scrollable "); 353 Element* scrollableElement = frame()->document()->getElementById("scrollable ");
354 ASSERT(scrollableElement); 354 ASSERT(scrollableElement);
355 355
356 LayoutObject* renderer = scrollableElement->renderer(); 356 LayoutObject* renderer = scrollableElement->layoutObject();
357 ASSERT_TRUE(renderer->isBox()); 357 ASSERT_TRUE(renderer->isBox());
358 ASSERT_TRUE(renderer->hasLayer()); 358 ASSERT_TRUE(renderer->hasLayer());
359 359
360 LayoutBox* box = toLayoutBox(renderer); 360 LayoutBox* box = toLayoutBox(renderer);
361 ASSERT_TRUE(box->usesCompositedScrolling()); 361 ASSERT_TRUE(box->usesCompositedScrolling());
362 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState()); 362 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState());
363 363
364 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay erMapping(); 364 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay erMapping();
365 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); 365 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer());
366 ASSERT(compositedLayerMapping->scrollingContentsLayer()); 366 ASSERT(compositedLayerMapping->scrollingContentsLayer());
(...skipping 19 matching lines...) Expand all
386 { 386 {
387 registerMockedHttpURLLoad("overflow-hidden.html"); 387 registerMockedHttpURLLoad("overflow-hidden.html");
388 navigateTo(m_baseURL + "overflow-hidden.html"); 388 navigateTo(m_baseURL + "overflow-hidden.html");
389 forceFullCompositingUpdate(); 389 forceFullCompositingUpdate();
390 390
391 // Verify the properties of the accelerated scrolling element starting from the LayoutObject 391 // Verify the properties of the accelerated scrolling element starting from the LayoutObject
392 // all the way to the WebLayer. 392 // all the way to the WebLayer.
393 Element* overflowElement = frame()->document()->getElementById("unscrollable -y"); 393 Element* overflowElement = frame()->document()->getElementById("unscrollable -y");
394 ASSERT(overflowElement); 394 ASSERT(overflowElement);
395 395
396 LayoutObject* renderer = overflowElement->renderer(); 396 LayoutObject* renderer = overflowElement->layoutObject();
397 ASSERT_TRUE(renderer->isBox()); 397 ASSERT_TRUE(renderer->isBox());
398 ASSERT_TRUE(renderer->hasLayer()); 398 ASSERT_TRUE(renderer->hasLayer());
399 399
400 LayoutBox* box = toLayoutBox(renderer); 400 LayoutBox* box = toLayoutBox(renderer);
401 ASSERT_TRUE(box->usesCompositedScrolling()); 401 ASSERT_TRUE(box->usesCompositedScrolling());
402 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState()); 402 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState());
403 403
404 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay erMapping(); 404 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay erMapping();
405 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); 405 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer());
406 ASSERT(compositedLayerMapping->scrollingContentsLayer()); 406 ASSERT(compositedLayerMapping->scrollingContentsLayer());
407 407
408 GraphicsLayer* graphicsLayer = compositedLayerMapping->scrollingContentsLaye r(); 408 GraphicsLayer* graphicsLayer = compositedLayerMapping->scrollingContentsLaye r();
409 ASSERT_EQ(box->layer()->scrollableArea(), graphicsLayer->scrollableArea()); 409 ASSERT_EQ(box->layer()->scrollableArea(), graphicsLayer->scrollableArea());
410 410
411 WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()- >platformLayer(); 411 WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()- >platformLayer();
412 ASSERT_TRUE(webScrollLayer->scrollable()); 412 ASSERT_TRUE(webScrollLayer->scrollable());
413 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal()); 413 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal());
414 ASSERT_FALSE(webScrollLayer->userScrollableVertical()); 414 ASSERT_FALSE(webScrollLayer->userScrollableVertical());
415 415
416 overflowElement = frame()->document()->getElementById("unscrollable-x"); 416 overflowElement = frame()->document()->getElementById("unscrollable-x");
417 ASSERT(overflowElement); 417 ASSERT(overflowElement);
418 418
419 renderer = overflowElement->renderer(); 419 renderer = overflowElement->layoutObject();
420 ASSERT_TRUE(renderer->isBox()); 420 ASSERT_TRUE(renderer->isBox());
421 ASSERT_TRUE(renderer->hasLayer()); 421 ASSERT_TRUE(renderer->hasLayer());
422 422
423 box = toLayoutBox(renderer); 423 box = toLayoutBox(renderer);
424 ASSERT_TRUE(box->scrollableArea()->usesCompositedScrolling()); 424 ASSERT_TRUE(box->scrollableArea()->usesCompositedScrolling());
425 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState()); 425 ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState());
426 426
427 compositedLayerMapping = box->layer()->compositedLayerMapping(); 427 compositedLayerMapping = box->layer()->compositedLayerMapping();
428 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); 428 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer());
429 ASSERT(compositedLayerMapping->scrollingContentsLayer()); 429 ASSERT(compositedLayerMapping->scrollingContentsLayer());
(...skipping 12 matching lines...) Expand all
442 registerMockedHttpURLLoad("iframe-scrolling.html"); 442 registerMockedHttpURLLoad("iframe-scrolling.html");
443 registerMockedHttpURLLoad("iframe-scrolling-inner.html"); 443 registerMockedHttpURLLoad("iframe-scrolling-inner.html");
444 navigateTo(m_baseURL + "iframe-scrolling.html"); 444 navigateTo(m_baseURL + "iframe-scrolling.html");
445 forceFullCompositingUpdate(); 445 forceFullCompositingUpdate();
446 446
447 // Verify the properties of the accelerated scrolling element starting from the LayoutObject 447 // Verify the properties of the accelerated scrolling element starting from the LayoutObject
448 // all the way to the WebLayer. 448 // all the way to the WebLayer.
449 Element* scrollableFrame = frame()->document()->getElementById("scrollable") ; 449 Element* scrollableFrame = frame()->document()->getElementById("scrollable") ;
450 ASSERT_TRUE(scrollableFrame); 450 ASSERT_TRUE(scrollableFrame);
451 451
452 LayoutObject* renderer = scrollableFrame->renderer(); 452 LayoutObject* renderer = scrollableFrame->layoutObject();
453 ASSERT_TRUE(renderer); 453 ASSERT_TRUE(renderer);
454 ASSERT_TRUE(renderer->isLayoutPart()); 454 ASSERT_TRUE(renderer->isLayoutPart());
455 455
456 LayoutPart* layoutPart = toLayoutPart(renderer); 456 LayoutPart* layoutPart = toLayoutPart(renderer);
457 ASSERT_TRUE(layoutPart); 457 ASSERT_TRUE(layoutPart);
458 ASSERT_TRUE(layoutPart->widget()); 458 ASSERT_TRUE(layoutPart->widget());
459 ASSERT_TRUE(layoutPart->widget()->isFrameView()); 459 ASSERT_TRUE(layoutPart->widget()->isFrameView());
460 460
461 FrameView* innerFrameView = toFrameView(layoutPart->widget()); 461 FrameView* innerFrameView = toFrameView(layoutPart->widget());
462 LayoutView* innerLayoutView = innerFrameView->layoutView(); 462 LayoutView* innerLayoutView = innerFrameView->layoutView();
(...skipping 23 matching lines...) Expand all
486 registerMockedHttpURLLoad("rtl-iframe.html"); 486 registerMockedHttpURLLoad("rtl-iframe.html");
487 registerMockedHttpURLLoad("rtl-iframe-inner.html"); 487 registerMockedHttpURLLoad("rtl-iframe-inner.html");
488 navigateTo(m_baseURL + "rtl-iframe.html"); 488 navigateTo(m_baseURL + "rtl-iframe.html");
489 forceFullCompositingUpdate(); 489 forceFullCompositingUpdate();
490 490
491 // Verify the properties of the accelerated scrolling element starting from the LayoutObject 491 // Verify the properties of the accelerated scrolling element starting from the LayoutObject
492 // all the way to the WebLayer. 492 // all the way to the WebLayer.
493 Element* scrollableFrame = frame()->document()->getElementById("scrollable") ; 493 Element* scrollableFrame = frame()->document()->getElementById("scrollable") ;
494 ASSERT_TRUE(scrollableFrame); 494 ASSERT_TRUE(scrollableFrame);
495 495
496 LayoutObject* renderer = scrollableFrame->renderer(); 496 LayoutObject* renderer = scrollableFrame->layoutObject();
497 ASSERT_TRUE(renderer); 497 ASSERT_TRUE(renderer);
498 ASSERT_TRUE(renderer->isLayoutPart()); 498 ASSERT_TRUE(renderer->isLayoutPart());
499 499
500 LayoutPart* layoutPart = toLayoutPart(renderer); 500 LayoutPart* layoutPart = toLayoutPart(renderer);
501 ASSERT_TRUE(layoutPart); 501 ASSERT_TRUE(layoutPart);
502 ASSERT_TRUE(layoutPart->widget()); 502 ASSERT_TRUE(layoutPart->widget());
503 ASSERT_TRUE(layoutPart->widget()->isFrameView()); 503 ASSERT_TRUE(layoutPart->widget()->isFrameView());
504 504
505 FrameView* innerFrameView = toFrameView(layoutPart->widget()); 505 FrameView* innerFrameView = toFrameView(layoutPart->widget());
506 LayoutView* innerLayoutView = innerFrameView->layoutView(); 506 LayoutView* innerLayoutView = innerFrameView->layoutView();
(...skipping 27 matching lines...) Expand all
534 blink::FrameTestHelpers::UseMockScrollbarSettings mockScrollbarSettings; 534 blink::FrameTestHelpers::UseMockScrollbarSettings mockScrollbarSettings;
535 535
536 registerMockedHttpURLLoad("trivial-scroller.html"); 536 registerMockedHttpURLLoad("trivial-scroller.html");
537 navigateTo(m_baseURL + "trivial-scroller.html"); 537 navigateTo(m_baseURL + "trivial-scroller.html");
538 forceFullCompositingUpdate(); 538 forceFullCompositingUpdate();
539 539
540 Document* document = frame()->document(); 540 Document* document = frame()->document();
541 Element* scrollableElement = document->getElementById("scroller"); 541 Element* scrollableElement = document->getElementById("scroller");
542 ASSERT(scrollableElement); 542 ASSERT(scrollableElement);
543 543
544 LayoutObject* renderer = scrollableElement->renderer(); 544 LayoutObject* renderer = scrollableElement->layoutObject();
545 ASSERT_TRUE(renderer->isBox()); 545 ASSERT_TRUE(renderer->isBox());
546 LayoutBox* box = toLayoutBox(renderer); 546 LayoutBox* box = toLayoutBox(renderer);
547 ASSERT_TRUE(box->usesCompositedScrolling()); 547 ASSERT_TRUE(box->usesCompositedScrolling());
548 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay erMapping(); 548 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay erMapping();
549 GraphicsLayer* scrollbarGraphicsLayer = compositedLayerMapping->layerForVert icalScrollbar(); 549 GraphicsLayer* scrollbarGraphicsLayer = compositedLayerMapping->layerForVert icalScrollbar();
550 ASSERT_TRUE(scrollbarGraphicsLayer); 550 ASSERT_TRUE(scrollbarGraphicsLayer);
551 551
552 bool hasWebScrollbarLayer = !scrollbarGraphicsLayer->drawsContent(); 552 bool hasWebScrollbarLayer = !scrollbarGraphicsLayer->drawsContent();
553 ASSERT_TRUE(hasWebScrollbarLayer || scrollbarGraphicsLayer->platformLayer()- >shouldScrollOnMainThread()); 553 ASSERT_TRUE(hasWebScrollbarLayer || scrollbarGraphicsLayer->platformLayer()- >shouldScrollOnMainThread());
554 } 554 }
(...skipping 30 matching lines...) Expand all
585 { 585 {
586 webViewImpl()->settings()->setPreferCompositingToLCDTextEnabled(false); 586 webViewImpl()->settings()->setPreferCompositingToLCDTextEnabled(false);
587 registerMockedHttpURLLoad("fixed-position-losing-backing.html"); 587 registerMockedHttpURLLoad("fixed-position-losing-backing.html");
588 navigateTo(m_baseURL + "fixed-position-losing-backing.html"); 588 navigateTo(m_baseURL + "fixed-position-losing-backing.html");
589 forceFullCompositingUpdate(); 589 forceFullCompositingUpdate();
590 590
591 WebLayer* scrollLayer = frame()->page()->deprecatedLocalMainFrame()->view()- >layerForScrolling()->platformLayer(); 591 WebLayer* scrollLayer = frame()->page()->deprecatedLocalMainFrame()->view()- >layerForScrolling()->platformLayer();
592 Document* document = frame()->document(); 592 Document* document = frame()->document();
593 Element* fixedPos = document->getElementById("fixed"); 593 Element* fixedPos = document->getElementById("fixed");
594 594
595 EXPECT_TRUE(static_cast<LayoutBoxModelObject*>(fixedPos->renderer())->layer( )->hasCompositedLayerMapping()); 595 EXPECT_TRUE(static_cast<LayoutBoxModelObject*>(fixedPos->layoutObject())->la yer()->hasCompositedLayerMapping());
596 EXPECT_FALSE(scrollLayer->shouldScrollOnMainThread()); 596 EXPECT_FALSE(scrollLayer->shouldScrollOnMainThread());
597 597
598 fixedPos->setInlineStyleProperty(CSSPropertyTransform, CSSValueNone); 598 fixedPos->setInlineStyleProperty(CSSPropertyTransform, CSSValueNone);
599 forceFullCompositingUpdate(); 599 forceFullCompositingUpdate();
600 600
601 EXPECT_FALSE(static_cast<LayoutBoxModelObject*>(fixedPos->renderer())->layer ()->hasCompositedLayerMapping()); 601 EXPECT_FALSE(static_cast<LayoutBoxModelObject*>(fixedPos->layoutObject())->l ayer()->hasCompositedLayerMapping());
602 EXPECT_TRUE(scrollLayer->shouldScrollOnMainThread()); 602 EXPECT_TRUE(scrollLayer->shouldScrollOnMainThread());
603 } 603 }
604 604
605 } // namespace 605 } // namespace
OLDNEW
« no previous file with comments | « Source/web/tests/PinchViewportTest.cpp ('k') | Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698