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 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1337 | 1337 |
1338 for (RenderLayer* child = layer->firstChild(); child; child = child->nextSib
ling()) { | 1338 for (RenderLayer* child = layer->firstChild(); child; child = child->nextSib
ling()) { |
1339 // Don't include paint invalidation rects for composited child layers; t
hey will paint themselves and have a different origin. | 1339 // Don't include paint invalidation rects for composited child layers; t
hey will paint themselves and have a different origin. |
1340 if (child->isPaintInvalidationContainer()) | 1340 if (child->isPaintInvalidationContainer()) |
1341 continue; | 1341 continue; |
1342 | 1342 |
1343 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(child
); | 1343 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(child
); |
1344 } | 1344 } |
1345 } | 1345 } |
1346 | 1346 |
| 1347 LayoutRect paintInvalidationRectIncludingNonCompositingDescendants(RenderLayer*
layer) |
| 1348 { |
| 1349 LayoutRect paintInvalidationRect = layer->renderer()->previousPaintInvalidat
ionRect(); |
| 1350 for (RenderLayer* child = layer->firstChild(); child; child = child->nextSib
ling()) { |
| 1351 // Don't include paint invalidation rects for composited child layers; t
hey will paint themselves and have a different origin. |
| 1352 if (child->isPaintInvalidationContainer()) |
| 1353 continue; |
| 1354 |
| 1355 paintInvalidationRect.unite(paintInvalidationRectIncludingNonCompositing
Descendants(child)); |
| 1356 } |
| 1357 return paintInvalidationRect; |
| 1358 } |
| 1359 |
1347 bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta) | 1360 bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta) |
1348 { | 1361 { |
1349 if (!contentsInCompositedLayer() || hasSlowRepaintObjects()) | 1362 if (!contentsInCompositedLayer() || hasSlowRepaintObjects()) |
1350 return false; | 1363 return false; |
1351 | 1364 |
1352 if (!m_viewportConstrainedObjects || m_viewportConstrainedObjects->isEmpty()
) { | 1365 if (!m_viewportConstrainedObjects || m_viewportConstrainedObjects->isEmpty()
) { |
1353 InspectorInstrumentation::didScroll(page()); | 1366 InspectorInstrumentation::didScroll(page()); |
1354 return true; | 1367 return true; |
1355 } | 1368 } |
1356 | 1369 |
| 1370 Region regionToUpdate; |
1357 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects)
{ | 1371 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects)
{ |
1358 RenderObject* renderer = viewportConstrainedObject; | 1372 RenderObject* renderer = viewportConstrainedObject; |
1359 ASSERT(renderer->style()->hasViewportConstrainedPosition()); | 1373 ASSERT(renderer->style()->hasViewportConstrainedPosition()); |
1360 ASSERT(renderer->hasLayer()); | 1374 ASSERT(renderer->hasLayer()); |
1361 RenderLayer* layer = toRenderBoxModelObject(renderer)->layer(); | 1375 RenderLayer* layer = toRenderBoxModelObject(renderer)->layer(); |
1362 | 1376 |
1363 if (layer->isPaintInvalidationContainer()) | 1377 if (layer->isPaintInvalidationContainer()) |
1364 continue; | 1378 continue; |
1365 | 1379 |
1366 if (layer->subtreeIsInvisible()) | 1380 if (layer->subtreeIsInvisible()) |
1367 continue; | 1381 continue; |
1368 | 1382 |
1369 // If the fixed layer has a blur/drop-shadow filter applied on at least
one of its parents, we cannot | 1383 // If the fixed layer has a blur/drop-shadow filter applied on at least
one of its parents, we cannot |
1370 // scroll using the fast path, otherwise the outsets of the filter will
be moved around the page. | 1384 // scroll using the fast path, otherwise the outsets of the filter will
be moved around the page. |
1371 if (layer->hasAncestorWithFilterOutsets()) | 1385 if (layer->hasAncestorWithFilterOutsets()) |
1372 return false; | 1386 return false; |
1373 | 1387 |
1374 setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(layer
); | 1388 IntRect updateRect = pixelSnappedIntRect(paintInvalidationRectIncludingN
onCompositingDescendants(layer)); |
| 1389 |
| 1390 const RenderLayerModelObject* repaintContainer = layer->renderer()->cont
ainerForPaintInvalidation(); |
| 1391 if (repaintContainer && !repaintContainer->isRenderView()) { |
| 1392 // Invalidate the old and new locations of fixed position elements t
hat are not drawn into the RenderView. |
| 1393 updateRect.moveBy(scrollPosition()); |
| 1394 IntRect previousRect = updateRect; |
| 1395 previousRect.move(scrollDelta); |
| 1396 // FIXME: Rather than uniting the rects, we should just issue both i
nvalidations. |
| 1397 updateRect.unite(previousRect); |
| 1398 layer->renderer()->invalidatePaintUsingContainer(repaintContainer, u
pdateRect, PaintInvalidationScroll); |
| 1399 } else { |
| 1400 // Coalesce the paint invalidations that will be issued to the rende
rView. |
| 1401 updateRect = contentsToRootView(updateRect); |
| 1402 if (!updateRect.isEmpty()) |
| 1403 regionToUpdate.unite(updateRect); |
| 1404 } |
1375 } | 1405 } |
1376 | 1406 |
1377 InspectorInstrumentation::didScroll(page()); | 1407 InspectorInstrumentation::didScroll(page()); |
| 1408 |
| 1409 // Invalidate the old and new locations of fixed position elements that are
drawn into the RenderView. |
| 1410 Vector<IntRect> subRectsToUpdate = regionToUpdate.rects(); |
| 1411 size_t viewportConstrainedObjectsCount = subRectsToUpdate.size(); |
| 1412 for (size_t i = 0; i < viewportConstrainedObjectsCount; ++i) { |
| 1413 IntRect updateRect = subRectsToUpdate[i]; |
| 1414 IntRect scrolledRect = updateRect; |
| 1415 scrolledRect.move(-scrollDelta); |
| 1416 updateRect.unite(scrolledRect); |
| 1417 // FIXME: We should be able to issue these invalidations separately and
before we actually scroll. |
| 1418 renderView()->setBackingNeedsPaintInvalidationInRect(rootViewToContents(
updateRect), PaintInvalidationScroll); |
| 1419 } |
| 1420 |
1378 return true; | 1421 return true; |
1379 } | 1422 } |
1380 | 1423 |
1381 void FrameView::scrollContentsSlowPath(const IntRect& updateRect) | 1424 void FrameView::scrollContentsSlowPath(const IntRect& updateRect) |
1382 { | 1425 { |
1383 if (contentsInCompositedLayer()) { | 1426 if (contentsInCompositedLayer()) { |
1384 IntRect updateRect = visibleContentRect(); | 1427 IntRect updateRect = visibleContentRect(); |
1385 ASSERT(renderView()); | 1428 ASSERT(renderView()); |
1386 renderView()->invalidatePaintRectangle(updateRect); | 1429 renderView()->invalidatePaintRectangle(updateRect); |
1387 } | 1430 } |
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2547 InspectorInstrumentation::willUpdateLayerTree(m_frame.get()); | 2590 InspectorInstrumentation::willUpdateLayerTree(m_frame.get()); |
2548 | 2591 |
2549 view->compositor()->updateIfNeededRecursive(); | 2592 view->compositor()->updateIfNeededRecursive(); |
2550 | 2593 |
2551 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot()) | 2594 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot()) |
2552 m_frame->page()->scrollingCoordinator()->updateAfterCompositingChang
eIfNeeded(); | 2595 m_frame->page()->scrollingCoordinator()->updateAfterCompositingChang
eIfNeeded(); |
2553 | 2596 |
2554 updateCompositedSelectionBoundsIfNeeded(); | 2597 updateCompositedSelectionBoundsIfNeeded(); |
2555 | 2598 |
2556 InspectorInstrumentation::didUpdateLayerTree(m_frame.get()); | 2599 InspectorInstrumentation::didUpdateLayerTree(m_frame.get()); |
| 2600 |
| 2601 scrollContentsIfNeededRecursive(); |
| 2602 |
| 2603 invalidateTreeIfNeededRecursive(); |
2557 } | 2604 } |
2558 | 2605 |
2559 scrollContentsIfNeededRecursive(); | |
2560 | |
2561 if (view) | |
2562 invalidateTreeIfNeededRecursive(); | |
2563 | |
2564 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean); | 2606 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean); |
2565 } | 2607 } |
2566 | 2608 |
2567 void FrameView::updateLayoutAndStyleIfNeededRecursive() | 2609 void FrameView::updateLayoutAndStyleIfNeededRecursive() |
2568 { | 2610 { |
2569 // We have to crawl our entire tree looking for any FrameViews that need | 2611 // We have to crawl our entire tree looking for any FrameViews that need |
2570 // layout and make sure they are up to date. | 2612 // layout and make sure they are up to date. |
2571 // Mac actually tests for intersection with the dirty region and tries not t
o | 2613 // Mac actually tests for intersection with the dirty region and tries not t
o |
2572 // update layout for frames that are outside the dirty region. Not only doe
s this seem | 2614 // update layout for frames that are outside the dirty region. Not only doe
s this seem |
2573 // pointless (since those frames will have set a zero timer to layout anyway
), but | 2615 // pointless (since those frames will have set a zero timer to layout anyway
), but |
(...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3958 return; | 4000 return; |
3959 | 4001 |
3960 ScrollableArea::setScrollOrigin(origin); | 4002 ScrollableArea::setScrollOrigin(origin); |
3961 | 4003 |
3962 // Update if the scroll origin changes, since our position will be different
if the content size did not change. | 4004 // Update if the scroll origin changes, since our position will be different
if the content size did not change. |
3963 if (updatePositionAtAll && updatePositionSynchronously) | 4005 if (updatePositionAtAll && updatePositionSynchronously) |
3964 updateScrollbars(scrollOffsetDouble()); | 4006 updateScrollbars(scrollOffsetDouble()); |
3965 } | 4007 } |
3966 | 4008 |
3967 } // namespace blink | 4009 } // namespace blink |
OLD | NEW |