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

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: rebase master Created 6 years, 2 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
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. 261 ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects ) ? UncachedClipRects : PaintingClipRects;
262 m_renderLayer.collectFragments(layerFragments, localPaintingInfo.rootLay er, localPaintingInfo.paintDirtyRect, 262 ShouldRespectOverflowClip respectOverflowClip = shouldRespectOverflowCli p(paintFlags, m_renderLayer.renderer());
263 (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Pai ntingClipRects, IgnoreOverlayScrollbarSize, 263 RenderLayer::DirtyRectIntersectionResult intersectionResult;
264 shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()), &of fsetFromRoot, localPaintingInfo.subPixelAccumulation); 264 m_renderLayer.collectFragments(layerFragments, &intersectionResult, loca lPaintingInfo.rootLayer, localPaintingInfo.paintDirtyRect, cacheSlot, IgnoreOver layScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.subPix elAccumulation);
265 updatePaintingInfoForFragments(layerFragments, localPaintingInfo, paintF lags, shouldPaintContent, &offsetFromRoot); 265 if (intersectionResult == RenderLayer::NotIntersectingDirtyRect && shoul dPaintContent) {
266 if (&m_renderLayer != localPaintingInfo.rootLayer || !(paintFlags & PaintLayerPaintingOverflowContents))
267 shouldPaintContent = false;
268 }
266 } 269 }
267 270
268 bool selectionOnly = localPaintingInfo.paintBehavior & PaintBehaviorSelecti onOnly; 271 bool selectionOnly = localPaintingInfo.paintBehavior & PaintBehaviorSelecti onOnly;
269 // If this layer's renderer is a child of the paintingRoot, we render uncond itionally, which 272 // 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). 273 // 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 274 // 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. 275 // so it will be tested against as we descend through the renderers.
273 RenderObject* paintingRootForRenderer = 0; 276 RenderObject* paintingRootForRenderer = 0;
274 if (localPaintingInfo.paintingRoot && !m_renderLayer.renderer()->isDescendan tOf(localPaintingInfo.paintingRoot)) 277 if (localPaintingInfo.paintingRoot && !m_renderLayer.renderer()->isDescendan tOf(localPaintingInfo.paintingRoot))
275 paintingRootForRenderer = localPaintingInfo.paintingRoot; 278 paintingRootForRenderer = localPaintingInfo.paintingRoot;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 LayoutPoint delta; 417 LayoutPoint delta;
415 layer->convertToLayerCoords(localPaintingInfo.rootLayer, delta); 418 layer->convertToLayerCoords(localPaintingInfo.rootLayer, delta);
416 clipRecorder.addRoundedRectClip(layer->renderer()->style()->getRound edInnerBorderFor(LayoutRect(delta, layer->size()))); 419 clipRecorder.addRoundedRectClip(layer->renderer()->style()->getRound edInnerBorderFor(LayoutRect(delta, layer->size())));
417 } 420 }
418 421
419 if (layer == localPaintingInfo.rootLayer) 422 if (layer == localPaintingInfo.rootLayer)
420 break; 423 break;
421 } 424 }
422 } 425 }
423 426
424 void LayerPainter::updatePaintingInfoForFragments(LayerFragments& fragments, con st LayerPaintingInfo& localPaintingInfo, PaintLayerFlags localPaintFlags,
425 bool shouldPaintContent, const LayoutPoint* offsetFromRoot)
426 {
427 ASSERT(offsetFromRoot);
428 for (size_t i = 0; i < fragments.size(); ++i) {
chrishtr 2014/10/28 18:47:42 How about just a method: bool LayerPainter::atLea
mstensho (USE GERRIT) 2014/10/28 20:08:21 You mean that you don't want the extra code (and p
chrishtr 2014/10/28 20:18:25 Is this method hard to implement? I was suggesti
mstensho (USE GERRIT) 2014/10/28 21:33:20 Done. It's kind of meaningless to loop through the
429 LayerFragment& fragment = fragments.at(i);
430 fragment.shouldPaintContent = shouldPaintContent;
431 if (&m_renderLayer != localPaintingInfo.rootLayer || !(localPaintFlags & PaintLayerPaintingOverflowContents)) {
432 LayoutPoint newOffsetFromRoot = *offsetFromRoot + fragment.paginatio nOffset;
433 fragment.shouldPaintContent &= m_renderLayer.intersectsDamageRect(fr agment.layerBounds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer, &newOffsetFromRoot);
434 }
435 }
436 }
437
438 void LayerPainter::paintLayerByApplyingTransform(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, const LayoutPoint& translationOffset) 427 void LayerPainter::paintLayerByApplyingTransform(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, const LayoutPoint& translationOffset)
439 { 428 {
440 // This involves subtracting out the position of the layer in our current co ordinate space, but preserving 429 // 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. 430 // the accumulated error for sub-pixel layout.
442 LayoutPoint delta; 431 LayoutPoint delta;
443 m_renderLayer.convertToLayerCoords(paintingInfo.rootLayer, delta); 432 m_renderLayer.convertToLayerCoords(paintingInfo.rootLayer, delta);
444 delta.moveBy(translationOffset); 433 delta.moveBy(translationOffset);
445 TransformationMatrix transform(m_renderLayer.renderableTransform(paintingInf o.paintBehavior)); 434 TransformationMatrix transform(m_renderLayer.renderableTransform(paintingInf o.paintBehavior));
446 IntPoint roundedDelta = roundedIntPoint(delta); 435 IntPoint roundedDelta = roundedIntPoint(delta);
447 transform.translateRight(roundedDelta.x(), roundedDelta.y()); 436 transform.translateRight(roundedDelta.x(), roundedDelta.y());
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 currLogicalTopOffset -= blockDelta; 654 currLogicalTopOffset -= blockDelta;
666 } 655 }
667 } 656 }
668 657
669 void LayerPainter::paintBackgroundForFragments(const LayerFragments& layerFragme nts, GraphicsContext* context, 658 void LayerPainter::paintBackgroundForFragments(const LayerFragments& layerFragme nts, GraphicsContext* context,
670 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, 659 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior,
671 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) 660 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags)
672 { 661 {
673 for (size_t i = 0; i < layerFragments.size(); ++i) { 662 for (size_t i = 0; i < layerFragments.size(); ++i) {
674 const LayerFragment& fragment = layerFragments.at(i); 663 const LayerFragment& fragment = layerFragments.at(i);
675 if (!fragment.shouldPaintContent)
676 continue;
677 664
678 // Begin transparency layers lazily now that we know we have to paint so mething. 665 // Begin transparency layers lazily now that we know we have to paint so mething.
679 if (haveTransparency || m_renderLayer.paintsWithBlendMode()) 666 if (haveTransparency || m_renderLayer.paintsWithBlendMode())
680 beginTransparencyLayers(context, localPaintingInfo.rootLayer, transp arencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation, localPaintingInfo. paintBehavior); 667 beginTransparencyLayers(context, localPaintingInfo.rootLayer, transp arencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation, localPaintingInfo. paintBehavior);
681 668
682 OwnPtr<ClipRecorder> clipRecorder; 669 OwnPtr<ClipRecorder> clipRecorder;
683 670
684 if (localPaintingInfo.clipToDirtyRect && needsToClip(localPaintingInfo, fragment.backgroundRect)) { 671 if (localPaintingInfo.clipToDirtyRect && needsToClip(localPaintingInfo, fragment.backgroundRect)) {
685 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Cl ipDisplayItem::LayerBackground, fragment.backgroundRect)); 672 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Cl ipDisplayItem::LayerBackground, fragment.backgroundRect));
686 applyRoundedRectClips(localPaintingInfo, context, fragment.backgroun dRect, paintFlags, *clipRecorder); 673 applyRoundedRectClips(localPaintingInfo, context, fragment.backgroun dRect, paintFlags, *clipRecorder);
687 } 674 }
688 675
689 // Paint the background. 676 // Paint the background.
690 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. 677 // 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()); 678 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()))); 679 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds. location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState())));
693 } 680 }
694 } 681 }
695 682
696 void LayerPainter::paintForegroundForFragments(const LayerFragments& layerFragme nts, GraphicsContext* context, 683 void LayerPainter::paintForegroundForFragments(const LayerFragments& layerFragme nts, GraphicsContext* context,
697 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, 684 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior,
698 RenderObject* paintingRootForRenderer, bool selectionOnly, PaintLayerFlags p aintFlags) 685 RenderObject* paintingRootForRenderer, bool selectionOnly, PaintLayerFlags p aintFlags)
699 { 686 {
700 // Begin transparency if we have something to paint. 687 // Begin transparency if we have something to paint.
701 if (haveTransparency || m_renderLayer.paintsWithBlendMode()) { 688 if (haveTransparency || m_renderLayer.paintsWithBlendMode()) {
702 for (size_t i = 0; i < layerFragments.size(); ++i) { 689 for (size_t i = 0; i < layerFragments.size(); ++i) {
703 const LayerFragment& fragment = layerFragments.at(i); 690 const LayerFragment& fragment = layerFragments.at(i);
704 if (fragment.shouldPaintContent && !fragment.foregroundRect.isEmpty( )) { 691 if (!fragment.foregroundRect.isEmpty()) {
705 beginTransparencyLayers(context, localPaintingInfo.rootLayer, tr ansparencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation, localPaintingI nfo.paintBehavior); 692 beginTransparencyLayers(context, localPaintingInfo.rootLayer, tr ansparencyPaintDirtyRect, localPaintingInfo.subPixelAccumulation, localPaintingI nfo.paintBehavior);
706 break; 693 break;
707 } 694 }
708 } 695 }
709 } 696 }
710 697
711 // Optimize clipping for the single fragment case. 698 // Optimize clipping for the single fragment case.
712 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() == 1 && layerFragments[0].shouldPaintContent && !layerFragments[0].foregroundRe ct.isEmpty(); 699 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() == 1 && !layerFragments[0].foregroundRect.isEmpty();
713 700
714 OwnPtr<ClipRecorder> clipRecorder; 701 OwnPtr<ClipRecorder> clipRecorder;
715 if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroun dRect)) { 702 if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroun dRect)) {
716 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, ClipDi splayItem::LayerForeground, layerFragments[0].foregroundRect)); 703 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, ClipDi splayItem::LayerForeground, layerFragments[0].foregroundRect));
717 applyRoundedRectClips(localPaintingInfo, context, layerFragments[0].fore groundRect, paintFlags, *clipRecorder); 704 applyRoundedRectClips(localPaintingInfo, context, layerFragments[0].fore groundRect, paintFlags, *clipRecorder);
718 } 705 }
719 706
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 707 // 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. 708 // interleaving of the fragments to work properly.
722 paintForegroundForFragmentsWithPhase(selectionOnly ? PaintPhaseSelection : P aintPhaseChildBlockBackgrounds, layerFragments, 709 paintForegroundForFragmentsWithPhase(selectionOnly ? PaintPhaseSelection : P aintPhaseChildBlockBackgrounds, layerFragments,
723 context, localPaintingInfo, paintBehavior, paintingRootForRenderer, pain tFlags); 710 context, localPaintingInfo, paintBehavior, paintingRootForRenderer, pain tFlags);
724 711
725 if (!selectionOnly) { 712 if (!selectionOnly) {
726 paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments, co ntext, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlags); 713 paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments, co ntext, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlags);
727 paintForegroundForFragmentsWithPhase(PaintPhaseForeground, layerFragment s, context, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlag s); 714 paintForegroundForFragmentsWithPhase(PaintPhaseForeground, layerFragment s, context, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlag s);
728 paintForegroundForFragmentsWithPhase(PaintPhaseChildOutlines, layerFragm ents, context, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintF lags); 715 paintForegroundForFragmentsWithPhase(PaintPhaseChildOutlines, layerFragm ents, context, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintF lags);
729 } 716 }
730 } 717 }
731 718
732 void LayerPainter::paintForegroundForFragmentsWithPhase(PaintPhase phase, const LayerFragments& layerFragments, GraphicsContext* context, 719 void LayerPainter::paintForegroundForFragmentsWithPhase(PaintPhase phase, const LayerFragments& layerFragments, GraphicsContext* context,
733 const LayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, Ren derObject* paintingRootForRenderer, PaintLayerFlags paintFlags) 720 const LayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, Ren derObject* paintingRootForRenderer, PaintLayerFlags paintFlags)
734 { 721 {
735 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() > 1; 722 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() > 1;
736 723
737 for (size_t i = 0; i < layerFragments.size(); ++i) { 724 for (size_t i = 0; i < layerFragments.size(); ++i) {
738 const LayerFragment& fragment = layerFragments.at(i); 725 const LayerFragment& fragment = layerFragments.at(i);
739 if (!fragment.shouldPaintContent || fragment.foregroundRect.isEmpty()) 726 if (fragment.foregroundRect.isEmpty())
740 continue; 727 continue;
741 728
742 OwnPtr<ClipRecorder> clipRecorder; 729 OwnPtr<ClipRecorder> clipRecorder;
743 if (shouldClip && needsToClip(localPaintingInfo, fragment.foregroundRect )) { 730 if (shouldClip && needsToClip(localPaintingInfo, fragment.foregroundRect )) {
744 // Note: this method only clips when there is more than one fragment . 731 // Note: this method only clips when there is more than one fragment .
745 ClipDisplayItem::ClipType clipType = ClipDisplayItem::LayerFragmentF loat; 732 ClipDisplayItem::ClipType clipType = ClipDisplayItem::LayerFragmentF loat;
746 switch (phase) { 733 switch (phase) {
747 case PaintPhaseFloat: 734 case PaintPhaseFloat:
748 break; 735 break;
749 case PaintPhaseForeground: 736 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()); 776 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()))); 777 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds. location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState())));
791 } 778 }
792 } 779 }
793 780
794 void LayerPainter::paintMaskForFragments(const LayerFragments& layerFragments, G raphicsContext* context, const LayerPaintingInfo& localPaintingInfo, 781 void LayerPainter::paintMaskForFragments(const LayerFragments& layerFragments, G raphicsContext* context, const LayerPaintingInfo& localPaintingInfo,
795 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) 782 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags)
796 { 783 {
797 for (size_t i = 0; i < layerFragments.size(); ++i) { 784 for (size_t i = 0; i < layerFragments.size(); ++i) {
798 const LayerFragment& fragment = layerFragments.at(i); 785 const LayerFragment& fragment = layerFragments.at(i);
799 if (!fragment.shouldPaintContent)
800 continue;
801
802 OwnPtr<ClipRecorder> clipRecorder; 786 OwnPtr<ClipRecorder> clipRecorder;
803 if (localPaintingInfo.clipToDirtyRect && needsToClip(localPaintingInfo, fragment.backgroundRect)) { 787 if (localPaintingInfo.clipToDirtyRect && needsToClip(localPaintingInfo, fragment.backgroundRect)) {
804 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Cl ipDisplayItem::LayerFragmentMask, fragment.backgroundRect)); 788 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. 789 applyRoundedRectClips(localPaintingInfo, context, fragment.backgroun dRect, paintFlags, *clipRecorder, DoNotIncludeSelfForBorderRadius); // Mask pain ting will handle clipping to self.
806 } 790 }
807 791
808 // Paint the mask. 792 // Paint the mask.
809 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. 793 // 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()); 794 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()))); 795 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds. location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState())));
812 } 796 }
813 } 797 }
814 798
815 void LayerPainter::paintChildClippingMaskForFragments(const LayerFragments& laye rFragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo , 799 void LayerPainter::paintChildClippingMaskForFragments(const LayerFragments& laye rFragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo ,
816 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) 800 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags)
817 { 801 {
818 for (size_t i = 0; i < layerFragments.size(); ++i) { 802 for (size_t i = 0; i < layerFragments.size(); ++i) {
819 const LayerFragment& fragment = layerFragments.at(i); 803 const LayerFragment& fragment = layerFragments.at(i);
820 if (!fragment.shouldPaintContent)
821 continue;
822
823 OwnPtr<ClipRecorder> clipRecorder; 804 OwnPtr<ClipRecorder> clipRecorder;
824 if (localPaintingInfo.clipToDirtyRect && needsToClip(localPaintingInfo, fragment.foregroundRect)) { 805 if (localPaintingInfo.clipToDirtyRect && needsToClip(localPaintingInfo, fragment.foregroundRect)) {
825 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Cl ipDisplayItem::LayerFragmentClippingMask, fragment.foregroundRect)); 806 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. 807 applyRoundedRectClips(localPaintingInfo, context, fragment.foregroun dRect, paintFlags, *clipRecorder, IncludeSelfForBorderRadius); // Child clipping mask painting will handle clipping to self.
827 } 808 }
828 809
829 // Paint the the clipped mask. 810 // Paint the the clipped mask.
830 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseClippingMask, PaintBehaviorNormal, paintingRootForRenderer, 0, localPaintingInfo.rootLayer->renderer()); 811 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()))); 812 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds. location() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(lo calPaintingInfo.subPixelAccumulation, m_renderLayer.compositingState())));
832 } 813 }
833 } 814 }
834 815
835 void LayerPainter::paintOverlayScrollbars(GraphicsContext* context, const Layout Rect& damageRect, PaintBehavior paintBehavior, RenderObject* paintingRoot) 816 void LayerPainter::paintOverlayScrollbars(GraphicsContext* context, const Layout Rect& damageRect, PaintBehavior paintBehavior, RenderObject* paintingRoot)
836 { 817 {
837 if (!m_renderLayer.containsDirtyOverlayScrollbars()) 818 if (!m_renderLayer.containsDirtyOverlayScrollbars())
838 return; 819 return;
839 820
840 LayerPaintingInfo paintingInfo(&m_renderLayer, enclosingIntRect(damageRect), paintBehavior, LayoutSize(), paintingRoot); 821 LayerPaintingInfo paintingInfo(&m_renderLayer, enclosingIntRect(damageRect), paintBehavior, LayoutSize(), paintingRoot);
841 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); 822 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars);
842 823
843 m_renderLayer.setContainsDirtyOverlayScrollbars(false); 824 m_renderLayer.setContainsDirtyOverlayScrollbars(false);
844 } 825 }
845 826
846 void LayerPainter::paintTransformedLayerIntoFragments(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) 827 void LayerPainter::paintTransformedLayerIntoFragments(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
847 { 828 {
848 LayerFragments enclosingPaginationFragments; 829 LayerFragments enclosingPaginationFragments;
849 LayoutPoint offsetOfPaginationLayerFromRoot; 830 LayoutPoint offsetOfPaginationLayerFromRoot;
850 LayoutRect transformedExtent = RenderLayer::transparencyClipBox(&m_renderLay er, m_renderLayer.enclosingPaginationLayer(), RenderLayer::PaintingTransparencyC lipBox, RenderLayer::RootOfTransparencyClipBox, paintingInfo.subPixelAccumulatio n, paintingInfo.paintBehavior); 831 LayoutRect transformedExtent = RenderLayer::transparencyClipBox(&m_renderLay er, m_renderLayer.enclosingPaginationLayer(), RenderLayer::PaintingTransparencyC lipBox, RenderLayer::RootOfTransparencyClipBox, paintingInfo.subPixelAccumulatio n, paintingInfo.paintBehavior);
851 m_renderLayer.enclosingPaginationLayer()->collectFragments(enclosingPaginati onFragments, paintingInfo.rootLayer, paintingInfo.paintDirtyRect, 832 m_renderLayer.enclosingPaginationLayer()->collectFragments(enclosingPaginati onFragments, 0, paintingInfo.rootLayer, paintingInfo.paintDirtyRect,
852 (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Paintin gClipRects, IgnoreOverlayScrollbarSize, 833 (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Paintin gClipRects, IgnoreOverlayScrollbarSize,
853 shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()), &offset OfPaginationLayerFromRoot, paintingInfo.subPixelAccumulation, &transformedExtent ); 834 shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()), &offset OfPaginationLayerFromRoot, paintingInfo.subPixelAccumulation, &transformedExtent );
854 835
855 for (size_t i = 0; i < enclosingPaginationFragments.size(); ++i) { 836 for (size_t i = 0; i < enclosingPaginationFragments.size(); ++i) {
856 const LayerFragment& fragment = enclosingPaginationFragments.at(i); 837 const LayerFragment& fragment = enclosingPaginationFragments.at(i);
857 838
858 // Apply the page/column clip for this fragment, as well as any clips es tablished by layers in between us and 839 // Apply the page/column clip for this fragment, as well as any clips es tablished by layers in between us and
859 // the enclosing pagination layer. 840 // the enclosing pagination layer.
860 LayoutRect clipRect = fragment.backgroundRect.rect(); 841 LayoutRect clipRect = fragment.backgroundRect.rect();
861 842
(...skipping 13 matching lines...) Expand all
875 if (needsToClip(paintingInfo, clipRect)) { 856 if (needsToClip(paintingInfo, clipRect)) {
876 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.parent(), con text, ClipDisplayItem::LayerFragmentParent, clipRect)); 857 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. 858 LayerPainter(*m_renderLayer.parent()).applyRoundedRectClips(painting Info, context, clipRect, paintFlags, *clipRecorder, DoNotIncludeSelfForBorderRad ius); // Child clipping mask painting will handle clipping to self.
878 } 859 }
879 860
880 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen t.paginationOffset); 861 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen t.paginationOffset);
881 } 862 }
882 } 863 }
883 864
884 } // namespace blink 865 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698