| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
| 3 * | 3 * |
| 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
| 5 * | 5 * |
| 6 * Other contributors: | 6 * Other contributors: |
| 7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
| 8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
| 9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
| 10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 return; | 181 return; |
| 182 } | 182 } |
| 183 } else { | 183 } else { |
| 184 if (GraphicsLayer* layer = layerForHorizontalScrollbar()) { | 184 if (GraphicsLayer* layer = layerForHorizontalScrollbar()) { |
| 185 layer->setNeedsDisplayInRect(rect); | 185 layer->setNeedsDisplayInRect(rect); |
| 186 return; | 186 return; |
| 187 } | 187 } |
| 188 } | 188 } |
| 189 | 189 |
| 190 IntRect scrollRect = rect; | 190 IntRect scrollRect = rect; |
| 191 // If we are not yet inserted into the tree, there is no need to repaint. | 191 // If we are not yet inserted into the tree, there is no need to issue paint
invaldiations. |
| 192 if (!box().parent()) | 192 if (!box().parent()) |
| 193 return; | 193 return; |
| 194 | 194 |
| 195 if (scrollbar == m_vBar.get()) | 195 if (scrollbar == m_vBar.get()) |
| 196 scrollRect.move(verticalScrollbarStart(0, box().width()), box().borderTo
p()); | 196 scrollRect.move(verticalScrollbarStart(0, box().width()), box().borderTo
p()); |
| 197 else | 197 else |
| 198 scrollRect.move(horizontalScrollbarStart(0), box().height() - box().bord
erBottom() - scrollbar->height()); | 198 scrollRect.move(horizontalScrollbarStart(0), box().height() - box().bord
erBottom() - scrollbar->height()); |
| 199 | 199 |
| 200 if (scrollRect.isEmpty()) | 200 if (scrollRect.isEmpty()) |
| 201 return; | 201 return; |
| 202 | 202 |
| 203 LayoutRect repaintRect = scrollRect; | 203 LayoutRect paintInvalidationRect = scrollRect; |
| 204 box().flipForWritingMode(repaintRect); | 204 box().flipForWritingMode(paintInvalidationRect); |
| 205 | 205 |
| 206 IntRect intRect = pixelSnappedIntRect(repaintRect); | 206 IntRect intRect = pixelSnappedIntRect(paintInvalidationRect); |
| 207 | 207 |
| 208 if (box().frameView()->isInPerformLayout()) | 208 if (box().frameView()->isInPerformLayout()) |
| 209 addScrollbarDamage(scrollbar, intRect); | 209 addScrollbarDamage(scrollbar, intRect); |
| 210 else | 210 else |
| 211 box().invalidatePaintRectangle(intRect); | 211 box().invalidatePaintRectangle(intRect); |
| 212 } | 212 } |
| 213 | 213 |
| 214 void RenderLayerScrollableArea::invalidateScrollCornerRect(const IntRect& rect) | 214 void RenderLayerScrollableArea::invalidateScrollCornerRect(const IntRect& rect) |
| 215 { | 215 { |
| 216 if (GraphicsLayer* layer = layerForScrollCorner()) { | 216 if (GraphicsLayer* layer = layerForScrollCorner()) { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 | 348 |
| 349 LocalFrame* frame = box().frame(); | 349 LocalFrame* frame = box().frame(); |
| 350 ASSERT(frame); | 350 ASSERT(frame); |
| 351 | 351 |
| 352 RefPtr<FrameView> frameView = box().frameView(); | 352 RefPtr<FrameView> frameView = box().frameView(); |
| 353 | 353 |
| 354 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ScrollLayer",
"data", InspectorScrollLayerEvent::data(&box())); | 354 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ScrollLayer",
"data", InspectorScrollLayerEvent::data(&box())); |
| 355 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
ne migrates to tracing. | 355 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli
ne migrates to tracing. |
| 356 InspectorInstrumentation::willScrollLayer(&box()); | 356 InspectorInstrumentation::willScrollLayer(&box()); |
| 357 | 357 |
| 358 const RenderLayerModelObject* repaintContainer = box().containerForPaintInva
lidation(); | 358 const RenderLayerModelObject* paintInvalidationContainer = box().containerFo
rPaintInvalidation(); |
| 359 | 359 |
| 360 // Update the positions of our child layers (if needed as only fixed layers
should be impacted by a scroll). | 360 // Update the positions of our child layers (if needed as only fixed layers
should be impacted by a scroll). |
| 361 // We don't update compositing layers, because we need to do a deep update f
rom the compositing ancestor. | 361 // We don't update compositing layers, because we need to do a deep update f
rom the compositing ancestor. |
| 362 if (!frameView->isInPerformLayout()) { | 362 if (!frameView->isInPerformLayout()) { |
| 363 // If we're in the middle of layout, we'll just update layers once layou
t has finished. | 363 // If we're in the middle of layout, we'll just update layers once layou
t has finished. |
| 364 layer()->clipper().clearClipRectsIncludingDescendants(); | 364 layer()->clipper().clearClipRectsIncludingDescendants(); |
| 365 box().setPreviousPaintInvalidationRect(box().boundsRectForPaintInvalidat
ion(repaintContainer)); | 365 box().setPreviousPaintInvalidationRect(box().boundsRectForPaintInvalidat
ion(paintInvalidationContainer)); |
| 366 // Update regions, scrolling may change the clip of a particular region. | 366 // Update regions, scrolling may change the clip of a particular region. |
| 367 frameView->updateAnnotatedRegions(); | 367 frameView->updateAnnotatedRegions(); |
| 368 // FIXME: We shouldn't call updateWidgetPositions() here since it might
tear down the render tree, | 368 // FIXME: We shouldn't call updateWidgetPositions() here since it might
tear down the render tree, |
| 369 // for now we just crash to avoid allowing an attacker to use after free
. | 369 // for now we just crash to avoid allowing an attacker to use after free
. |
| 370 frameView->updateWidgetPositions(); | 370 frameView->updateWidgetPositions(); |
| 371 RELEASE_ASSERT(frameView->renderView()); | 371 RELEASE_ASSERT(frameView->renderView()); |
| 372 updateCompositingLayersAfterScroll(); | 372 updateCompositingLayersAfterScroll(); |
| 373 } | 373 } |
| 374 | 374 |
| 375 // The caret rect needs to be invalidated after scrolling | 375 // The caret rect needs to be invalidated after scrolling |
| 376 frame->selection().setCaretRectNeedsUpdate(); | 376 frame->selection().setCaretRectNeedsUpdate(); |
| 377 | 377 |
| 378 FloatQuad quadForFakeMouseMoveEvent = FloatQuad(layer()->renderer()->previou
sPaintInvalidationRect()); | 378 FloatQuad quadForFakeMouseMoveEvent = FloatQuad(layer()->renderer()->previou
sPaintInvalidationRect()); |
| 379 | 379 |
| 380 quadForFakeMouseMoveEvent = repaintContainer->localToAbsoluteQuad(quadForFak
eMouseMoveEvent); | 380 quadForFakeMouseMoveEvent = paintInvalidationContainer->localToAbsoluteQuad(
quadForFakeMouseMoveEvent); |
| 381 frame->eventHandler().dispatchFakeMouseMoveEventSoonInQuad(quadForFakeMouseM
oveEvent); | 381 frame->eventHandler().dispatchFakeMouseMoveEventSoonInQuad(quadForFakeMouseM
oveEvent); |
| 382 | 382 |
| 383 bool requiresRepaint = true; | 383 bool requiresPaintInvalidation = true; |
| 384 | 384 |
| 385 if (!box().isMarquee() && box().view()->compositor()->inCompositingMode()) { | 385 if (!box().isMarquee() && box().view()->compositor()->inCompositingMode()) { |
| 386 // Hits in virtual/gpu/fast/canvas/canvas-scroll-path-into-view.html. | 386 // Hits in virtual/gpu/fast/canvas/canvas-scroll-path-into-view.html. |
| 387 DisableCompositingQueryAsserts disabler; | 387 DisableCompositingQueryAsserts disabler; |
| 388 bool onlyScrolledCompositedLayers = scrollsOverflow() | 388 bool onlyScrolledCompositedLayers = scrollsOverflow() |
| 389 && !layer()->hasVisibleNonLayerContent() | 389 && !layer()->hasVisibleNonLayerContent() |
| 390 && !layer()->hasNonCompositedChild() | 390 && !layer()->hasNonCompositedChild() |
| 391 && !layer()->hasBlockSelectionGapBounds() | 391 && !layer()->hasBlockSelectionGapBounds() |
| 392 && box().style()->backgroundLayers().attachment() != LocalBackground
Attachment; | 392 && box().style()->backgroundLayers().attachment() != LocalBackground
Attachment; |
| 393 | 393 |
| 394 if (usesCompositedScrolling() || onlyScrolledCompositedLayers) | 394 if (usesCompositedScrolling() || onlyScrolledCompositedLayers) |
| 395 requiresRepaint = false; | 395 requiresPaintInvalidation = false; |
| 396 } | 396 } |
| 397 | 397 |
| 398 // Just schedule a full repaint of our object. | 398 // Just schedule a full paint invalidation of our object. |
| 399 if (requiresRepaint) { | 399 if (requiresPaintInvalidation) { |
| 400 if (box().frameView()->isInPerformLayout()) | 400 if (box().frameView()->isInPerformLayout()) |
| 401 box().setShouldDoFullPaintInvalidation(true); | 401 box().setShouldDoFullPaintInvalidation(true); |
| 402 else | 402 else |
| 403 box().invalidatePaintUsingContainer(repaintContainer, layer()->rende
rer()->previousPaintInvalidationRect(), InvalidationScroll); | 403 box().invalidatePaintUsingContainer(paintInvalidationContainer, laye
r()->renderer()->previousPaintInvalidationRect(), InvalidationScroll); |
| 404 } | 404 } |
| 405 | 405 |
| 406 // Schedule the scroll DOM event. | 406 // Schedule the scroll DOM event. |
| 407 if (box().node()) | 407 if (box().node()) |
| 408 box().node()->document().enqueueScrollEventForNode(box().node()); | 408 box().node()->document().enqueueScrollEventForNode(box().node()); |
| 409 | 409 |
| 410 if (AXObjectCache* cache = box().document().existingAXObjectCache()) | 410 if (AXObjectCache* cache = box().document().existingAXObjectCache()) |
| 411 cache->handleScrollPositionChanged(&box()); | 411 cache->handleScrollPositionChanged(&box()); |
| 412 | 412 |
| 413 InspectorInstrumentation::didScrollLayer(&box()); | 413 InspectorInstrumentation::didScrollLayer(&box()); |
| (...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1458 void RenderLayerScrollableArea::setTopmostScrollChild(RenderLayer* scrollChild) | 1458 void RenderLayerScrollableArea::setTopmostScrollChild(RenderLayer* scrollChild) |
| 1459 { | 1459 { |
| 1460 // We only want to track the topmost scroll child for scrollable areas with | 1460 // We only want to track the topmost scroll child for scrollable areas with |
| 1461 // overlay scrollbars. | 1461 // overlay scrollbars. |
| 1462 if (!hasOverlayScrollbars()) | 1462 if (!hasOverlayScrollbars()) |
| 1463 return; | 1463 return; |
| 1464 m_nextTopmostScrollChild = scrollChild; | 1464 m_nextTopmostScrollChild = scrollChild; |
| 1465 } | 1465 } |
| 1466 | 1466 |
| 1467 } // namespace blink | 1467 } // namespace blink |
| OLD | NEW |