| 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 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1382 // Note: This is only for output rect, so there's no need to expand the
dirty source rect. | 1382 // Note: This is only for output rect, so there's no need to expand the
dirty source rect. |
| 1383 rectForRepaint.unite(calculateLayerBounds(this)); | 1383 rectForRepaint.unite(calculateLayerBounds(this)); |
| 1384 } | 1384 } |
| 1385 | 1385 |
| 1386 RenderLayer* parentLayer = enclosingFilterRepaintLayer(); | 1386 RenderLayer* parentLayer = enclosingFilterRepaintLayer(); |
| 1387 ASSERT(parentLayer); | 1387 ASSERT(parentLayer); |
| 1388 FloatQuad repaintQuad(rectForRepaint); | 1388 FloatQuad repaintQuad(rectForRepaint); |
| 1389 LayoutRect parentLayerRect = renderer()->localToContainerQuad(repaintQuad, p
arentLayer->renderer()).enclosingBoundingBox(); | 1389 LayoutRect parentLayerRect = renderer()->localToContainerQuad(repaintQuad, p
arentLayer->renderer()).enclosingBoundingBox(); |
| 1390 | 1390 |
| 1391 if (parentLayer->isComposited()) { | 1391 if (parentLayer->isComposited()) { |
| 1392 if (!parentLayer->backing()->paintsIntoWindow()) { | 1392 parentLayer->setBackingNeedsRepaintInRect(parentLayerRect); |
| 1393 parentLayer->setBackingNeedsRepaintInRect(parentLayerRect); | 1393 return; |
| 1394 return; | |
| 1395 } | |
| 1396 // If the painting goes to window, redirect the painting to the parent R
enderView. | |
| 1397 parentLayer = renderer()->view()->layer(); | |
| 1398 parentLayerRect = renderer()->localToContainerQuad(repaintQuad, parentLa
yer->renderer()).enclosingBoundingBox(); | |
| 1399 } | 1394 } |
| 1400 | 1395 |
| 1401 if (parentLayer->paintsWithFilters()) { | 1396 if (parentLayer->paintsWithFilters()) { |
| 1402 parentLayer->setFilterBackendNeedsRepaintingInRect(parentLayerRect); | 1397 parentLayer->setFilterBackendNeedsRepaintingInRect(parentLayerRect); |
| 1403 return; | 1398 return; |
| 1404 } | 1399 } |
| 1405 | 1400 |
| 1406 if (parentLayer->isRootLayer()) { | 1401 if (parentLayer->isRootLayer()) { |
| 1407 RenderView* view = toRenderView(parentLayer->renderer()); | 1402 RenderView* view = toRenderView(parentLayer->renderer()); |
| 1408 view->repaintViewRectangle(parentLayerRect); | 1403 view->repaintViewRectangle(parentLayerRect); |
| (...skipping 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3419 return false; | 3414 return false; |
| 3420 } | 3415 } |
| 3421 | 3416 |
| 3422 void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo&
paintingInfo, PaintLayerFlags paintFlags) | 3417 void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo&
paintingInfo, PaintLayerFlags paintFlags) |
| 3423 { | 3418 { |
| 3424 if (isComposited()) { | 3419 if (isComposited()) { |
| 3425 // The updatingControlTints() painting pass goes through compositing lay
ers, | 3420 // The updatingControlTints() painting pass goes through compositing lay
ers, |
| 3426 // but we need to ensure that we don't cache clip rects computed with th
e wrong root in this case. | 3421 // but we need to ensure that we don't cache clip rects computed with th
e wrong root in this case. |
| 3427 if (context->updatingControlTints() || (paintingInfo.paintBehavior & Pai
ntBehaviorFlattenCompositingLayers)) | 3422 if (context->updatingControlTints() || (paintingInfo.paintBehavior & Pai
ntBehaviorFlattenCompositingLayers)) |
| 3428 paintFlags |= PaintLayerTemporaryClipRects; | 3423 paintFlags |= PaintLayerTemporaryClipRects; |
| 3429 else if (!backing()->paintsIntoWindow() | 3424 else if (!backing()->paintsIntoCompositedAncestor() |
| 3430 && !backing()->paintsIntoCompositedAncestor() | |
| 3431 && !shouldDoSoftwarePaint(this, paintFlags & PaintLayerPaintingRefle
ction)) { | 3425 && !shouldDoSoftwarePaint(this, paintFlags & PaintLayerPaintingRefle
ction)) { |
| 3432 // If this RenderLayer should paint into its backing, that will be d
one via RenderLayerBacking::paintIntoLayer(). | 3426 // If this RenderLayer should paint into its backing, that will be d
one via RenderLayerBacking::paintIntoLayer(). |
| 3433 return; | 3427 return; |
| 3434 } | 3428 } |
| 3435 } else if (viewportConstrainedNotCompositedReason() == NotCompositedForBound
sOutOfView) { | 3429 } else if (viewportConstrainedNotCompositedReason() == NotCompositedForBound
sOutOfView) { |
| 3436 // Don't paint out-of-view viewport constrained layers (when doing prepa
inting) because they will never be visible | 3430 // Don't paint out-of-view viewport constrained layers (when doing prepa
inting) because they will never be visible |
| 3437 // unless their position or viewport size is changed. | 3431 // unless their position or viewport size is changed. |
| 3438 return; | 3432 return; |
| 3439 } | 3433 } |
| 3440 | 3434 |
| (...skipping 1918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5359 return m_backing ? m_backing->layerForVerticalScrollbar() : 0; | 5353 return m_backing ? m_backing->layerForVerticalScrollbar() : 0; |
| 5360 } | 5354 } |
| 5361 | 5355 |
| 5362 GraphicsLayer* RenderLayer::layerForScrollCorner() const | 5356 GraphicsLayer* RenderLayer::layerForScrollCorner() const |
| 5363 { | 5357 { |
| 5364 return m_backing ? m_backing->layerForScrollCorner() : 0; | 5358 return m_backing ? m_backing->layerForScrollCorner() : 0; |
| 5365 } | 5359 } |
| 5366 | 5360 |
| 5367 bool RenderLayer::paintsWithTransform(PaintBehavior paintBehavior) const | 5361 bool RenderLayer::paintsWithTransform(PaintBehavior paintBehavior) const |
| 5368 { | 5362 { |
| 5369 bool paintsToWindow = !isComposited() || backing()->paintsIntoWindow(); | 5363 return transform() && ((paintBehavior & PaintBehaviorFlattenCompositingLayer
s) || !isComposited()); |
| 5370 return transform() && ((paintBehavior & PaintBehaviorFlattenCompositingLayer
s) || paintsToWindow); | |
| 5371 } | 5364 } |
| 5372 | 5365 |
| 5373 bool RenderLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect)
const | 5366 bool RenderLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect)
const |
| 5374 { | 5367 { |
| 5375 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) | 5368 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) |
| 5376 return false; | 5369 return false; |
| 5377 | 5370 |
| 5378 if (paintsWithTransparency(PaintBehaviorNormal)) | 5371 if (paintsWithTransparency(PaintBehaviorNormal)) |
| 5379 return false; | 5372 return false; |
| 5380 | 5373 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5599 void RenderLayer::repaintIncludingDescendants() | 5592 void RenderLayer::repaintIncludingDescendants() |
| 5600 { | 5593 { |
| 5601 renderer()->repaint(); | 5594 renderer()->repaint(); |
| 5602 for (RenderLayer* curr = firstChild(); curr; curr = curr->nextSibling()) | 5595 for (RenderLayer* curr = firstChild(); curr; curr = curr->nextSibling()) |
| 5603 curr->repaintIncludingDescendants(); | 5596 curr->repaintIncludingDescendants(); |
| 5604 } | 5597 } |
| 5605 | 5598 |
| 5606 void RenderLayer::setBackingNeedsRepaint() | 5599 void RenderLayer::setBackingNeedsRepaint() |
| 5607 { | 5600 { |
| 5608 ASSERT(isComposited()); | 5601 ASSERT(isComposited()); |
| 5609 if (backing()->paintsIntoWindow()) { | 5602 backing()->setContentsNeedDisplay(); |
| 5610 // If we're trying to repaint the placeholder document layer, propagate
the | |
| 5611 // repaint to the native view system. | |
| 5612 RenderView* view = renderer()->view(); | |
| 5613 if (view) | |
| 5614 view->repaintViewRectangle(absoluteBoundingBox()); | |
| 5615 } else | |
| 5616 backing()->setContentsNeedDisplay(); | |
| 5617 } | 5603 } |
| 5618 | 5604 |
| 5619 void RenderLayer::setBackingNeedsRepaintInRect(const LayoutRect& r) | 5605 void RenderLayer::setBackingNeedsRepaintInRect(const LayoutRect& r) |
| 5620 { | 5606 { |
| 5621 // https://bugs.webkit.org/show_bug.cgi?id=61159 describes an unreproducible
crash here, | 5607 // https://bugs.webkit.org/show_bug.cgi?id=61159 describes an unreproducible
crash here, |
| 5622 // so assert but check that the layer is composited. | 5608 // so assert but check that the layer is composited. |
| 5623 ASSERT(isComposited()); | 5609 ASSERT(isComposited()); |
| 5624 if (!isComposited() || backing()->paintsIntoWindow()) { | 5610 if (!isComposited()) { |
| 5625 // If we're trying to repaint the placeholder document layer, propagate
the | 5611 // If we're trying to repaint the placeholder document layer, propagate
the |
| 5626 // repaint to the native view system. | 5612 // repaint to the native view system. |
| 5627 LayoutRect absRect(r); | 5613 LayoutRect absRect(r); |
| 5628 LayoutPoint delta; | 5614 LayoutPoint delta; |
| 5629 convertToLayerCoords(root(), delta); | 5615 convertToLayerCoords(root(), delta); |
| 5630 absRect.moveBy(delta); | 5616 absRect.moveBy(delta); |
| 5631 | 5617 |
| 5632 RenderView* view = renderer()->view(); | 5618 RenderView* view = renderer()->view(); |
| 5633 if (view) | 5619 if (view) |
| 5634 view->repaintViewRectangle(absRect); | 5620 view->repaintViewRectangle(absRect); |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6258 } | 6244 } |
| 6259 } | 6245 } |
| 6260 | 6246 |
| 6261 void showLayerTree(const WebCore::RenderObject* renderer) | 6247 void showLayerTree(const WebCore::RenderObject* renderer) |
| 6262 { | 6248 { |
| 6263 if (!renderer) | 6249 if (!renderer) |
| 6264 return; | 6250 return; |
| 6265 showLayerTree(renderer->enclosingLayer()); | 6251 showLayerTree(renderer->enclosingLayer()); |
| 6266 } | 6252 } |
| 6267 #endif | 6253 #endif |
| OLD | NEW |