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/layout/ClipPathOperation.h" | 9 #include "core/layout/ClipPathOperation.h" |
10 #include "core/layout/FilterEffectRenderer.h" | 10 #include "core/layout/FilterEffectRenderer.h" |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 for (size_t i = 0; i < layerFragments.size(); ++i) { | 455 for (size_t i = 0; i < layerFragments.size(); ++i) { |
456 const LayerFragment& fragment = layerFragments.at(i); | 456 const LayerFragment& fragment = layerFragments.at(i); |
457 | 457 |
458 ScopeRecorder scopeRecorder(context, *m_renderLayer.renderer()); | 458 ScopeRecorder scopeRecorder(context, *m_renderLayer.renderer()); |
459 OwnPtr<LayerClipRecorder> clipRecorder; | 459 OwnPtr<LayerClipRecorder> clipRecorder; |
460 | 460 |
461 if (needsToClip(localPaintingInfo, fragment.backgroundRect)) { | 461 if (needsToClip(localPaintingInfo, fragment.backgroundRect)) { |
462 clipRecorder = adoptPtr(new LayerClipRecorder(m_renderLayer.renderer
(), context, DisplayItem::ClipLayerOverflowControls, fragment.backgroundRect, &l
ocalPaintingInfo, fragment.paginationOffset, paintFlags)); | 462 clipRecorder = adoptPtr(new LayerClipRecorder(m_renderLayer.renderer
(), context, DisplayItem::ClipLayerOverflowControls, fragment.backgroundRect, &l
ocalPaintingInfo, fragment.paginationOffset, paintFlags)); |
463 } | 463 } |
464 if (LayerScrollableArea* scrollableArea = m_renderLayer.scrollableArea()
) | 464 if (LayerScrollableArea* scrollableArea = m_renderLayer.scrollableArea()
) |
465 ScrollableAreaPainter(*scrollableArea).paintOverflowControls(context
, roundedIntPoint(toPoint(fragment.layerBounds.location() - m_renderLayer.render
BoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccumulat
ion, m_renderLayer.compositingState()))), pixelSnappedIntRect(fragment.backgroun
dRect.rect()), true); | 465 ScrollableAreaPainter(*scrollableArea).paintOverflowControls(context
, roundedIntPoint(toPoint(fragment.layerBounds.location() - m_renderLayer.layout
BoxLocation() + subPixelAccumulationIfNeeded(localPaintingInfo.subPixelAccumulat
ion, m_renderLayer.compositingState()))), pixelSnappedIntRect(fragment.backgroun
dRect.rect()), true); |
466 } | 466 } |
467 } | 467 } |
468 | 468 |
469 static bool checkContainingBlockChainForPagination(LayoutBoxModelObject* rendere
r, RenderBox* ancestorColumnsRenderer) | 469 static bool checkContainingBlockChainForPagination(LayoutBoxModelObject* rendere
r, LayoutBox* ancestorColumnsRenderer) |
470 { | 470 { |
471 RenderView* view = renderer->view(); | 471 RenderView* view = renderer->view(); |
472 LayoutBoxModelObject* prevBlock = renderer; | 472 LayoutBoxModelObject* prevBlock = renderer; |
473 RenderBlock* containingBlock; | 473 RenderBlock* containingBlock; |
474 for (containingBlock = renderer->containingBlock(); | 474 for (containingBlock = renderer->containingBlock(); |
475 containingBlock && containingBlock != view && containingBlock != ancesto
rColumnsRenderer; | 475 containingBlock && containingBlock != view && containingBlock != ancesto
rColumnsRenderer; |
476 containingBlock = containingBlock->containingBlock()) | 476 containingBlock = containingBlock->containingBlock()) |
477 prevBlock = containingBlock; | 477 prevBlock = containingBlock; |
478 | 478 |
479 // If the columns block wasn't in our containing block chain, then we aren't
paginated by it. | 479 // If the columns block wasn't in our containing block chain, then we aren't
paginated by it. |
480 if (containingBlock != ancestorColumnsRenderer) | 480 if (containingBlock != ancestorColumnsRenderer) |
481 return false; | 481 return false; |
482 | 482 |
483 // If the previous block is absolutely positioned, then we can't be paginate
d by the columns block. | 483 // If the previous block is absolutely positioned, then we can't be paginate
d by the columns block. |
484 if (prevBlock->isOutOfFlowPositioned()) | 484 if (prevBlock->isOutOfFlowPositioned()) |
485 return false; | 485 return false; |
486 | 486 |
487 // Otherwise we are paginated by the columns block. | 487 // Otherwise we are paginated by the columns block. |
488 return true; | 488 return true; |
489 } | 489 } |
490 | 490 |
491 void LayerPainter::paintPaginatedChildLayer(Layer* childLayer, GraphicsContext*
context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) | 491 void LayerPainter::paintPaginatedChildLayer(Layer* childLayer, GraphicsContext*
context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags) |
492 { | 492 { |
493 // We need to do multiple passes, breaking up our child layer into strips. | 493 // We need to do multiple passes, breaking up our child layer into strips. |
494 Vector<Layer*> columnLayers; | 494 Vector<Layer*> columnLayers; |
495 LayerStackingNode* ancestorNode = m_renderLayer.stackingNode()->isNormalFlow
Only() ? m_renderLayer.parent()->stackingNode() : m_renderLayer.stackingNode()->
ancestorStackingContextNode(); | 495 LayerStackingNode* ancestorNode = m_renderLayer.stackingNode()->isNormalFlow
Only() ? m_renderLayer.parent()->stackingNode() : m_renderLayer.stackingNode()->
ancestorStackingContextNode(); |
496 for (Layer* curr = childLayer->parent(); curr; curr = curr->parent()) { | 496 for (Layer* curr = childLayer->parent(); curr; curr = curr->parent()) { |
497 if (curr->renderer()->hasColumns() && checkContainingBlockChainForPagina
tion(childLayer->renderer(), curr->renderBox())) | 497 if (curr->renderer()->hasColumns() && checkContainingBlockChainForPagina
tion(childLayer->renderer(), curr->layoutBox())) |
498 columnLayers.append(curr); | 498 columnLayers.append(curr); |
499 if (curr->stackingNode() == ancestorNode) | 499 if (curr->stackingNode() == ancestorNode) |
500 break; | 500 break; |
501 } | 501 } |
502 | 502 |
503 // It is possible for paintLayer() to be called after the child layer ceases
to be paginated but before | 503 // It is possible for paintLayer() to be called after the child layer ceases
to be paginated but before |
504 // updatePaginationRecusive() is called and resets the isPaginated() flag, s
ee <rdar://problem/10098679>. | 504 // updatePaginationRecusive() is called and resets the isPaginated() flag, s
ee <rdar://problem/10098679>. |
505 // If this is the case, just bail out, since the upcoming call to updatePagi
nationRecusive() will paint invalidate the layer. | 505 // If this is the case, just bail out, since the upcoming call to updatePagi
nationRecusive() will paint invalidate the layer. |
506 // FIXME: Is this true anymore? This seems very suspicious. | 506 // FIXME: Is this true anymore? This seems very suspicious. |
507 if (!columnLayers.size()) | 507 if (!columnLayers.size()) |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 break; | 617 break; |
618 default: | 618 default: |
619 clippingRule = LayerClipRecorder::IncludeSelfForBorderRadius; | 619 clippingRule = LayerClipRecorder::IncludeSelfForBorderRadius; |
620 break; | 620 break; |
621 } | 621 } |
622 | 622 |
623 clipRecorder = adoptPtr(new LayerClipRecorder(m_renderLayer.renderer(),
context, clipType, clipRect, &paintingInfo, fragment.paginationOffset, paintFlag
s, clippingRule)); | 623 clipRecorder = adoptPtr(new LayerClipRecorder(m_renderLayer.renderer(),
context, clipType, clipRect, &paintingInfo, fragment.paginationOffset, paintFlag
s, clippingRule)); |
624 } | 624 } |
625 | 625 |
626 PaintInfo paintInfo(context, pixelSnappedIntRect(clipRect.rect()), phase, pa
intBehavior, paintingRootForRenderer, 0, paintingInfo.rootLayer->renderer()); | 626 PaintInfo paintInfo(context, pixelSnappedIntRect(clipRect.rect()), phase, pa
intBehavior, paintingRootForRenderer, 0, paintingInfo.rootLayer->renderer()); |
627 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds.loca
tion() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(painti
ngInfo.subPixelAccumulation, m_renderLayer.compositingState()))); | 627 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds.loca
tion() - m_renderLayer.layoutBoxLocation() + subPixelAccumulationIfNeeded(painti
ngInfo.subPixelAccumulation, m_renderLayer.compositingState()))); |
628 } | 628 } |
629 | 629 |
630 void LayerPainter::paintBackgroundForFragments(const LayerFragments& layerFragme
nts, GraphicsContext* context, | 630 void LayerPainter::paintBackgroundForFragments(const LayerFragments& layerFragme
nts, GraphicsContext* context, |
631 const LayoutRect& transparencyPaintDirtyRect, const LayerPaintingInfo& local
PaintingInfo, PaintBehavior paintBehavior, | 631 const LayoutRect& transparencyPaintDirtyRect, const LayerPaintingInfo& local
PaintingInfo, PaintBehavior paintBehavior, |
632 LayoutObject* paintingRootForRenderer, PaintLayerFlags paintFlags) | 632 LayoutObject* paintingRootForRenderer, PaintLayerFlags paintFlags) |
633 { | 633 { |
634 for (const auto& fragment: layerFragments) { | 634 for (const auto& fragment: layerFragments) { |
635 ScopeRecorder scopeRecorder(context, *m_renderLayer.renderer()); | 635 ScopeRecorder scopeRecorder(context, *m_renderLayer.renderer()); |
636 paintFragmentWithPhase(PaintPhaseBlockBackground, fragment, context, fra
gment.backgroundRect, localPaintingInfo, paintBehavior, paintingRootForRenderer,
paintFlags, HasNotClipped); | 636 paintFragmentWithPhase(PaintPhaseBlockBackground, fragment, context, fra
gment.backgroundRect, localPaintingInfo, paintBehavior, paintingRootForRenderer,
paintFlags, HasNotClipped); |
637 } | 637 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 if (!m_renderLayer.containsDirtyOverlayScrollbars()) | 707 if (!m_renderLayer.containsDirtyOverlayScrollbars()) |
708 return; | 708 return; |
709 | 709 |
710 LayerPaintingInfo paintingInfo(&m_renderLayer, enclosingIntRect(damageRect),
paintBehavior, LayoutSize(), paintingRoot); | 710 LayerPaintingInfo paintingInfo(&m_renderLayer, enclosingIntRect(damageRect),
paintBehavior, LayoutSize(), paintingRoot); |
711 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); | 711 paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars); |
712 | 712 |
713 m_renderLayer.setContainsDirtyOverlayScrollbars(false); | 713 m_renderLayer.setContainsDirtyOverlayScrollbars(false); |
714 } | 714 } |
715 | 715 |
716 } // namespace blink | 716 } // namespace blink |
OLD | NEW |