| 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/layout/compositing/CompositedLayerMapping.h" | 29 #include "core/layout/compositing/CompositedLayerMapping.h" |
| 30 #include "core/layout/compositing/RenderLayerCompositor.h" | 30 #include "core/layout/compositing/LayerCompositor.h" |
| 31 #include "core/page/Page.h" | 31 #include "core/page/Page.h" |
| 32 #include "core/rendering/RenderPart.h" | 32 #include "core/rendering/RenderPart.h" |
| 33 #include "core/rendering/RenderView.h" | 33 #include "core/rendering/RenderView.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" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 webViewImpl()->layout(); | 73 webViewImpl()->layout(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void registerMockedHttpURLLoad(const std::string& fileName) | 76 void registerMockedHttpURLLoad(const std::string& fileName) |
| 77 { | 77 { |
| 78 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseU
RL.c_str()), WebString::fromUTF8(fileName.c_str())); | 78 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseU
RL.c_str()), WebString::fromUTF8(fileName.c_str())); |
| 79 } | 79 } |
| 80 | 80 |
| 81 WebLayer* getRootScrollLayer() | 81 WebLayer* getRootScrollLayer() |
| 82 { | 82 { |
| 83 RenderLayerCompositor* compositor = frame()->contentRenderer()->composit
or(); | 83 LayerCompositor* compositor = frame()->contentRenderer()->compositor(); |
| 84 ASSERT(compositor); | 84 ASSERT(compositor); |
| 85 ASSERT(compositor->scrollLayer()); | 85 ASSERT(compositor->scrollLayer()); |
| 86 | 86 |
| 87 WebLayer* webScrollLayer = compositor->scrollLayer()->platformLayer(); | 87 WebLayer* webScrollLayer = compositor->scrollLayer()->platformLayer(); |
| 88 return webScrollLayer; | 88 return webScrollLayer; |
| 89 } | 89 } |
| 90 | 90 |
| 91 WebViewImpl* webViewImpl() const { return m_helper.webViewImpl(); } | 91 WebViewImpl* webViewImpl() const { return m_helper.webViewImpl(); } |
| 92 LocalFrame* frame() const { return m_helper.webViewImpl()->mainFrameImpl()->
frame(); } | 92 LocalFrame* frame() const { return m_helper.webViewImpl()->mainFrameImpl()->
frame(); } |
| 93 | 93 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 ASSERT_NEAR(1.2, webScrollLayer->scrollPositionDouble().y, 0.01); | 181 ASSERT_NEAR(1.2, webScrollLayer->scrollPositionDouble().y, 0.01); |
| 182 } | 182 } |
| 183 | 183 |
| 184 static WebLayer* webLayerFromElement(Element* element) | 184 static WebLayer* webLayerFromElement(Element* element) |
| 185 { | 185 { |
| 186 if (!element) | 186 if (!element) |
| 187 return 0; | 187 return 0; |
| 188 RenderObject* renderer = element->renderer(); | 188 RenderObject* renderer = element->renderer(); |
| 189 if (!renderer || !renderer->isBoxModelObject()) | 189 if (!renderer || !renderer->isBoxModelObject()) |
| 190 return 0; | 190 return 0; |
| 191 RenderLayer* layer = toRenderBoxModelObject(renderer)->layer(); | 191 Layer* layer = toRenderBoxModelObject(renderer)->layer(); |
| 192 if (!layer) | 192 if (!layer) |
| 193 return 0; | 193 return 0; |
| 194 if (!layer->hasCompositedLayerMapping()) | 194 if (!layer->hasCompositedLayerMapping()) |
| 195 return 0; | 195 return 0; |
| 196 CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMappi
ng(); | 196 CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMappi
ng(); |
| 197 GraphicsLayer* graphicsLayer = compositedLayerMapping->mainGraphicsLayer(); | 197 GraphicsLayer* graphicsLayer = compositedLayerMapping->mainGraphicsLayer(); |
| 198 if (!graphicsLayer) | 198 if (!graphicsLayer) |
| 199 return 0; | 199 return 0; |
| 200 return graphicsLayer->platformLayer(); | 200 return graphicsLayer->platformLayer(); |
| 201 } | 201 } |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 | 460 |
| 461 RenderPart* renderPart = toRenderPart(renderer); | 461 RenderPart* renderPart = toRenderPart(renderer); |
| 462 ASSERT_TRUE(renderPart); | 462 ASSERT_TRUE(renderPart); |
| 463 ASSERT_TRUE(renderPart->widget()); | 463 ASSERT_TRUE(renderPart->widget()); |
| 464 ASSERT_TRUE(renderPart->widget()->isFrameView()); | 464 ASSERT_TRUE(renderPart->widget()->isFrameView()); |
| 465 | 465 |
| 466 FrameView* innerFrameView = toFrameView(renderPart->widget()); | 466 FrameView* innerFrameView = toFrameView(renderPart->widget()); |
| 467 RenderView* innerRenderView = innerFrameView->renderView(); | 467 RenderView* innerRenderView = innerFrameView->renderView(); |
| 468 ASSERT_TRUE(innerRenderView); | 468 ASSERT_TRUE(innerRenderView); |
| 469 | 469 |
| 470 RenderLayerCompositor* innerCompositor = innerRenderView->compositor(); | 470 LayerCompositor* innerCompositor = innerRenderView->compositor(); |
| 471 ASSERT_TRUE(innerCompositor->inCompositingMode()); | 471 ASSERT_TRUE(innerCompositor->inCompositingMode()); |
| 472 ASSERT_TRUE(innerCompositor->scrollLayer()); | 472 ASSERT_TRUE(innerCompositor->scrollLayer()); |
| 473 | 473 |
| 474 GraphicsLayer* scrollLayer = innerCompositor->scrollLayer(); | 474 GraphicsLayer* scrollLayer = innerCompositor->scrollLayer(); |
| 475 ASSERT_EQ(innerFrameView, scrollLayer->scrollableArea()); | 475 ASSERT_EQ(innerFrameView, scrollLayer->scrollableArea()); |
| 476 | 476 |
| 477 WebLayer* webScrollLayer = scrollLayer->platformLayer(); | 477 WebLayer* webScrollLayer = scrollLayer->platformLayer(); |
| 478 ASSERT_TRUE(webScrollLayer->scrollable()); | 478 ASSERT_TRUE(webScrollLayer->scrollable()); |
| 479 | 479 |
| 480 #if OS(ANDROID) | 480 #if OS(ANDROID) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 504 | 504 |
| 505 RenderPart* renderPart = toRenderPart(renderer); | 505 RenderPart* renderPart = toRenderPart(renderer); |
| 506 ASSERT_TRUE(renderPart); | 506 ASSERT_TRUE(renderPart); |
| 507 ASSERT_TRUE(renderPart->widget()); | 507 ASSERT_TRUE(renderPart->widget()); |
| 508 ASSERT_TRUE(renderPart->widget()->isFrameView()); | 508 ASSERT_TRUE(renderPart->widget()->isFrameView()); |
| 509 | 509 |
| 510 FrameView* innerFrameView = toFrameView(renderPart->widget()); | 510 FrameView* innerFrameView = toFrameView(renderPart->widget()); |
| 511 RenderView* innerRenderView = innerFrameView->renderView(); | 511 RenderView* innerRenderView = innerFrameView->renderView(); |
| 512 ASSERT_TRUE(innerRenderView); | 512 ASSERT_TRUE(innerRenderView); |
| 513 | 513 |
| 514 RenderLayerCompositor* innerCompositor = innerRenderView->compositor(); | 514 LayerCompositor* innerCompositor = innerRenderView->compositor(); |
| 515 ASSERT_TRUE(innerCompositor->inCompositingMode()); | 515 ASSERT_TRUE(innerCompositor->inCompositingMode()); |
| 516 ASSERT_TRUE(innerCompositor->scrollLayer()); | 516 ASSERT_TRUE(innerCompositor->scrollLayer()); |
| 517 | 517 |
| 518 GraphicsLayer* scrollLayer = innerCompositor->scrollLayer(); | 518 GraphicsLayer* scrollLayer = innerCompositor->scrollLayer(); |
| 519 ASSERT_EQ(innerFrameView, scrollLayer->scrollableArea()); | 519 ASSERT_EQ(innerFrameView, scrollLayer->scrollableArea()); |
| 520 | 520 |
| 521 WebLayer* webScrollLayer = scrollLayer->platformLayer(); | 521 WebLayer* webScrollLayer = scrollLayer->platformLayer(); |
| 522 ASSERT_TRUE(webScrollLayer->scrollable()); | 522 ASSERT_TRUE(webScrollLayer->scrollable()); |
| 523 | 523 |
| 524 int expectedScrollPosition = 958 + (innerFrameView->verticalScrollbar()->isO
verlayScrollbar() ? 0 : 15); | 524 int expectedScrollPosition = 958 + (innerFrameView->verticalScrollbar()->isO
verlayScrollbar() ? 0 : 15); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 WebLayer* contentsLayer = scrollbarGraphicsLayer->contentsLayer(); | 580 WebLayer* contentsLayer = scrollbarGraphicsLayer->contentsLayer(); |
| 581 ASSERT_TRUE(contentsLayer); | 581 ASSERT_TRUE(contentsLayer); |
| 582 | 582 |
| 583 // After scrollableAreaScrollbarLayerDidChange, | 583 // After scrollableAreaScrollbarLayerDidChange, |
| 584 // if the main frame's scrollbarLayer is opaque, | 584 // if the main frame's scrollbarLayer is opaque, |
| 585 // contentsLayer should be opaque too. | 585 // contentsLayer should be opaque too. |
| 586 ASSERT_EQ(platformLayer->opaque(), contentsLayer->opaque()); | 586 ASSERT_EQ(platformLayer->opaque(), contentsLayer->opaque()); |
| 587 } | 587 } |
| 588 | 588 |
| 589 } // namespace | 589 } // namespace |
| OLD | NEW |