Chromium Code Reviews| 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.renderer( ), context, DisplayItem::ClipLayerParent, clipRect)); |
|
mstensho (USE GERRIT)
2014/11/13 08:32:16
That should be m_renderLayer.parent()->renderer()
pdr.
2014/11/13 18:40:48
Good catch. Fixed.
| |
| 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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 496 } | 496 } |
| 497 | 497 |
| 498 void LayerPainter::paintOverflowControlsForFragments(const LayerFragments& layer Fragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo, PaintLayerFlags paintFlags) | 498 void LayerPainter::paintOverflowControlsForFragments(const LayerFragments& layer Fragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo, PaintLayerFlags paintFlags) |
| 499 { | 499 { |
| 500 for (size_t i = 0; i < layerFragments.size(); ++i) { | 500 for (size_t i = 0; i < layerFragments.size(); ++i) { |
| 501 const LayerFragment& fragment = layerFragments.at(i); | 501 const LayerFragment& fragment = layerFragments.at(i); |
| 502 | 502 |
| 503 OwnPtr<ClipRecorder> clipRecorder; | 503 OwnPtr<ClipRecorder> clipRecorder; |
| 504 | 504 |
| 505 if (needsToClip(localPaintingInfo, fragment.backgroundRect)) { | 505 if (needsToClip(localPaintingInfo, fragment.backgroundRect)) { |
| 506 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Di splayItem::ClipLayerOverflowControls, fragment.backgroundRect)); | 506 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.renderer(), c ontext, DisplayItem::ClipLayerOverflowControls, fragment.backgroundRect)); |
| 507 if (fragment.backgroundRect.hasRadius()) | 507 if (fragment.backgroundRect.hasRadius()) |
| 508 applyRoundedRectClips(m_renderLayer, localPaintingInfo, context, paintFlags, *clipRecorder); | 508 applyRoundedRectClips(m_renderLayer, localPaintingInfo, context, paintFlags, *clipRecorder); |
| 509 } | 509 } |
| 510 if (RenderLayerScrollableArea* scrollableArea = m_renderLayer.scrollable Area()) | 510 if (RenderLayerScrollableArea* scrollableArea = m_renderLayer.scrollable Area()) |
| 511 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); | 511 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); |
| 512 } | 512 } |
| 513 } | 513 } |
| 514 | 514 |
| 515 static bool checkContainingBlockChainForPagination(RenderLayerModelObject* rende rer, RenderBox* ancestorColumnsRenderer) | 515 static bool checkContainingBlockChainForPagination(RenderLayerModelObject* rende rer, RenderBox* ancestorColumnsRenderer) |
| 516 { | 516 { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 685 clipType = DisplayItem::ClipLayerFragmentMask; | 685 clipType = DisplayItem::ClipLayerFragmentMask; |
| 686 clippingRule = DoNotIncludeSelfForBorderRadius; // Mask painting wil l handle clipping to self. | 686 clippingRule = DoNotIncludeSelfForBorderRadius; // Mask painting wil l handle clipping to self. |
| 687 break; | 687 break; |
| 688 case PaintPhaseClippingMask: | 688 case PaintPhaseClippingMask: |
| 689 clipType = DisplayItem::ClipLayerFragmentClippingMask; | 689 clipType = DisplayItem::ClipLayerFragmentClippingMask; |
| 690 break; | 690 break; |
| 691 default: | 691 default: |
| 692 ASSERT_NOT_REACHED(); | 692 ASSERT_NOT_REACHED(); |
| 693 } | 693 } |
| 694 | 694 |
| 695 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, clipTy pe, clipRect)); | 695 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.renderer(), conte xt, clipType, clipRect)); |
| 696 if (clipRect.hasRadius()) | 696 if (clipRect.hasRadius()) |
| 697 applyRoundedRectClips(m_renderLayer, paintingInfo, context, paintFla gs, *clipRecorder, clippingRule); | 697 applyRoundedRectClips(m_renderLayer, paintingInfo, context, paintFla gs, *clipRecorder, clippingRule); |
| 698 } | 698 } |
| 699 | 699 |
| 700 PaintInfo paintInfo(context, pixelSnappedIntRect(clipRect.rect()), phase, pa intBehavior, paintingRootForRenderer, 0, paintingInfo.rootLayer->renderer()); | 700 PaintInfo paintInfo(context, pixelSnappedIntRect(clipRect.rect()), phase, pa intBehavior, paintingRootForRenderer, 0, paintingInfo.rootLayer->renderer()); |
| 701 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds.loca tion() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(painti ngInfo.subPixelAccumulation, m_renderLayer.compositingState()))); | 701 m_renderLayer.renderer()->paint(paintInfo, toPoint(fragment.layerBounds.loca tion() - m_renderLayer.renderBoxLocation() + subPixelAccumulationIfNeeded(painti ngInfo.subPixelAccumulation, m_renderLayer.compositingState()))); |
| 702 } | 702 } |
| 703 | 703 |
| 704 void LayerPainter::paintBackgroundForFragments(const LayerFragments& layerFragme nts, GraphicsContext* context, | 704 void LayerPainter::paintBackgroundForFragments(const LayerFragments& layerFragme nts, GraphicsContext* context, |
| 705 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, | 705 const LayoutRect& transparencyPaintDirtyRect, bool haveTransparency, const L ayerPaintingInfo& localPaintingInfo, PaintBehavior paintBehavior, |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 727 break; | 727 break; |
| 728 } | 728 } |
| 729 } | 729 } |
| 730 } | 730 } |
| 731 | 731 |
| 732 // Optimize clipping for the single fragment case. | 732 // Optimize clipping for the single fragment case. |
| 733 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() == 1 && !layerFragments[0].foregroundRect.isEmpty(); | 733 bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() == 1 && !layerFragments[0].foregroundRect.isEmpty(); |
| 734 ClipState clipState = HasNotClipped; | 734 ClipState clipState = HasNotClipped; |
| 735 OwnPtr<ClipRecorder> clipRecorder; | 735 OwnPtr<ClipRecorder> clipRecorder; |
| 736 if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroun dRect)) { | 736 if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroun dRect)) { |
| 737 clipRecorder = adoptPtr(new ClipRecorder(&m_renderLayer, context, Displa yItem::ClipLayerForeground, layerFragments[0].foregroundRect)); | 737 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.renderer(), conte xt, DisplayItem::ClipLayerForeground, layerFragments[0].foregroundRect)); |
| 738 if (layerFragments[0].foregroundRect.hasRadius()) | 738 if (layerFragments[0].foregroundRect.hasRadius()) |
| 739 applyRoundedRectClips(m_renderLayer, localPaintingInfo, context, pai ntFlags, *clipRecorder); | 739 applyRoundedRectClips(m_renderLayer, localPaintingInfo, context, pai ntFlags, *clipRecorder); |
| 740 clipState = HasClipped; | 740 clipState = HasClipped; |
| 741 } | 741 } |
| 742 | 742 |
| 743 // We have to loop through every fragment multiple times, since we have to i ssue paint invalidations in each specific phase in order for | 743 // We have to loop through every fragment multiple times, since we have to i ssue paint invalidations in each specific phase in order for |
| 744 // interleaving of the fragments to work properly. | 744 // interleaving of the fragments to work properly. |
| 745 paintForegroundForFragmentsWithPhase(selectionOnly ? PaintPhaseSelection : P aintPhaseChildBlockBackgrounds, layerFragments, | 745 paintForegroundForFragmentsWithPhase(selectionOnly ? PaintPhaseSelection : P aintPhaseChildBlockBackgrounds, layerFragments, |
| 746 context, localPaintingInfo, paintBehavior, paintingRootForRenderer, pain tFlags, clipState); | 746 context, localPaintingInfo, paintBehavior, paintingRootForRenderer, pain tFlags, clipState); |
| 747 | 747 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 818 ClipRectsContext clipRectsContext(m_renderLayer.enclosingPaginationL ayer(), (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Paintin gClipRects, IgnoreOverlayScrollbarSize); | 818 ClipRectsContext clipRectsContext(m_renderLayer.enclosingPaginationL ayer(), (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : Paintin gClipRects, IgnoreOverlayScrollbarSize); |
| 819 if (shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()) == IgnoreOverflowClip) | 819 if (shouldRespectOverflowClip(paintFlags, m_renderLayer.renderer()) == IgnoreOverflowClip) |
| 820 clipRectsContext.setIgnoreOverflowClip(); | 820 clipRectsContext.setIgnoreOverflowClip(); |
| 821 LayoutRect parentClipRect = m_renderLayer.clipper().backgroundClipRe ct(clipRectsContext).rect(); | 821 LayoutRect parentClipRect = m_renderLayer.clipper().backgroundClipRe ct(clipRectsContext).rect(); |
| 822 parentClipRect.moveBy(fragment.paginationOffset + offsetOfPagination LayerFromRoot); | 822 parentClipRect.moveBy(fragment.paginationOffset + offsetOfPagination LayerFromRoot); |
| 823 clipRect.intersect(parentClipRect); | 823 clipRect.intersect(parentClipRect); |
| 824 } | 824 } |
| 825 | 825 |
| 826 OwnPtr<ClipRecorder> clipRecorder; | 826 OwnPtr<ClipRecorder> clipRecorder; |
| 827 if (needsToClip(paintingInfo, clipRect)) | 827 if (needsToClip(paintingInfo, clipRect)) |
| 828 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.parent(), con text, DisplayItem::ClipLayerFragmentParent, clipRect)); | 828 clipRecorder = adoptPtr(new ClipRecorder(m_renderLayer.renderer(), c ontext, DisplayItem::ClipLayerFragmentParent, clipRect)); |
| 829 | 829 |
| 830 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen t.paginationOffset); | 830 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragmen t.paginationOffset); |
| 831 } | 831 } |
| 832 } | 832 } |
| 833 | 833 |
| 834 } // namespace blink | 834 } // namespace blink |
| OLD | NEW |