| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 return 0; | 194 return 0; |
| 195 if (!layer->hasCompositedLayerMapping()) | 195 if (!layer->hasCompositedLayerMapping()) |
| 196 return 0; | 196 return 0; |
| 197 CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMappi
ng(); | 197 CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMappi
ng(); |
| 198 GraphicsLayer* graphicsLayer = compositedLayerMapping->mainGraphicsLayer(); | 198 GraphicsLayer* graphicsLayer = compositedLayerMapping->mainGraphicsLayer(); |
| 199 if (!graphicsLayer) | 199 if (!graphicsLayer) |
| 200 return 0; | 200 return 0; |
| 201 return graphicsLayer->platformLayer(); | 201 return graphicsLayer->platformLayer(); |
| 202 } | 202 } |
| 203 | 203 |
| 204 | |
| 205 TEST_F(ScrollingCoordinatorTest, fractionalScrollingNonLayerFixedPosition) | |
| 206 { | |
| 207 registerMockedHttpURLLoad("fractional-scroll-fixed-position.html"); | |
| 208 navigateTo(m_baseURL + "fractional-scroll-fixed-position.html"); | |
| 209 // Prevent fixed-position element from getting its own layer. | |
| 210 webViewImpl()->settings()->setPreferCompositingToLCDTextEnabled(false); | |
| 211 forceFullCompositingUpdate(); | |
| 212 | |
| 213 FrameView* frameView = frame()->view(); | |
| 214 frameView->setScrollPosition(DoublePoint(1.5, 1.5), ProgrammaticScroll); | |
| 215 WebLayer* rootScrollLayer = getRootScrollLayer(); | |
| 216 // Scroll on main if there is non-composited fixed position element. | |
| 217 // And the containing scroll layer should not get fractional scroll offset. | |
| 218 ASSERT_TRUE(rootScrollLayer->shouldScrollOnMainThread()); | |
| 219 ASSERT_EQ(1.0, rootScrollLayer->scrollPositionDouble().x); | |
| 220 ASSERT_EQ(1.0, rootScrollLayer->scrollPositionDouble().y); | |
| 221 ASSERT_EQ(0.0, rootScrollLayer->position().x); | |
| 222 ASSERT_EQ(0.0, rootScrollLayer->position().y); | |
| 223 } | |
| 224 | |
| 225 TEST_F(ScrollingCoordinatorTest, fastScrollingForFixedPosition) | 204 TEST_F(ScrollingCoordinatorTest, fastScrollingForFixedPosition) |
| 226 { | 205 { |
| 227 registerMockedHttpURLLoad("fixed-position.html"); | 206 registerMockedHttpURLLoad("fixed-position.html"); |
| 228 navigateTo(m_baseURL + "fixed-position.html"); | 207 navigateTo(m_baseURL + "fixed-position.html"); |
| 229 forceFullCompositingUpdate(); | 208 forceFullCompositingUpdate(); |
| 230 | 209 |
| 231 // Fixed position should not fall back to main thread scrolling. | 210 // Fixed position should not fall back to main thread scrolling. |
| 232 WebLayer* rootScrollLayer = getRootScrollLayer(); | 211 WebLayer* rootScrollLayer = getRootScrollLayer(); |
| 233 ASSERT_FALSE(rootScrollLayer->shouldScrollOnMainThread()); | 212 ASSERT_FALSE(rootScrollLayer->shouldScrollOnMainThread()); |
| 234 | 213 |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 EXPECT_FALSE(scrollLayer->shouldScrollOnMainThread()); | 622 EXPECT_FALSE(scrollLayer->shouldScrollOnMainThread()); |
| 644 | 623 |
| 645 fixedPos->setInlineStyleProperty(CSSPropertyTransform, CSSValueNone); | 624 fixedPos->setInlineStyleProperty(CSSPropertyTransform, CSSValueNone); |
| 646 forceFullCompositingUpdate(); | 625 forceFullCompositingUpdate(); |
| 647 | 626 |
| 648 EXPECT_FALSE(static_cast<LayoutBoxModelObject*>(fixedPos->layoutObject())->l
ayer()->hasCompositedLayerMapping()); | 627 EXPECT_FALSE(static_cast<LayoutBoxModelObject*>(fixedPos->layoutObject())->l
ayer()->hasCompositedLayerMapping()); |
| 649 EXPECT_TRUE(scrollLayer->shouldScrollOnMainThread()); | 628 EXPECT_TRUE(scrollLayer->shouldScrollOnMainThread()); |
| 650 } | 629 } |
| 651 | 630 |
| 652 } // namespace blink | 631 } // namespace blink |
| OLD | NEW |