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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderLayer.h ('k') | Source/core/rendering/RenderLayerBacking.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderLayer.cpp
diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp
index 2e5e260ea0e15f0a2537a147ad40e33b2640eb5e..0c2966febc71ff1b226fe4c518dbd917faa96b8c 100644
--- a/Source/core/rendering/RenderLayer.cpp
+++ b/Source/core/rendering/RenderLayer.cpp
@@ -3331,6 +3331,7 @@ void RenderLayer::paintLayerContents(GraphicsContext* context, const LayerPainti
bool shouldPaintNormalFlowAndPosZOrderLists = isPaintingCompositedForeground;
bool shouldPaintOverlayScrollbars = isPaintingOverlayScrollbars;
bool shouldPaintMask = (paintFlags & PaintLayerPaintingCompositingMaskPhase) && shouldPaintContent && renderer()->hasMask() && !selectionOnly;
+ bool shouldPaintClippingMask = (paintFlags & PaintLayerPaintingChildClippingMaskPhase) && renderer()->style()->hasBorderRadius() && shouldPaintContent && !selectionOnly;
PaintBehavior paintBehavior = PaintBehaviorNormal;
if (paintFlags & PaintLayerPaintingSkipRootBackground)
@@ -3386,6 +3387,11 @@ void RenderLayer::paintLayerContents(GraphicsContext* context, const LayerPainti
if (shouldPaintMask)
paintMaskForFragments(layerFragments, context, localPaintingInfo, paintingRootForRenderer);
+ if (shouldPaintClippingMask) {
+ // Paint the border radius mask for the fragments.
+ paintChildClippingMaskForFragments(layerFragments, context, localPaintingInfo, paintingRootForRenderer);
+ }
+
// End our transparency layer
if (haveTransparency && m_usedTransparency && !m_paintingInsideReflection) {
context->endLayer();
@@ -3688,6 +3694,26 @@ void RenderLayer::paintMaskForFragments(const LayerFragments& layerFragments, Gr
}
}
+void RenderLayer::paintChildClippingMaskForFragments(const LayerFragments& layerFragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo,
+ RenderObject* paintingRootForRenderer)
+{
+ for (size_t i = 0; i < layerFragments.size(); ++i) {
+ const LayerFragment& fragment = layerFragments.at(i);
+ if (!fragment.shouldPaintContent)
+ continue;
+
+ if (localPaintingInfo.clipToDirtyRect)
+ clipToRect(localPaintingInfo.rootLayer, context, localPaintingInfo.paintDirtyRect, fragment.foregroundRect, IncludeSelfForBorderRadius); // Child clipping mask painting will handle clipping to self.
+
+ // Paint the the clipped mask.
+ PaintInfo paintInfo(context, pixelSnappedIntRect(fragment.backgroundRect.rect()), PaintPhaseClippingMask, PaintBehaviorNormal, paintingRootForRenderer, localPaintingInfo.region, 0, 0, localPaintingInfo.rootLayer->renderer());
+ renderer()->paint(paintInfo, toPoint(fragment.layerBounds.location() - renderBoxLocation() + localPaintingInfo.subPixelAccumulation));
+
+ if (localPaintingInfo.clipToDirtyRect)
+ restoreClip(context, localPaintingInfo.paintDirtyRect, fragment.foregroundRect);
+ }
+}
+
void RenderLayer::paintOverflowControlsForFragments(const LayerFragments& layerFragments, GraphicsContext* context, const LayerPaintingInfo& localPaintingInfo)
{
for (size_t i = 0; i < layerFragments.size(); ++i) {
@@ -5007,6 +5033,11 @@ bool RenderLayer::hasCompositedMask() const
return m_backing && m_backing->hasMaskLayer();
}
+bool RenderLayer::hasCompositedClippingMask() const
+{
+ return m_backing && m_backing->hasChildClippingMaskLayer();
+}
+
GraphicsLayer* RenderLayer::layerForScrolling() const
{
return m_backing ? m_backing->scrollingContentsLayer() : 0;
« 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