Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: Source/core/rendering/RenderLayer.cpp

Issue 16688004: Large canvas does not honor containing div's border radius (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Replaced explicit baselines with NeedsRebaseline Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/rendering/RenderLayer.h ('k') | Source/core/rendering/RenderLayerBacking.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 3313 matching lines...) Expand 10 before | Expand all | Expand 10 after
3324 3324
3325 bool forceBlackText = localPaintingInfo.paintBehavior & PaintBehaviorForceBl ackText; 3325 bool forceBlackText = localPaintingInfo.paintBehavior & PaintBehaviorForceBl ackText;
3326 bool selectionOnly = localPaintingInfo.paintBehavior & PaintBehaviorSelecti onOnly; 3326 bool selectionOnly = localPaintingInfo.paintBehavior & PaintBehaviorSelecti onOnly;
3327 3327
3328 bool shouldPaintBackground = isPaintingCompositedBackground && shouldPaintCo ntent && !selectionOnly; 3328 bool shouldPaintBackground = isPaintingCompositedBackground && shouldPaintCo ntent && !selectionOnly;
3329 bool shouldPaintNegZOrderList = (isPaintingScrollingContent && isPaintingOve rflowContents) || (!isPaintingScrollingContent && isPaintingCompositedBackground ); 3329 bool shouldPaintNegZOrderList = (isPaintingScrollingContent && isPaintingOve rflowContents) || (!isPaintingScrollingContent && isPaintingCompositedBackground );
3330 bool shouldPaintOwnContents = isPaintingCompositedForeground && shouldPaintC ontent; 3330 bool shouldPaintOwnContents = isPaintingCompositedForeground && shouldPaintC ontent;
3331 bool shouldPaintNormalFlowAndPosZOrderLists = isPaintingCompositedForeground ; 3331 bool shouldPaintNormalFlowAndPosZOrderLists = isPaintingCompositedForeground ;
3332 bool shouldPaintOverlayScrollbars = isPaintingOverlayScrollbars; 3332 bool shouldPaintOverlayScrollbars = isPaintingOverlayScrollbars;
3333 bool shouldPaintMask = (paintFlags & PaintLayerPaintingCompositingMaskPhase) && shouldPaintContent && renderer()->hasMask() && !selectionOnly; 3333 bool shouldPaintMask = (paintFlags & PaintLayerPaintingCompositingMaskPhase) && shouldPaintContent && renderer()->hasMask() && !selectionOnly;
3334 bool shouldPaintClippingMask = (paintFlags & PaintLayerPaintingChildClipping MaskPhase) && renderer()->style()->hasBorderRadius() && shouldPaintContent && !s electionOnly;
3334 3335
3335 PaintBehavior paintBehavior = PaintBehaviorNormal; 3336 PaintBehavior paintBehavior = PaintBehaviorNormal;
3336 if (paintFlags & PaintLayerPaintingSkipRootBackground) 3337 if (paintFlags & PaintLayerPaintingSkipRootBackground)
3337 paintBehavior |= PaintBehaviorSkipRootBackground; 3338 paintBehavior |= PaintBehaviorSkipRootBackground;
3338 else if (paintFlags & PaintLayerPaintingRootBackgroundOnly) 3339 else if (paintFlags & PaintLayerPaintingRootBackgroundOnly)
3339 paintBehavior |= PaintBehaviorRootBackgroundOnly; 3340 paintBehavior |= PaintBehaviorRootBackgroundOnly;
3340 3341
3341 LayerFragments layerFragments; 3342 LayerFragments layerFragments;
3342 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) { 3343 if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) {
3343 // Collect the fragments. This will compute the clip rectangles and pain t offsets for each layer fragment, as well as whether or not the content of each 3344 // Collect the fragments. This will compute the clip rectangles and pain t offsets for each layer fragment, as well as whether or not the content of each
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3379 context = filterPainter.applyFilterEffect(); 3380 context = filterPainter.applyFilterEffect();
3380 restoreClip(transparencyLayerContext, localPaintingInfo.paintDirtyRect, backgroundRect); 3381 restoreClip(transparencyLayerContext, localPaintingInfo.paintDirtyRect, backgroundRect);
3381 } 3382 }
3382 3383
3383 // Make sure that we now use the original transparency context. 3384 // Make sure that we now use the original transparency context.
3384 ASSERT(transparencyLayerContext == context); 3385 ASSERT(transparencyLayerContext == context);
3385 3386
3386 if (shouldPaintMask) 3387 if (shouldPaintMask)
3387 paintMaskForFragments(layerFragments, context, localPaintingInfo, painti ngRootForRenderer); 3388 paintMaskForFragments(layerFragments, context, localPaintingInfo, painti ngRootForRenderer);
3388 3389
3390 if (shouldPaintClippingMask) {
3391 // Paint the border radius mask for the fragments.
3392 paintChildClippingMaskForFragments(layerFragments, context, localPaintin gInfo, paintingRootForRenderer);
3393 }
3394
3389 // End our transparency layer 3395 // End our transparency layer
3390 if (haveTransparency && m_usedTransparency && !m_paintingInsideReflection) { 3396 if (haveTransparency && m_usedTransparency && !m_paintingInsideReflection) {
3391 context->endLayer(); 3397 context->endLayer();
3392 context->restore(); 3398 context->restore();
3393 m_usedTransparency = false; 3399 m_usedTransparency = false;
3394 } 3400 }
3395 3401
3396 if (resourceClipper) 3402 if (resourceClipper)
3397 resourceClipper->postApplyResource(renderer(), context, ApplyToDefaultMo de, 0, 0); 3403 resourceClipper->postApplyResource(renderer(), context, ApplyToDefaultMo de, 0, 0);
3398 3404
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
3681 // Paint the mask. 3687 // Paint the mask.
3682 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info. 3688 // FIXME: Eventually we will collect the region from the fragment itself instead of just from the paint info.
3683 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseMask, PaintBehaviorNormal, paintingRootForRenderer, localPai ntingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer()); 3689 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseMask, PaintBehaviorNormal, paintingRootForRenderer, localPai ntingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer());
3684 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + localPaintingInfo.subPixelAccumulation)); 3690 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + localPaintingInfo.subPixelAccumulation));
3685 3691
3686 if (localPaintingInfo.clipToDirtyRect) 3692 if (localPaintingInfo.clipToDirtyRect)
3687 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back groundRect); 3693 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.back groundRect);
3688 } 3694 }
3689 } 3695 }
3690 3696
3697 void RenderLayer::paintChildClippingMaskForFragments(const LayerFragments& layer Fragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo,
3698 RenderObject* paintingRootForRenderer)
3699 {
3700 for (size_t i = 0; i < layerFragments.size(); ++i) {
3701 const LayerFragment& fragment = layerFragments.at(i);
3702 if (!fragment.shouldPaintContent)
3703 continue;
3704
3705 if (localPaintingInfo.clipToDirtyRect)
3706 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.p aintDirtyRect, fragment.foregroundRect, IncludeSelfForBorderRadius); // Child cl ipping mask painting will handle clipping to self.
3707
3708 // Paint the the clipped mask.
3709 PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect .rect()), PaintPhaseClippingMask, PaintBehaviorNormal, paintingRootForRenderer, localPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer());
3710 renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - r enderBoxLocation() + localPaintingInfo.subPixelAccumulation));
3711
3712 if (localPaintingInfo.clipToDirtyRect)
3713 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.fore groundRect);
3714 }
3715 }
3716
3691 void RenderLayer::paintOverflowControlsForFragments(const LayerFragments& layerF ragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo) 3717 void RenderLayer::paintOverflowControlsForFragments(const LayerFragments& layerF ragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo)
3692 { 3718 {
3693 for (size_t i = 0; i < layerFragments.size(); ++i) { 3719 for (size_t i = 0; i < layerFragments.size(); ++i) {
3694 const LayerFragment& fragment = layerFragments.at(i); 3720 const LayerFragment& fragment = layerFragments.at(i);
3695 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.paint DirtyRect, fragment.backgroundRect); 3721 clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.paint DirtyRect, fragment.backgroundRect);
3696 paintOverflowControls(context, roundedIntPoint(toPoint(fragment.layerBou nds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation)), 3722 paintOverflowControls(context, roundedIntPoint(toPoint(fragment.layerBou nds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation)),
3697 pixelSnappedIntRect(fragment.backgroundRect.rect()), true); 3723 pixelSnappedIntRect(fragment.backgroundRect.rect()), true);
3698 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.backgrou ndRect); 3724 restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.backgrou ndRect);
3699 } 3725 }
3700 } 3726 }
(...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after
5000 5026
5001 if (!layerBeingDestroyed) 5027 if (!layerBeingDestroyed)
5002 updateOrRemoveFilterEffectRenderer(); 5028 updateOrRemoveFilterEffectRenderer();
5003 } 5029 }
5004 5030
5005 bool RenderLayer::hasCompositedMask() const 5031 bool RenderLayer::hasCompositedMask() const
5006 { 5032 {
5007 return m_backing && m_backing->hasMaskLayer(); 5033 return m_backing && m_backing->hasMaskLayer();
5008 } 5034 }
5009 5035
5036 bool RenderLayer::hasCompositedClippingMask() const
5037 {
5038 return m_backing && m_backing->hasChildClippingMaskLayer();
5039 }
5040
5010 GraphicsLayer* RenderLayer::layerForScrolling() const 5041 GraphicsLayer* RenderLayer::layerForScrolling() const
5011 { 5042 {
5012 return m_backing ? m_backing->scrollingContentsLayer() : 0; 5043 return m_backing ? m_backing->scrollingContentsLayer() : 0;
5013 } 5044 }
5014 5045
5015 GraphicsLayer* RenderLayer::layerForScrollChild() const 5046 GraphicsLayer* RenderLayer::layerForScrollChild() const
5016 { 5047 {
5017 // If we have an ancestor clipping layer because of our scroll parent, we do not want to 5048 // If we have an ancestor clipping layer because of our scroll parent, we do not want to
5018 // scroll that clip layer -- we need it to stay put and we will slide within it. If, on 5049 // scroll that clip layer -- we need it to stay put and we will slide within it. If, on
5019 // the other hand, we have an ancestor clipping layer due to some other clip ping layer, we 5050 // the other hand, we have an ancestor clipping layer due to some other clip ping layer, we
(...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after
6060 } 6091 }
6061 } 6092 }
6062 6093
6063 void showLayerTree(const WebCore::RenderObject* renderer) 6094 void showLayerTree(const WebCore::RenderObject* renderer)
6064 { 6095 {
6065 if (!renderer) 6096 if (!renderer)
6066 return; 6097 return;
6067 showLayerTree(renderer->enclosingLayer()); 6098 showLayerTree(renderer->enclosingLayer());
6068 } 6099 }
6069 #endif 6100 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderLayer.h ('k') | Source/core/rendering/RenderLayerBacking.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698