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 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1501 // Note: This is only for output rect, so there's no need to expand the
dirty source rect. | 1501 // Note: This is only for output rect, so there's no need to expand the
dirty source rect. |
1502 rectForRepaint.unite(calculateLayerBounds(this)); | 1502 rectForRepaint.unite(calculateLayerBounds(this)); |
1503 } | 1503 } |
1504 | 1504 |
1505 RenderLayer* parentLayer = enclosingFilterRepaintLayer(); | 1505 RenderLayer* parentLayer = enclosingFilterRepaintLayer(); |
1506 ASSERT(parentLayer); | 1506 ASSERT(parentLayer); |
1507 FloatQuad repaintQuad(rectForRepaint); | 1507 FloatQuad repaintQuad(rectForRepaint); |
1508 LayoutRect parentLayerRect = renderer()->localToContainerQuad(repaintQuad, p
arentLayer->renderer()).enclosingBoundingBox(); | 1508 LayoutRect parentLayerRect = renderer()->localToContainerQuad(repaintQuad, p
arentLayer->renderer()).enclosingBoundingBox(); |
1509 | 1509 |
1510 if (parentLayer->isComposited()) { | 1510 if (parentLayer->isComposited()) { |
1511 if (!parentLayer->backing()->paintsIntoWindow()) { | 1511 parentLayer->setBackingNeedsRepaintInRect(parentLayerRect); |
1512 parentLayer->setBackingNeedsRepaintInRect(parentLayerRect); | 1512 return; |
1513 return; | |
1514 } | |
1515 // If the painting goes to window, redirect the painting to the parent R
enderView. | |
1516 parentLayer = renderer()->view()->layer(); | |
1517 parentLayerRect = renderer()->localToContainerQuad(repaintQuad, parentLa
yer->renderer()).enclosingBoundingBox(); | |
1518 } | 1513 } |
1519 | 1514 |
1520 if (parentLayer->paintsWithFilters()) { | 1515 if (parentLayer->paintsWithFilters()) { |
1521 parentLayer->setFilterBackendNeedsRepaintingInRect(parentLayerRect); | 1516 parentLayer->setFilterBackendNeedsRepaintingInRect(parentLayerRect); |
1522 return; | 1517 return; |
1523 } | 1518 } |
1524 | 1519 |
1525 if (parentLayer->isRootLayer()) { | 1520 if (parentLayer->isRootLayer()) { |
1526 RenderView* view = toRenderView(parentLayer->renderer()); | 1521 RenderView* view = toRenderView(parentLayer->renderer()); |
1527 view->repaintViewRectangle(parentLayerRect); | 1522 view->repaintViewRectangle(parentLayerRect); |
(...skipping 2048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3576 return false; | 3571 return false; |
3577 } | 3572 } |
3578 | 3573 |
3579 void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo&
paintingInfo, PaintLayerFlags paintFlags) | 3574 void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo&
paintingInfo, PaintLayerFlags paintFlags) |
3580 { | 3575 { |
3581 if (isComposited()) { | 3576 if (isComposited()) { |
3582 // The updatingControlTints() painting pass goes through compositing lay
ers, | 3577 // The updatingControlTints() painting pass goes through compositing lay
ers, |
3583 // but we need to ensure that we don't cache clip rects computed with th
e wrong root in this case. | 3578 // but we need to ensure that we don't cache clip rects computed with th
e wrong root in this case. |
3584 if (context->updatingControlTints() || (paintingInfo.paintBehavior & Pai
ntBehaviorFlattenCompositingLayers)) | 3579 if (context->updatingControlTints() || (paintingInfo.paintBehavior & Pai
ntBehaviorFlattenCompositingLayers)) |
3585 paintFlags |= PaintLayerTemporaryClipRects; | 3580 paintFlags |= PaintLayerTemporaryClipRects; |
3586 else if (!backing()->paintsIntoWindow() | 3581 else if (!backing()->paintsIntoCompositedAncestor() |
3587 && !backing()->paintsIntoCompositedAncestor() | |
3588 && !shouldDoSoftwarePaint(this, paintFlags & PaintLayerPaintingRefle
ction)) { | 3582 && !shouldDoSoftwarePaint(this, paintFlags & PaintLayerPaintingRefle
ction)) { |
3589 // If this RenderLayer should paint into its backing, that will be d
one via RenderLayerBacking::paintIntoLayer(). | 3583 // If this RenderLayer should paint into its backing, that will be d
one via RenderLayerBacking::paintIntoLayer(). |
3590 return; | 3584 return; |
3591 } | 3585 } |
3592 } else if (viewportConstrainedNotCompositedReason() == NotCompositedForBound
sOutOfView) { | 3586 } else if (viewportConstrainedNotCompositedReason() == NotCompositedForBound
sOutOfView) { |
3593 // Don't paint out-of-view viewport constrained layers (when doing prepa
inting) because they will never be visible | 3587 // Don't paint out-of-view viewport constrained layers (when doing prepa
inting) because they will never be visible |
3594 // unless their position or viewport size is changed. | 3588 // unless their position or viewport size is changed. |
3595 return; | 3589 return; |
3596 } | 3590 } |
3597 | 3591 |
(...skipping 1891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5489 return m_backing ? m_backing->layerForVerticalScrollbar() : 0; | 5483 return m_backing ? m_backing->layerForVerticalScrollbar() : 0; |
5490 } | 5484 } |
5491 | 5485 |
5492 GraphicsLayer* RenderLayer::layerForScrollCorner() const | 5486 GraphicsLayer* RenderLayer::layerForScrollCorner() const |
5493 { | 5487 { |
5494 return m_backing ? m_backing->layerForScrollCorner() : 0; | 5488 return m_backing ? m_backing->layerForScrollCorner() : 0; |
5495 } | 5489 } |
5496 | 5490 |
5497 bool RenderLayer::paintsWithTransform(PaintBehavior paintBehavior) const | 5491 bool RenderLayer::paintsWithTransform(PaintBehavior paintBehavior) const |
5498 { | 5492 { |
5499 bool paintsToWindow = !isComposited() || backing()->paintsIntoWindow(); | 5493 return transform() && ((paintBehavior & PaintBehaviorFlattenCompositingLayer
s) || !isComposited()); |
5500 return transform() && ((paintBehavior & PaintBehaviorFlattenCompositingLayer
s) || paintsToWindow); | |
5501 } | 5494 } |
5502 | 5495 |
5503 bool RenderLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect)
const | 5496 bool RenderLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect)
const |
5504 { | 5497 { |
5505 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) | 5498 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) |
5506 return false; | 5499 return false; |
5507 | 5500 |
5508 if (paintsWithTransparency(PaintBehaviorNormal)) | 5501 if (paintsWithTransparency(PaintBehaviorNormal)) |
5509 return false; | 5502 return false; |
5510 | 5503 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5746 void RenderLayer::repaintIncludingDescendants() | 5739 void RenderLayer::repaintIncludingDescendants() |
5747 { | 5740 { |
5748 renderer()->repaint(); | 5741 renderer()->repaint(); |
5749 for (RenderLayer* curr = firstChild(); curr; curr = curr->nextSibling()) | 5742 for (RenderLayer* curr = firstChild(); curr; curr = curr->nextSibling()) |
5750 curr->repaintIncludingDescendants(); | 5743 curr->repaintIncludingDescendants(); |
5751 } | 5744 } |
5752 | 5745 |
5753 void RenderLayer::setBackingNeedsRepaint() | 5746 void RenderLayer::setBackingNeedsRepaint() |
5754 { | 5747 { |
5755 ASSERT(isComposited()); | 5748 ASSERT(isComposited()); |
5756 if (backing()->paintsIntoWindow()) { | 5749 backing()->setContentsNeedDisplay(); |
5757 // If we're trying to repaint the placeholder document layer, propagate
the | |
5758 // repaint to the native view system. | |
5759 RenderView* view = renderer()->view(); | |
5760 if (view) | |
5761 view->repaintViewRectangle(absoluteBoundingBox()); | |
5762 } else | |
5763 backing()->setContentsNeedDisplay(); | |
5764 } | 5750 } |
5765 | 5751 |
5766 void RenderLayer::setBackingNeedsRepaintInRect(const LayoutRect& r) | 5752 void RenderLayer::setBackingNeedsRepaintInRect(const LayoutRect& r) |
5767 { | 5753 { |
5768 // https://bugs.webkit.org/show_bug.cgi?id=61159 describes an unreproducible
crash here, | 5754 // https://bugs.webkit.org/show_bug.cgi?id=61159 describes an unreproducible
crash here, |
5769 // so assert but check that the layer is composited. | 5755 // so assert but check that the layer is composited. |
5770 ASSERT(isComposited()); | 5756 ASSERT(isComposited()); |
5771 if (!isComposited() || backing()->paintsIntoWindow()) { | 5757 if (!isComposited()) { |
5772 // If we're trying to repaint the placeholder document layer, propagate
the | 5758 // If we're trying to repaint the placeholder document layer, propagate
the |
5773 // repaint to the native view system. | 5759 // repaint to the native view system. |
5774 LayoutRect absRect(r); | 5760 LayoutRect absRect(r); |
5775 LayoutPoint delta; | 5761 LayoutPoint delta; |
5776 convertToLayerCoords(root(), delta); | 5762 convertToLayerCoords(root(), delta); |
5777 absRect.moveBy(delta); | 5763 absRect.moveBy(delta); |
5778 | 5764 |
5779 RenderView* view = renderer()->view(); | 5765 RenderView* view = renderer()->view(); |
5780 if (view) | 5766 if (view) |
5781 view->repaintViewRectangle(absRect); | 5767 view->repaintViewRectangle(absRect); |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6442 } | 6428 } |
6443 } | 6429 } |
6444 | 6430 |
6445 void showLayerTree(const WebCore::RenderObject* renderer) | 6431 void showLayerTree(const WebCore::RenderObject* renderer) |
6446 { | 6432 { |
6447 if (!renderer) | 6433 if (!renderer) |
6448 return; | 6434 return; |
6449 showLayerTree(renderer->enclosingLayer()); | 6435 showLayerTree(renderer->enclosingLayer()); |
6450 } | 6436 } |
6451 #endif | 6437 #endif |
OLD | NEW |