Changeset 200284 in webkit
- Timestamp:
- Apr 29, 2016 9:13:22 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r200283 r200284 1 2016-04-29 Simon Fraser <simon.fraser@apple.com> 2 3 Make clipToRect() and restoreClip() have similar signatures 4 https://bugs.webkit.org/show_bug.cgi?id=157229 5 6 Reviewed by Zalan Bujtas. 7 8 clipToRect() and restoreClip() are always called in pairs, but had different 9 parameter order, and parameter types. So make them more similar. 10 11 In future we could use them in a stack-based class. 12 13 No behavior change. 14 15 * rendering/RenderLayer.cpp: 16 (WebCore::RenderLayer::clipToRect): 17 (WebCore::RenderLayer::restoreClip): 18 (WebCore::RenderLayer::paintLayer): 19 (WebCore::RenderLayer::applyFilters): 20 (WebCore::RenderLayer::paintTransformedLayerIntoFragments): 21 (WebCore::RenderLayer::paintBackgroundForFragments): 22 (WebCore::RenderLayer::paintForegroundForFragments): 23 (WebCore::RenderLayer::paintForegroundForFragmentsWithPhase): 24 (WebCore::RenderLayer::paintOutlineForFragments): 25 (WebCore::RenderLayer::paintMaskForFragments): 26 (WebCore::RenderLayer::paintChildClippingMaskForFragments): 27 (WebCore::RenderLayer::paintOverflowControlsForFragments): 28 (WebCore::RenderLayer::calculateClipRects): 29 * rendering/RenderLayer.h: 30 1 31 2016-04-29 Simon Fraser <simon.fraser@apple.com> 2 32 -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r200283 r200284 3828 3828 } 3829 3829 3830 void RenderLayer::clipToRect( const LayerPaintingInfo& paintingInfo, GraphicsContext& context, const ClipRect& clipRect, BorderRadiusClippingRule rule)3830 void RenderLayer::clipToRect(GraphicsContext& context, const LayerPaintingInfo& paintingInfo, const ClipRect& clipRect, BorderRadiusClippingRule rule) 3831 3831 { 3832 3832 float deviceScaleFactor = renderer().document().deviceScaleFactor(); … … 3862 3862 } 3863 3863 3864 void RenderLayer::restoreClip(GraphicsContext& context, const Lay outRect& paintDirtyRect, const ClipRect& clipRect)3865 { 3866 if ((!clipRect.isInfinite() && clipRect.rect() != paint DirtyRect) || clipRect.affectedByRadius())3864 void RenderLayer::restoreClip(GraphicsContext& context, const LayerPaintingInfo& paintingInfo, const ClipRect& clipRect) 3865 { 3866 if ((!clipRect.isInfinite() && clipRect.rect() != paintingInfo.paintDirtyRect) || clipRect.affectedByRadius()) 3867 3867 context.restore(); 3868 3868 } … … 3983 3983 3984 3984 // Push the parent coordinate space's clip. 3985 parent()->clipToRect( paintingInfo, context, clipRect);3985 parent()->clipToRect(context, paintingInfo, clipRect); 3986 3986 } 3987 3987 … … 3990 3990 // Restore the clip. 3991 3991 if (parent()) 3992 parent()->restoreClip(context, paintingInfo .paintDirtyRect, clipRect);3992 parent()->restoreClip(context, paintingInfo, clipRect); 3993 3993 3994 3994 return; … … 4203 4203 // FIXME: Handle more than one fragment. 4204 4204 ClipRect backgroundRect = layerFragments.isEmpty() ? ClipRect() : layerFragments[0].backgroundRect; 4205 clipToRect( paintingInfo, originalContext, backgroundRect);4205 clipToRect(originalContext, paintingInfo, backgroundRect); 4206 4206 filterPainter->applyFilterEffect(originalContext); 4207 restoreClip(originalContext, paintingInfo .paintDirtyRect, backgroundRect);4207 restoreClip(originalContext, paintingInfo, backgroundRect); 4208 4208 } 4209 4209 … … 4664 4664 } 4665 4665 4666 parent()->clipToRect( paintingInfo, context, clipRect);4666 parent()->clipToRect(context, paintingInfo, clipRect); 4667 4667 paintLayerByApplyingTransform(context, paintingInfo, paintFlags, fragment.paginationOffset); 4668 parent()->restoreClip(context, paintingInfo .paintDirtyRect, clipRect);4668 parent()->restoreClip(context, paintingInfo, clipRect); 4669 4669 } 4670 4670 } … … 4685 4685 // Paint our background first, before painting any child layers. 4686 4686 // Establish the clip used to paint our background. 4687 clipToRect( localPaintingInfo, context, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); // Background painting will handle clipping to self.4687 clipToRect(context, localPaintingInfo, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); // Background painting will handle clipping to self. 4688 4688 } 4689 4689 … … 4694 4694 4695 4695 if (localPaintingInfo.clipToDirtyRect) 4696 restoreClip(context, localPaintingInfo .paintDirtyRect, fragment.backgroundRect);4696 restoreClip(context, localPaintingInfo, fragment.backgroundRect); 4697 4697 } 4698 4698 } … … 4725 4725 if (shouldClip) { 4726 4726 clippedRect = layerFragments[0].foregroundRect; 4727 clipToRect( localPaintingInfo, context, clippedRect);4727 clipToRect(context, localPaintingInfo, clippedRect); 4728 4728 } 4729 4729 … … 4740 4740 4741 4741 if (shouldClip) 4742 restoreClip(context, localPaintingInfo .paintDirtyRect, clippedRect);4742 restoreClip(context, localPaintingInfo, clippedRect); 4743 4743 } 4744 4744 … … 4753 4753 4754 4754 if (shouldClip) 4755 clipToRect( localPaintingInfo, context, fragment.foregroundRect);4755 clipToRect(context, localPaintingInfo, fragment.foregroundRect); 4756 4756 4757 4757 PaintInfo paintInfo(context, fragment.foregroundRect.rect(), phase, paintBehavior, subtreePaintRootForRenderer, nullptr, nullptr, &localPaintingInfo.rootLayer->renderer()); … … 4761 4761 4762 4762 if (shouldClip) 4763 restoreClip(context, localPaintingInfo .paintDirtyRect, fragment.foregroundRect);4763 restoreClip(context, localPaintingInfo, fragment.foregroundRect); 4764 4764 } 4765 4765 } … … 4774 4774 // Paint our own outline 4775 4775 PaintInfo paintInfo(context, fragment.backgroundRect.rect(), PaintPhaseSelfOutline, paintBehavior, subtreePaintRootForRenderer, nullptr, nullptr, &localPaintingInfo.rootLayer->renderer()); 4776 clipToRect( localPaintingInfo, context, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius);4776 clipToRect(context, localPaintingInfo, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); 4777 4777 renderer().paint(paintInfo, toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelAccumulation)); 4778 restoreClip(context, localPaintingInfo .paintDirtyRect, fragment.backgroundRect);4778 restoreClip(context, localPaintingInfo, fragment.backgroundRect); 4779 4779 } 4780 4780 } … … 4788 4788 4789 4789 if (localPaintingInfo.clipToDirtyRect) 4790 clipToRect( localPaintingInfo, context, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); // Mask painting will handle clipping to self.4790 clipToRect(context, localPaintingInfo, fragment.backgroundRect, DoNotIncludeSelfForBorderRadius); // Mask painting will handle clipping to self. 4791 4791 4792 4792 // Paint the mask. … … 4796 4796 4797 4797 if (localPaintingInfo.clipToDirtyRect) 4798 restoreClip(context, localPaintingInfo .paintDirtyRect, fragment.backgroundRect);4798 restoreClip(context, localPaintingInfo, fragment.backgroundRect); 4799 4799 } 4800 4800 } … … 4808 4808 4809 4809 if (localPaintingInfo.clipToDirtyRect) 4810 clipToRect( localPaintingInfo, context, fragment.foregroundRect, IncludeSelfForBorderRadius); // Child clipping mask painting will handle clipping to self.4810 clipToRect(context, localPaintingInfo, fragment.foregroundRect, IncludeSelfForBorderRadius); // Child clipping mask painting will handle clipping to self. 4811 4811 4812 4812 // Paint the clipped mask. … … 4815 4815 4816 4816 if (localPaintingInfo.clipToDirtyRect) 4817 restoreClip(context, localPaintingInfo .paintDirtyRect, fragment.foregroundRect);4817 restoreClip(context, localPaintingInfo, fragment.foregroundRect); 4818 4818 } 4819 4819 } … … 4824 4824 if (fragment.backgroundRect.isEmpty()) 4825 4825 continue; 4826 clipToRect( localPaintingInfo, context, fragment.backgroundRect);4826 clipToRect(context, localPaintingInfo, fragment.backgroundRect); 4827 4827 paintOverflowControls(context, roundedIntPoint(toLayoutPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subpixelAccumulation)), 4828 4828 snappedIntRect(fragment.backgroundRect.rect()), true); 4829 restoreClip(context, localPaintingInfo .paintDirtyRect, fragment.backgroundRect);4829 restoreClip(context, localPaintingInfo, fragment.backgroundRect); 4830 4830 } 4831 4831 } … … 7005 7005 // Optimize clipping for the single fragment case. 7006 7006 if (shouldClip) 7007 clipToRect( paintingInfo, context, clipRect);7007 clipToRect(context, paintingInfo, clipRect); 7008 7008 7009 7009 flowThreadLayer->paintNamedFlowThreadInsideRegion(context, flowFragment, paintingInfo.paintDirtyRect, fragment.layerBounds.location() + paintingInfo.subpixelAccumulation, … … 7011 7011 7012 7012 if (shouldClip) 7013 restoreClip(context, paintingInfo .paintDirtyRect, clipRect);7013 restoreClip(context, paintingInfo, clipRect); 7014 7014 } 7015 7015 } -
trunk/Source/WebCore/rendering/RenderLayer.h
r200283 r200284 727 727 void clearRepaintRects(); 728 728 729 void clipToRect( const LayerPaintingInfo&, GraphicsContext&, const ClipRect&, BorderRadiusClippingRule = IncludeSelfForBorderRadius);730 void restoreClip(GraphicsContext&, const Lay outRect& paintDirtyRect, const ClipRect&);729 void clipToRect(GraphicsContext&, const LayerPaintingInfo&, const ClipRect&, BorderRadiusClippingRule = IncludeSelfForBorderRadius); 730 void restoreClip(GraphicsContext&, const LayerPaintingInfo&, const ClipRect&); 731 731 732 732 bool shouldRepaintAfterLayout() const;
Note: See TracChangeset
for help on using the changeset viewer.