OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 if (compositingState == PaintsIntoOwnBacking) | 459 if (compositingState == PaintsIntoOwnBacking) |
486 return LayoutSize(); | 460 return LayoutSize(); |
487 return subPixelAccumulation; | 461 return subPixelAccumulation; |
488 } | 462 } |
489 | 463 |
490 void LayerPainter::paintOverflowControlsForFragments(const LayerFragments& layer
Fragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo,
PaintLayerFlags paintFlags) | 464 void LayerPainter::paintOverflowControlsForFragments(const LayerFragments& layer
Fragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo,
PaintLayerFlags paintFlags) |
491 { | 465 { |
492 for (size_t i = 0; i < layerFragments.size(); ++i) { | 466 for (size_t i = 0; i < layerFragments.size(); ++i) { |
493 const LayerFragment& fragment = layerFragments.at(i); | 467 const LayerFragment& fragment = layerFragments.at(i); |
494 | 468 |
495 OwnPtr<ClipRecorder> clipRecorder; | 469 OwnPtr<LayerClipRecorder> clipRecorder; |
496 | 470 |
497 if (needsToClip(localPaintingInfo, fragment.backgroundRect)) { | 471 if (needsToClip(localPaintingInfo, fragment.backgroundRect)) { |
498 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.renderer(), c
ontext, DisplayItem::ClipLayerOverflowControls, fragment.backgroundRect, &localP
aintingInfo, fragment.paginationOffset, paintFlags)); | 472 clipRecorder = adoptPtr(new LayerClipRecorder(m_renderLayer.renderer
(), context, DisplayItem::ClipLayerOverflowControls, fragment.backgroundRect, &l
ocalPaintingInfo, fragment.paginationOffset, paintFlags)); |
499 } | 473 } |
500 if (RenderLayerScrollableArea* scrollableArea = m_renderLayer.scrollable
Area()) | 474 if (RenderLayerScrollableArea* scrollableArea = m_renderLayer.scrollable
Area()) |
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); | 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); |
502 } | 476 } |
503 } | 477 } |
504 | 478 |
505 static bool checkContainingBlockChainForPagination(RenderLayerModelObject* rende
rer, RenderBox* ancestorColumnsRenderer) | 479 static bool checkContainingBlockChainForPagination(RenderLayerModelObject* rende
rer, RenderBox* ancestorColumnsRenderer) |
506 { | 480 { |
507 RenderView* view = renderer->view(); | 481 RenderView* view = renderer->view(); |
508 RenderLayerModelObject* prevBlock = renderer; | 482 RenderLayerModelObject* prevBlock = renderer; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 LayoutUnit blockDelta = isHorizontal ? colRect.height() : colRect.width(
); | 611 LayoutUnit blockDelta = isHorizontal ? colRect.height() : colRect.width(
); |
638 if (columnBlock->style()->isFlippedBlocksWritingMode()) | 612 if (columnBlock->style()->isFlippedBlocksWritingMode()) |
639 currLogicalTopOffset += blockDelta; | 613 currLogicalTopOffset += blockDelta; |
640 else | 614 else |
641 currLogicalTopOffset -= blockDelta; | 615 currLogicalTopOffset -= blockDelta; |
642 } | 616 } |
643 } | 617 } |
644 | 618 |
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) | 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) |
646 { | 620 { |
647 OwnPtr<ClipRecorder> clipRecorder; | 621 OwnPtr<LayerClipRecorder> clipRecorder; |
648 if (clipState != HasClipped && paintingInfo.clipToDirtyRect && needsToClip(p
aintingInfo, clipRect)) { | 622 if (clipState != HasClipped && paintingInfo.clipToDirtyRect && needsToClip(p
aintingInfo, clipRect)) { |
649 ClipRecorder::BorderRadiusClippingRule clippingRule = ClipRecorder::Incl
udeSelfForBorderRadius; | 623 LayerClipRecorder::BorderRadiusClippingRule clippingRule = LayerClipReco
rder::IncludeSelfForBorderRadius; |
650 DisplayItem::Type clipType = DisplayItem::ClipLayerFragmentFloat; | 624 DisplayItem::Type clipType = DisplayItem::ClipLayerFragmentFloat; |
651 switch (phase) { | 625 switch (phase) { |
652 case PaintPhaseFloat: | 626 case PaintPhaseFloat: |
653 break; | 627 break; |
654 case PaintPhaseForeground: | 628 case PaintPhaseForeground: |
655 clipType = DisplayItem::ClipLayerFragmentForeground; | 629 clipType = DisplayItem::ClipLayerFragmentForeground; |
656 break; | 630 break; |
657 case PaintPhaseChildOutlines: | 631 case PaintPhaseChildOutlines: |
658 clipType = DisplayItem::ClipLayerFragmentChildOutline; | 632 clipType = DisplayItem::ClipLayerFragmentChildOutline; |
659 break; | 633 break; |
660 case PaintPhaseSelection: | 634 case PaintPhaseSelection: |
661 clipType = DisplayItem::ClipLayerFragmentSelection; | 635 clipType = DisplayItem::ClipLayerFragmentSelection; |
662 break; | 636 break; |
663 case PaintPhaseChildBlockBackgrounds: | 637 case PaintPhaseChildBlockBackgrounds: |
664 clipType = DisplayItem::ClipLayerFragmentChildBlockBackgrounds; | 638 clipType = DisplayItem::ClipLayerFragmentChildBlockBackgrounds; |
665 break; | 639 break; |
666 case PaintPhaseBlockBackground: | 640 case PaintPhaseBlockBackground: |
667 clipType = DisplayItem::ClipLayerBackground; | 641 clipType = DisplayItem::ClipLayerBackground; |
668 clippingRule = ClipRecorder::DoNotIncludeSelfForBorderRadius; // Bac
kground painting will handle clipping to self. | 642 clippingRule = LayerClipRecorder::DoNotIncludeSelfForBorderRadius; /
/ Background painting will handle clipping to self. |
669 break; | 643 break; |
670 case PaintPhaseSelfOutline: | 644 case PaintPhaseSelfOutline: |
671 clipType = DisplayItem::ClipLayerFragmentOutline; | 645 clipType = DisplayItem::ClipLayerFragmentOutline; |
672 clippingRule = ClipRecorder::DoNotIncludeSelfForBorderRadius; | 646 clippingRule = LayerClipRecorder::DoNotIncludeSelfForBorderRadius; |
673 break; | 647 break; |
674 case PaintPhaseMask: | 648 case PaintPhaseMask: |
675 clipType = DisplayItem::ClipLayerFragmentMask; | 649 clipType = DisplayItem::ClipLayerFragmentMask; |
676 clippingRule = ClipRecorder::DoNotIncludeSelfForBorderRadius; // Mas
k painting will handle clipping to self. | 650 clippingRule = LayerClipRecorder::DoNotIncludeSelfForBorderRadius; /
/ Mask painting will handle clipping to self. |
677 break; | 651 break; |
678 case PaintPhaseClippingMask: | 652 case PaintPhaseClippingMask: |
679 clipType = DisplayItem::ClipLayerFragmentClippingMask; | 653 clipType = DisplayItem::ClipLayerFragmentClippingMask; |
680 break; | 654 break; |
681 default: | 655 default: |
682 ASSERT_NOT_REACHED(); | 656 ASSERT_NOT_REACHED(); |
683 } | 657 } |
684 | 658 |
685 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.renderer(), conte
xt, clipType, clipRect, &paintingInfo, fragment.paginationOffset, paintFlags, cl
ippingRule)); | 659 clipRecorder = adoptPtr(new LayerClipRecorder(m_renderLayer.renderer(),
context, clipType, clipRect, &paintingInfo, fragment.paginationOffset, paintFlag
s, clippingRule)); |
686 } | 660 } |
687 | 661 |
688 PaintInfo paintInfo(context, pixelSnappedIntRect(clipRect.rect()), phase, pa
intBehavior, paintingRootForRenderer, 0, paintingInfo.rootLayer->renderer()); | 662 PaintInfo paintInfo(context, pixelSnappedIntRect(clipRect.rect()), phase, pa
intBehavior, paintingRootForRenderer, 0, paintingInfo.rootLayer->renderer()); |
689 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds.loca
tion() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(painti
ngInfo.subPixelAccumulation, m_renderLayer.compositingState()))); | 663 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds.loca
tion() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(painti
ngInfo.subPixelAccumulation, m_renderLayer.compositingState()))); |
690 } | 664 } |
691 | 665 |
692 void LayerPainter::paintBackgroundForFragments(const LayerFragments& layerFragme
nts, GraphicsContext* context, | 666 void LayerPainter::paintBackgroundForFragments(const LayerFragments& layerFragme
nts, GraphicsContext* context, |
693 const LayoutRect& transparencyPaintDirtyRect, const LayerPaintingInfo& local
PaintingInfo, PaintBehavior paintBehavior, | 667 const LayoutRect& transparencyPaintDirtyRect, const LayerPaintingInfo& local
PaintingInfo, PaintBehavior paintBehavior, |
694 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) | 668 RenderObject* paintingRootForRenderer, PaintLayerFlags paintFlags) |
695 { | 669 { |
696 for (const auto& fragment: layerFragments) { | 670 for (const auto& fragment: layerFragments) { |
697 paintFragmentWithPhase(PaintPhaseBlockBackground, fragment, context, fra
gment.backgroundRect, localPaintingInfo, paintBehavior, paintingRootForRenderer,
paintFlags, HasNotClipped); | 671 paintFragmentWithPhase(PaintPhaseBlockBackground, fragment, context, fra
gment.backgroundRect, localPaintingInfo, paintBehavior, paintingRootForRenderer,
paintFlags, HasNotClipped); |
698 } | 672 } |
699 } | 673 } |
700 | 674 |
701 void LayerPainter::paintForegroundForFragments(const LayerFragments& layerFragme
nts, GraphicsContext* context, | 675 void LayerPainter::paintForegroundForFragments(const LayerFragments& layerFragme
nts, GraphicsContext* context, |
702 const LayoutRect& transparencyPaintDirtyRect, const LayerPaintingInfo& local
PaintingInfo, PaintBehavior paintBehavior, | 676 const LayoutRect& transparencyPaintDirtyRect, const LayerPaintingInfo& local
PaintingInfo, PaintBehavior paintBehavior, |
703 RenderObject* paintingRootForRenderer, bool selectionOnly, PaintLayerFlags p
aintFlags) | 677 RenderObject* paintingRootForRenderer, bool selectionOnly, PaintLayerFlags p
aintFlags) |
704 { | 678 { |
705 // Optimize clipping for the single fragment case. | 679 // Optimize clipping for the single fragment case. |
706 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size()
== 1 && !layerFragments[0].foregroundRect.isEmpty(); | 680 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size()
== 1 && !layerFragments[0].foregroundRect.isEmpty(); |
707 ClipState clipState = HasNotClipped; | 681 ClipState clipState = HasNotClipped; |
708 OwnPtr<ClipRecorder> clipRecorder; | 682 OwnPtr<LayerClipRecorder> clipRecorder; |
709 if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroun
dRect)) { | 683 if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroun
dRect)) { |
710 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.renderer(), conte
xt, DisplayItem::ClipLayerForeground, layerFragments[0].foregroundRect, &localPa
intingInfo, layerFragments[0].paginationOffset, paintFlags)); | 684 clipRecorder = adoptPtr(new LayerClipRecorder(m_renderLayer.renderer(),
context, DisplayItem::ClipLayerForeground, layerFragments[0].foregroundRect, &lo
calPaintingInfo, layerFragments[0].paginationOffset, paintFlags)); |
711 clipState = HasClipped; | 685 clipState = HasClipped; |
712 } | 686 } |
713 | 687 |
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 | 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 |
715 // interleaving of the fragments to work properly. | 689 // interleaving of the fragments to work properly. |
716 paintForegroundForFragmentsWithPhase(selectionOnly ? PaintPhaseSelection : P
aintPhaseChildBlockBackgrounds, layerFragments, | 690 paintForegroundForFragmentsWithPhase(selectionOnly ? PaintPhaseSelection : P
aintPhaseChildBlockBackgrounds, layerFragments, |
717 context, localPaintingInfo, paintBehavior, paintingRootForRenderer, pain
tFlags, clipState); | 691 context, localPaintingInfo, paintBehavior, paintingRootForRenderer, pain
tFlags, clipState); |
718 | 692 |
719 if (!selectionOnly) { | 693 if (!selectionOnly) { |
720 paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments, co
ntext, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlags, cl
ipState); | 694 paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments, co
ntext, localPaintingInfo, paintBehavior, paintingRootForRenderer, paintFlags, cl
ipState); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 if (!m_renderLayer.containsDirtyOverlayScrollbars()) | 734 if (!m_renderLayer.containsDirtyOverlayScrollbars()) |
761 return; | 735 return; |
762 | 736 |
763 LayerPaintingInfo paintingInfo(&m_renderLayer, enclosingIntRect(damageRect),
paintBehavior, LayoutSize(), paintingRoot); | 737 LayerPaintingInfo paintingInfo(&m_renderLayer, enclosingIntRect(damageRect),
paintBehavior, LayoutSize(), paintingRoot); |
764 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 738 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
765 | 739 |
766 m_renderLayer.setContainsDirtyOverlayScrollbars(false); | 740 m_renderLayer.setContainsDirtyOverlayScrollbars(false); |
767 } | 741 } |
768 | 742 |
769 } // namespace blink | 743 } // namespace blink |
OLD | NEW |