| 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 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1515 // Note: This is only for output rect, so there's no need to expand the
dirty source rect. | 1515 // Note: This is only for output rect, so there's no need to expand the
dirty source rect. |
| 1516 rectForRepaint.unite(calculateLayerBounds(this)); | 1516 rectForRepaint.unite(calculateLayerBounds(this)); |
| 1517 } | 1517 } |
| 1518 | 1518 |
| 1519 RenderLayer* parentLayer = enclosingFilterRepaintLayer(); | 1519 RenderLayer* parentLayer = enclosingFilterRepaintLayer(); |
| 1520 ASSERT(parentLayer); | 1520 ASSERT(parentLayer); |
| 1521 FloatQuad repaintQuad(rectForRepaint); | 1521 FloatQuad repaintQuad(rectForRepaint); |
| 1522 LayoutRect parentLayerRect = renderer()->localToContainerQuad(repaintQuad, p
arentLayer->renderer()).enclosingBoundingBox(); | 1522 LayoutRect parentLayerRect = renderer()->localToContainerQuad(repaintQuad, p
arentLayer->renderer()).enclosingBoundingBox(); |
| 1523 | 1523 |
| 1524 if (parentLayer->isComposited()) { | 1524 if (parentLayer->isComposited()) { |
| 1525 if (!parentLayer->backing()->paintsIntoWindow()) { | 1525 parentLayer->setBackingNeedsRepaintInRect(parentLayerRect); |
| 1526 parentLayer->setBackingNeedsRepaintInRect(parentLayerRect); | 1526 return; |
| 1527 return; | |
| 1528 } | |
| 1529 // If the painting goes to window, redirect the painting to the parent R
enderView. | |
| 1530 parentLayer = renderer()->view()->layer(); | |
| 1531 parentLayerRect = renderer()->localToContainerQuad(repaintQuad, parentLa
yer->renderer()).enclosingBoundingBox(); | |
| 1532 } | 1527 } |
| 1533 | 1528 |
| 1534 if (parentLayer->paintsWithFilters()) { | 1529 if (parentLayer->paintsWithFilters()) { |
| 1535 parentLayer->setFilterBackendNeedsRepaintingInRect(parentLayerRect); | 1530 parentLayer->setFilterBackendNeedsRepaintingInRect(parentLayerRect); |
| 1536 return; | 1531 return; |
| 1537 } | 1532 } |
| 1538 | 1533 |
| 1539 if (parentLayer->isRootLayer()) { | 1534 if (parentLayer->isRootLayer()) { |
| 1540 RenderView* view = toRenderView(parentLayer->renderer()); | 1535 RenderView* view = toRenderView(parentLayer->renderer()); |
| 1541 view->repaintViewRectangle(parentLayerRect); | 1536 view->repaintViewRectangle(parentLayerRect); |
| (...skipping 2052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3594 return false; | 3589 return false; |
| 3595 } | 3590 } |
| 3596 | 3591 |
| 3597 void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo&
paintingInfo, PaintLayerFlags paintFlags) | 3592 void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo&
paintingInfo, PaintLayerFlags paintFlags) |
| 3598 { | 3593 { |
| 3599 if (isComposited()) { | 3594 if (isComposited()) { |
| 3600 // The updatingControlTints() painting pass goes through compositing lay
ers, | 3595 // The updatingControlTints() painting pass goes through compositing lay
ers, |
| 3601 // but we need to ensure that we don't cache clip rects computed with th
e wrong root in this case. | 3596 // but we need to ensure that we don't cache clip rects computed with th
e wrong root in this case. |
| 3602 if (context->updatingControlTints() || (paintingInfo.paintBehavior & Pai
ntBehaviorFlattenCompositingLayers)) | 3597 if (context->updatingControlTints() || (paintingInfo.paintBehavior & Pai
ntBehaviorFlattenCompositingLayers)) |
| 3603 paintFlags |= PaintLayerTemporaryClipRects; | 3598 paintFlags |= PaintLayerTemporaryClipRects; |
| 3604 else if (!backing()->paintsIntoWindow() | 3599 else if (!backing()->paintsIntoCompositedAncestor() |
| 3605 && !backing()->paintsIntoCompositedAncestor() | |
| 3606 && !shouldDoSoftwarePaint(this, paintFlags & PaintLayerPaintingRefle
ction)) { | 3600 && !shouldDoSoftwarePaint(this, paintFlags & PaintLayerPaintingRefle
ction)) { |
| 3607 // If this RenderLayer should paint into its backing, that will be d
one via RenderLayerBacking::paintIntoLayer(). | 3601 // If this RenderLayer should paint into its backing, that will be d
one via RenderLayerBacking::paintIntoLayer(). |
| 3608 return; | 3602 return; |
| 3609 } | 3603 } |
| 3610 } else if (viewportConstrainedNotCompositedReason() == NotCompositedForBound
sOutOfView) { | 3604 } else if (viewportConstrainedNotCompositedReason() == NotCompositedForBound
sOutOfView) { |
| 3611 // Don't paint out-of-view viewport constrained layers (when doing prepa
inting) because they will never be visible | 3605 // Don't paint out-of-view viewport constrained layers (when doing prepa
inting) because they will never be visible |
| 3612 // unless their position or viewport size is changed. | 3606 // unless their position or viewport size is changed. |
| 3613 return; | 3607 return; |
| 3614 } | 3608 } |
| 3615 | 3609 |
| (...skipping 1891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5507 return m_backing ? m_backing->layerForVerticalScrollbar() : 0; | 5501 return m_backing ? m_backing->layerForVerticalScrollbar() : 0; |
| 5508 } | 5502 } |
| 5509 | 5503 |
| 5510 GraphicsLayer* RenderLayer::layerForScrollCorner() const | 5504 GraphicsLayer* RenderLayer::layerForScrollCorner() const |
| 5511 { | 5505 { |
| 5512 return m_backing ? m_backing->layerForScrollCorner() : 0; | 5506 return m_backing ? m_backing->layerForScrollCorner() : 0; |
| 5513 } | 5507 } |
| 5514 | 5508 |
| 5515 bool RenderLayer::paintsWithTransform(PaintBehavior paintBehavior) const | 5509 bool RenderLayer::paintsWithTransform(PaintBehavior paintBehavior) const |
| 5516 { | 5510 { |
| 5517 bool paintsToWindow = !isComposited() || backing()->paintsIntoWindow(); | 5511 return transform() && ((paintBehavior & PaintBehaviorFlattenCompositingLayer
s) || !isComposited()); |
| 5518 return transform() && ((paintBehavior & PaintBehaviorFlattenCompositingLayer
s) || paintsToWindow); | |
| 5519 } | 5512 } |
| 5520 | 5513 |
| 5521 bool RenderLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect)
const | 5514 bool RenderLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect)
const |
| 5522 { | 5515 { |
| 5523 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) | 5516 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) |
| 5524 return false; | 5517 return false; |
| 5525 | 5518 |
| 5526 if (paintsWithTransparency(PaintBehaviorNormal)) | 5519 if (paintsWithTransparency(PaintBehaviorNormal)) |
| 5527 return false; | 5520 return false; |
| 5528 | 5521 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5764 void RenderLayer::repaintIncludingDescendants() | 5757 void RenderLayer::repaintIncludingDescendants() |
| 5765 { | 5758 { |
| 5766 renderer()->repaint(); | 5759 renderer()->repaint(); |
| 5767 for (RenderLayer* curr = firstChild(); curr; curr = curr->nextSibling()) | 5760 for (RenderLayer* curr = firstChild(); curr; curr = curr->nextSibling()) |
| 5768 curr->repaintIncludingDescendants(); | 5761 curr->repaintIncludingDescendants(); |
| 5769 } | 5762 } |
| 5770 | 5763 |
| 5771 void RenderLayer::setBackingNeedsRepaint() | 5764 void RenderLayer::setBackingNeedsRepaint() |
| 5772 { | 5765 { |
| 5773 ASSERT(isComposited()); | 5766 ASSERT(isComposited()); |
| 5774 if (backing()->paintsIntoWindow()) { | 5767 backing()->setContentsNeedDisplay(); |
| 5775 // If we're trying to repaint the placeholder document layer, propagate
the | |
| 5776 // repaint to the native view system. | |
| 5777 RenderView* view = renderer()->view(); | |
| 5778 if (view) | |
| 5779 view->repaintViewRectangle(absoluteBoundingBox()); | |
| 5780 } else | |
| 5781 backing()->setContentsNeedDisplay(); | |
| 5782 } | 5768 } |
| 5783 | 5769 |
| 5784 void RenderLayer::setBackingNeedsRepaintInRect(const LayoutRect& r) | 5770 void RenderLayer::setBackingNeedsRepaintInRect(const LayoutRect& r) |
| 5785 { | 5771 { |
| 5786 // https://bugs.webkit.org/show_bug.cgi?id=61159 describes an unreproducible
crash here, | 5772 // https://bugs.webkit.org/show_bug.cgi?id=61159 describes an unreproducible
crash here, |
| 5787 // so assert but check that the layer is composited. | 5773 // so assert but check that the layer is composited. |
| 5788 ASSERT(isComposited()); | 5774 ASSERT(isComposited()); |
| 5789 if (!isComposited() || backing()->paintsIntoWindow()) { | 5775 if (!isComposited()) { |
| 5790 // If we're trying to repaint the placeholder document layer, propagate
the | 5776 // If we're trying to repaint the placeholder document layer, propagate
the |
| 5791 // repaint to the native view system. | 5777 // repaint to the native view system. |
| 5792 LayoutRect absRect(r); | 5778 LayoutRect absRect(r); |
| 5793 LayoutPoint delta; | 5779 LayoutPoint delta; |
| 5794 convertToLayerCoords(root(), delta); | 5780 convertToLayerCoords(root(), delta); |
| 5795 absRect.moveBy(delta); | 5781 absRect.moveBy(delta); |
| 5796 | 5782 |
| 5797 RenderView* view = renderer()->view(); | 5783 RenderView* view = renderer()->view(); |
| 5798 if (view) | 5784 if (view) |
| 5799 view->repaintViewRectangle(absRect); | 5785 view->repaintViewRectangle(absRect); |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6460 } | 6446 } |
| 6461 } | 6447 } |
| 6462 | 6448 |
| 6463 void showLayerTree(const WebCore::RenderObject* renderer) | 6449 void showLayerTree(const WebCore::RenderObject* renderer) |
| 6464 { | 6450 { |
| 6465 if (!renderer) | 6451 if (!renderer) |
| 6466 return; | 6452 return; |
| 6467 showLayerTree(renderer->enclosingLayer()); | 6453 showLayerTree(renderer->enclosingLayer()); |
| 6468 } | 6454 } |
| 6469 #endif | 6455 #endif |
| OLD | NEW |