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" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 OwnPtr<ClipRecorder> clipRecorder; | 95 OwnPtr<ClipRecorder> clipRecorder; |
96 if (m_renderLayer.parent()) { | 96 if (m_renderLayer.parent()) { |
97 ClipRectsContext clipRectsContext(paintingInfo.rootLayer, (paintFlag
s & PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects, Ignore
OverlayScrollbarSize); | 97 ClipRectsContext clipRectsContext(paintingInfo.rootLayer, (paintFlag
s & PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects, Ignore
OverlayScrollbarSize); |
98 if (shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer())
== IgnoreOverflowClip) | 98 if (shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer())
== IgnoreOverflowClip) |
99 clipRectsContext.setIgnoreOverflowClip(); | 99 clipRectsContext.setIgnoreOverflowClip(); |
100 clipRect = m_renderLayer.clipper().backgroundClipRect(clipRectsConte
xt); | 100 clipRect = m_renderLayer.clipper().backgroundClipRect(clipRectsConte
xt); |
101 clipRect.intersect(paintingInfo.paintDirtyRect); | 101 clipRect.intersect(paintingInfo.paintDirtyRect); |
102 | 102 |
103 if (needsToClip(paintingInfo, clipRect)) { | 103 if (needsToClip(paintingInfo, clipRect)) { |
104 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.parent(),
context, DisplayItem::ClipLayerParent, clipRect)); | 104 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.clippingC
ontainer(), m_renderLayer.parent(), context, DisplayItem::ClipLayerParent, clipR
ect)); |
105 if (clipRect.hasRadius()) | 105 if (clipRect.hasRadius()) |
106 applyRoundedRectClips(*m_renderLayer.parent(), paintingInfo,
context, paintFlags, *clipRecorder); | 106 applyRoundedRectClips(*m_renderLayer.parent(), paintingInfo,
context, paintFlags, *clipRecorder); |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 paintLayerByApplyingTransform(context, paintingInfo, paintFlags); | 110 paintLayerByApplyingTransform(context, paintingInfo, paintFlags); |
111 | 111 |
112 return; | 112 return; |
113 } | 113 } |
114 | 114 |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 } | 499 } |
500 | 500 |
501 void LayerPainter::paintOverflowControlsForFragments(const LayerFragments& layer
Fragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo,
PaintLayerFlags paintFlags) | 501 void LayerPainter::paintOverflowControlsForFragments(const LayerFragments& layer
Fragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo,
PaintLayerFlags paintFlags) |
502 { | 502 { |
503 for (size_t i = 0; i < layerFragments.size(); ++i) { | 503 for (size_t i = 0; i < layerFragments.size(); ++i) { |
504 const LayerFragment& fragment = layerFragments.at(i); | 504 const LayerFragment& fragment = layerFragments.at(i); |
505 | 505 |
506 OwnPtr<ClipRecorder> clipRecorder; | 506 OwnPtr<ClipRecorder> clipRecorder; |
507 | 507 |
508 if (needsToClip(localPaintingInfo, fragment.backgroundRect)) { | 508 if (needsToClip(localPaintingInfo, fragment.backgroundRect)) { |
509 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Di
splayItem::ClipLayerOverflowControls, fragment.backgroundRect)); | 509 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.clippingConta
iner(), &m_renderLayer, context, DisplayItem::ClipLayerOverflowControls, fragmen
t.backgroundRect)); |
510 if (fragment.backgroundRect.hasRadius()) | 510 if (fragment.backgroundRect.hasRadius()) |
511 applyRoundedRectClips(m_renderLayer, localPaintingInfo, context,
paintFlags, *clipRecorder); | 511 applyRoundedRectClips(m_renderLayer, localPaintingInfo, context,
paintFlags, *clipRecorder); |
512 } | 512 } |
513 if (RenderLayerScrollableArea* scrollableArea = m_renderLayer.scrollable
Area()) | 513 if (RenderLayerScrollableArea* scrollableArea = m_renderLayer.scrollable
Area()) |
514 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); | 514 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); |
515 } | 515 } |
516 } | 516 } |
517 | 517 |
518 static bool checkContainingBlockChainForPagination(RenderLayerModelObject* rende
rer, RenderBox* ancestorColumnsRenderer) | 518 static bool checkContainingBlockChainForPagination(RenderLayerModelObject* rende
rer, RenderBox* ancestorColumnsRenderer) |
519 { | 519 { |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 clipType = DisplayItem::ClipLayerFragmentMask; | 688 clipType = DisplayItem::ClipLayerFragmentMask; |
689 clippingRule = DoNotIncludeSelfForBorderRadius; // Mask painting wil
l handle clipping to self. | 689 clippingRule = DoNotIncludeSelfForBorderRadius; // Mask painting wil
l handle clipping to self. |
690 break; | 690 break; |
691 case PaintPhaseClippingMask: | 691 case PaintPhaseClippingMask: |
692 clipType = DisplayItem::ClipLayerFragmentClippingMask; | 692 clipType = DisplayItem::ClipLayerFragmentClippingMask; |
693 break; | 693 break; |
694 default: | 694 default: |
695 ASSERT_NOT_REACHED(); | 695 ASSERT_NOT_REACHED(); |
696 } | 696 } |
697 | 697 |
698 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, clipTy
pe, clipRect)); | 698 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.clippingContainer
(), &m_renderLayer, context, clipType, clipRect)); |
699 if (clipRect.hasRadius()) | 699 if (clipRect.hasRadius()) |
700 applyRoundedRectClips(m_renderLayer, paintingInfo, context, paintFla
gs, *clipRecorder, clippingRule); | 700 applyRoundedRectClips(m_renderLayer, paintingInfo, context, paintFla
gs, *clipRecorder, clippingRule); |
701 } | 701 } |
702 | 702 |
703 PaintInfo paintInfo(context, pixelSnappedIntRect(clipRect.rect()), phase, pa
intBehavior, paintingRootForRenderer, 0, paintingInfo.rootLayer->renderer()); | 703 PaintInfo paintInfo(context, pixelSnappedIntRect(clipRect.rect()), phase, pa
intBehavior, paintingRootForRenderer, 0, paintingInfo.rootLayer->renderer()); |
704 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds.loca
tion() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(painti
ngInfo.subPixelAccumulation, m_renderLayer.compositingState()))); | 704 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds.loca
tion() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(painti
ngInfo.subPixelAccumulation, m_renderLayer.compositingState()))); |
705 } | 705 } |
706 | 706 |
707 void LayerPainter::paintBackgroundForFragments(const LayerFragments& layerFragme
nts, GraphicsContext* context, | 707 void LayerPainter::paintBackgroundForFragments(const LayerFragments& layerFragme
nts, GraphicsContext* context, |
708 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L
ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, | 708 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L
ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, |
(...skipping 21 matching lines...) Expand all Loading... |
730 break; | 730 break; |
731 } | 731 } |
732 } | 732 } |
733 } | 733 } |
734 | 734 |
735 // Optimize clipping for the single fragment case. | 735 // Optimize clipping for the single fragment case. |
736 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size()
== 1 && !layerFragments[0].foregroundRect.isEmpty(); | 736 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size()
== 1 && !layerFragments[0].foregroundRect.isEmpty(); |
737 ClipState clipState = HasNotClipped; | 737 ClipState clipState = HasNotClipped; |
738 OwnPtr<ClipRecorder> clipRecorder; | 738 OwnPtr<ClipRecorder> clipRecorder; |
739 if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroun
dRect)) { | 739 if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroun
dRect)) { |
740 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Displa
yItem::ClipLayerForeground, layerFragments[0].foregroundRect)); | 740 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.clippingContainer
(), &m_renderLayer, context, DisplayItem::ClipLayerForeground, layerFragments[0]
.foregroundRect)); |
741 if (layerFragments[0].foregroundRect.hasRadius()) | 741 if (layerFragments[0].foregroundRect.hasRadius()) |
742 applyRoundedRectClips(m_renderLayer, localPaintingInfo, context, pai
ntFlags, *clipRecorder); | 742 applyRoundedRectClips(m_renderLayer, localPaintingInfo, context, pai
ntFlags, *clipRecorder); |
743 clipState = HasClipped; | 743 clipState = HasClipped; |
744 } | 744 } |
745 | 745 |
746 // We have to loop through every fragment multiple times, since we have to i
ssue paint invalidations in each specific phase in order for | 746 // We have to loop through every fragment multiple times, since we have to i
ssue paint invalidations in each specific phase in order for |
747 // interleaving of the fragments to work properly. | 747 // interleaving of the fragments to work properly. |
748 paintForegroundForFragmentsWithPhase(selectionOnly ? PaintPhaseSelection : P
aintPhaseChildBlockBackgrounds, layerFragments, | 748 paintForegroundForFragmentsWithPhase(selectionOnly ? PaintPhaseSelection : P
aintPhaseChildBlockBackgrounds, layerFragments, |
749 context, localPaintingInfo, paintBehavior, paintingRootForRenderer, pain
tFlags, clipState); | 749 context, localPaintingInfo, paintBehavior, paintingRootForRenderer, pain
tFlags, clipState); |
750 | 750 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 ClipRectsContext clipRectsContext(m_renderLayer.enclosingPaginationL
ayer(), (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Paintin
gClipRects, IgnoreOverlayScrollbarSize); | 821 ClipRectsContext clipRectsContext(m_renderLayer.enclosingPaginationL
ayer(), (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Paintin
gClipRects, IgnoreOverlayScrollbarSize); |
822 if (shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer())
== IgnoreOverflowClip) | 822 if (shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer())
== IgnoreOverflowClip) |
823 clipRectsContext.setIgnoreOverflowClip(); | 823 clipRectsContext.setIgnoreOverflowClip(); |
824 LayoutRect parentClipRect = m_renderLayer.clipper().backgroundClipRe
ct(clipRectsContext).rect(); | 824 LayoutRect parentClipRect = m_renderLayer.clipper().backgroundClipRe
ct(clipRectsContext).rect(); |
825 parentClipRect.moveBy(fragment.paginationOffset + offsetOfPagination
LayerFromRoot); | 825 parentClipRect.moveBy(fragment.paginationOffset + offsetOfPagination
LayerFromRoot); |
826 clipRect.intersect(parentClipRect); | 826 clipRect.intersect(parentClipRect); |
827 } | 827 } |
828 | 828 |
829 OwnPtr<ClipRecorder> clipRecorder; | 829 OwnPtr<ClipRecorder> clipRecorder; |
830 if (needsToClip(paintingInfo, clipRect)) | 830 if (needsToClip(paintingInfo, clipRect)) |
831 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.parent(), con
text, DisplayItem::ClipLayerFragmentParent, clipRect)); | 831 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.clippingConta
iner(), m_renderLayer.parent(), context, DisplayItem::ClipLayerFragmentParent, c
lipRect)); |
832 | 832 |
833 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen
t.paginationOffset); | 833 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen
t.paginationOffset); |
834 } | 834 } |
835 } | 835 } |
836 | 836 |
837 } // namespace blink | 837 } // namespace blink |
OLD | NEW |