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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 return 0; | 159 return 0; |
160 if (!layer->hasCompositedLayerMapping()) | 160 if (!layer->hasCompositedLayerMapping()) |
161 return 0; | 161 return 0; |
162 CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMappi
ng(); | 162 CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMappi
ng(); |
163 GraphicsLayer* graphicsLayer = compositedLayerMapping->mainGraphicsLayer(); | 163 GraphicsLayer* graphicsLayer = compositedLayerMapping->mainGraphicsLayer(); |
164 if (!graphicsLayer) | 164 if (!graphicsLayer) |
165 return 0; | 165 return 0; |
166 return graphicsLayer->platformLayer(); | 166 return graphicsLayer->platformLayer(); |
167 } | 167 } |
168 | 168 |
| 169 |
| 170 TEST_F(ScrollingCoordinatorChromiumTest, fractionalScrollingNonLayerFixedPositio
n) |
| 171 { |
| 172 registerMockedHttpURLLoad("fractional-scroll-fixed-position.html"); |
| 173 navigateTo(m_baseURL + "fractional-scroll-fixed-position.html"); |
| 174 // Prevent fixed-position element from getting its own layer. |
| 175 webViewImpl()->settings()->setPreferCompositingToLCDTextEnabled(false); |
| 176 forceFullCompositingUpdate(); |
| 177 |
| 178 FrameView* frameView = frame()->view(); |
| 179 frameView->scrollTo(DoublePoint(1.5, 1.5)); |
| 180 WebLayer* rootScrollLayer = getRootScrollLayer(); |
| 181 // Scroll on main if there is non-composited fixed position element. |
| 182 // And the containing scroll layer should not get fractional scroll offset. |
| 183 ASSERT_TRUE(rootScrollLayer->shouldScrollOnMainThread()); |
| 184 ASSERT_EQ(1.0, rootScrollLayer->scrollPositionDouble().x); |
| 185 ASSERT_EQ(1.0, rootScrollLayer->scrollPositionDouble().y); |
| 186 ASSERT_EQ(0.0, rootScrollLayer->position().x); |
| 187 ASSERT_EQ(0.0, rootScrollLayer->position().y); |
| 188 } |
| 189 |
169 TEST_F(ScrollingCoordinatorChromiumTest, fastScrollingForFixedPosition) | 190 TEST_F(ScrollingCoordinatorChromiumTest, fastScrollingForFixedPosition) |
170 { | 191 { |
171 registerMockedHttpURLLoad("fixed-position.html"); | 192 registerMockedHttpURLLoad("fixed-position.html"); |
172 navigateTo(m_baseURL + "fixed-position.html"); | 193 navigateTo(m_baseURL + "fixed-position.html"); |
173 forceFullCompositingUpdate(); | 194 forceFullCompositingUpdate(); |
174 | 195 |
175 // Fixed position should not fall back to main thread scrolling. | 196 // Fixed position should not fall back to main thread scrolling. |
176 WebLayer* rootScrollLayer = getRootScrollLayer(); | 197 WebLayer* rootScrollLayer = getRootScrollLayer(); |
177 ASSERT_FALSE(rootScrollLayer->shouldScrollOnMainThread()); | 198 ASSERT_FALSE(rootScrollLayer->shouldScrollOnMainThread()); |
178 | 199 |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 WebLayer* contentsLayer = scrollbarGraphicsLayer->contentsLayer(); | 522 WebLayer* contentsLayer = scrollbarGraphicsLayer->contentsLayer(); |
502 ASSERT_TRUE(contentsLayer); | 523 ASSERT_TRUE(contentsLayer); |
503 | 524 |
504 // After scrollableAreaScrollbarLayerDidChange, | 525 // After scrollableAreaScrollbarLayerDidChange, |
505 // if the main frame's scrollbarLayer is opaque, | 526 // if the main frame's scrollbarLayer is opaque, |
506 // contentsLayer should be opaque too. | 527 // contentsLayer should be opaque too. |
507 ASSERT_EQ(platformLayer->opaque(), contentsLayer->opaque()); | 528 ASSERT_EQ(platformLayer->opaque(), contentsLayer->opaque()); |
508 } | 529 } |
509 | 530 |
510 } // namespace | 531 } // namespace |
OLD | NEW |