OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
5 * 2000 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
10 * | 10 * |
(...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1247 void FrameView::scrollContentsIfNeeded() | 1247 void FrameView::scrollContentsIfNeeded() |
1248 { | 1248 { |
1249 bool didScroll = !pendingScrollDelta().isZero(); | 1249 bool didScroll = !pendingScrollDelta().isZero(); |
1250 ScrollView::scrollContentsIfNeeded(); | 1250 ScrollView::scrollContentsIfNeeded(); |
1251 if (didScroll) | 1251 if (didScroll) |
1252 updateFixedElementPaintInvalidationRectsAfterScroll(); | 1252 updateFixedElementPaintInvalidationRectsAfterScroll(); |
1253 } | 1253 } |
1254 | 1254 |
1255 bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect
& rectToScroll) | 1255 bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect
& rectToScroll) |
1256 { | 1256 { |
| 1257 if (!contentsInCompositedLayer()) |
| 1258 return false; |
| 1259 |
1257 if (!m_viewportConstrainedObjects || m_viewportConstrainedObjects->isEmpty()
) { | 1260 if (!m_viewportConstrainedObjects || m_viewportConstrainedObjects->isEmpty()
) { |
1258 hostWindow()->scroll(); | 1261 hostWindow()->scroll(); |
1259 return true; | 1262 return true; |
1260 } | 1263 } |
1261 | 1264 |
1262 const bool isCompositedContentLayer = contentsInCompositedLayer(); | |
1263 | |
1264 // Get the rects of the fixed objects visible in the rectToScroll | 1265 // Get the rects of the fixed objects visible in the rectToScroll |
1265 Region regionToUpdate; | 1266 Region regionToUpdate; |
1266 ViewportConstrainedObjectSet::const_iterator end = m_viewportConstrainedObje
cts->end(); | 1267 ViewportConstrainedObjectSet::const_iterator end = m_viewportConstrainedObje
cts->end(); |
1267 for (ViewportConstrainedObjectSet::const_iterator it = m_viewportConstrained
Objects->begin(); it != end; ++it) { | 1268 for (ViewportConstrainedObjectSet::const_iterator it = m_viewportConstrained
Objects->begin(); it != end; ++it) { |
1268 RenderObject* renderer = *it; | 1269 RenderObject* renderer = *it; |
1269 // m_viewportConstrainedObjects should not contain non-viewport constrai
ned objects. | 1270 // m_viewportConstrainedObjects should not contain non-viewport constrai
ned objects. |
1270 ASSERT(renderer->style()->hasViewportConstrainedPosition()); | 1271 ASSERT(renderer->style()->hasViewportConstrainedPosition()); |
1271 | 1272 |
1272 // Fixed items should always have layers. | 1273 // Fixed items should always have layers. |
1273 ASSERT(renderer->hasLayer()); | 1274 ASSERT(renderer->hasLayer()); |
1274 RenderLayer* layer = toRenderBoxModelObject(renderer)->layer(); | 1275 RenderLayer* layer = toRenderBoxModelObject(renderer)->layer(); |
1275 | 1276 |
1276 // Layers that paint into their ancestor or into a grouped backing will
still need | 1277 // Layers that paint into their ancestor or into a grouped backing will
still need |
1277 // to apply a paint invalidation. If the layer paints into its own backi
ng, then | 1278 // to apply a paint invalidation. If the layer paints into its own backi
ng, then |
1278 // it does not need paint invalidation just to scroll. | 1279 // it does not need paint invalidation just to scroll. |
1279 if (layer->compositingState() == PaintsIntoOwnBacking) | 1280 if (layer->compositingState() == PaintsIntoOwnBacking) |
1280 continue; | 1281 continue; |
1281 | 1282 |
1282 if (layer->hasAncestorWithFilterOutsets()) { | 1283 if (layer->hasAncestorWithFilterOutsets()) { |
1283 // If the fixed layer has a blur/drop-shadow filter applied on at le
ast one of its parents, we cannot | 1284 // If the fixed layer has a blur/drop-shadow filter applied on at le
ast one of its parents, we cannot |
1284 // scroll using the fast path, otherwise the outsets of the filter w
ill be moved around the page. | 1285 // scroll using the fast path, otherwise the outsets of the filter w
ill be moved around the page. |
1285 return false; | 1286 return false; |
1286 } | 1287 } |
1287 | 1288 |
1288 IntRect updateRect = pixelSnappedIntRect(layer->repainter().repaintRectI
ncludingNonCompositingDescendants()); | 1289 IntRect updateRect = pixelSnappedIntRect(layer->repainter().repaintRectI
ncludingNonCompositingDescendants()); |
1289 | 1290 |
1290 const RenderLayerModelObject* repaintContainer = layer->renderer()->cont
ainerForPaintInvalidation(); | 1291 const RenderLayerModelObject* repaintContainer = layer->renderer()->cont
ainerForPaintInvalidation(); |
1291 if (repaintContainer && !repaintContainer->isRenderView()) { | 1292 if (repaintContainer && !repaintContainer->isRenderView()) { |
1292 // If the fixed-position layer is contained by a composited layer th
at is not its containing block, | 1293 // Invalidate the old and new locations of fixed position elements t
hat are not drawn into the RenderView. |
1293 // then we have to invalidate that enclosing layer, not the RenderVi
ew. | |
1294 // FIXME: Why do we need to issue this invalidation? Won't the fixed
position element just scroll | |
1295 // with the enclosing layer. | |
1296 updateRect.moveBy(scrollPosition()); | 1294 updateRect.moveBy(scrollPosition()); |
1297 IntRect previousRect = updateRect; | 1295 IntRect previousRect = updateRect; |
1298 previousRect.move(scrollDelta); | 1296 previousRect.move(scrollDelta); |
| 1297 // FIXME: Rather than uniting the rects, we should just issue both i
nvalidations. |
1299 updateRect.unite(previousRect); | 1298 updateRect.unite(previousRect); |
1300 layer->renderer()->invalidatePaintUsingContainer(repaintContainer, u
pdateRect, InvalidationScroll); | 1299 layer->renderer()->invalidatePaintUsingContainer(repaintContainer, u
pdateRect, InvalidationScroll); |
1301 } else { | 1300 } else { |
1302 // Coalesce the paint invalidations that will be issued to the rende
rView. | 1301 // Coalesce the paint invalidations that will be issued to the rende
rView. |
1303 updateRect = contentsToRootView(updateRect); | 1302 updateRect = contentsToRootView(updateRect); |
1304 if (!isCompositedContentLayer && clipsPaintInvalidations()) | |
1305 updateRect.intersect(rectToScroll); | |
1306 if (!updateRect.isEmpty()) | 1303 if (!updateRect.isEmpty()) |
1307 regionToUpdate.unite(updateRect); | 1304 regionToUpdate.unite(updateRect); |
1308 } | 1305 } |
1309 } | 1306 } |
1310 | 1307 |
1311 // 1) scroll | |
1312 hostWindow()->scroll(); | 1308 hostWindow()->scroll(); |
1313 | 1309 |
1314 // 2) update the area of fixed objects that has been invalidated | 1310 // Invalidate the old and new locations of fixed position elements that are
drawn into the RenderView. |
1315 Vector<IntRect> subRectsToUpdate = regionToUpdate.rects(); | 1311 Vector<IntRect> subRectsToUpdate = regionToUpdate.rects(); |
1316 size_t viewportConstrainedObjectsCount = subRectsToUpdate.size(); | 1312 size_t viewportConstrainedObjectsCount = subRectsToUpdate.size(); |
1317 for (size_t i = 0; i < viewportConstrainedObjectsCount; ++i) { | 1313 for (size_t i = 0; i < viewportConstrainedObjectsCount; ++i) { |
1318 IntRect updateRect = subRectsToUpdate[i]; | 1314 IntRect updateRect = subRectsToUpdate[i]; |
1319 IntRect scrolledRect = updateRect; | 1315 IntRect scrolledRect = updateRect; |
1320 scrolledRect.move(-scrollDelta); | 1316 scrolledRect.move(-scrollDelta); |
1321 updateRect.unite(scrolledRect); | 1317 updateRect.unite(scrolledRect); |
1322 if (isCompositedContentLayer) { | 1318 // FIXME: We should be able to issue these invalidations separately and
before we actually scroll. |
1323 updateRect = rootViewToContents(updateRect); | 1319 renderView()->layer()->repainter().setBackingNeedsRepaintInRect(rootView
ToContents(updateRect)); |
1324 ASSERT(renderView()); | |
1325 renderView()->layer()->repainter().setBackingNeedsRepaintInRect(upda
teRect); | |
1326 continue; | |
1327 } | |
1328 if (clipsPaintInvalidations()) | |
1329 updateRect.intersect(rectToScroll); | |
1330 hostWindow()->invalidateContentsAndRootView(updateRect); | |
1331 } | 1320 } |
1332 | 1321 |
1333 return true; | 1322 return true; |
1334 } | 1323 } |
1335 | 1324 |
1336 void FrameView::scrollContentsSlowPath(const IntRect& updateRect) | 1325 void FrameView::scrollContentsSlowPath(const IntRect& updateRect) |
1337 { | 1326 { |
1338 if (contentsInCompositedLayer()) { | 1327 if (contentsInCompositedLayer()) { |
1339 IntRect updateRect = visibleContentRect(); | 1328 IntRect updateRect = visibleContentRect(); |
1340 ASSERT(renderView()); | 1329 ASSERT(renderView()); |
(...skipping 1803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3144 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o
rientation) | 3133 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o
rientation) |
3145 { | 3134 { |
3146 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); | 3135 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); |
3147 if (AXObjectCache* cache = axObjectCache()) { | 3136 if (AXObjectCache* cache = axObjectCache()) { |
3148 cache->remove(scrollbar); | 3137 cache->remove(scrollbar); |
3149 cache->handleScrollbarUpdate(this); | 3138 cache->handleScrollbarUpdate(this); |
3150 } | 3139 } |
3151 } | 3140 } |
3152 | 3141 |
3153 } // namespace blink | 3142 } // namespace blink |
OLD | NEW |