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

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

Issue 744163002: Enable fast/images with slimming paint (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove unnecessary numbers Created 6 years 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 | Annotate | Revision Log
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/paint/FilterPainter.h" 10 #include "core/paint/FilterPainter.h"
11 #include "core/paint/LayerClipRecorder.h"
11 #include "core/paint/TransformDisplayItem.h" 12 #include "core/paint/TransformDisplayItem.h"
12 #include "core/paint/TransparencyDisplayItem.h" 13 #include "core/paint/TransparencyDisplayItem.h"
13 #include "core/rendering/ClipPathOperation.h" 14 #include "core/rendering/ClipPathOperation.h"
14 #include "core/rendering/FilterEffectRenderer.h" 15 #include "core/rendering/FilterEffectRenderer.h"
15 #include "core/rendering/PaintInfo.h" 16 #include "core/rendering/PaintInfo.h"
16 #include "core/rendering/RenderBlock.h" 17 #include "core/rendering/RenderBlock.h"
17 #include "core/rendering/RenderLayer.h" 18 #include "core/rendering/RenderLayer.h"
18 #include "core/rendering/RenderView.h" 19 #include "core/rendering/RenderView.h"
19 #include "core/rendering/svg/RenderSVGResourceClipper.h" 20 #include "core/rendering/svg/RenderSVGResourceClipper.h"
20 21
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 73
73 // PaintLayerAppliedTransform is used in RenderReplica, to avoid applying th e transform twice. 74 // PaintLayerAppliedTransform is used in RenderReplica, to avoid applying th e transform twice.
74 if (m_renderLayer.paintsWithTransform(paintingInfo.paintBehavior) && !(paint Flags & PaintLayerAppliedTransform)) { 75 if (m_renderLayer.paintsWithTransform(paintingInfo.paintBehavior) && !(paint Flags & PaintLayerAppliedTransform)) {
75 paintLayerWithTransform(context, paintingInfo, paintFlags); 76 paintLayerWithTransform(context, paintingInfo, paintFlags);
76 return; 77 return;
77 } 78 }
78 79
79 paintLayerContentsAndReflection(context, paintingInfo, paintFlags); 80 paintLayerContentsAndReflection(context, paintingInfo, paintFlags);
80 } 81 }
81 82
82 class TransparencyLayerHelper {
83 public:
84 TransparencyLayerHelper(GraphicsContext* context, RenderLayer& renderLayer, const RenderLayer* rootLayer, const LayoutRect& paintDirtyRect, const LayoutSize & subPixelAccumulation, PaintBehavior paintBehavior)
85 : m_transparencyLayerInProgress(false)
86 , m_context(context)
87 , m_renderLayer(renderLayer)
88 {
89 // Blending operations must be performed only with the nearest ancestor stacking context.
90 // Note that there is no need to create a transparency layer if we're pa inting the root.
91 // FIXME: this should be unified further into RenderLayer::paintsWithTra nsparency().
92 bool shouldUseTransparencyLayerForBlendMode = !renderLayer.renderer()->i sDocumentElement() && renderLayer.stackingNode()->isStackingContext() && renderL ayer.hasNonIsolatedDescendantWithBlendMode();
93 if (!shouldUseTransparencyLayerForBlendMode && !renderLayer.paintsWithTr ansparency(paintBehavior))
94 return;
95
96 OwnPtr<BeginTransparencyDisplayItem> beginTransparencyDisplayItem = adop tPtr(new BeginTransparencyDisplayItem(
97 renderLayer.renderer(), DisplayItem::BeginTransparency, renderLayer. paintingExtent(rootLayer, paintDirtyRect, subPixelAccumulation, paintBehavior),
98 renderLayer.renderer()->style()->blendMode(), renderLayer.renderer() ->opacity()));
99 if (RuntimeEnabledFeatures::slimmingPaintEnabled())
100 renderLayer.renderer()->view()->viewDisplayList().add(beginTranspare ncyDisplayItem.release());
101 else
102 beginTransparencyDisplayItem->replay(context);
103
104 m_transparencyLayerInProgress = true;
105 }
106
107 ~TransparencyLayerHelper()
108 {
109 if (!m_transparencyLayerInProgress)
110 return;
111 OwnPtr<EndTransparencyDisplayItem> endTransparencyDisplayItem = adoptPtr (new EndTransparencyDisplayItem(m_renderLayer.renderer(), DisplayItem::EndTransp arency));
112 if (RuntimeEnabledFeatures::slimmingPaintEnabled())
113 m_renderLayer.renderer()->view()->viewDisplayList().add(endTranspare ncyDisplayItem.release());
114 else
115 endTransparencyDisplayItem->replay(m_context);
116 }
117 private:
118 bool m_transparencyLayerInProgress;
119 GraphicsContext* m_context;
120 const RenderLayer& m_renderLayer;
121 };
122
123 void LayerPainter::paintLayerContentsAndReflection(GraphicsContext* context, con st LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) 83 void LayerPainter::paintLayerContentsAndReflection(GraphicsContext* context, con st LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
124 { 84 {
125 ASSERT(m_renderLayer.isSelfPaintingLayer() || m_renderLayer.hasSelfPaintingL ayerDescendant()); 85 ASSERT(m_renderLayer.isSelfPaintingLayer() || m_renderLayer.hasSelfPaintingL ayerDescendant());
126 86
127 PaintLayerFlags localPaintFlags = paintFlags & ~(PaintLayerAppliedTransform) ; 87 PaintLayerFlags localPaintFlags = paintFlags & ~(PaintLayerAppliedTransform) ;
128 88
129 // Paint the reflection first if we have one. 89 // Paint the reflection first if we have one.
130 if (m_renderLayer.reflectionInfo()) 90 if (m_renderLayer.reflectionInfo())
131 m_renderLayer.reflectionInfo()->paint(context, paintingInfo, localPaintF lags | PaintLayerPaintingReflection); 91 m_renderLayer.reflectionInfo()->paint(context, paintingInfo, localPaintF lags | PaintLayerPaintingReflection);
132 92
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 196
237 if (m_renderLayer.compositingState() == PaintsIntoOwnBacking) 197 if (m_renderLayer.compositingState() == PaintsIntoOwnBacking)
238 offsetFromRoot.move(m_renderLayer.subpixelAccumulation()); 198 offsetFromRoot.move(m_renderLayer.subpixelAccumulation());
239 199
240 LayoutRect rootRelativeBounds; 200 LayoutRect rootRelativeBounds;
241 bool rootRelativeBoundsComputed = false; 201 bool rootRelativeBoundsComputed = false;
242 202
243 // These helpers output clip and transparency layers using a RAII pattern. S tack-allocated-varibles are destructed in the reverse order of construction, 203 // These helpers output clip and transparency layers using a RAII pattern. S tack-allocated-varibles are destructed in the reverse order of construction,
244 // so they are nested properly. 204 // so they are nested properly.
245 ClipPathHelper clipPathHelper(context, m_renderLayer, paintingInfo, rootRela tiveBounds, rootRelativeBoundsComputed, offsetFromRoot, paintFlags); 205 ClipPathHelper clipPathHelper(context, m_renderLayer, paintingInfo, rootRela tiveBounds, rootRelativeBoundsComputed, offsetFromRoot, paintFlags);
246 TransparencyLayerHelper transparencyLayerHelper(context, m_renderLayer, pain tingInfo.rootLayer, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulati on, paintingInfo.paintBehavior); 206
207 OwnPtr<TransparencyRecorder> transparencyRecorder;
208 OwnPtr<LayerClipRecorder> clipRecorder;
209 // Blending operations must be performed only with the nearest ancestor stac king context.
210 // Note that there is no need to create a transparency layer if we're painti ng the root.
211 // FIXME: this should be unified further into RenderLayer::paintsWithTranspa rency().
212 bool shouldUseTransparencyLayerForBlendMode = !m_renderLayer.renderer()->isD ocumentElement() && m_renderLayer.stackingNode()->isStackingContext() && m_rende rLayer.hasNonIsolatedDescendantWithBlendMode();
213 if (shouldUseTransparencyLayerForBlendMode || m_renderLayer.paintsWithTransp arency(paintingInfo.paintBehavior)) {
214 clipRecorder = adoptPtr(new LayerClipRecorder(m_renderLayer.renderer(), context, DisplayItem::TransparencyClip,
215 m_renderLayer.paintingExtent(paintingInfo.rootLayer, paintingInfo.pa intDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.paintBehavior),
216 &paintingInfo, LayoutPoint(), paintFlags));
217
218 transparencyRecorder = adoptPtr(new TransparencyRecorder(context, m_rend erLayer.renderer(), DisplayItem::BeginTransparency,
219 m_renderLayer.renderer()->style()->blendMode(), m_renderLayer.render er()->opacity()));
220 }
247 221
248 LayerPaintingInfo localPaintingInfo(paintingInfo); 222 LayerPaintingInfo localPaintingInfo(paintingInfo);
249 223
250 LayerFragments layerFragments; 224 LayerFragments layerFragments;
251 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) { 225 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) {
252 // Collect the fragments. This will compute the clip rectangles and pain t offsets for each layer fragment. 226 // Collect the fragments. This will compute the clip rectangles and pain t offsets for each layer fragment.
253 m_renderLayer.collectFragments(layerFragments, localPaintingInfo.rootLay er, localPaintingInfo.paintDirtyRect, 227 m_renderLayer.collectFragments(layerFragments, localPaintingInfo.rootLay er, localPaintingInfo.paintDirtyRect,
254 (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Pai ntingClipRects, IgnoreOverlayScrollbarSize, 228 (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Pai ntingClipRects, IgnoreOverlayScrollbarSize,
255 shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()), &of fsetFromRoot, localPaintingInfo.subPixelAccumulation); 229 shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()), &of fsetFromRoot, localPaintingInfo.subPixelAccumulation);
256 if (shouldPaintContent) 230 if (shouldPaintContent)
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 // We don't need to collect any fragments in the regular way here. We ha ve already 355 // We don't need to collect any fragments in the regular way here. We ha ve already
382 // calculated a clip rectangle for the ancestry if it was needed, and cl ipping this 356 // calculated a clip rectangle for the ancestry if it was needed, and cl ipping this
383 // layer is something that can be done further down the path, when the t ransform has 357 // layer is something that can be done further down the path, when the t ransform has
384 // been applied. 358 // been applied.
385 LayerFragment fragment; 359 LayerFragment fragment;
386 fragment.backgroundRect = paintingInfo.paintDirtyRect; 360 fragment.backgroundRect = paintingInfo.paintDirtyRect;
387 fragments.append(fragment); 361 fragments.append(fragment);
388 } 362 }
389 363
390 for (const auto& fragment: fragments) { 364 for (const auto& fragment: fragments) {
391 OwnPtr<ClipRecorder> clipRecorder; 365 OwnPtr<LayerClipRecorder> clipRecorder;
392 if (parentLayer) { 366 if (parentLayer) {
393 ClipRect clipRectForFragment(clipRect); 367 ClipRect clipRectForFragment(clipRect);
394 clipRectForFragment.moveBy(fragment.paginationOffset); 368 clipRectForFragment.moveBy(fragment.paginationOffset);
395 clipRectForFragment.intersect(fragment.backgroundRect); 369 clipRectForFragment.intersect(fragment.backgroundRect);
396 if (clipRectForFragment.isEmpty()) 370 if (clipRectForFragment.isEmpty())
397 continue; 371 continue;
398 if (needsToClip(paintingInfo, clipRectForFragment)) 372 if (needsToClip(paintingInfo, clipRectForFragment))
399 clipRecorder = adoptPtr(new ClipRecorder(parentLayer->renderer() , context, DisplayItem::ClipLayerParent, clipRectForFragment, &paintingInfo, fra gment.paginationOffset, paintFlags)); 373 clipRecorder = adoptPtr(new LayerClipRecorder(parentLayer->rende rer(), context, DisplayItem::ClipLayerParent, clipRectForFragment, &paintingInfo , fragment.paginationOffset, paintFlags));
400 } 374 }
401 375
402 paintFragmentByApplyingTransform(context, paintingInfo, paintFlags, frag ment.paginationOffset); 376 paintFragmentByApplyingTransform(context, paintingInfo, paintFlags, frag ment.paginationOffset);
403 } 377 }
404 } 378 }
405 379
406 void LayerPainter::paintFragmentByApplyingTransform(GraphicsContext* context, co nst LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, const LayoutPoi nt& fragmentTranslation) 380 void LayerPainter::paintFragmentByApplyingTransform(GraphicsContext* context, co nst LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, const LayoutPoi nt& fragmentTranslation)
407 { 381 {
408 // This involves subtracting out the position of the layer in our current co ordinate space, but preserving 382 // This involves subtracting out the position of the layer in our current co ordinate space, but preserving
409 // the accumulated error for sub-pixel layout. 383 // the accumulated error for sub-pixel layout.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 if (compositingState == PaintsIntoOwnBacking) 458 if (compositingState == PaintsIntoOwnBacking)
485 return LayoutSize(); 459 return LayoutSize();
486 return subPixelAccumulation; 460 return subPixelAccumulation;
487 } 461 }
488 462
489 void LayerPainter::paintOverflowControlsForFragments(const LayerFragments& layer Fragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo, PaintLayerFlags paintFlags) 463 void LayerPainter::paintOverflowControlsForFragments(const LayerFragments& layer Fragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo, PaintLayerFlags paintFlags)
490 { 464 {
491 for (size_t i = 0; i < layerFragments.size(); ++i) { 465 for (size_t i = 0; i < layerFragments.size(); ++i) {
492 const LayerFragment& fragment = layerFragments.at(i); 466 const LayerFragment& fragment = layerFragments.at(i);
493 467
494 OwnPtr<ClipRecorder> clipRecorder; 468 OwnPtr<LayerClipRecorder> clipRecorder;
495 469
496 if (needsToClip(localPaintingInfo, fragment.backgroundRect)) { 470 if (needsToClip(localPaintingInfo, fragment.backgroundRect)) {
497 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.renderer(), c ontext, DisplayItem::ClipLayerOverflowControls, fragment.backgroundRect, &localP aintingInfo, fragment.paginationOffset, paintFlags)); 471 clipRecorder = adoptPtr(new LayerClipRecorder(m_renderLayer.renderer (), context, DisplayItem::ClipLayerOverflowControls, fragment.backgroundRect, &l ocalPaintingInfo, fragment.paginationOffset, paintFlags));
498 } 472 }
499 if (RenderLayerScrollableArea* scrollableArea = m_renderLayer.scrollable Area()) 473 if (RenderLayerScrollableArea* scrollableArea = m_renderLayer.scrollable Area())
500 scrollableArea->paintOverflowControls(context, roundedIntPoint(toPoi nt(fragment.layerBounds.location() - m_renderLayer.renderBoxLocation() + subPixe lAccumulationIfNeeded(localPaintingInfo.subPixelAccumulation, m_renderLayer.comp ositingState()))), pixelSnappedIntRect(fragment.backgroundRect.rect()), true); 474 scrollableArea->paintOverflowControls(context, roundedIntPoint(toPoi nt(fragment.layerBounds.location() - m_renderLayer.renderBoxLocation() + subPixe lAccumulationIfNeeded(localPaintingInfo.subPixelAccumulation, m_renderLayer.comp ositingState()))), pixelSnappedIntRect(fragment.backgroundRect.rect()), true);
501 } 475 }
502 } 476 }
503 477
504 static bool checkContainingBlockChainForPagination(RenderLayerModelObject* rende rer, RenderBox* ancestorColumnsRenderer) 478 static bool checkContainingBlockChainForPagination(RenderLayerModelObject* rende rer, RenderBox* ancestorColumnsRenderer)
505 { 479 {
506 RenderView* view = renderer->view(); 480 RenderView* view = renderer->view();
507 RenderLayerModelObject* prevBlock = renderer; 481 RenderLayerModelObject* prevBlock = renderer;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 LayoutUnit blockDelta = isHorizontal ? colRect.height() : colRect.width( ); 610 LayoutUnit blockDelta = isHorizontal ? colRect.height() : colRect.width( );
637 if (columnBlock->style()->isFlippedBlocksWritingMode()) 611 if (columnBlock->style()->isFlippedBlocksWritingMode())
638 currLogicalTopOffset += blockDelta; 612 currLogicalTopOffset += blockDelta;
639 else 613 else
640 currLogicalTopOffset -= blockDelta; 614 currLogicalTopOffset -= blockDelta;
641 } 615 }
642 } 616 }
643 617
644 void LayerPainter::paintFragmentWithPhase(PaintPhase phase, const LayerFragment& fragment, GraphicsContext* context, const ClipRect& clipRect, const LayerPainti ngInfo& paintingInfo, PaintBehavior paintBehavior, RenderObject* paintingRootFor Renderer, PaintLayerFlags paintFlags, ClipState clipState) 618 void LayerPainter::paintFragmentWithPhase(PaintPhase phase, const LayerFragment& fragment, GraphicsContext* context, const ClipRect& clipRect, const LayerPainti ngInfo& paintingInfo, PaintBehavior paintBehavior, RenderObject* paintingRootFor Renderer, PaintLayerFlags paintFlags, ClipState clipState)
645 { 619 {
646 OwnPtr<ClipRecorder> clipRecorder; 620 OwnPtr<LayerClipRecorder> clipRecorder;
647 if (clipState != HasClipped && paintingInfo.clipToDirtyRect && needsToClip(p aintingInfo, clipRect)) { 621 if (clipState != HasClipped && paintingInfo.clipToDirtyRect && needsToClip(p aintingInfo, clipRect)) {
648 ClipRecorder::BorderRadiusClippingRule clippingRule = ClipRecorder::Incl udeSelfForBorderRadius; 622 LayerClipRecorder::BorderRadiusClippingRule clippingRule = LayerClipReco rder::IncludeSelfForBorderRadius;
649 DisplayItem::Type clipType = DisplayItem::ClipLayerFragmentFloat; 623 DisplayItem::Type clipType = DisplayItem::ClipLayerFragmentFloat;
650 switch (phase) { 624 switch (phase) {
651 case PaintPhaseFloat: 625 case PaintPhaseFloat:
652 break; 626 break;
653 case PaintPhaseForeground: 627 case PaintPhaseForeground:
654 clipType = DisplayItem::ClipLayerFragmentForeground; 628 clipType = DisplayItem::ClipLayerFragmentForeground;
655 break; 629 break;
656 case PaintPhaseChildOutlines: 630 case PaintPhaseChildOutlines:
657 clipType = DisplayItem::ClipLayerFragmentChildOutline; 631 clipType = DisplayItem::ClipLayerFragmentChildOutline;
658 break; 632 break;
659 case PaintPhaseSelection: 633 case PaintPhaseSelection:
660 clipType = DisplayItem::ClipLayerFragmentSelection; 634 clipType = DisplayItem::ClipLayerFragmentSelection;
661 break; 635 break;
662 case PaintPhaseChildBlockBackgrounds: 636 case PaintPhaseChildBlockBackgrounds:
663 clipType = DisplayItem::ClipLayerFragmentChildBlockBackgrounds; 637 clipType = DisplayItem::ClipLayerFragmentChildBlockBackgrounds;
664 break; 638 break;
665 case PaintPhaseBlockBackground: 639 case PaintPhaseBlockBackground:
666 clipType = DisplayItem::ClipLayerBackground; 640 clipType = DisplayItem::ClipLayerBackground;
667 clippingRule = ClipRecorder::DoNotIncludeSelfForBorderRadius; // Bac kground painting will handle clipping to self. 641 clippingRule = LayerClipRecorder::DoNotIncludeSelfForBorderRadius; / / Background painting will handle clipping to self.
668 break; 642 break;
669 case PaintPhaseSelfOutline: 643 case PaintPhaseSelfOutline:
670 clipType = DisplayItem::ClipLayerFragmentOutline; 644 clipType = DisplayItem::ClipLayerFragmentOutline;
671 clippingRule = ClipRecorder::DoNotIncludeSelfForBorderRadius; 645 clippingRule = LayerClipRecorder::DoNotIncludeSelfForBorderRadius;
672 break; 646 break;
673 case PaintPhaseMask: 647 case PaintPhaseMask:
674 clipType = DisplayItem::ClipLayerFragmentMask; 648 clipType = DisplayItem::ClipLayerFragmentMask;
675 clippingRule = ClipRecorder::DoNotIncludeSelfForBorderRadius; // Mas k painting will handle clipping to self. 649 clippingRule = LayerClipRecorder::DoNotIncludeSelfForBorderRadius; / / Mask painting will handle clipping to self.
676 break; 650 break;
677 case PaintPhaseClippingMask: 651 case PaintPhaseClippingMask:
678 clipType = DisplayItem::ClipLayerFragmentClippingMask; 652 clipType = DisplayItem::ClipLayerFragmentClippingMask;
679 break; 653 break;
680 default: 654 default:
681 ASSERT_NOT_REACHED(); 655 ASSERT_NOT_REACHED();
682 } 656 }
683 657
684 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.renderer(), conte xt, clipType, clipRect, &paintingInfo, fragment.paginationOffset, paintFlags, cl ippingRule)); 658 clipRecorder = adoptPtr(new LayerClipRecorder(m_renderLayer.renderer(), context, clipType, clipRect, &paintingInfo, fragment.paginationOffset, paintFlag s, clippingRule));
685 } 659 }
686 660
687 PaintInfo paintInfo(context, pixelSnappedIntRect(clipRect.rect()), phase, pa intBehavior, paintingRootForRenderer, 0, paintingInfo.rootLayer->renderer()); 661 PaintInfo paintInfo(context, pixelSnappedIntRect(clipRect.rect()), phase, pa intBehavior, paintingRootForRenderer, 0, paintingInfo.rootLayer->renderer());
688 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds.loca tion() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(painti ngInfo.subPixelAccumulation, m_renderLayer.compositingState()))); 662 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds.loca tion() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(painti ngInfo.subPixelAccumulation, m_renderLayer.compositingState())));
689 } 663 }
690 664
691 void LayerPainter::paintBackgroundForFragments(const LayerFragments& layerFragme nts, GraphicsContext* context, 665 void LayerPainter::paintBackgroundForFragments(const LayerFragments& layerFragme nts, GraphicsContext* context,
692 const LayoutRect& transparencyPaintDirtyRect, const LayerPaintingInfo& local PaintingInfo, PaintBehavior paintBehavior, 666 const LayoutRect& transparencyPaintDirtyRect, const LayerPaintingInfo& local PaintingInfo, PaintBehavior paintBehavior,
693 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) 667 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags)
694 { 668 {
695 for (const auto& fragment: layerFragments) { 669 for (const auto& fragment: layerFragments) {
696 paintFragmentWithPhase(PaintPhaseBlockBackground, fragment, context, fra gment.backgroundRect, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlags, HasNotClipped); 670 paintFragmentWithPhase(PaintPhaseBlockBackground, fragment, context, fra gment.backgroundRect, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlags, HasNotClipped);
697 } 671 }
698 } 672 }
699 673
700 void LayerPainter::paintForegroundForFragments(const LayerFragments& layerFragme nts, GraphicsContext* context, 674 void LayerPainter::paintForegroundForFragments(const LayerFragments& layerFragme nts, GraphicsContext* context,
701 const LayoutRect& transparencyPaintDirtyRect, const LayerPaintingInfo& local PaintingInfo, PaintBehavior paintBehavior, 675 const LayoutRect& transparencyPaintDirtyRect, const LayerPaintingInfo& local PaintingInfo, PaintBehavior paintBehavior,
702 RenderObject* paintingRootForRenderer, bool selectionOnly, PaintLayerFlags p aintFlags) 676 RenderObject* paintingRootForRenderer, bool selectionOnly, PaintLayerFlags p aintFlags)
703 { 677 {
704 // Optimize clipping for the single fragment case. 678 // Optimize clipping for the single fragment case.
705 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() == 1 && !layerFragments[0].foregroundRect.isEmpty(); 679 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() == 1 && !layerFragments[0].foregroundRect.isEmpty();
706 ClipState clipState = HasNotClipped; 680 ClipState clipState = HasNotClipped;
707 OwnPtr<ClipRecorder> clipRecorder; 681 OwnPtr<LayerClipRecorder> clipRecorder;
708 if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroun dRect)) { 682 if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroun dRect)) {
709 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.renderer(), conte xt, DisplayItem::ClipLayerForeground, layerFragments[0].foregroundRect, &localPa intingInfo, layerFragments[0].paginationOffset, paintFlags)); 683 clipRecorder = adoptPtr(new LayerClipRecorder(m_renderLayer.renderer(), context, DisplayItem::ClipLayerForeground, layerFragments[0].foregroundRect, &lo calPaintingInfo, layerFragments[0].paginationOffset, paintFlags));
710 clipState = HasClipped; 684 clipState = HasClipped;
711 } 685 }
712 686
713 // We have to loop through every fragment multiple times, since we have to i ssue paint invalidations in each specific phase in order for 687 // We have to loop through every fragment multiple times, since we have to i ssue paint invalidations in each specific phase in order for
714 // interleaving of the fragments to work properly. 688 // interleaving of the fragments to work properly.
715 paintForegroundForFragmentsWithPhase(selectionOnly ? PaintPhaseSelection : P aintPhaseChildBlockBackgrounds, layerFragments, 689 paintForegroundForFragmentsWithPhase(selectionOnly ? PaintPhaseSelection : P aintPhaseChildBlockBackgrounds, layerFragments,
716 context, localPaintingInfo, paintBehavior, paintingRootForRenderer, pain tFlags, clipState); 690 context, localPaintingInfo, paintBehavior, paintingRootForRenderer, pain tFlags, clipState);
717 691
718 if (!selectionOnly) { 692 if (!selectionOnly) {
719 paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments, co ntext, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlags, cl ipState); 693 paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments, co ntext, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlags, cl ipState);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 if (!m_renderLayer.containsDirtyOverlayScrollbars()) 733 if (!m_renderLayer.containsDirtyOverlayScrollbars())
760 return; 734 return;
761 735
762 LayerPaintingInfo paintingInfo(&m_renderLayer, enclosingIntRect(damageRect), paintBehavior, LayoutSize(), paintingRoot); 736 LayerPaintingInfo paintingInfo(&m_renderLayer, enclosingIntRect(damageRect), paintBehavior, LayoutSize(), paintingRoot);
763 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); 737 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars);
764 738
765 m_renderLayer.setContainsDirtyOverlayScrollbars(false); 739 m_renderLayer.setContainsDirtyOverlayScrollbars(false);
766 } 740 }
767 741
768 } // namespace blink 742 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698