Chromium Code Reviews| Index: Source/core/paint/LayerPainter.cpp |
| diff --git a/Source/core/paint/LayerPainter.cpp b/Source/core/paint/LayerPainter.cpp |
| index 6ee9a82b608de4f7c194ff0ef9ad7429b358e675..2d915e225834d3338da923d3b1bfaee0dc14f44f 100644 |
| --- a/Source/core/paint/LayerPainter.cpp |
| +++ b/Source/core/paint/LayerPainter.cpp |
| @@ -257,12 +257,12 @@ void LayerPainter::paintLayerContents(GraphicsContext* context, const LayerPaint |
| LayerFragments layerFragments; |
| if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) { |
| - // Collect the fragments. This will compute the clip rectangles and paint offsets for each layer fragment, as well as whether or not the content of each |
| - // fragment should paint. |
| + // Collect the fragments. This will compute the clip rectangles and paint offsets for each layer fragment. |
| m_renderLayer.collectFragments(layerFragments, localPaintingInfo.rootLayer, localPaintingInfo.paintDirtyRect, |
| (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects, IgnoreOverlayScrollbarSize, |
| shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()), &offsetFromRoot, localPaintingInfo.subPixelAccumulation); |
| - updatePaintingInfoForFragments(layerFragments, localPaintingInfo, paintFlags, shouldPaintContent, &offsetFromRoot); |
| + if (shouldPaintContent) |
| + shouldPaintContent = atLeastOneFragmentIntersectsDamageRect(layerFragments, localPaintingInfo, paintFlags, offsetFromRoot); |
| } |
| bool selectionOnly = localPaintingInfo.paintBehavior & PaintBehaviorSelectionOnly; |
| @@ -421,18 +421,20 @@ void LayerPainter::applyRoundedRectClips(const LayerPaintingInfo& localPaintingI |
| } |
| } |
| -void LayerPainter::updatePaintingInfoForFragments(LayerFragments& fragments, const LayerPaintingInfo& localPaintingInfo, PaintLayerFlags localPaintFlags, |
| - bool shouldPaintContent, const LayoutPoint* offsetFromRoot) |
| +bool LayerPainter::atLeastOneFragmentIntersectsDamageRect(LayerFragments& fragments, const LayerPaintingInfo& localPaintingInfo, PaintLayerFlags localPaintFlags, const LayoutPoint& offsetFromRoot) |
| { |
| - ASSERT(offsetFromRoot); |
| - for (size_t i = 0; i < fragments.size(); ++i) { |
| - LayerFragment& fragment = fragments.at(i); |
| - fragment.shouldPaintContent = shouldPaintContent; |
| - if (&m_renderLayer != localPaintingInfo.rootLayer || !(localPaintFlags & PaintLayerPaintingOverflowContents)) { |
| - LayoutPoint newOffsetFromRoot = *offsetFromRoot + fragment.paginationOffset; |
| - fragment.shouldPaintContent &= m_renderLayer.intersectsDamageRect(fragment.layerBounds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer, &newOffsetFromRoot); |
| - } |
| + if (m_renderLayer.enclosingPaginationLayer()) |
| + return true; // The fragments created have already been found to intersect with the damage rect. |
|
chrishtr
2014/10/28 21:44:46
Is this comment accurate? Isn't it more like we ar
mstensho (USE GERRIT)
2014/10/28 22:56:49
Yes, it should be accurate. RenderMultiColumnSet::
|
| + |
| + if (&m_renderLayer == localPaintingInfo.rootLayer && (localPaintFlags & PaintLayerPaintingOverflowContents)) |
| + return true; |
| + |
| + for (LayerFragment& fragment: fragments) { |
| + LayoutPoint newOffsetFromRoot = offsetFromRoot + fragment.paginationOffset; |
| + if (m_renderLayer.intersectsDamageRect(fragment.layerBounds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer, &newOffsetFromRoot)) |
|
chrishtr
2014/10/28 21:44:46
Add a note that this works only for the main fragm
mstensho (USE GERRIT)
2014/10/28 22:56:49
Done.
|
| + return true; |
| } |
| + return false; |
| } |
| void LayerPainter::paintLayerByApplyingTransform(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, const LayoutPoint& translationOffset) |
| @@ -672,8 +674,6 @@ void LayerPainter::paintBackgroundForFragments(const LayerFragments& layerFragme |
| { |
| for (size_t i = 0; i < layerFragments.size(); ++i) { |
| const LayerFragment& fragment = layerFragments.at(i); |
| - if (!fragment.shouldPaintContent) |
| - continue; |
| // Begin transparency layers lazily now that we know we have to paint something. |
| if (haveTransparency || m_renderLayer.paintsWithBlendMode()) |
| @@ -701,7 +701,7 @@ void LayerPainter::paintForegroundForFragments(const LayerFragments& layerFragme |
| if (haveTransparency || m_renderLayer.paintsWithBlendMode()) { |
| for (size_t i = 0; i < layerFragments.size(); ++i) { |
| const LayerFragment& fragment = layerFragments.at(i); |
| - if (fragment.shouldPaintContent && !fragment.foregroundRect.isEmpty()) { |
| + if (!fragment.foregroundRect.isEmpty()) { |
| beginTransparencyLayers(context, localPaintingInfo.rootLayer, transparencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation, localPaintingInfo.paintBehavior); |
| break; |
| } |
| @@ -709,7 +709,7 @@ void LayerPainter::paintForegroundForFragments(const LayerFragments& layerFragme |
| } |
| // Optimize clipping for the single fragment case. |
| - bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() == 1 && layerFragments[0].shouldPaintContent && !layerFragments[0].foregroundRect.isEmpty(); |
| + bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() == 1 && !layerFragments[0].foregroundRect.isEmpty(); |
| OwnPtr<ClipRecorder> clipRecorder; |
| if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroundRect)) { |
| @@ -736,7 +736,7 @@ void LayerPainter::paintForegroundForFragmentsWithPhase(PaintPhase phase, const |
| for (size_t i = 0; i < layerFragments.size(); ++i) { |
| const LayerFragment& fragment = layerFragments.at(i); |
| - if (!fragment.shouldPaintContent || fragment.foregroundRect.isEmpty()) |
| + if (fragment.foregroundRect.isEmpty()) |
| continue; |
| OwnPtr<ClipRecorder> clipRecorder; |
| @@ -796,9 +796,6 @@ void LayerPainter::paintMaskForFragments(const LayerFragments& layerFragments, G |
| { |
| for (size_t i = 0; i < layerFragments.size(); ++i) { |
| const LayerFragment& fragment = layerFragments.at(i); |
| - if (!fragment.shouldPaintContent) |
| - continue; |
| - |
| OwnPtr<ClipRecorder> clipRecorder; |
| if (localPaintingInfo.clipToDirtyRect && needsToClip(localPaintingInfo, fragment.backgroundRect)) { |
| clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, ClipDisplayItem::LayerFragmentMask, fragment.backgroundRect)); |
| @@ -817,9 +814,6 @@ void LayerPainter::paintChildClippingMaskForFragments(const LayerFragments& laye |
| { |
| for (size_t i = 0; i < layerFragments.size(); ++i) { |
| const LayerFragment& fragment = layerFragments.at(i); |
| - if (!fragment.shouldPaintContent) |
| - continue; |
| - |
| OwnPtr<ClipRecorder> clipRecorder; |
| if (localPaintingInfo.clipToDirtyRect && needsToClip(localPaintingInfo, fragment.foregroundRect)) { |
| clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, ClipDisplayItem::LayerFragmentClippingMask, fragment.foregroundRect)); |