OLD | NEW |
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 |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN
Y | 16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN
Y |
17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O
N | 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O
N |
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 */ | 23 */ |
24 | 24 |
25 #include "config.h" | 25 #include "config.h" |
26 | 26 |
27 #include "core/page/scrolling/ScrollingCoordinator.h" | 27 #include "core/page/scrolling/ScrollingCoordinator.h" |
28 | 28 |
29 #include "core/page/Page.h" | 29 #include "core/page/Page.h" |
| 30 #include "core/rendering/RenderPart.h" |
30 #include "core/rendering/RenderView.h" | 31 #include "core/rendering/RenderView.h" |
31 #include "core/rendering/RenderWidget.h" | |
32 #include "core/rendering/compositing/CompositedLayerMapping.h" | 32 #include "core/rendering/compositing/CompositedLayerMapping.h" |
33 #include "core/rendering/compositing/RenderLayerCompositor.h" | 33 #include "core/rendering/compositing/RenderLayerCompositor.h" |
34 #include "core/testing/URLTestHelpers.h" | 34 #include "core/testing/URLTestHelpers.h" |
35 #include "platform/graphics/GraphicsLayer.h" | 35 #include "platform/graphics/GraphicsLayer.h" |
36 #include "public/platform/Platform.h" | 36 #include "public/platform/Platform.h" |
37 #include "public/platform/WebLayer.h" | 37 #include "public/platform/WebLayer.h" |
38 #include "public/platform/WebLayerPositionConstraint.h" | 38 #include "public/platform/WebLayerPositionConstraint.h" |
39 #include "public/platform/WebLayerTreeView.h" | 39 #include "public/platform/WebLayerTreeView.h" |
40 #include "public/platform/WebUnitTestSupport.h" | 40 #include "public/platform/WebUnitTestSupport.h" |
41 #include "public/web/WebSettings.h" | 41 #include "public/web/WebSettings.h" |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 navigateTo(m_baseURL + "iframe-scrolling.html"); | 389 navigateTo(m_baseURL + "iframe-scrolling.html"); |
390 forceFullCompositingUpdate(); | 390 forceFullCompositingUpdate(); |
391 | 391 |
392 // Verify the properties of the accelerated scrolling element starting from
the RenderObject | 392 // Verify the properties of the accelerated scrolling element starting from
the RenderObject |
393 // all the way to the WebLayer. | 393 // all the way to the WebLayer. |
394 Element* scrollableFrame = frame()->document()->getElementById("scrollable")
; | 394 Element* scrollableFrame = frame()->document()->getElementById("scrollable")
; |
395 ASSERT_TRUE(scrollableFrame); | 395 ASSERT_TRUE(scrollableFrame); |
396 | 396 |
397 RenderObject* renderer = scrollableFrame->renderer(); | 397 RenderObject* renderer = scrollableFrame->renderer(); |
398 ASSERT_TRUE(renderer); | 398 ASSERT_TRUE(renderer); |
399 ASSERT_TRUE(renderer->isWidget()); | 399 ASSERT_TRUE(renderer->isRenderPart()); |
400 | 400 |
401 RenderWidget* renderWidget = toRenderWidget(renderer); | 401 RenderPart* renderPart = toRenderPart(renderer); |
402 ASSERT_TRUE(renderWidget); | 402 ASSERT_TRUE(renderPart); |
403 ASSERT_TRUE(renderWidget->widget()); | 403 ASSERT_TRUE(renderPart->widget()); |
404 ASSERT_TRUE(renderWidget->widget()->isFrameView()); | 404 ASSERT_TRUE(renderPart->widget()->isFrameView()); |
405 | 405 |
406 FrameView* innerFrameView = toFrameView(renderWidget->widget()); | 406 FrameView* innerFrameView = toFrameView(renderPart->widget()); |
407 RenderView* innerRenderView = innerFrameView->renderView(); | 407 RenderView* innerRenderView = innerFrameView->renderView(); |
408 ASSERT_TRUE(innerRenderView); | 408 ASSERT_TRUE(innerRenderView); |
409 | 409 |
410 RenderLayerCompositor* innerCompositor = innerRenderView->compositor(); | 410 RenderLayerCompositor* innerCompositor = innerRenderView->compositor(); |
411 ASSERT_TRUE(innerCompositor->inCompositingMode()); | 411 ASSERT_TRUE(innerCompositor->inCompositingMode()); |
412 ASSERT_TRUE(innerCompositor->scrollLayer()); | 412 ASSERT_TRUE(innerCompositor->scrollLayer()); |
413 | 413 |
414 GraphicsLayer* scrollLayer = innerCompositor->scrollLayer(); | 414 GraphicsLayer* scrollLayer = innerCompositor->scrollLayer(); |
415 ASSERT_EQ(innerFrameView, scrollLayer->scrollableArea()); | 415 ASSERT_EQ(innerFrameView, scrollLayer->scrollableArea()); |
416 | 416 |
(...skipping 16 matching lines...) Expand all Loading... |
433 navigateTo(m_baseURL + "rtl-iframe.html"); | 433 navigateTo(m_baseURL + "rtl-iframe.html"); |
434 forceFullCompositingUpdate(); | 434 forceFullCompositingUpdate(); |
435 | 435 |
436 // Verify the properties of the accelerated scrolling element starting from
the RenderObject | 436 // Verify the properties of the accelerated scrolling element starting from
the RenderObject |
437 // all the way to the WebLayer. | 437 // all the way to the WebLayer. |
438 Element* scrollableFrame = frame()->document()->getElementById("scrollable")
; | 438 Element* scrollableFrame = frame()->document()->getElementById("scrollable")
; |
439 ASSERT_TRUE(scrollableFrame); | 439 ASSERT_TRUE(scrollableFrame); |
440 | 440 |
441 RenderObject* renderer = scrollableFrame->renderer(); | 441 RenderObject* renderer = scrollableFrame->renderer(); |
442 ASSERT_TRUE(renderer); | 442 ASSERT_TRUE(renderer); |
443 ASSERT_TRUE(renderer->isWidget()); | 443 ASSERT_TRUE(renderer->isRenderPart()); |
444 | 444 |
445 RenderWidget* renderWidget = toRenderWidget(renderer); | 445 RenderPart* renderPart = toRenderPart(renderer); |
446 ASSERT_TRUE(renderWidget); | 446 ASSERT_TRUE(renderPart); |
447 ASSERT_TRUE(renderWidget->widget()); | 447 ASSERT_TRUE(renderPart->widget()); |
448 ASSERT_TRUE(renderWidget->widget()->isFrameView()); | 448 ASSERT_TRUE(renderPart->widget()->isFrameView()); |
449 | 449 |
450 FrameView* innerFrameView = toFrameView(renderWidget->widget()); | 450 FrameView* innerFrameView = toFrameView(renderPart->widget()); |
451 RenderView* innerRenderView = innerFrameView->renderView(); | 451 RenderView* innerRenderView = innerFrameView->renderView(); |
452 ASSERT_TRUE(innerRenderView); | 452 ASSERT_TRUE(innerRenderView); |
453 | 453 |
454 RenderLayerCompositor* innerCompositor = innerRenderView->compositor(); | 454 RenderLayerCompositor* innerCompositor = innerRenderView->compositor(); |
455 ASSERT_TRUE(innerCompositor->inCompositingMode()); | 455 ASSERT_TRUE(innerCompositor->inCompositingMode()); |
456 ASSERT_TRUE(innerCompositor->scrollLayer()); | 456 ASSERT_TRUE(innerCompositor->scrollLayer()); |
457 | 457 |
458 GraphicsLayer* scrollLayer = innerCompositor->scrollLayer(); | 458 GraphicsLayer* scrollLayer = innerCompositor->scrollLayer(); |
459 ASSERT_EQ(innerFrameView, scrollLayer->scrollableArea()); | 459 ASSERT_EQ(innerFrameView, scrollLayer->scrollableArea()); |
460 | 460 |
461 WebLayer* webScrollLayer = scrollLayer->platformLayer(); | 461 WebLayer* webScrollLayer = scrollLayer->platformLayer(); |
462 ASSERT_TRUE(webScrollLayer->scrollable()); | 462 ASSERT_TRUE(webScrollLayer->scrollable()); |
463 | 463 |
464 int expectedScrollPosition = 958 + (innerFrameView->verticalScrollbar()->isO
verlayScrollbar() ? 0 : 15); | 464 int expectedScrollPosition = 958 + (innerFrameView->verticalScrollbar()->isO
verlayScrollbar() ? 0 : 15); |
465 ASSERT_EQ(expectedScrollPosition, webScrollLayer->scrollPosition().x); | 465 ASSERT_EQ(expectedScrollPosition, webScrollLayer->scrollPosition().x); |
466 } | 466 } |
467 | 467 |
468 TEST_F(ScrollingCoordinatorChromiumTest, setupScrollbarLayerShouldNotCrash) | 468 TEST_F(ScrollingCoordinatorChromiumTest, setupScrollbarLayerShouldNotCrash) |
469 { | 469 { |
470 registerMockedHttpURLLoad("setup_scrollbar_layer_crash.html"); | 470 registerMockedHttpURLLoad("setup_scrollbar_layer_crash.html"); |
471 navigateTo(m_baseURL + "setup_scrollbar_layer_crash.html"); | 471 navigateTo(m_baseURL + "setup_scrollbar_layer_crash.html"); |
472 forceFullCompositingUpdate(); | 472 forceFullCompositingUpdate(); |
473 // This test document setup an iframe with scrollbars, then switch to | 473 // This test document setup an iframe with scrollbars, then switch to |
474 // an empty document by javascript. | 474 // an empty document by javascript. |
475 } | 475 } |
476 | 476 |
477 } // namespace | 477 } // namespace |
OLD | NEW |