| 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 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 ASSERT_TRUE(layoutObject->isBox()); | 203 ASSERT_TRUE(layoutObject->isBox()); |
| 204 LayoutBox* box = toLayoutBox(layoutObject); | 204 LayoutBox* box = toLayoutBox(layoutObject); |
| 205 ASSERT_TRUE(box->usesCompositedScrolling()); | 205 ASSERT_TRUE(box->usesCompositedScrolling()); |
| 206 CompositedLayerMapping* compositedLayerMapping = | 206 CompositedLayerMapping* compositedLayerMapping = |
| 207 box->layer()->compositedLayerMapping(); | 207 box->layer()->compositedLayerMapping(); |
| 208 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); | 208 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); |
| 209 DCHECK(compositedLayerMapping->scrollingContentsLayer()); | 209 DCHECK(compositedLayerMapping->scrollingContentsLayer()); |
| 210 WebLayer* webScrollLayer = | 210 WebLayer* webScrollLayer = |
| 211 compositedLayerMapping->scrollingContentsLayer()->platformLayer(); | 211 compositedLayerMapping->scrollingContentsLayer()->platformLayer(); |
| 212 ASSERT_TRUE(webScrollLayer); | 212 ASSERT_TRUE(webScrollLayer); |
| 213 ASSERT_NEAR(1.2, webScrollLayer->scrollPositionDouble().x, 0.01); | 213 ASSERT_NEAR(1.2f, webScrollLayer->scrollOffset().width, 0.01f); |
| 214 ASSERT_NEAR(1.2, webScrollLayer->scrollPositionDouble().y, 0.01); | 214 ASSERT_NEAR(1.2f, webScrollLayer->scrollOffset().height, 0.01f); |
| 215 | 215 |
| 216 RuntimeEnabledFeatures::setFractionalScrollOffsetsEnabled( | 216 RuntimeEnabledFeatures::setFractionalScrollOffsetsEnabled( |
| 217 origFractionalOffsetsEnabled); | 217 origFractionalOffsetsEnabled); |
| 218 } | 218 } |
| 219 | 219 |
| 220 static WebLayer* webLayerFromElement(Element* element) { | 220 static WebLayer* webLayerFromElement(Element* element) { |
| 221 if (!element) | 221 if (!element) |
| 222 return 0; | 222 return 0; |
| 223 LayoutObject* layoutObject = element->layoutObject(); | 223 LayoutObject* layoutObject = element->layoutObject(); |
| 224 if (!layoutObject || !layoutObject->isBoxModelObject()) | 224 if (!layoutObject || !layoutObject->isBoxModelObject()) |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 | 596 |
| 597 GraphicsLayer* scrollLayer = innerCompositor->scrollLayer(); | 597 GraphicsLayer* scrollLayer = innerCompositor->scrollLayer(); |
| 598 ASSERT_EQ(innerFrameView, scrollLayer->getScrollableArea()); | 598 ASSERT_EQ(innerFrameView, scrollLayer->getScrollableArea()); |
| 599 | 599 |
| 600 WebLayer* webScrollLayer = scrollLayer->platformLayer(); | 600 WebLayer* webScrollLayer = scrollLayer->platformLayer(); |
| 601 ASSERT_TRUE(webScrollLayer->scrollable()); | 601 ASSERT_TRUE(webScrollLayer->scrollable()); |
| 602 | 602 |
| 603 int expectedScrollPosition = | 603 int expectedScrollPosition = |
| 604 958 + | 604 958 + |
| 605 (innerFrameView->verticalScrollbar()->isOverlayScrollbar() ? 0 : 15); | 605 (innerFrameView->verticalScrollbar()->isOverlayScrollbar() ? 0 : 15); |
| 606 ASSERT_EQ(expectedScrollPosition, webScrollLayer->scrollPositionDouble().x); | 606 ASSERT_EQ(expectedScrollPosition, webScrollLayer->scrollOffset().width); |
| 607 } | 607 } |
| 608 | 608 |
| 609 TEST_F(ScrollingCoordinatorTest, setupScrollbarLayerShouldNotCrash) { | 609 TEST_F(ScrollingCoordinatorTest, setupScrollbarLayerShouldNotCrash) { |
| 610 registerMockedHttpURLLoad("setup_scrollbar_layer_crash.html"); | 610 registerMockedHttpURLLoad("setup_scrollbar_layer_crash.html"); |
| 611 navigateTo(m_baseURL + "setup_scrollbar_layer_crash.html"); | 611 navigateTo(m_baseURL + "setup_scrollbar_layer_crash.html"); |
| 612 forceFullCompositingUpdate(); | 612 forceFullCompositingUpdate(); |
| 613 // This test document setup an iframe with scrollbars, then switch to | 613 // This test document setup an iframe with scrollbars, then switch to |
| 614 // an empty document by javascript. | 614 // an empty document by javascript. |
| 615 } | 615 } |
| 616 | 616 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 forceFullCompositingUpdate(); | 735 forceFullCompositingUpdate(); |
| 736 scrollbarGraphicsLayer = compositedLayerMapping->layerForVerticalScrollbar(); | 736 scrollbarGraphicsLayer = compositedLayerMapping->layerForVerticalScrollbar(); |
| 737 ASSERT_FALSE( | 737 ASSERT_FALSE( |
| 738 scrollbarGraphicsLayer->platformLayer()->shouldScrollOnMainThread()); | 738 scrollbarGraphicsLayer->platformLayer()->shouldScrollOnMainThread()); |
| 739 ASSERT_FALSE( | 739 ASSERT_FALSE( |
| 740 scrollbarGraphicsLayer->platformLayer()->mainThreadScrollingReasons() & | 740 scrollbarGraphicsLayer->platformLayer()->mainThreadScrollingReasons() & |
| 741 MainThreadScrollingReason::kCustomScrollbarScrolling); | 741 MainThreadScrollingReason::kCustomScrollbarScrolling); |
| 742 } | 742 } |
| 743 | 743 |
| 744 } // namespace blink | 744 } // namespace blink |
| OLD | NEW |