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

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

Issue 1144203004: Allow certain SP recorder classes to defer their "begin" operation. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 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 | 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/DeprecatedPaintLayerPainter.h" 6 #include "core/paint/DeprecatedPaintLayerPainter.h"
7 7
8 #include "core/frame/Settings.h" 8 #include "core/frame/Settings.h"
9 #include "core/layout/ClipPathOperation.h" 9 #include "core/layout/ClipPathOperation.h"
10 #include "core/layout/LayoutBlock.h" 10 #include "core/layout/LayoutBlock.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 else 205 else
206 offsetFromRoot.move(paintingInfo.subPixelAccumulation); 206 offsetFromRoot.move(paintingInfo.subPixelAccumulation);
207 207
208 LayoutRect rootRelativeBounds; 208 LayoutRect rootRelativeBounds;
209 bool rootRelativeBoundsComputed = false; 209 bool rootRelativeBoundsComputed = false;
210 210
211 // These helpers output clip and compositing operations using a RAII pattern . Stack-allocated-varibles are destructed in the reverse order of construction, 211 // These helpers output clip and compositing operations using a RAII pattern . Stack-allocated-varibles are destructed in the reverse order of construction,
212 // so they are nested properly. 212 // so they are nested properly.
213 ClipPathHelper clipPathHelper(context, m_paintLayer, paintingInfo, rootRelat iveBounds, rootRelativeBoundsComputed, offsetFromRoot, paintFlags); 213 ClipPathHelper clipPathHelper(context, m_paintLayer, paintingInfo, rootRelat iveBounds, rootRelativeBoundsComputed, offsetFromRoot, paintFlags);
214 214
215 OwnPtr<LayerClipRecorder> clipRecorder; 215 LayerClipRecorder clipRecorder(*context, DisplayItem::TransparencyClip);
216 OwnPtr<CompositingRecorder> compositingRecorder; 216 CompositingRecorder compositingRecorder(*context, *m_paintLayer.layoutObject ());
217 // Blending operations must be performed only with the nearest ancestor stac king context. 217 // Blending operations must be performed only with the nearest ancestor stac king context.
218 // Note that there is no need to composite if we're painting the root. 218 // Note that there is no need to composite if we're painting the root.
219 // FIXME: this should be unified further into DeprecatedPaintLayer::paintsWi thTransparency(). 219 // FIXME: this should be unified further into DeprecatedPaintLayer::paintsWi thTransparency().
220 bool shouldCompositeForBlendMode = (!m_paintLayer.layoutObject()->isDocument Element() || m_paintLayer.layoutObject()->isSVGRoot()) && m_paintLayer.stackingN ode()->isStackingContext() && m_paintLayer.hasNonIsolatedDescendantWithBlendMode (); 220 bool shouldCompositeForBlendMode = (!m_paintLayer.layoutObject()->isDocument Element() || m_paintLayer.layoutObject()->isSVGRoot()) && m_paintLayer.stackingN ode()->isStackingContext() && m_paintLayer.hasNonIsolatedDescendantWithBlendMode ();
221 if (shouldCompositeForBlendMode || m_paintLayer.paintsWithTransparency(paint ingInfo.paintBehavior)) { 221 if (shouldCompositeForBlendMode || m_paintLayer.paintsWithTransparency(paint ingInfo.paintBehavior)) {
222 clipRecorder = adoptPtr(new LayerClipRecorder(*context, *m_paintLayer.la youtObject(), DisplayItem::TransparencyClip, 222 clipRecorder.begin(*m_paintLayer.layoutObject(),
223 m_paintLayer.paintingExtent(paintingInfo.rootLayer, paintingInfo.pai ntDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.paintBehavior), 223 m_paintLayer.paintingExtent(paintingInfo.rootLayer, paintingInfo.pai ntDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.paintBehavior),
224 &paintingInfo, LayoutPoint(), paintFlags)); 224 &paintingInfo, LayoutPoint(), paintFlags);
225 225 compositingRecorder.begin(
226 compositingRecorder = adoptPtr(new CompositingRecorder(*context, *m_pain tLayer.layoutObject(),
227 WebCoreCompositeToSkiaComposite(CompositeSourceOver, m_paintLayer.la youtObject()->style()->blendMode()), 226 WebCoreCompositeToSkiaComposite(CompositeSourceOver, m_paintLayer.la youtObject()->style()->blendMode()),
228 m_paintLayer.layoutObject()->opacity())); 227 m_paintLayer.layoutObject()->opacity());
229 } 228 }
230 229
231 DeprecatedPaintLayerPaintingInfo localPaintingInfo(paintingInfo); 230 DeprecatedPaintLayerPaintingInfo localPaintingInfo(paintingInfo);
232 231
233 DeprecatedPaintLayerFragments layerFragments; 232 DeprecatedPaintLayerFragments layerFragments;
234 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) { 233 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) {
235 // Collect the fragments. This will compute the clip rectangles and pain t offsets for each layer fragment. 234 // Collect the fragments. This will compute the clip rectangles and pain t offsets for each layer fragment.
236 ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects ) ? UncachedClipRects : PaintingClipRects; 235 ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects ) ? UncachedClipRects : PaintingClipRects;
237 ShouldRespectOverflowClip respectOverflowClip = shouldRespectOverflowCli p(paintFlags, m_paintLayer.layoutObject()); 236 ShouldRespectOverflowClip respectOverflowClip = shouldRespectOverflowCli p(paintFlags, m_paintLayer.layoutObject());
238 if (fragmentPolicy == ForceSingleFragment) 237 if (fragmentPolicy == ForceSingleFragment)
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 // calculated a clip rectangle for the ancestry if it was needed, and cl ipping this 367 // calculated a clip rectangle for the ancestry if it was needed, and cl ipping this
369 // layer is something that can be done further down the path, when the t ransform has 368 // layer is something that can be done further down the path, when the t ransform has
370 // been applied. 369 // been applied.
371 DeprecatedPaintLayerFragment fragment; 370 DeprecatedPaintLayerFragment fragment;
372 fragment.backgroundRect = paintingInfo.paintDirtyRect; 371 fragment.backgroundRect = paintingInfo.paintDirtyRect;
373 fragments.append(fragment); 372 fragments.append(fragment);
374 } 373 }
375 374
376 bool needsScope = fragments.size() > 1; 375 bool needsScope = fragments.size() > 1;
377 for (const auto& fragment: fragments) { 376 for (const auto& fragment: fragments) {
378 OwnPtr<ScopeRecorder> scopeRecorder; 377 ScopeRecorder scopeRecorder(*context, *m_paintLayer.layoutObject(), Scop eRecorder::DeferBegin);
379 if (needsScope) 378 if (needsScope)
380 scopeRecorder = adoptPtr(new ScopeRecorder(*context, *m_paintLayer.l ayoutObject())); 379 scopeRecorder.begin();
381 OwnPtr<LayerClipRecorder> clipRecorder; 380 LayerClipRecorder clipRecorder(*context, DisplayItem::ClipLayerParent);
382 if (parentLayer) { 381 if (parentLayer) {
383 ClipRect clipRectForFragment(ancestorBackgroundClipRect); 382 ClipRect clipRectForFragment(ancestorBackgroundClipRect);
384 clipRectForFragment.moveBy(fragment.paginationOffset); 383 clipRectForFragment.moveBy(fragment.paginationOffset);
385 clipRectForFragment.intersect(fragment.backgroundRect); 384 clipRectForFragment.intersect(fragment.backgroundRect);
386 if (clipRectForFragment.isEmpty()) 385 if (clipRectForFragment.isEmpty())
387 continue; 386 continue;
388 if (needsToClip(paintingInfo, clipRectForFragment)) 387 if (needsToClip(paintingInfo, clipRectForFragment))
389 clipRecorder = adoptPtr(new LayerClipRecorder(*context, *parentL ayer->layoutObject(), DisplayItem::ClipLayerParent, clipRectForFragment, &painti ngInfo, fragment.paginationOffset, paintFlags)); 388 clipRecorder.begin(*parentLayer->layoutObject(), clipRectForFrag ment, &paintingInfo, fragment.paginationOffset, paintFlags);
390 } 389 }
391 390
392 paintFragmentByApplyingTransform(context, paintingInfo, paintFlags, frag ment.paginationOffset); 391 paintFragmentByApplyingTransform(context, paintingInfo, paintFlags, frag ment.paginationOffset);
393 } 392 }
394 } 393 }
395 394
396 void DeprecatedPaintLayerPainter::paintFragmentByApplyingTransform(GraphicsConte xt* context, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFla gs paintFlags, const LayoutPoint& fragmentTranslation) 395 void DeprecatedPaintLayerPainter::paintFragmentByApplyingTransform(GraphicsConte xt* context, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFla gs paintFlags, const LayoutPoint& fragmentTranslation)
397 { 396 {
398 // This involves subtracting out the position of the layer in our current co ordinate space, but preserving 397 // This involves subtracting out the position of the layer in our current co ordinate space, but preserving
399 // the accumulated error for sub-pixel layout. 398 // the accumulated error for sub-pixel layout.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 return m_paintLayer.compositingState() == NotComposited 449 return m_paintLayer.compositingState() == NotComposited
451 || (paintingInfo.paintBehavior & PaintBehaviorFlattenCompositingLayers) 450 || (paintingInfo.paintBehavior & PaintBehaviorFlattenCompositingLayers)
452 || ((paintFlags & PaintLayerPaintingReflection) && !m_paintLayer.has3DTr ansform()) 451 || ((paintFlags & PaintLayerPaintingReflection) && !m_paintLayer.has3DTr ansform())
453 || paintForFixedRootBackground(&m_paintLayer, paintFlags); 452 || paintForFixedRootBackground(&m_paintLayer, paintFlags);
454 } 453 }
455 454
456 void DeprecatedPaintLayerPainter::paintOverflowControlsForFragments(const Deprec atedPaintLayerFragments& layerFragments, GraphicsContext* context, const Depreca tedPaintLayerPaintingInfo& localPaintingInfo, PaintLayerFlags paintFlags) 455 void DeprecatedPaintLayerPainter::paintOverflowControlsForFragments(const Deprec atedPaintLayerFragments& layerFragments, GraphicsContext* context, const Depreca tedPaintLayerPaintingInfo& localPaintingInfo, PaintLayerFlags paintFlags)
457 { 456 {
458 bool needsScope = layerFragments.size() > 1; 457 bool needsScope = layerFragments.size() > 1;
459 for (auto& fragment : layerFragments) { 458 for (auto& fragment : layerFragments) {
460 OwnPtr<ScopeRecorder> scopeRecorder; 459 ScopeRecorder scopeRecorder(*context, *m_paintLayer.layoutObject(), Scop eRecorder::DeferBegin);
461 if (needsScope) 460 if (needsScope)
462 scopeRecorder = adoptPtr(new ScopeRecorder(*context, *m_paintLayer.l ayoutObject())); 461 scopeRecorder.begin();
463 462
464 OwnPtr<LayerClipRecorder> clipRecorder; 463 LayerClipRecorder clipRecorder(*context, DisplayItem::ClipLayerOverflowC ontrols);
465 464
466 if (needsToClip(localPaintingInfo, fragment.backgroundRect)) { 465 if (needsToClip(localPaintingInfo, fragment.backgroundRect)) {
467 clipRecorder = adoptPtr(new LayerClipRecorder(*context, *m_paintLaye r.layoutObject(), DisplayItem::ClipLayerOverflowControls, fragment.backgroundRec t, &localPaintingInfo, fragment.paginationOffset, paintFlags)); 466 clipRecorder.begin(*m_paintLayer.layoutObject(), fragment.background Rect, &localPaintingInfo, fragment.paginationOffset, paintFlags);
468 } 467 }
469 if (DeprecatedPaintLayerScrollableArea* scrollableArea = m_paintLayer.sc rollableArea()) 468 if (DeprecatedPaintLayerScrollableArea* scrollableArea = m_paintLayer.sc rollableArea())
470 ScrollableAreaPainter(*scrollableArea).paintOverflowControls(context , roundedIntPoint(toPoint(fragment.layerBounds.location() - m_paintLayer.layoutB oxLocation())), pixelSnappedIntRect(fragment.backgroundRect.rect()), true); 469 ScrollableAreaPainter(*scrollableArea).paintOverflowControls(context , roundedIntPoint(toPoint(fragment.layerBounds.location() - m_paintLayer.layoutB oxLocation())), pixelSnappedIntRect(fragment.backgroundRect.rect()), true);
471 } 470 }
472 } 471 }
473 472
474 static bool checkContainingBlockChainForPagination(LayoutBoxModelObject* layoutO bject, LayoutBox* ancestorColumnsLayoutObject) 473 static bool checkContainingBlockChainForPagination(LayoutBoxModelObject* layoutO bject, LayoutBox* ancestorColumnsLayoutObject)
475 { 474 {
476 LayoutView* view = layoutObject->view(); 475 LayoutView* view = layoutObject->view();
477 LayoutBoxModelObject* prevBlock = layoutObject; 476 LayoutBoxModelObject* prevBlock = layoutObject;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 currLogicalTopOffset += blockDelta; 604 currLogicalTopOffset += blockDelta;
606 else 605 else
607 currLogicalTopOffset -= blockDelta; 606 currLogicalTopOffset -= blockDelta;
608 } 607 }
609 } 608 }
610 609
611 void DeprecatedPaintLayerPainter::paintFragmentWithPhase(PaintPhase phase, const DeprecatedPaintLayerFragment& fragment, GraphicsContext* context, const ClipRec t& clipRect, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintBehavior paintBehavior, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paint Flags, ClipState clipState) 610 void DeprecatedPaintLayerPainter::paintFragmentWithPhase(PaintPhase phase, const DeprecatedPaintLayerFragment& fragment, GraphicsContext* context, const ClipRec t& clipRect, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintBehavior paintBehavior, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paint Flags, ClipState clipState)
612 { 611 {
613 ASSERT(m_paintLayer.isSelfPaintingLayer()); 612 ASSERT(m_paintLayer.isSelfPaintingLayer());
614 613
615 OwnPtr<LayerClipRecorder> clipRecorder; 614 DisplayItem::Type clipType = DisplayItem::paintPhaseToClipLayerFragmentType( phase);
615 LayerClipRecorder clipRecorder(*context, clipType);
616 if (clipState != HasClipped && paintingInfo.clipToDirtyRect && needsToClip(p aintingInfo, clipRect)) { 616 if (clipState != HasClipped && paintingInfo.clipToDirtyRect && needsToClip(p aintingInfo, clipRect)) {
617 DisplayItem::Type clipType = DisplayItem::paintPhaseToClipLayerFragmentT ype(phase);
618 LayerClipRecorder::BorderRadiusClippingRule clippingRule; 617 LayerClipRecorder::BorderRadiusClippingRule clippingRule;
619 switch (phase) { 618 switch (phase) {
620 case PaintPhaseBlockBackground: // Background painting will handle clipp ing to self. 619 case PaintPhaseBlockBackground: // Background painting will handle clipp ing to self.
621 case PaintPhaseSelfOutline: 620 case PaintPhaseSelfOutline:
622 case PaintPhaseMask: // Mask painting will handle clipping to self. 621 case PaintPhaseMask: // Mask painting will handle clipping to self.
623 clippingRule = LayerClipRecorder::DoNotIncludeSelfForBorderRadius; 622 clippingRule = LayerClipRecorder::DoNotIncludeSelfForBorderRadius;
624 break; 623 break;
625 default: 624 default:
626 clippingRule = LayerClipRecorder::IncludeSelfForBorderRadius; 625 clippingRule = LayerClipRecorder::IncludeSelfForBorderRadius;
627 break; 626 break;
628 } 627 }
629 628 clipRecorder.begin(*m_paintLayer.layoutObject(), clipRect, &paintingInfo , fragment.paginationOffset, paintFlags, clippingRule);
630 clipRecorder = adoptPtr(new LayerClipRecorder(*context, *m_paintLayer.la youtObject(), clipType, clipRect, &paintingInfo, fragment.paginationOffset, pain tFlags, clippingRule));
631 } 629 }
632 630
633 PaintInfo paintInfo(context, pixelSnappedIntRect(clipRect.rect()), phase, pa intBehavior, paintingRootForLayoutObject, 0, paintingInfo.rootLayer->layoutObjec t()); 631 PaintInfo paintInfo(context, pixelSnappedIntRect(clipRect.rect()), phase, pa intBehavior, paintingRootForLayoutObject, 0, paintingInfo.rootLayer->layoutObjec t());
634 OwnPtr<ScrollRecorder> scrollRecorder; 632 ScrollRecorder scrollRecorder(*paintInfo.context, *m_paintLayer.layoutObject (), phase);
635 LayoutPoint paintOffset = toPoint(fragment.layerBounds.location() - m_paintL ayer.layoutBoxLocation()); 633 LayoutPoint paintOffset = toPoint(fragment.layerBounds.location() - m_paintL ayer.layoutBoxLocation());
636 if (&m_paintLayer != paintingInfo.rootLayer && paintingInfo.rootLayer->layou tObject()->hasOverflowClip()) { 634 if (&m_paintLayer != paintingInfo.rootLayer && paintingInfo.rootLayer->layou tObject()->hasOverflowClip()) {
637 // As a sublayer of the root layer, m_paintLayer's painting is not contr olled by the ScrollRecorder 635 // As a sublayer of the root layer, m_paintLayer's painting is not contr olled by the ScrollRecorder
638 // created by BlockPainter of the root layer, so we need to issue Scroll Recorder for them separately. 636 // created by BlockPainter of the root layer, so we need to issue Scroll Recorder for them separately.
639 // FIXME: This doesn't apply in slimming paint phase 2. 637 // FIXME: This doesn't apply in slimming paint phase 2.
640 IntSize scrollOffset = paintingInfo.rootLayer->layoutBox()->scrolledCont entOffset(); 638 IntSize scrollOffset = paintingInfo.rootLayer->layoutBox()->scrolledCont entOffset();
641 if (paintingInfo.rootLayer->scrollsOverflow() || !scrollOffset.isZero()) { 639 if (paintingInfo.rootLayer->scrollsOverflow() || !scrollOffset.isZero()) {
642 paintOffset += scrollOffset; 640 paintOffset += scrollOffset;
643 paintInfo.rect.move(scrollOffset); 641 paintInfo.rect.move(scrollOffset);
644 scrollRecorder = adoptPtr(new ScrollRecorder(*paintInfo.context, *m_ paintLayer.layoutObject(), paintInfo.phase, scrollOffset)); 642 scrollRecorder.begin(scrollOffset);
645 } 643 }
646 } 644 }
647 m_paintLayer.layoutObject()->paint(paintInfo, paintOffset); 645 m_paintLayer.layoutObject()->paint(paintInfo, paintOffset);
648 } 646 }
649 647
650 void DeprecatedPaintLayerPainter::paintBackgroundForFragments(const DeprecatedPa intLayerFragments& layerFragments, GraphicsContext* context, 648 void DeprecatedPaintLayerPainter::paintBackgroundForFragments(const DeprecatedPa intLayerFragments& layerFragments, GraphicsContext* context,
651 const LayoutRect& transparencyPaintDirtyRect, const DeprecatedPaintLayerPain tingInfo& localPaintingInfo, PaintBehavior paintBehavior, 649 const LayoutRect& transparencyPaintDirtyRect, const DeprecatedPaintLayerPain tingInfo& localPaintingInfo, PaintBehavior paintBehavior,
652 LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paintFlags) 650 LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paintFlags)
653 { 651 {
654 bool needsScope = layerFragments.size() > 1; 652 bool needsScope = layerFragments.size() > 1;
655 for (auto& fragment: layerFragments) { 653 for (auto& fragment: layerFragments) {
656 OwnPtr<ScopeRecorder> scopeRecorder; 654 ScopeRecorder scopeRecorder(*context, *m_paintLayer.layoutObject(), Scop eRecorder::DeferBegin);
657 if (needsScope) 655 if (needsScope)
658 scopeRecorder = adoptPtr(new ScopeRecorder(*context, *m_paintLayer.l ayoutObject())); 656 scopeRecorder.begin();
659 paintFragmentWithPhase(PaintPhaseBlockBackground, fragment, context, fra gment.backgroundRect, localPaintingInfo, paintBehavior, paintingRootForLayoutObj ect, paintFlags, HasNotClipped); 657 paintFragmentWithPhase(PaintPhaseBlockBackground, fragment, context, fra gment.backgroundRect, localPaintingInfo, paintBehavior, paintingRootForLayoutObj ect, paintFlags, HasNotClipped);
660 } 658 }
661 } 659 }
662 660
663 void DeprecatedPaintLayerPainter::paintForegroundForFragments(const DeprecatedPa intLayerFragments& layerFragments, GraphicsContext* context, 661 void DeprecatedPaintLayerPainter::paintForegroundForFragments(const DeprecatedPa intLayerFragments& layerFragments, GraphicsContext* context,
664 const LayoutRect& transparencyPaintDirtyRect, const DeprecatedPaintLayerPain tingInfo& localPaintingInfo, PaintBehavior paintBehavior, 662 const LayoutRect& transparencyPaintDirtyRect, const DeprecatedPaintLayerPain tingInfo& localPaintingInfo, PaintBehavior paintBehavior,
665 LayoutObject* paintingRootForLayoutObject, bool selectionOnly, PaintLayerFla gs paintFlags) 663 LayoutObject* paintingRootForLayoutObject, bool selectionOnly, PaintLayerFla gs paintFlags)
666 { 664 {
667 // Optimize clipping for the single fragment case. 665 // Optimize clipping for the single fragment case.
668 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() == 1 && !layerFragments[0].foregroundRect.isEmpty(); 666 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() == 1 && !layerFragments[0].foregroundRect.isEmpty();
669 ClipState clipState = HasNotClipped; 667 ClipState clipState = HasNotClipped;
670 OwnPtr<LayerClipRecorder> clipRecorder; 668 LayerClipRecorder clipRecorder(*context, DisplayItem::ClipLayerForeground);
671 if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroun dRect)) { 669 if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroun dRect)) {
672 clipRecorder = adoptPtr(new LayerClipRecorder(*context, *m_paintLayer.la youtObject(), DisplayItem::ClipLayerForeground, layerFragments[0].foregroundRect , &localPaintingInfo, layerFragments[0].paginationOffset, paintFlags)); 670 clipRecorder.begin(*m_paintLayer.layoutObject(), layerFragments[0].foreg roundRect, &localPaintingInfo, layerFragments[0].paginationOffset, paintFlags);
673 clipState = HasClipped; 671 clipState = HasClipped;
674 } 672 }
675 673
676 // We have to loop through every fragment multiple times, since we have to i ssue paint invalidations in each specific phase in order for 674 // We have to loop through every fragment multiple times, since we have to i ssue paint invalidations in each specific phase in order for
677 // interleaving of the fragments to work properly. 675 // interleaving of the fragments to work properly.
678 paintForegroundForFragmentsWithPhase(selectionOnly ? PaintPhaseSelection : P aintPhaseChildBlockBackgrounds, layerFragments, 676 paintForegroundForFragmentsWithPhase(selectionOnly ? PaintPhaseSelection : P aintPhaseChildBlockBackgrounds, layerFragments,
679 context, localPaintingInfo, paintBehavior, paintingRootForLayoutObject, paintFlags, clipState); 677 context, localPaintingInfo, paintBehavior, paintingRootForLayoutObject, paintFlags, clipState);
680 678
681 if (!selectionOnly) { 679 if (!selectionOnly) {
682 paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments, co ntext, localPaintingInfo, paintBehavior, paintingRootForLayoutObject, paintFlags , clipState); 680 paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments, co ntext, localPaintingInfo, paintBehavior, paintingRootForLayoutObject, paintFlags , clipState);
683 paintForegroundForFragmentsWithPhase(PaintPhaseForeground, layerFragment s, context, localPaintingInfo, paintBehavior, paintingRootForLayoutObject, paint Flags, clipState); 681 paintForegroundForFragmentsWithPhase(PaintPhaseForeground, layerFragment s, context, localPaintingInfo, paintBehavior, paintingRootForLayoutObject, paint Flags, clipState);
684 paintForegroundForFragmentsWithPhase(PaintPhaseChildOutlines, layerFragm ents, context, localPaintingInfo, paintBehavior, paintingRootForLayoutObject, pa intFlags, clipState); 682 paintForegroundForFragmentsWithPhase(PaintPhaseChildOutlines, layerFragm ents, context, localPaintingInfo, paintBehavior, paintingRootForLayoutObject, pa intFlags, clipState);
685 } 683 }
686 } 684 }
687 685
688 void DeprecatedPaintLayerPainter::paintForegroundForFragmentsWithPhase(PaintPhas e phase, const DeprecatedPaintLayerFragments& layerFragments, GraphicsContext* c ontext, 686 void DeprecatedPaintLayerPainter::paintForegroundForFragmentsWithPhase(PaintPhas e phase, const DeprecatedPaintLayerFragments& layerFragments, GraphicsContext* c ontext,
689 const DeprecatedPaintLayerPaintingInfo& localPaintingInfo, PaintBehavior pai ntBehavior, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paintFlag s, ClipState clipState) 687 const DeprecatedPaintLayerPaintingInfo& localPaintingInfo, PaintBehavior pai ntBehavior, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paintFlag s, ClipState clipState)
690 { 688 {
691 bool needsScope = layerFragments.size() > 1; 689 bool needsScope = layerFragments.size() > 1;
692 for (auto& fragment: layerFragments) { 690 for (auto& fragment: layerFragments) {
693 if (!fragment.foregroundRect.isEmpty()) { 691 if (!fragment.foregroundRect.isEmpty()) {
694 OwnPtr<ScopeRecorder> scopeRecorder; 692 ScopeRecorder scopeRecorder(*context, *m_paintLayer.layoutObject(), ScopeRecorder::DeferBegin);
695 if (needsScope) 693 if (needsScope)
696 scopeRecorder = adoptPtr(new ScopeRecorder(*context, *m_paintLay er.layoutObject())); 694 scopeRecorder.begin();
697 paintFragmentWithPhase(phase, fragment, context, fragment.foreground Rect, localPaintingInfo, paintBehavior, paintingRootForLayoutObject, paintFlags, clipState); 695 paintFragmentWithPhase(phase, fragment, context, fragment.foreground Rect, localPaintingInfo, paintBehavior, paintingRootForLayoutObject, paintFlags, clipState);
698 } 696 }
699 } 697 }
700 } 698 }
701 699
702 void DeprecatedPaintLayerPainter::paintOutlineForFragments(const DeprecatedPaint LayerFragments& layerFragments, GraphicsContext* context, const DeprecatedPaintL ayerPaintingInfo& localPaintingInfo, 700 void DeprecatedPaintLayerPainter::paintOutlineForFragments(const DeprecatedPaint LayerFragments& layerFragments, GraphicsContext* context, const DeprecatedPaintL ayerPaintingInfo& localPaintingInfo,
703 PaintBehavior paintBehavior, LayoutObject* paintingRootForLayoutObject, Pain tLayerFlags paintFlags) 701 PaintBehavior paintBehavior, LayoutObject* paintingRootForLayoutObject, Pain tLayerFlags paintFlags)
704 { 702 {
705 bool needsScope = layerFragments.size() > 1; 703 bool needsScope = layerFragments.size() > 1;
706 for (auto& fragment: layerFragments) { 704 for (auto& fragment: layerFragments) {
707 if (!fragment.outlineRect.isEmpty()) { 705 if (!fragment.outlineRect.isEmpty()) {
708 OwnPtr<ScopeRecorder> scopeRecorder; 706 ScopeRecorder scopeRecorder(*context, *m_paintLayer.layoutObject());
709 if (needsScope) 707 if (needsScope)
710 scopeRecorder = adoptPtr(new ScopeRecorder(*context, *m_paintLay er.layoutObject())); 708 scopeRecorder.begin();
711 paintFragmentWithPhase(PaintPhaseSelfOutline, fragment, context, fra gment.outlineRect, localPaintingInfo, paintBehavior, paintingRootForLayoutObject , paintFlags, HasNotClipped); 709 paintFragmentWithPhase(PaintPhaseSelfOutline, fragment, context, fra gment.outlineRect, localPaintingInfo, paintBehavior, paintingRootForLayoutObject , paintFlags, HasNotClipped);
712 } 710 }
713 } 711 }
714 } 712 }
715 713
716 void DeprecatedPaintLayerPainter::paintMaskForFragments(const DeprecatedPaintLay erFragments& layerFragments, GraphicsContext* context, const DeprecatedPaintLaye rPaintingInfo& localPaintingInfo, 714 void DeprecatedPaintLayerPainter::paintMaskForFragments(const DeprecatedPaintLay erFragments& layerFragments, GraphicsContext* context, const DeprecatedPaintLaye rPaintingInfo& localPaintingInfo,
717 LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paintFlags) 715 LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paintFlags)
718 { 716 {
719 bool needsScope = layerFragments.size() > 1; 717 bool needsScope = layerFragments.size() > 1;
720 for (auto& fragment: layerFragments) { 718 for (auto& fragment: layerFragments) {
721 OwnPtr<ScopeRecorder> scopeRecorder; 719 ScopeRecorder scopeRecorder(*context, *m_paintLayer.layoutObject());
722 if (needsScope) 720 if (needsScope)
723 scopeRecorder = adoptPtr(new ScopeRecorder(*context, *m_paintLayer.l ayoutObject())); 721 scopeRecorder.begin();
724 paintFragmentWithPhase(PaintPhaseMask, fragment, context, fragment.backg roundRect, localPaintingInfo, PaintBehaviorNormal, paintingRootForLayoutObject, paintFlags, HasNotClipped); 722 paintFragmentWithPhase(PaintPhaseMask, fragment, context, fragment.backg roundRect, localPaintingInfo, PaintBehaviorNormal, paintingRootForLayoutObject, paintFlags, HasNotClipped);
725 } 723 }
726 } 724 }
727 725
728 void DeprecatedPaintLayerPainter::paintChildClippingMaskForFragments(const Depre catedPaintLayerFragments& layerFragments, GraphicsContext* context, const Deprec atedPaintLayerPaintingInfo& localPaintingInfo, 726 void DeprecatedPaintLayerPainter::paintChildClippingMaskForFragments(const Depre catedPaintLayerFragments& layerFragments, GraphicsContext* context, const Deprec atedPaintLayerPaintingInfo& localPaintingInfo,
729 LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paintFlags) 727 LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paintFlags)
730 { 728 {
731 bool needsScope = layerFragments.size() > 1; 729 bool needsScope = layerFragments.size() > 1;
732 for (auto& fragment: layerFragments) { 730 for (auto& fragment: layerFragments) {
733 OwnPtr<ScopeRecorder> scopeRecorder; 731 ScopeRecorder scopeRecorder(*context, *m_paintLayer.layoutObject());
734 if (needsScope) 732 if (needsScope)
735 scopeRecorder = adoptPtr(new ScopeRecorder(*context, *m_paintLayer.l ayoutObject())); 733 scopeRecorder.begin();
736 paintFragmentWithPhase(PaintPhaseClippingMask, fragment, context, fragme nt.foregroundRect, localPaintingInfo, PaintBehaviorNormal, paintingRootForLayout Object, paintFlags, HasNotClipped); 734 paintFragmentWithPhase(PaintPhaseClippingMask, fragment, context, fragme nt.foregroundRect, localPaintingInfo, PaintBehaviorNormal, paintingRootForLayout Object, paintFlags, HasNotClipped);
737 } 735 }
738 } 736 }
739 737
740 void DeprecatedPaintLayerPainter::paintOverlayScrollbars(GraphicsContext* contex t, const LayoutRect& damageRect, PaintBehavior paintBehavior, LayoutObject* pain tingRoot) 738 void DeprecatedPaintLayerPainter::paintOverlayScrollbars(GraphicsContext* contex t, const LayoutRect& damageRect, PaintBehavior paintBehavior, LayoutObject* pain tingRoot)
741 { 739 {
742 if (!m_paintLayer.containsDirtyOverlayScrollbars()) 740 if (!m_paintLayer.containsDirtyOverlayScrollbars())
743 return; 741 return;
744 742
745 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl osingIntRect(damageRect)), paintBehavior, LayoutSize(), paintingRoot); 743 DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(encl osingIntRect(damageRect)), paintBehavior, LayoutSize(), paintingRoot);
746 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); 744 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars);
747 745
748 m_paintLayer.setContainsDirtyOverlayScrollbars(false); 746 m_paintLayer.setContainsDirtyOverlayScrollbars(false);
749 } 747 }
750 748
751 } // namespace blink 749 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/CompositingRecorder.cpp ('k') | Source/core/paint/FileUploadControlPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698