| 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 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1568 bool RenderLayer::hasOverflowControls() const | 1568 bool RenderLayer::hasOverflowControls() const |
| 1569 { | 1569 { |
| 1570 return m_scrollableArea && (m_scrollableArea->hasScrollbar() || m_scrollable
Area->hasScrollCorner() || renderer()->style()->resize() != RESIZE_NONE); | 1570 return m_scrollableArea && (m_scrollableArea->hasScrollbar() || m_scrollable
Area->hasScrollCorner() || renderer()->style()->resize() != RESIZE_NONE); |
| 1571 } | 1571 } |
| 1572 | 1572 |
| 1573 void RenderLayer::paint(GraphicsContext* context, const LayoutRect& damageRect,
PaintBehavior paintBehavior, RenderObject* paintingRoot, PaintLayerFlags paintFl
ags) | 1573 void RenderLayer::paint(GraphicsContext* context, const LayoutRect& damageRect,
PaintBehavior paintBehavior, RenderObject* paintingRoot, PaintLayerFlags paintFl
ags) |
| 1574 { | 1574 { |
| 1575 OverlapTestRequestMap overlapTestRequests; | 1575 OverlapTestRequestMap overlapTestRequests; |
| 1576 | 1576 |
| 1577 LayerPaintingInfo paintingInfo(this, enclosingIntRect(damageRect), paintBeha
vior, LayoutSize(), paintingRoot, &overlapTestRequests); | 1577 LayerPaintingInfo paintingInfo(this, enclosingIntRect(damageRect), paintBeha
vior, LayoutSize(), paintingRoot, &overlapTestRequests); |
| 1578 paintLayer(context, paintingInfo, paintFlags); | 1578 if (shouldPaintLayerInSoftwareMode(context, paintingInfo, paintFlags)) |
| 1579 paintLayer(context, paintingInfo, paintFlags); |
| 1579 | 1580 |
| 1580 OverlapTestRequestMap::iterator end = overlapTestRequests.end(); | 1581 OverlapTestRequestMap::iterator end = overlapTestRequests.end(); |
| 1581 for (OverlapTestRequestMap::iterator it = overlapTestRequests.begin(); it !=
end; ++it) | 1582 for (OverlapTestRequestMap::iterator it = overlapTestRequests.begin(); it !=
end; ++it) |
| 1582 it->key->setIsOverlapped(false); | 1583 it->key->setIsOverlapped(false); |
| 1583 } | 1584 } |
| 1584 | 1585 |
| 1585 void RenderLayer::paintOverlayScrollbars(GraphicsContext* context, const LayoutR
ect& damageRect, PaintBehavior paintBehavior, RenderObject* paintingRoot) | 1586 void RenderLayer::paintOverlayScrollbars(GraphicsContext* context, const LayoutR
ect& damageRect, PaintBehavior paintBehavior, RenderObject* paintingRoot) |
| 1586 { | 1587 { |
| 1587 if (!m_containsDirtyOverlayScrollbars) | 1588 if (!m_containsDirtyOverlayScrollbars) |
| 1588 return; | 1589 return; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1655 for (OverlapTestRequestMap::iterator it = overlapTestRequests.begin(); it !=
end; ++it) { | 1656 for (OverlapTestRequestMap::iterator it = overlapTestRequests.begin(); it !=
end; ++it) { |
| 1656 if (!boundingBox.intersects(it->value)) | 1657 if (!boundingBox.intersects(it->value)) |
| 1657 continue; | 1658 continue; |
| 1658 | 1659 |
| 1659 it->key->setIsOverlapped(true); | 1660 it->key->setIsOverlapped(true); |
| 1660 overlappedRequestClients.append(it->key); | 1661 overlappedRequestClients.append(it->key); |
| 1661 } | 1662 } |
| 1662 overlapTestRequests.removeAll(overlappedRequestClients); | 1663 overlapTestRequests.removeAll(overlappedRequestClients); |
| 1663 } | 1664 } |
| 1664 | 1665 |
| 1665 static bool shouldDoSoftwarePaint(const RenderLayer* layer, bool paintingReflect
ion) | |
| 1666 { | |
| 1667 return paintingReflection && !layer->has3DTransform(); | |
| 1668 } | |
| 1669 | |
| 1670 static inline bool shouldSuppressPaintingLayer(RenderLayer* layer) | 1666 static inline bool shouldSuppressPaintingLayer(RenderLayer* layer) |
| 1671 { | 1667 { |
| 1672 // Avoid painting descendants of the root layer when stylesheets haven't loa
ded. This eliminates FOUC. | 1668 // Avoid painting descendants of the root layer when stylesheets haven't loa
ded. This eliminates FOUC. |
| 1673 // It's ok not to draw, because later on, when all the stylesheets do load,
updateStyleSelector on the Document | 1669 // It's ok not to draw, because later on, when all the stylesheets do load,
updateStyleSelector on the Document |
| 1674 // will do a full repaint(). | 1670 // will do a full repaint(). |
| 1675 if (layer->renderer()->document().didLayoutWithPendingStylesheets() && !laye
r->isRootLayer() && !layer->renderer()->isDocumentElement()) | 1671 if (layer->renderer()->document().didLayoutWithPendingStylesheets() && !laye
r->isRootLayer() && !layer->renderer()->isDocumentElement()) |
| 1676 return true; | 1672 return true; |
| 1677 | 1673 |
| 1678 return false; | 1674 return false; |
| 1679 } | 1675 } |
| 1680 | 1676 |
| 1681 static bool paintForFixedRootBackground(const RenderLayer* layer, PaintLayerFlag
s paintFlags) | 1677 static bool paintForFixedRootBackground(const RenderLayer* layer, PaintLayerFlag
s paintFlags) |
| 1682 { | 1678 { |
| 1683 return layer->renderer()->isDocumentElement() && (paintFlags & PaintLayerPai
ntingRootBackgroundOnly); | 1679 return layer->renderer()->isDocumentElement() && (paintFlags & PaintLayerPai
ntingRootBackgroundOnly); |
| 1684 } | 1680 } |
| 1685 | 1681 |
| 1686 static ShouldRespectOverflowClip shouldRespectOverflowClip(PaintLayerFlags paint
Flags, const RenderObject* renderer) | 1682 static ShouldRespectOverflowClip shouldRespectOverflowClip(PaintLayerFlags paint
Flags, const RenderObject* renderer) |
| 1687 { | 1683 { |
| 1688 return (paintFlags & PaintLayerPaintingOverflowContents || (paintFlags & Pai
ntLayerPaintingChildClippingMaskPhase && renderer->hasClipPath())) ? IgnoreOverf
lowClip : RespectOverflowClip; | 1684 return (paintFlags & PaintLayerPaintingOverflowContents || (paintFlags & Pai
ntLayerPaintingChildClippingMaskPhase && renderer->hasClipPath())) ? IgnoreOverf
lowClip : RespectOverflowClip; |
| 1689 } | 1685 } |
| 1690 | 1686 |
| 1691 void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo&
paintingInfo, PaintLayerFlags paintFlags) | 1687 void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo&
paintingInfo, PaintLayerFlags paintFlags) |
| 1692 { | 1688 { |
| 1693 // https://code.google.com/p/chromium/issues/detail?id=343772 | 1689 // https://code.google.com/p/chromium/issues/detail?id=343772 |
| 1694 DisableCompositingQueryAsserts disabler; | 1690 DisableCompositingQueryAsserts disabler; |
| 1695 | 1691 |
| 1696 if (compositingState() != NotComposited && compositingState() != PaintsIntoG
roupedBacking) { | 1692 if (compositingState() != NotComposited) { |
| 1697 // The updatingControlTints() painting pass goes through compositing lay
ers, | |
| 1698 // but we need to ensure that we don't cache clip rects computed with th
e wrong root in this case. | |
| 1699 if (context->updatingControlTints() || (paintingInfo.paintBehavior & Pai
ntBehaviorFlattenCompositingLayers)) { | 1693 if (context->updatingControlTints() || (paintingInfo.paintBehavior & Pai
ntBehaviorFlattenCompositingLayers)) { |
| 1694 // The updatingControlTints() painting pass goes through compositing
layers, |
| 1695 // but we need to ensure that we don't cache clip rects computed wit
h the wrong root in this case. |
| 1696 // FIXME: ok, but what about PaintBehaviorFlattenCompositingLayers?
That's for printing. |
| 1697 // FIXME: why isn't the code here global, as opposed to being set on
each paintLayer() call? |
| 1700 paintFlags |= PaintLayerUncachedClipRects; | 1698 paintFlags |= PaintLayerUncachedClipRects; |
| 1701 } else if (!compositedLayerMapping()->paintsIntoCompositedAncestor() | |
| 1702 && !shouldDoSoftwarePaint(this, paintFlags & PaintLayerPaintingRefle
ction) | |
| 1703 && !paintForFixedRootBackground(this, paintFlags)) { | |
| 1704 // If this RenderLayer should paint into its own backing, that will
be done via CompositedLayerMapping::paintContents() | |
| 1705 // and CompositedLayerMapping::doPaintTask(). | |
| 1706 return; | |
| 1707 } | 1699 } |
| 1708 } else if (viewportConstrainedNotCompositedReason() == NotCompositedForBound
sOutOfView) { | 1700 } else if (viewportConstrainedNotCompositedReason() == NotCompositedForBound
sOutOfView) { |
| 1709 // Don't paint out-of-view viewport constrained layers (when doing prepa
inting) because they will never be visible | 1701 // Don't paint out-of-view viewport constrained layers (when doing prepa
inting) because they will never be visible |
| 1710 // unless their position or viewport size is changed. | 1702 // unless their position or viewport size is changed. |
| 1711 return; | 1703 return; |
| 1712 } | 1704 } |
| 1713 | 1705 |
| 1714 // Non self-painting leaf layers don't need to be painted as their renderer(
) should properly paint itself. | 1706 // Non self-painting leaf layers don't need to be painted as their renderer(
) should properly paint itself. |
| 1715 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) | 1707 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) |
| 1716 return; | 1708 return; |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2026 stateSaver.save(); | 2018 stateSaver.save(); |
| 2027 context->concatCTM(transform.toAffineTransform()); | 2019 context->concatCTM(transform.toAffineTransform()); |
| 2028 } | 2020 } |
| 2029 | 2021 |
| 2030 // Now do a paint with the root layer shifted to be us. | 2022 // Now do a paint with the root layer shifted to be us. |
| 2031 LayerPaintingInfo transformedPaintingInfo(this, enclosingIntRect(transform.i
nverse().mapRect(paintingInfo.paintDirtyRect)), paintingInfo.paintBehavior, | 2023 LayerPaintingInfo transformedPaintingInfo(this, enclosingIntRect(transform.i
nverse().mapRect(paintingInfo.paintDirtyRect)), paintingInfo.paintBehavior, |
| 2032 adjustedSubPixelAccumulation, paintingInfo.paintingRoot, paintingInfo.ov
erlapTestRequests); | 2024 adjustedSubPixelAccumulation, paintingInfo.paintingRoot, paintingInfo.ov
erlapTestRequests); |
| 2033 paintLayerContentsAndReflection(context, transformedPaintingInfo, paintFlags
); | 2025 paintLayerContentsAndReflection(context, transformedPaintingInfo, paintFlags
); |
| 2034 } | 2026 } |
| 2035 | 2027 |
| 2028 bool RenderLayer::shouldPaintLayerInSoftwareMode(GraphicsContext* context, const
LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) |
| 2029 { |
| 2030 DisableCompositingQueryAsserts disabler; |
| 2031 |
| 2032 return compositingState() == NotComposited |
| 2033 || compositingState() == HasOwnBackingButPaintsIntoAncestor |
| 2034 || context->updatingControlTints() |
| 2035 || (paintingInfo.paintBehavior & PaintBehaviorFlattenCompositingLayers) |
| 2036 || ((paintFlags & PaintLayerPaintingReflection) && !has3DTransform()) |
| 2037 || paintForFixedRootBackground(this, paintFlags); |
| 2038 } |
| 2039 |
| 2036 void RenderLayer::paintChildren(unsigned childrenToVisit, GraphicsContext* conte
xt, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) | 2040 void RenderLayer::paintChildren(unsigned childrenToVisit, GraphicsContext* conte
xt, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) |
| 2037 { | 2041 { |
| 2038 if (!hasSelfPaintingLayerDescendant()) | 2042 if (!hasSelfPaintingLayerDescendant()) |
| 2039 return; | 2043 return; |
| 2040 | 2044 |
| 2041 #if ENABLE(ASSERT) | 2045 #if ENABLE(ASSERT) |
| 2042 LayerListMutationDetector mutationChecker(m_stackingNode.get()); | 2046 LayerListMutationDetector mutationChecker(m_stackingNode.get()); |
| 2043 #endif | 2047 #endif |
| 2044 | 2048 |
| 2045 RenderLayerStackingNodeIterator iterator(*m_stackingNode, childrenToVisit); | 2049 RenderLayerStackingNodeIterator iterator(*m_stackingNode, childrenToVisit); |
| 2046 while (RenderLayerStackingNode* child = iterator.next()) { | 2050 while (RenderLayerStackingNode* child = iterator.next()) { |
| 2047 RenderLayer* childLayer = child->layer(); | 2051 RenderLayer* childLayer = child->layer(); |
| 2048 | 2052 // If this RenderLayer should paint into its own backing or a grouped ba
cking, that will be done via CompositedLayerMapping::paintContents() |
| 2049 // Squashed RenderLayers should not paint into their ancestor. | 2053 // and CompositedLayerMapping::doPaintTask(). |
| 2050 if (childLayer->compositingState() == PaintsIntoGroupedBacking) | 2054 if (!childLayer->shouldPaintLayerInSoftwareMode(context, paintingInfo, p
aintFlags)) |
| 2051 continue; | 2055 continue; |
| 2052 | 2056 |
| 2053 if (!childLayer->isPaginated()) | 2057 if (!childLayer->isPaginated()) |
| 2054 childLayer->paintLayer(context, paintingInfo, paintFlags); | 2058 childLayer->paintLayer(context, paintingInfo, paintFlags); |
| 2055 else | 2059 else |
| 2056 paintPaginatedChildLayer(childLayer, context, paintingInfo, paintFla
gs); | 2060 paintPaginatedChildLayer(childLayer, context, paintingInfo, paintFla
gs); |
| 2057 } | 2061 } |
| 2058 } | 2062 } |
| 2059 | 2063 |
| 2060 void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer*
rootLayer, const LayoutRect& dirtyRect, | 2064 void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer*
rootLayer, const LayoutRect& dirtyRect, |
| (...skipping 1725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3786 } | 3790 } |
| 3787 } | 3791 } |
| 3788 | 3792 |
| 3789 void showLayerTree(const blink::RenderObject* renderer) | 3793 void showLayerTree(const blink::RenderObject* renderer) |
| 3790 { | 3794 { |
| 3791 if (!renderer) | 3795 if (!renderer) |
| 3792 return; | 3796 return; |
| 3793 showLayerTree(renderer->enclosingLayer()); | 3797 showLayerTree(renderer->enclosingLayer()); |
| 3794 } | 3798 } |
| 3795 #endif | 3799 #endif |
| OLD | NEW |