| 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 1507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1518 // Note: This is only for output rect, so there's no need to expand the
dirty source rect. | 1518 // Note: This is only for output rect, so there's no need to expand the
dirty source rect. |
| 1519 rectForRepaint.unite(calculateLayerBounds(this)); | 1519 rectForRepaint.unite(calculateLayerBounds(this)); |
| 1520 } | 1520 } |
| 1521 | 1521 |
| 1522 RenderLayer* parentLayer = enclosingFilterRepaintLayer(); | 1522 RenderLayer* parentLayer = enclosingFilterRepaintLayer(); |
| 1523 ASSERT(parentLayer); | 1523 ASSERT(parentLayer); |
| 1524 FloatQuad repaintQuad(rectForRepaint); | 1524 FloatQuad repaintQuad(rectForRepaint); |
| 1525 LayoutRect parentLayerRect = renderer()->localToContainerQuad(repaintQuad, p
arentLayer->renderer()).enclosingBoundingBox(); | 1525 LayoutRect parentLayerRect = renderer()->localToContainerQuad(repaintQuad, p
arentLayer->renderer()).enclosingBoundingBox(); |
| 1526 | 1526 |
| 1527 if (parentLayer->isComposited()) { | 1527 if (parentLayer->isComposited()) { |
| 1528 if (!parentLayer->backing()->paintsIntoWindow()) { | 1528 parentLayer->setBackingNeedsRepaintInRect(parentLayerRect); |
| 1529 parentLayer->setBackingNeedsRepaintInRect(parentLayerRect); | 1529 return; |
| 1530 return; | |
| 1531 } | |
| 1532 // If the painting goes to window, redirect the painting to the parent R
enderView. | |
| 1533 parentLayer = renderer()->view()->layer(); | |
| 1534 parentLayerRect = renderer()->localToContainerQuad(repaintQuad, parentLa
yer->renderer()).enclosingBoundingBox(); | |
| 1535 } | 1530 } |
| 1536 | 1531 |
| 1537 if (parentLayer->paintsWithFilters()) { | 1532 if (parentLayer->paintsWithFilters()) { |
| 1538 parentLayer->setFilterBackendNeedsRepaintingInRect(parentLayerRect); | 1533 parentLayer->setFilterBackendNeedsRepaintingInRect(parentLayerRect); |
| 1539 return; | 1534 return; |
| 1540 } | 1535 } |
| 1541 | 1536 |
| 1542 if (parentLayer->isRootLayer()) { | 1537 if (parentLayer->isRootLayer()) { |
| 1543 RenderView* view = toRenderView(parentLayer->renderer()); | 1538 RenderView* view = toRenderView(parentLayer->renderer()); |
| 1544 view->repaintViewRectangle(parentLayerRect); | 1539 view->repaintViewRectangle(parentLayerRect); |
| (...skipping 2052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3597 return false; | 3592 return false; |
| 3598 } | 3593 } |
| 3599 | 3594 |
| 3600 void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo&
paintingInfo, PaintLayerFlags paintFlags) | 3595 void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo&
paintingInfo, PaintLayerFlags paintFlags) |
| 3601 { | 3596 { |
| 3602 if (isComposited()) { | 3597 if (isComposited()) { |
| 3603 // The updatingControlTints() painting pass goes through compositing lay
ers, | 3598 // The updatingControlTints() painting pass goes through compositing lay
ers, |
| 3604 // but we need to ensure that we don't cache clip rects computed with th
e wrong root in this case. | 3599 // but we need to ensure that we don't cache clip rects computed with th
e wrong root in this case. |
| 3605 if (context->updatingControlTints() || (paintingInfo.paintBehavior & Pai
ntBehaviorFlattenCompositingLayers)) | 3600 if (context->updatingControlTints() || (paintingInfo.paintBehavior & Pai
ntBehaviorFlattenCompositingLayers)) |
| 3606 paintFlags |= PaintLayerTemporaryClipRects; | 3601 paintFlags |= PaintLayerTemporaryClipRects; |
| 3607 else if (!backing()->paintsIntoWindow() | 3602 else if (!backing()->paintsIntoCompositedAncestor() |
| 3608 && !backing()->paintsIntoCompositedAncestor() | |
| 3609 && !shouldDoSoftwarePaint(this, paintFlags & PaintLayerPaintingRefle
ction)) { | 3603 && !shouldDoSoftwarePaint(this, paintFlags & PaintLayerPaintingRefle
ction)) { |
| 3610 // If this RenderLayer should paint into its backing, that will be d
one via RenderLayerBacking::paintIntoLayer(). | 3604 // If this RenderLayer should paint into its backing, that will be d
one via RenderLayerBacking::paintIntoLayer(). |
| 3611 return; | 3605 return; |
| 3612 } | 3606 } |
| 3613 } else if (viewportConstrainedNotCompositedReason() == NotCompositedForBound
sOutOfView) { | 3607 } else if (viewportConstrainedNotCompositedReason() == NotCompositedForBound
sOutOfView) { |
| 3614 // Don't paint out-of-view viewport constrained layers (when doing prepa
inting) because they will never be visible | 3608 // Don't paint out-of-view viewport constrained layers (when doing prepa
inting) because they will never be visible |
| 3615 // unless their position or viewport size is changed. | 3609 // unless their position or viewport size is changed. |
| 3616 return; | 3610 return; |
| 3617 } | 3611 } |
| 3618 | 3612 |
| (...skipping 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5527 return m_backing ? m_backing->layerForVerticalScrollbar() : 0; | 5521 return m_backing ? m_backing->layerForVerticalScrollbar() : 0; |
| 5528 } | 5522 } |
| 5529 | 5523 |
| 5530 GraphicsLayer* RenderLayer::layerForScrollCorner() const | 5524 GraphicsLayer* RenderLayer::layerForScrollCorner() const |
| 5531 { | 5525 { |
| 5532 return m_backing ? m_backing->layerForScrollCorner() : 0; | 5526 return m_backing ? m_backing->layerForScrollCorner() : 0; |
| 5533 } | 5527 } |
| 5534 | 5528 |
| 5535 bool RenderLayer::paintsWithTransform(PaintBehavior paintBehavior) const | 5529 bool RenderLayer::paintsWithTransform(PaintBehavior paintBehavior) const |
| 5536 { | 5530 { |
| 5537 bool paintsToWindow = !isComposited() || backing()->paintsIntoWindow(); | 5531 return transform() && ((paintBehavior & PaintBehaviorFlattenCompositingLayer
s) || !isComposited()); |
| 5538 return transform() && ((paintBehavior & PaintBehaviorFlattenCompositingLayer
s) || paintsToWindow); | |
| 5539 } | 5532 } |
| 5540 | 5533 |
| 5541 bool RenderLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect)
const | 5534 bool RenderLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect)
const |
| 5542 { | 5535 { |
| 5543 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) | 5536 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) |
| 5544 return false; | 5537 return false; |
| 5545 | 5538 |
| 5546 if (paintsWithTransparency(PaintBehaviorNormal)) | 5539 if (paintsWithTransparency(PaintBehaviorNormal)) |
| 5547 return false; | 5540 return false; |
| 5548 | 5541 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5784 void RenderLayer::repaintIncludingDescendants() | 5777 void RenderLayer::repaintIncludingDescendants() |
| 5785 { | 5778 { |
| 5786 renderer()->repaint(); | 5779 renderer()->repaint(); |
| 5787 for (RenderLayer* curr = firstChild(); curr; curr = curr->nextSibling()) | 5780 for (RenderLayer* curr = firstChild(); curr; curr = curr->nextSibling()) |
| 5788 curr->repaintIncludingDescendants(); | 5781 curr->repaintIncludingDescendants(); |
| 5789 } | 5782 } |
| 5790 | 5783 |
| 5791 void RenderLayer::setBackingNeedsRepaint() | 5784 void RenderLayer::setBackingNeedsRepaint() |
| 5792 { | 5785 { |
| 5793 ASSERT(isComposited()); | 5786 ASSERT(isComposited()); |
| 5794 if (backing()->paintsIntoWindow()) { | 5787 backing()->setContentsNeedDisplay(); |
| 5795 // If we're trying to repaint the placeholder document layer, propagate
the | |
| 5796 // repaint to the native view system. | |
| 5797 RenderView* view = renderer()->view(); | |
| 5798 if (view) | |
| 5799 view->repaintViewRectangle(absoluteBoundingBox()); | |
| 5800 } else | |
| 5801 backing()->setContentsNeedDisplay(); | |
| 5802 } | 5788 } |
| 5803 | 5789 |
| 5804 void RenderLayer::setBackingNeedsRepaintInRect(const LayoutRect& r) | 5790 void RenderLayer::setBackingNeedsRepaintInRect(const LayoutRect& r) |
| 5805 { | 5791 { |
| 5806 // https://bugs.webkit.org/show_bug.cgi?id=61159 describes an unreproducible
crash here, | 5792 // https://bugs.webkit.org/show_bug.cgi?id=61159 describes an unreproducible
crash here, |
| 5807 // so assert but check that the layer is composited. | 5793 // so assert but check that the layer is composited. |
| 5808 ASSERT(isComposited()); | 5794 ASSERT(isComposited()); |
| 5809 if (!isComposited() || backing()->paintsIntoWindow()) { | 5795 if (!isComposited()) { |
| 5810 // If we're trying to repaint the placeholder document layer, propagate
the | 5796 // If we're trying to repaint the placeholder document layer, propagate
the |
| 5811 // repaint to the native view system. | 5797 // repaint to the native view system. |
| 5812 LayoutRect absRect(r); | 5798 LayoutRect absRect(r); |
| 5813 LayoutPoint delta; | 5799 LayoutPoint delta; |
| 5814 convertToLayerCoords(root(), delta); | 5800 convertToLayerCoords(root(), delta); |
| 5815 absRect.moveBy(delta); | 5801 absRect.moveBy(delta); |
| 5816 | 5802 |
| 5817 RenderView* view = renderer()->view(); | 5803 RenderView* view = renderer()->view(); |
| 5818 if (view) | 5804 if (view) |
| 5819 view->repaintViewRectangle(absRect); | 5805 view->repaintViewRectangle(absRect); |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6482 } | 6468 } |
| 6483 } | 6469 } |
| 6484 | 6470 |
| 6485 void showLayerTree(const WebCore::RenderObject* renderer) | 6471 void showLayerTree(const WebCore::RenderObject* renderer) |
| 6486 { | 6472 { |
| 6487 if (!renderer) | 6473 if (!renderer) |
| 6488 return; | 6474 return; |
| 6489 showLayerTree(renderer->enclosingLayer()); | 6475 showLayerTree(renderer->enclosingLayer()); |
| 6490 } | 6476 } |
| 6491 #endif | 6477 #endif |
| OLD | NEW |