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

Side by Side Diff: Source/core/paint/LayerPainter.cpp

Issue 666493002: Remove updatePaintingInfoForFragments() and per-fragment shouldPaintContent flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Code review. Add comment. Created 6 years, 1 month 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
« no previous file with comments | « Source/core/paint/LayerPainter.h ('k') | Source/core/rendering/LayerFragment.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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.
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 // Note that this really only works reliably on the first fragment. If t he layer has visible
435 // overflow and a subsequent fragment doesn't intersect with the border box of the layer
436 // (i.e. only contains an overflow portion of the layer), intersection w ill fail. The reason
437 // for this is that fragment.layerBounds is set to the border box, not t he bounding box, of
438 // the layer.
439 if (m_renderLayer.intersectsDamageRect(fragment.layerBounds, fragment.ba ckgroundRect.rect(), localPaintingInfo.rootLayer, &newOffsetFromRoot))
440 return true;
435 } 441 }
442 return false;
436 } 443 }
437 444
438 void LayerPainter::paintLayerByApplyingTransform(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, const LayoutPoint& translationOffset) 445 void LayerPainter::paintLayerByApplyingTransform(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, const LayoutPoint& translationOffset)
439 { 446 {
440 // This involves subtracting out the position of the layer in our current co ordinate space, but preserving 447 // 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. 448 // the accumulated error for sub-pixel layout.
442 LayoutPoint delta; 449 LayoutPoint delta;
443 m_renderLayer.convertToLayerCoords(paintingInfo.rootLayer, delta); 450 m_renderLayer.convertToLayerCoords(paintingInfo.rootLayer, delta);
444 delta.moveBy(translationOffset); 451 delta.moveBy(translationOffset);
445 TransformationMatrix transform(m_renderLayer.renderableTransform(paintingInf o.paintBehavior)); 452 TransformationMatrix transform(m_renderLayer.renderableTransform(paintingInf o.paintBehavior));
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 currLogicalTopOffset -= blockDelta; 672 currLogicalTopOffset -= blockDelta;
666 } 673 }
667 } 674 }
668 675
669 void LayerPainter::paintBackgroundForFragments(const LayerFragments& layerFragme nts, GraphicsContext* context, 676 void LayerPainter::paintBackgroundForFragments(const LayerFragments& layerFragme nts, GraphicsContext* context,
670 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, 677 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior,
671 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) 678 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags)
672 { 679 {
673 for (size_t i = 0; i < layerFragments.size(); ++i) { 680 for (size_t i = 0; i < layerFragments.size(); ++i) {
674 const LayerFragment& fragment = layerFragments.at(i); 681 const LayerFragment& fragment = layerFragments.at(i);
675 if (!fragment.shouldPaintContent)
676 continue;
677 682
678 // Begin transparency layers lazily now that we know we have to paint so mething. 683 // Begin transparency layers lazily now that we know we have to paint so mething.
679 if (haveTransparency || m_renderLayer.paintsWithBlendMode()) 684 if (haveTransparency || m_renderLayer.paintsWithBlendMode())
680 beginTransparencyLayers(context, localPaintingInfo.rootLayer, transp arencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation, localPaintingInfo. paintBehavior); 685 beginTransparencyLayers(context, localPaintingInfo.rootLayer, transp arencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation, localPaintingInfo. paintBehavior);
681 686
682 OwnPtr<ClipRecorder> clipRecorder; 687 OwnPtr<ClipRecorder> clipRecorder;
683 688
684 if (localPaintingInfo.clipToDirtyRect && needsToClip(localPaintingInfo, fragment.backgroundRect)) { 689 if (localPaintingInfo.clipToDirtyRect && needsToClip(localPaintingInfo, fragment.backgroundRect)) {
685 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Cl ipDisplayItem::LayerBackground, fragment.backgroundRect)); 690 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Cl ipDisplayItem::LayerBackground, fragment.backgroundRect));
686 applyRoundedRectClips(localPaintingInfo, context, fragment.backgroun dRect, paintFlags, *clipRecorder); 691 applyRoundedRectClips(localPaintingInfo, context, fragment.backgroun dRect, paintFlags, *clipRecorder);
687 } 692 }
688 693
689 // Paint the background. 694 // Paint the background.
690 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. 695 // 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()); 696 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()))); 697 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds. location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState())));
693 } 698 }
694 } 699 }
695 700
696 void LayerPainter::paintForegroundForFragments(const LayerFragments& layerFragme nts, GraphicsContext* context, 701 void LayerPainter::paintForegroundForFragments(const LayerFragments& layerFragme nts, GraphicsContext* context,
697 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, 702 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior,
698 RenderObject* paintingRootForRenderer, bool selectionOnly, PaintLayerFlags p aintFlags) 703 RenderObject* paintingRootForRenderer, bool selectionOnly, PaintLayerFlags p aintFlags)
699 { 704 {
700 // Begin transparency if we have something to paint. 705 // Begin transparency if we have something to paint.
701 if (haveTransparency || m_renderLayer.paintsWithBlendMode()) { 706 if (haveTransparency || m_renderLayer.paintsWithBlendMode()) {
702 for (size_t i = 0; i < layerFragments.size(); ++i) { 707 for (size_t i = 0; i < layerFragments.size(); ++i) {
703 const LayerFragment& fragment = layerFragments.at(i); 708 const LayerFragment& fragment = layerFragments.at(i);
704 if (fragment.shouldPaintContent && !fragment.foregroundRect.isEmpty( )) { 709 if (!fragment.foregroundRect.isEmpty()) {
705 beginTransparencyLayers(context, localPaintingInfo.rootLayer, tr ansparencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation, localPaintingI nfo.paintBehavior); 710 beginTransparencyLayers(context, localPaintingInfo.rootLayer, tr ansparencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation, localPaintingI nfo.paintBehavior);
706 break; 711 break;
707 } 712 }
708 } 713 }
709 } 714 }
710 715
711 // Optimize clipping for the single fragment case. 716 // Optimize clipping for the single fragment case.
712 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() == 1 && layerFragments[0].shouldPaintContent && !layerFragments[0].foregroundRe ct.isEmpty(); 717 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() == 1 && !layerFragments[0].foregroundRect.isEmpty();
713 718
714 OwnPtr<ClipRecorder> clipRecorder; 719 OwnPtr<ClipRecorder> clipRecorder;
715 if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroun dRect)) { 720 if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroun dRect)) {
716 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, ClipDi splayItem::LayerForeground, layerFragments[0].foregroundRect)); 721 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, ClipDi splayItem::LayerForeground, layerFragments[0].foregroundRect));
717 applyRoundedRectClips(localPaintingInfo, context, layerFragments[0].fore groundRect, paintFlags, *clipRecorder); 722 applyRoundedRectClips(localPaintingInfo, context, layerFragments[0].fore groundRect, paintFlags, *clipRecorder);
718 } 723 }
719 724
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 725 // 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. 726 // interleaving of the fragments to work properly.
722 paintForegroundForFragmentsWithPhase(selectionOnly ? PaintPhaseSelection : P aintPhaseChildBlockBackgrounds, layerFragments, 727 paintForegroundForFragmentsWithPhase(selectionOnly ? PaintPhaseSelection : P aintPhaseChildBlockBackgrounds, layerFragments,
723 context, localPaintingInfo, paintBehavior, paintingRootForRenderer, pain tFlags); 728 context, localPaintingInfo, paintBehavior, paintingRootForRenderer, pain tFlags);
724 729
725 if (!selectionOnly) { 730 if (!selectionOnly) {
726 paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments, co ntext, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlags); 731 paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments, co ntext, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlags);
727 paintForegroundForFragmentsWithPhase(PaintPhaseForeground, layerFragment s, context, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlag s); 732 paintForegroundForFragmentsWithPhase(PaintPhaseForeground, layerFragment s, context, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlag s);
728 paintForegroundForFragmentsWithPhase(PaintPhaseChildOutlines, layerFragm ents, context, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintF lags); 733 paintForegroundForFragmentsWithPhase(PaintPhaseChildOutlines, layerFragm ents, context, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintF lags);
729 } 734 }
730 } 735 }
731 736
732 void LayerPainter::paintForegroundForFragmentsWithPhase(PaintPhase phase, const LayerFragments& layerFragments, GraphicsContext* context, 737 void LayerPainter::paintForegroundForFragmentsWithPhase(PaintPhase phase, const LayerFragments& layerFragments, GraphicsContext* context,
733 const LayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, Ren derObject* paintingRootForRenderer, PaintLayerFlags paintFlags) 738 const LayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, Ren derObject* paintingRootForRenderer, PaintLayerFlags paintFlags)
734 { 739 {
735 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() > 1; 740 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() > 1;
736 741
737 for (size_t i = 0; i < layerFragments.size(); ++i) { 742 for (size_t i = 0; i < layerFragments.size(); ++i) {
738 const LayerFragment& fragment = layerFragments.at(i); 743 const LayerFragment& fragment = layerFragments.at(i);
739 if (!fragment.shouldPaintContent || fragment.foregroundRect.isEmpty()) 744 if (fragment.foregroundRect.isEmpty())
740 continue; 745 continue;
741 746
742 OwnPtr<ClipRecorder> clipRecorder; 747 OwnPtr<ClipRecorder> clipRecorder;
743 if (shouldClip && needsToClip(localPaintingInfo, fragment.foregroundRect )) { 748 if (shouldClip && needsToClip(localPaintingInfo, fragment.foregroundRect )) {
744 // Note: this method only clips when there is more than one fragment . 749 // Note: this method only clips when there is more than one fragment .
745 ClipDisplayItem::ClipType clipType = ClipDisplayItem::LayerFragmentF loat; 750 ClipDisplayItem::ClipType clipType = ClipDisplayItem::LayerFragmentF loat;
746 switch (phase) { 751 switch (phase) {
747 case PaintPhaseFloat: 752 case PaintPhaseFloat:
748 break; 753 break;
749 case PaintPhaseForeground: 754 case PaintPhaseForeground:
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.outlineRect.re ct()), PaintPhaseSelfOutline, paintBehavior, paintingRootForRenderer, 0, localPa intingInfo.rootLayer->renderer()); 794 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()))); 795 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds. location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState())));
791 } 796 }
792 } 797 }
793 798
794 void LayerPainter::paintMaskForFragments(const LayerFragments& layerFragments, G raphicsContext* context, const LayerPaintingInfo& localPaintingInfo, 799 void LayerPainter::paintMaskForFragments(const LayerFragments& layerFragments, G raphicsContext* context, const LayerPaintingInfo& localPaintingInfo,
795 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) 800 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags)
796 { 801 {
797 for (size_t i = 0; i < layerFragments.size(); ++i) { 802 for (size_t i = 0; i < layerFragments.size(); ++i) {
798 const LayerFragment& fragment = layerFragments.at(i); 803 const LayerFragment& fragment = layerFragments.at(i);
799 if (!fragment.shouldPaintContent)
800 continue;
801
802 OwnPtr<ClipRecorder> clipRecorder; 804 OwnPtr<ClipRecorder> clipRecorder;
803 if (localPaintingInfo.clipToDirtyRect && needsToClip(localPaintingInfo, fragment.backgroundRect)) { 805 if (localPaintingInfo.clipToDirtyRect && needsToClip(localPaintingInfo, fragment.backgroundRect)) {
804 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Cl ipDisplayItem::LayerFragmentMask, fragment.backgroundRect)); 806 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. 807 applyRoundedRectClips(localPaintingInfo, context, fragment.backgroun dRect, paintFlags, *clipRecorder, DoNotIncludeSelfForBorderRadius); // Mask pain ting will handle clipping to self.
806 } 808 }
807 809
808 // Paint the mask. 810 // Paint the mask.
809 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. 811 // 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()); 812 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()))); 813 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds. location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState())));
812 } 814 }
813 } 815 }
814 816
815 void LayerPainter::paintChildClippingMaskForFragments(const LayerFragments& laye rFragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo , 817 void LayerPainter::paintChildClippingMaskForFragments(const LayerFragments& laye rFragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo ,
816 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) 818 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags)
817 { 819 {
818 for (size_t i = 0; i < layerFragments.size(); ++i) { 820 for (size_t i = 0; i < layerFragments.size(); ++i) {
819 const LayerFragment& fragment = layerFragments.at(i); 821 const LayerFragment& fragment = layerFragments.at(i);
820 if (!fragment.shouldPaintContent)
821 continue;
822
823 OwnPtr<ClipRecorder> clipRecorder; 822 OwnPtr<ClipRecorder> clipRecorder;
824 if (localPaintingInfo.clipToDirtyRect && needsToClip(localPaintingInfo, fragment.foregroundRect)) { 823 if (localPaintingInfo.clipToDirtyRect && needsToClip(localPaintingInfo, fragment.foregroundRect)) {
825 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Cl ipDisplayItem::LayerFragmentClippingMask, fragment.foregroundRect)); 824 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. 825 applyRoundedRectClips(localPaintingInfo, context, fragment.foregroun dRect, paintFlags, *clipRecorder, IncludeSelfForBorderRadius); // Child clipping mask painting will handle clipping to self.
827 } 826 }
828 827
829 // Paint the the clipped mask. 828 // Paint the the clipped mask.
830 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseClippingMask, PaintBehaviorNormal, paintingRootForRenderer, 0, localPaintingInfo.rootLayer->renderer()); 829 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()))); 830 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds. location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState())));
832 } 831 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 if (needsToClip(paintingInfo, clipRect)) { 874 if (needsToClip(paintingInfo, clipRect)) {
876 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.parent(), con text, ClipDisplayItem::LayerFragmentParent, clipRect)); 875 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. 876 LayerPainter(*m_renderLayer.parent()).applyRoundedRectClips(painting Info, context, clipRect, paintFlags, *clipRecorder, DoNotIncludeSelfForBorderRad ius); // Child clipping mask painting will handle clipping to self.
878 } 877 }
879 878
880 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen t.paginationOffset); 879 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen t.paginationOffset);
881 } 880 }
882 } 881 }
883 882
884 } // namespace blink 883 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/LayerPainter.h ('k') | Source/core/rendering/LayerFragment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698