Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: Source/core/rendering/RenderLayer.cpp

Issue 408543002: Actually paint squashed layers when printing. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1686 static ShouldRespectOverflowClip shouldRespectOverflowClip(PaintLayerFlags paint Flags, const RenderObject* renderer) 1687 static ShouldRespectOverflowClip shouldRespectOverflowClip(PaintLayerFlags paint Flags, const RenderObject* renderer)
1687 { 1688 {
1688 return (paintFlags & PaintLayerPaintingOverflowContents || (paintFlags & Pai ntLayerPaintingChildClippingMaskPhase && renderer->hasClipPath())) ? IgnoreOverf lowClip : RespectOverflowClip; 1689 return (paintFlags & PaintLayerPaintingOverflowContents || (paintFlags & Pai ntLayerPaintingChildClippingMaskPhase && renderer->hasClipPath())) ? IgnoreOverf lowClip : RespectOverflowClip;
1689 } 1690 }
1690 1691
1691 void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) 1692 void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
1692 { 1693 {
1693 // https://code.google.com/p/chromium/issues/detail?id=343772 1694 // https://code.google.com/p/chromium/issues/detail?id=343772
1694 DisableCompositingQueryAsserts disabler; 1695 DisableCompositingQueryAsserts disabler;
1695 1696
1696 if (compositingState() != NotComposited && compositingState() != PaintsIntoG roupedBacking) { 1697 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)) { 1698 if (context->updatingControlTints() || (paintingInfo.paintBehavior & Pai ntBehaviorFlattenCompositingLayers)) {
1699 // The updatingControlTints() painting pass goes through compositing layers,
1700 // but we need to ensure that we don't cache clip rects computed wit h the wrong root in this case.
1701 // FIXME: ok, but what about PaintBehaviorFlattenCompositingLayers? That's for printing.
1702 // FIXME: why isn't the code here global, as opposed to being set on each paintLayer() call?
1700 paintFlags |= PaintLayerUncachedClipRects; 1703 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 } 1704 }
1708 } else if (viewportConstrainedNotCompositedReason() == NotCompositedForBound sOutOfView) { 1705 } 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 1706 // 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. 1707 // unless their position or viewport size is changed.
1711 return; 1708 return;
1712 } 1709 }
1713 1710
1714 // Non self-painting leaf layers don't need to be painted as their renderer( ) should properly paint itself. 1711 // Non self-painting leaf layers don't need to be painted as their renderer( ) should properly paint itself.
1715 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant()) 1712 if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant())
1716 return; 1713 return;
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
2026 stateSaver.save(); 2023 stateSaver.save();
2027 context->concatCTM(transform.toAffineTransform()); 2024 context->concatCTM(transform.toAffineTransform());
2028 } 2025 }
2029 2026
2030 // Now do a paint with the root layer shifted to be us. 2027 // 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, 2028 LayerPaintingInfo transformedPaintingInfo(this, enclosingIntRect(transform.i nverse().mapRect(paintingInfo.paintDirtyRect)), paintingInfo.paintBehavior,
2032 adjustedSubPixelAccumulation, paintingInfo.paintingRoot, paintingInfo.ov erlapTestRequests); 2029 adjustedSubPixelAccumulation, paintingInfo.paintingRoot, paintingInfo.ov erlapTestRequests);
2033 paintLayerContentsAndReflection(context, transformedPaintingInfo, paintFlags ); 2030 paintLayerContentsAndReflection(context, transformedPaintingInfo, paintFlags );
2034 } 2031 }
2035 2032
2033 bool RenderLayer::shouldPaintLayerInSoftwareMode(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
2034 {
2035 bool retval = (compositingState() == NotComposited
ojan 2014/07/18 21:27:31 Nit: no need for the local bool
chrishtr 2014/07/18 21:40:21 Done.
2036 || compositingState() == HasOwnBackingButPaintsIntoAncestor
2037 || context->updatingControlTints()
2038 || (paintingInfo.paintBehavior & PaintBehaviorFlattenCompositingLayers)
2039 || shouldDoSoftwarePaint(this, paintFlags & PaintLayerPaintingReflection )
ojan 2014/07/18 21:27:31 This method is confusing now that we have shouldPa
chrishtr 2014/07/18 21:40:21 Done.
2040 || paintForFixedRootBackground(this, paintFlags));
2041 return retval;
2042 }
2043
2036 void RenderLayer::paintChildren(unsigned childrenToVisit, GraphicsContext* conte xt, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) 2044 void RenderLayer::paintChildren(unsigned childrenToVisit, GraphicsContext* conte xt, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
2037 { 2045 {
2038 if (!hasSelfPaintingLayerDescendant()) 2046 if (!hasSelfPaintingLayerDescendant())
2039 return; 2047 return;
2040 2048
2041 #if ASSERT_ENABLED 2049 #if ASSERT_ENABLED
2042 LayerListMutationDetector mutationChecker(m_stackingNode.get()); 2050 LayerListMutationDetector mutationChecker(m_stackingNode.get());
2043 #endif 2051 #endif
2044 2052
2045 RenderLayerStackingNodeIterator iterator(*m_stackingNode, childrenToVisit); 2053 RenderLayerStackingNodeIterator iterator(*m_stackingNode, childrenToVisit);
2046 while (RenderLayerStackingNode* child = iterator.next()) { 2054 while (RenderLayerStackingNode* child = iterator.next()) {
2047 RenderLayer* childLayer = child->layer(); 2055 RenderLayer* childLayer = child->layer();
2048 2056 // 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. 2057 // and CompositedLayerMapping::doPaintTask().
2050 if (childLayer->compositingState() == PaintsIntoGroupedBacking) 2058 if (!childLayer->shouldPaintLayerInSoftwareMode(context, paintingInfo, p aintFlags))
2051 continue; 2059 continue;
2052 2060
2053 if (!childLayer->isPaginated()) 2061 if (!childLayer->isPaginated())
2054 childLayer->paintLayer(context, paintingInfo, paintFlags); 2062 childLayer->paintLayer(context, paintingInfo, paintFlags);
2055 else 2063 else
2056 paintPaginatedChildLayer(childLayer, context, paintingInfo, paintFla gs); 2064 paintPaginatedChildLayer(childLayer, context, paintingInfo, paintFla gs);
2057 } 2065 }
2058 } 2066 }
2059 2067
2060 void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer* rootLayer, const LayoutRect& dirtyRect, 2068 void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer* rootLayer, const LayoutRect& dirtyRect,
(...skipping 1725 matching lines...) Expand 10 before | Expand all | Expand 10 after
3786 } 3794 }
3787 } 3795 }
3788 3796
3789 void showLayerTree(const WebCore::RenderObject* renderer) 3797 void showLayerTree(const WebCore::RenderObject* renderer)
3790 { 3798 {
3791 if (!renderer) 3799 if (!renderer)
3792 return; 3800 return;
3793 showLayerTree(renderer->enclosingLayer()); 3801 showLayerTree(renderer->enclosingLayer());
3794 } 3802 }
3795 #endif 3803 #endif
OLDNEW
« LayoutTests/compositing/squashing/squashing-print.html ('K') | « Source/core/rendering/RenderLayer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698