Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/paint/LayerPainter.h" | 6 #include "core/paint/LayerPainter.h" |
| 7 | 7 |
| 8 #include "core/frame/Settings.h" | 8 #include "core/frame/Settings.h" |
| 9 #include "core/page/Page.h" | 9 #include "core/page/Page.h" |
| 10 #include "core/rendering/ClipPathOperation.h" | 10 #include "core/rendering/ClipPathOperation.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 bool createTransparencyLayerForBlendMode = !m_renderLayer.renderer()->isDocu mentElement() && m_renderLayer.stackingNode()->isStackingContext() && m_renderLa yer.hasNonIsolatedDescendantWithBlendMode(); | 250 bool createTransparencyLayerForBlendMode = !m_renderLayer.renderer()->isDocu mentElement() && m_renderLayer.stackingNode()->isStackingContext() && m_renderLa yer.hasNonIsolatedDescendantWithBlendMode(); |
| 251 | 251 |
| 252 if (createTransparencyLayerForBlendMode) | 252 if (createTransparencyLayerForBlendMode) |
| 253 beginTransparencyLayers(context, paintingInfo.rootLayer, paintingInfo.pa intDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.paintBehavior); | 253 beginTransparencyLayers(context, paintingInfo.rootLayer, paintingInfo.pa intDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.paintBehavior); |
| 254 | 254 |
| 255 LayerPaintingInfo localPaintingInfo(paintingInfo); | 255 LayerPaintingInfo localPaintingInfo(paintingInfo); |
| 256 bool haveFilterEffect = m_renderLayer.filterRenderer() && m_renderLayer.pain tsWithFilters(); | 256 bool haveFilterEffect = m_renderLayer.filterRenderer() && m_renderLayer.pain tsWithFilters(); |
| 257 | 257 |
| 258 LayerFragments layerFragments; | 258 LayerFragments layerFragments; |
| 259 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) { | 259 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) { |
| 260 // Collect the fragments. This will compute the clip rectangles and pain t offsets for each layer fragment, as well as whether or not the content of each | 260 // Collect the fragments. This will compute the clip rectangles and pain t offsets for each layer fragment. |
| 261 // fragment should paint. | |
| 262 m_renderLayer.collectFragments(layerFragments, localPaintingInfo.rootLay er, localPaintingInfo.paintDirtyRect, | 261 m_renderLayer.collectFragments(layerFragments, localPaintingInfo.rootLay er, localPaintingInfo.paintDirtyRect, |
| 263 (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Pai ntingClipRects, IgnoreOverlayScrollbarSize, | 262 (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Pai ntingClipRects, IgnoreOverlayScrollbarSize, |
| 264 shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()), &of fsetFromRoot, localPaintingInfo.subPixelAccumulation); | 263 shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()), &of fsetFromRoot, localPaintingInfo.subPixelAccumulation); |
| 265 updatePaintingInfoForFragments(layerFragments, localPaintingInfo, paintF lags, shouldPaintContent, &offsetFromRoot); | 264 if (shouldPaintContent) |
| 265 shouldPaintContent = atLeastOneFragmentIntersectsDamageRect(layerFra gments, localPaintingInfo, paintFlags, offsetFromRoot); | |
| 266 } | 266 } |
| 267 | 267 |
| 268 bool selectionOnly = localPaintingInfo.paintBehavior & PaintBehaviorSelecti onOnly; | 268 bool selectionOnly = localPaintingInfo.paintBehavior & PaintBehaviorSelecti onOnly; |
| 269 // If this layer's renderer is a child of the paintingRoot, we render uncond itionally, which | 269 // If this layer's renderer is a child of the paintingRoot, we render uncond itionally, which |
| 270 // is done by passing a nil paintingRoot down to our renderer (as if no pain tingRoot was ever set). | 270 // is done by passing a nil paintingRoot down to our renderer (as if no pain tingRoot was ever set). |
| 271 // Else, our renderer tree may or may not contain the painting root, so we p ass that root along | 271 // Else, our renderer tree may or may not contain the painting root, so we p ass that root along |
| 272 // so it will be tested against as we descend through the renderers. | 272 // so it will be tested against as we descend through the renderers. |
| 273 RenderObject* paintingRootForRenderer = 0; | 273 RenderObject* paintingRootForRenderer = 0; |
| 274 if (localPaintingInfo.paintingRoot && !m_renderLayer.renderer()->isDescendan tOf(localPaintingInfo.paintingRoot)) | 274 if (localPaintingInfo.paintingRoot && !m_renderLayer.renderer()->isDescendan tOf(localPaintingInfo.paintingRoot)) |
| 275 paintingRootForRenderer = localPaintingInfo.paintingRoot; | 275 paintingRootForRenderer = localPaintingInfo.paintingRoot; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 414 LayoutPoint delta; | 414 LayoutPoint delta; |
| 415 layer->convertToLayerCoords(localPaintingInfo.rootLayer, delta); | 415 layer->convertToLayerCoords(localPaintingInfo.rootLayer, delta); |
| 416 clipRecorder.addRoundedRectClip(layer->renderer()->style()->getRound edInnerBorderFor(LayoutRect(delta, layer->size()))); | 416 clipRecorder.addRoundedRectClip(layer->renderer()->style()->getRound edInnerBorderFor(LayoutRect(delta, layer->size()))); |
| 417 } | 417 } |
| 418 | 418 |
| 419 if (layer == localPaintingInfo.rootLayer) | 419 if (layer == localPaintingInfo.rootLayer) |
| 420 break; | 420 break; |
| 421 } | 421 } |
| 422 } | 422 } |
| 423 | 423 |
| 424 void LayerPainter::updatePaintingInfoForFragments(LayerFragments& fragments, con st LayerPaintingInfo& localPaintingInfo, PaintLayerFlags localPaintFlags, | 424 bool LayerPainter::atLeastOneFragmentIntersectsDamageRect(LayerFragments& fragme nts, const LayerPaintingInfo& localPaintingInfo, PaintLayerFlags localPaintFlags , const LayoutPoint& offsetFromRoot) |
| 425 bool shouldPaintContent, const LayoutPoint* offsetFromRoot) | |
| 426 { | 425 { |
| 427 ASSERT(offsetFromRoot); | 426 if (m_renderLayer.enclosingPaginationLayer()) |
| 428 for (size_t i = 0; i < fragments.size(); ++i) { | 427 return true; // The fragments created have already been found to interse ct 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::
| |
| 429 LayerFragment& fragment = fragments.at(i); | 428 |
| 430 fragment.shouldPaintContent = shouldPaintContent; | 429 if (&m_renderLayer == localPaintingInfo.rootLayer && (localPaintFlags & Pain tLayerPaintingOverflowContents)) |
| 431 if (&m_renderLayer != localPaintingInfo.rootLayer || !(localPaintFlags & PaintLayerPaintingOverflowContents)) { | 430 return true; |
| 432 LayoutPoint newOffsetFromRoot = *offsetFromRoot + fragment.paginatio nOffset; | 431 |
| 433 fragment.shouldPaintContent &= m_renderLayer.intersectsDamageRect(fr agment.layerBounds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer, &newOffsetFromRoot); | 432 for (LayerFragment& fragment: fragments) { |
| 434 } | 433 LayoutPoint newOffsetFromRoot = offsetFromRoot + fragment.paginationOffs et; |
| 434 if (m_renderLayer.intersectsDamageRect(fragment.layerBounds, fragment.ba ckgroundRect.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.
| |
| 435 return true; | |
| 435 } | 436 } |
| 437 return false; | |
| 436 } | 438 } |
| 437 | 439 |
| 438 void LayerPainter::paintLayerByApplyingTransform(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, const LayoutPoint& translationOffset) | 440 void LayerPainter::paintLayerByApplyingTransform(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, const LayoutPoint& translationOffset) |
| 439 { | 441 { |
| 440 // This involves subtracting out the position of the layer in our current co ordinate space, but preserving | 442 // This involves subtracting out the position of the layer in our current co ordinate space, but preserving |
| 441 // the accumulated error for sub-pixel layout. | 443 // the accumulated error for sub-pixel layout. |
| 442 LayoutPoint delta; | 444 LayoutPoint delta; |
| 443 m_renderLayer.convertToLayerCoords(paintingInfo.rootLayer, delta); | 445 m_renderLayer.convertToLayerCoords(paintingInfo.rootLayer, delta); |
| 444 delta.moveBy(translationOffset); | 446 delta.moveBy(translationOffset); |
| 445 TransformationMatrix transform(m_renderLayer.renderableTransform(paintingInf o.paintBehavior)); | 447 TransformationMatrix transform(m_renderLayer.renderableTransform(paintingInf o.paintBehavior)); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 665 currLogicalTopOffset -= blockDelta; | 667 currLogicalTopOffset -= blockDelta; |
| 666 } | 668 } |
| 667 } | 669 } |
| 668 | 670 |
| 669 void LayerPainter::paintBackgroundForFragments(const LayerFragments& layerFragme nts, GraphicsContext* context, | 671 void LayerPainter::paintBackgroundForFragments(const LayerFragments& layerFragme nts, GraphicsContext* context, |
| 670 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, | 672 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, |
| 671 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) | 673 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) |
| 672 { | 674 { |
| 673 for (size_t i = 0; i < layerFragments.size(); ++i) { | 675 for (size_t i = 0; i < layerFragments.size(); ++i) { |
| 674 const LayerFragment& fragment = layerFragments.at(i); | 676 const LayerFragment& fragment = layerFragments.at(i); |
| 675 if (!fragment.shouldPaintContent) | |
| 676 continue; | |
| 677 | 677 |
| 678 // Begin transparency layers lazily now that we know we have to paint so mething. | 678 // Begin transparency layers lazily now that we know we have to paint so mething. |
| 679 if (haveTransparency || m_renderLayer.paintsWithBlendMode()) | 679 if (haveTransparency || m_renderLayer.paintsWithBlendMode()) |
| 680 beginTransparencyLayers(context, localPaintingInfo.rootLayer, transp arencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation, localPaintingInfo. paintBehavior); | 680 beginTransparencyLayers(context, localPaintingInfo.rootLayer, transp arencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation, localPaintingInfo. paintBehavior); |
| 681 | 681 |
| 682 OwnPtr<ClipRecorder> clipRecorder; | 682 OwnPtr<ClipRecorder> clipRecorder; |
| 683 | 683 |
| 684 if (localPaintingInfo.clipToDirtyRect && needsToClip(localPaintingInfo, fragment.backgroundRect)) { | 684 if (localPaintingInfo.clipToDirtyRect && needsToClip(localPaintingInfo, fragment.backgroundRect)) { |
| 685 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Cl ipDisplayItem::LayerBackground, fragment.backgroundRect)); | 685 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Cl ipDisplayItem::LayerBackground, fragment.backgroundRect)); |
| 686 applyRoundedRectClips(localPaintingInfo, context, fragment.backgroun dRect, paintFlags, *clipRecorder); | 686 applyRoundedRectClips(localPaintingInfo, context, fragment.backgroun dRect, paintFlags, *clipRecorder); |
| 687 } | 687 } |
| 688 | 688 |
| 689 // Paint the background. | 689 // Paint the background. |
| 690 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. | 690 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. |
| 691 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseBlockBackground, paintBehavior, paintingRootForRenderer, 0, localPaintingInfo.rootLayer->renderer()); | 691 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseBlockBackground, paintBehavior, paintingRootForRenderer, 0, localPaintingInfo.rootLayer->renderer()); |
| 692 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds. location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState()))); | 692 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds. location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState()))); |
| 693 } | 693 } |
| 694 } | 694 } |
| 695 | 695 |
| 696 void LayerPainter::paintForegroundForFragments(const LayerFragments& layerFragme nts, GraphicsContext* context, | 696 void LayerPainter::paintForegroundForFragments(const LayerFragments& layerFragme nts, GraphicsContext* context, |
| 697 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, | 697 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, |
| 698 RenderObject* paintingRootForRenderer, bool selectionOnly, PaintLayerFlags p aintFlags) | 698 RenderObject* paintingRootForRenderer, bool selectionOnly, PaintLayerFlags p aintFlags) |
| 699 { | 699 { |
| 700 // Begin transparency if we have something to paint. | 700 // Begin transparency if we have something to paint. |
| 701 if (haveTransparency || m_renderLayer.paintsWithBlendMode()) { | 701 if (haveTransparency || m_renderLayer.paintsWithBlendMode()) { |
| 702 for (size_t i = 0; i < layerFragments.size(); ++i) { | 702 for (size_t i = 0; i < layerFragments.size(); ++i) { |
| 703 const LayerFragment& fragment = layerFragments.at(i); | 703 const LayerFragment& fragment = layerFragments.at(i); |
| 704 if (fragment.shouldPaintContent && !fragment.foregroundRect.isEmpty( )) { | 704 if (!fragment.foregroundRect.isEmpty()) { |
| 705 beginTransparencyLayers(context, localPaintingInfo.rootLayer, tr ansparencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation, localPaintingI nfo.paintBehavior); | 705 beginTransparencyLayers(context, localPaintingInfo.rootLayer, tr ansparencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation, localPaintingI nfo.paintBehavior); |
| 706 break; | 706 break; |
| 707 } | 707 } |
| 708 } | 708 } |
| 709 } | 709 } |
| 710 | 710 |
| 711 // Optimize clipping for the single fragment case. | 711 // Optimize clipping for the single fragment case. |
| 712 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() == 1 && layerFragments[0].shouldPaintContent && !layerFragments[0].foregroundRe ct.isEmpty(); | 712 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() == 1 && !layerFragments[0].foregroundRect.isEmpty(); |
| 713 | 713 |
| 714 OwnPtr<ClipRecorder> clipRecorder; | 714 OwnPtr<ClipRecorder> clipRecorder; |
| 715 if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroun dRect)) { | 715 if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroun dRect)) { |
| 716 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, ClipDi splayItem::LayerForeground, layerFragments[0].foregroundRect)); | 716 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, ClipDi splayItem::LayerForeground, layerFragments[0].foregroundRect)); |
| 717 applyRoundedRectClips(localPaintingInfo, context, layerFragments[0].fore groundRect, paintFlags, *clipRecorder); | 717 applyRoundedRectClips(localPaintingInfo, context, layerFragments[0].fore groundRect, paintFlags, *clipRecorder); |
| 718 } | 718 } |
| 719 | 719 |
| 720 // We have to loop through every fragment multiple times, since we have to i ssue paint invalidations in each specific phase in order for | 720 // We have to loop through every fragment multiple times, since we have to i ssue paint invalidations in each specific phase in order for |
| 721 // interleaving of the fragments to work properly. | 721 // interleaving of the fragments to work properly. |
| 722 paintForegroundForFragmentsWithPhase(selectionOnly ? PaintPhaseSelection : P aintPhaseChildBlockBackgrounds, layerFragments, | 722 paintForegroundForFragmentsWithPhase(selectionOnly ? PaintPhaseSelection : P aintPhaseChildBlockBackgrounds, layerFragments, |
| 723 context, localPaintingInfo, paintBehavior, paintingRootForRenderer, pain tFlags); | 723 context, localPaintingInfo, paintBehavior, paintingRootForRenderer, pain tFlags); |
| 724 | 724 |
| 725 if (!selectionOnly) { | 725 if (!selectionOnly) { |
| 726 paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments, co ntext, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlags); | 726 paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments, co ntext, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlags); |
| 727 paintForegroundForFragmentsWithPhase(PaintPhaseForeground, layerFragment s, context, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlag s); | 727 paintForegroundForFragmentsWithPhase(PaintPhaseForeground, layerFragment s, context, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlag s); |
| 728 paintForegroundForFragmentsWithPhase(PaintPhaseChildOutlines, layerFragm ents, context, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintF lags); | 728 paintForegroundForFragmentsWithPhase(PaintPhaseChildOutlines, layerFragm ents, context, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintF lags); |
| 729 } | 729 } |
| 730 } | 730 } |
| 731 | 731 |
| 732 void LayerPainter::paintForegroundForFragmentsWithPhase(PaintPhase phase, const LayerFragments& layerFragments, GraphicsContext* context, | 732 void LayerPainter::paintForegroundForFragmentsWithPhase(PaintPhase phase, const LayerFragments& layerFragments, GraphicsContext* context, |
| 733 const LayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, Ren derObject* paintingRootForRenderer, PaintLayerFlags paintFlags) | 733 const LayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, Ren derObject* paintingRootForRenderer, PaintLayerFlags paintFlags) |
| 734 { | 734 { |
| 735 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() > 1; | 735 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() > 1; |
| 736 | 736 |
| 737 for (size_t i = 0; i < layerFragments.size(); ++i) { | 737 for (size_t i = 0; i < layerFragments.size(); ++i) { |
| 738 const LayerFragment& fragment = layerFragments.at(i); | 738 const LayerFragment& fragment = layerFragments.at(i); |
| 739 if (!fragment.shouldPaintContent || fragment.foregroundRect.isEmpty()) | 739 if (fragment.foregroundRect.isEmpty()) |
| 740 continue; | 740 continue; |
| 741 | 741 |
| 742 OwnPtr<ClipRecorder> clipRecorder; | 742 OwnPtr<ClipRecorder> clipRecorder; |
| 743 if (shouldClip && needsToClip(localPaintingInfo, fragment.foregroundRect )) { | 743 if (shouldClip && needsToClip(localPaintingInfo, fragment.foregroundRect )) { |
| 744 // Note: this method only clips when there is more than one fragment . | 744 // Note: this method only clips when there is more than one fragment . |
| 745 ClipDisplayItem::ClipType clipType = ClipDisplayItem::LayerFragmentF loat; | 745 ClipDisplayItem::ClipType clipType = ClipDisplayItem::LayerFragmentF loat; |
| 746 switch (phase) { | 746 switch (phase) { |
| 747 case PaintPhaseFloat: | 747 case PaintPhaseFloat: |
| 748 break; | 748 break; |
| 749 case PaintPhaseForeground: | 749 case PaintPhaseForeground: |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 789 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.outlineRect.re ct()), PaintPhaseSelfOutline, paintBehavior, paintingRootForRenderer, 0, localPa intingInfo.rootLayer->renderer()); | 789 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.outlineRect.re ct()), PaintPhaseSelfOutline, paintBehavior, paintingRootForRenderer, 0, localPa intingInfo.rootLayer->renderer()); |
| 790 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds. location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState()))); | 790 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds. location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState()))); |
| 791 } | 791 } |
| 792 } | 792 } |
| 793 | 793 |
| 794 void LayerPainter::paintMaskForFragments(const LayerFragments& layerFragments, G raphicsContext* context, const LayerPaintingInfo& localPaintingInfo, | 794 void LayerPainter::paintMaskForFragments(const LayerFragments& layerFragments, G raphicsContext* context, const LayerPaintingInfo& localPaintingInfo, |
| 795 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) | 795 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) |
| 796 { | 796 { |
| 797 for (size_t i = 0; i < layerFragments.size(); ++i) { | 797 for (size_t i = 0; i < layerFragments.size(); ++i) { |
| 798 const LayerFragment& fragment = layerFragments.at(i); | 798 const LayerFragment& fragment = layerFragments.at(i); |
| 799 if (!fragment.shouldPaintContent) | |
| 800 continue; | |
| 801 | |
| 802 OwnPtr<ClipRecorder> clipRecorder; | 799 OwnPtr<ClipRecorder> clipRecorder; |
| 803 if (localPaintingInfo.clipToDirtyRect && needsToClip(localPaintingInfo, fragment.backgroundRect)) { | 800 if (localPaintingInfo.clipToDirtyRect && needsToClip(localPaintingInfo, fragment.backgroundRect)) { |
| 804 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Cl ipDisplayItem::LayerFragmentMask, fragment.backgroundRect)); | 801 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Cl ipDisplayItem::LayerFragmentMask, fragment.backgroundRect)); |
| 805 applyRoundedRectClips(localPaintingInfo, context, fragment.backgroun dRect, paintFlags, *clipRecorder, DoNotIncludeSelfForBorderRadius); // Mask pain ting will handle clipping to self. | 802 applyRoundedRectClips(localPaintingInfo, context, fragment.backgroun dRect, paintFlags, *clipRecorder, DoNotIncludeSelfForBorderRadius); // Mask pain ting will handle clipping to self. |
| 806 } | 803 } |
| 807 | 804 |
| 808 // Paint the mask. | 805 // Paint the mask. |
| 809 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. | 806 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. |
| 810 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseMask, PaintBehaviorNormal, paintingRootForRenderer, 0, local PaintingInfo.rootLayer->renderer()); | 807 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseMask, PaintBehaviorNormal, paintingRootForRenderer, 0, local PaintingInfo.rootLayer->renderer()); |
| 811 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds. location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState()))); | 808 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds. location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState()))); |
| 812 } | 809 } |
| 813 } | 810 } |
| 814 | 811 |
| 815 void LayerPainter::paintChildClippingMaskForFragments(const LayerFragments& laye rFragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo , | 812 void LayerPainter::paintChildClippingMaskForFragments(const LayerFragments& laye rFragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo , |
| 816 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) | 813 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) |
| 817 { | 814 { |
| 818 for (size_t i = 0; i < layerFragments.size(); ++i) { | 815 for (size_t i = 0; i < layerFragments.size(); ++i) { |
| 819 const LayerFragment& fragment = layerFragments.at(i); | 816 const LayerFragment& fragment = layerFragments.at(i); |
| 820 if (!fragment.shouldPaintContent) | |
| 821 continue; | |
| 822 | |
| 823 OwnPtr<ClipRecorder> clipRecorder; | 817 OwnPtr<ClipRecorder> clipRecorder; |
| 824 if (localPaintingInfo.clipToDirtyRect && needsToClip(localPaintingInfo, fragment.foregroundRect)) { | 818 if (localPaintingInfo.clipToDirtyRect && needsToClip(localPaintingInfo, fragment.foregroundRect)) { |
| 825 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Cl ipDisplayItem::LayerFragmentClippingMask, fragment.foregroundRect)); | 819 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Cl ipDisplayItem::LayerFragmentClippingMask, fragment.foregroundRect)); |
| 826 applyRoundedRectClips(localPaintingInfo, context, fragment.foregroun dRect, paintFlags, *clipRecorder, IncludeSelfForBorderRadius); // Child clipping mask painting will handle clipping to self. | 820 applyRoundedRectClips(localPaintingInfo, context, fragment.foregroun dRect, paintFlags, *clipRecorder, IncludeSelfForBorderRadius); // Child clipping mask painting will handle clipping to self. |
| 827 } | 821 } |
| 828 | 822 |
| 829 // Paint the the clipped mask. | 823 // Paint the the clipped mask. |
| 830 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseClippingMask, PaintBehaviorNormal, paintingRootForRenderer, 0, localPaintingInfo.rootLayer->renderer()); | 824 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseClippingMask, PaintBehaviorNormal, paintingRootForRenderer, 0, localPaintingInfo.rootLayer->renderer()); |
| 831 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds. location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState()))); | 825 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds. location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState()))); |
| 832 } | 826 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 875 if (needsToClip(paintingInfo, clipRect)) { | 869 if (needsToClip(paintingInfo, clipRect)) { |
| 876 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.parent(), con text, ClipDisplayItem::LayerFragmentParent, clipRect)); | 870 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.parent(), con text, ClipDisplayItem::LayerFragmentParent, clipRect)); |
| 877 LayerPainter(*m_renderLayer.parent()).applyRoundedRectClips(painting Info, context, clipRect, paintFlags, *clipRecorder, DoNotIncludeSelfForBorderRad ius); // Child clipping mask painting will handle clipping to self. | 871 LayerPainter(*m_renderLayer.parent()).applyRoundedRectClips(painting Info, context, clipRect, paintFlags, *clipRecorder, DoNotIncludeSelfForBorderRad ius); // Child clipping mask painting will handle clipping to self. |
| 878 } | 872 } |
| 879 | 873 |
| 880 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen t.paginationOffset); | 874 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen t.paginationOffset); |
| 881 } | 875 } |
| 882 } | 876 } |
| 883 | 877 |
| 884 } // namespace blink | 878 } // namespace blink |
| OLD | NEW |