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

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

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

Powered by Google App Engine
This is Rietveld 408576698