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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/rendering/RenderLayer.cpp
diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp
index 7e711c8b1a2d9d769e85d0c1db7af10eb3da6204..c6f40ab338050b1b37d2e4783d112ef65821ec1b 100644
--- a/Source/core/rendering/RenderLayer.cpp
+++ b/Source/core/rendering/RenderLayer.cpp
@@ -1575,7 +1575,8 @@ void RenderLayer::paint(GraphicsContext* context, const LayoutRect& damageRect,
OverlapTestRequestMap overlapTestRequests;
LayerPaintingInfo paintingInfo(this, enclosingIntRect(damageRect), paintBehavior, LayoutSize(), paintingRoot, &overlapTestRequests);
- paintLayer(context, paintingInfo, paintFlags);
+ if (shouldPaintLayerInSoftwareMode(context, paintingInfo, paintFlags))
+ paintLayer(context, paintingInfo, paintFlags);
OverlapTestRequestMap::iterator end = overlapTestRequests.end();
for (OverlapTestRequestMap::iterator it = overlapTestRequests.begin(); it != end; ++it)
@@ -1693,17 +1694,13 @@ void RenderLayer::paintLayer(GraphicsContext* context, const LayerPaintingInfo&
// https://code.google.com/p/chromium/issues/detail?id=343772
DisableCompositingQueryAsserts disabler;
- if (compositingState() != NotComposited && compositingState() != PaintsIntoGroupedBacking) {
- // The updatingControlTints() painting pass goes through compositing layers,
- // but we need to ensure that we don't cache clip rects computed with the wrong root in this case.
+ if (compositingState() != NotComposited) {
if (context->updatingControlTints() || (paintingInfo.paintBehavior & PaintBehaviorFlattenCompositingLayers)) {
+ // The updatingControlTints() painting pass goes through compositing layers,
+ // but we need to ensure that we don't cache clip rects computed with the wrong root in this case.
+ // FIXME: ok, but what about PaintBehaviorFlattenCompositingLayers? That's for printing.
+ // FIXME: why isn't the code here global, as opposed to being set on each paintLayer() call?
paintFlags |= PaintLayerUncachedClipRects;
- } else if (!compositedLayerMapping()->paintsIntoCompositedAncestor()
- && !shouldDoSoftwarePaint(this, paintFlags & PaintLayerPaintingReflection)
- && !paintForFixedRootBackground(this, paintFlags)) {
- // If this RenderLayer should paint into its own backing, that will be done via CompositedLayerMapping::paintContents()
- // and CompositedLayerMapping::doPaintTask().
- return;
}
} else if (viewportConstrainedNotCompositedReason() == NotCompositedForBoundsOutOfView) {
// Don't paint out-of-view viewport constrained layers (when doing prepainting) because they will never be visible
@@ -2033,6 +2030,17 @@ void RenderLayer::paintLayerByApplyingTransform(GraphicsContext* context, const
paintLayerContentsAndReflection(context, transformedPaintingInfo, paintFlags);
}
+bool RenderLayer::shouldPaintLayerInSoftwareMode(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
+{
+ 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.
+ || compositingState() == HasOwnBackingButPaintsIntoAncestor
+ || context->updatingControlTints()
+ || (paintingInfo.paintBehavior & PaintBehaviorFlattenCompositingLayers)
+ || 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.
+ || paintForFixedRootBackground(this, paintFlags));
+ return retval;
+}
+
void RenderLayer::paintChildren(unsigned childrenToVisit, GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
{
if (!hasSelfPaintingLayerDescendant())
@@ -2045,9 +2053,9 @@ void RenderLayer::paintChildren(unsigned childrenToVisit, GraphicsContext* conte
RenderLayerStackingNodeIterator iterator(*m_stackingNode, childrenToVisit);
while (RenderLayerStackingNode* child = iterator.next()) {
RenderLayer* childLayer = child->layer();
-
- // Squashed RenderLayers should not paint into their ancestor.
- if (childLayer->compositingState() == PaintsIntoGroupedBacking)
+ // If this RenderLayer should paint into its own backing or a grouped backing, that will be done via CompositedLayerMapping::paintContents()
+ // and CompositedLayerMapping::doPaintTask().
+ if (!childLayer->shouldPaintLayerInSoftwareMode(context, paintingInfo, paintFlags))
continue;
if (!childLayer->isPaginated())
« 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