Bug 140536

Summary: Border-radius clipping on a stacking context causes descendants to not render
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: Layout and RenderingAssignee: Simon Fraser (smfr) <simon.fraser>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, dino, simon.fraser, sun.shin, thorton
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 138551    
Attachments:
Description Flags
Testcase
none
Patch
none
test-result
none
test-result-expected
none
clip and border radius test
none
Patch none

Description Simon Fraser (smfr) 2015-01-15 20:24:17 PST
Created attachment 244747 [details]
Testcase

Attached testcase shows a bug with border-radius clipping on a stacking context, with composited descendants.
Comment 1 Simon Fraser (smfr) 2015-01-15 22:03:58 PST
I have a fix for this.
Comment 2 Simon Fraser (smfr) 2015-01-17 11:14:40 PST
Created attachment 244842 [details]
Patch
Comment 3 Byungseon Shin 2015-01-19 10:41:04 PST
I have verified that this change resolve the issue clearly on Mac Platform.
Thanks Simon.
Comment 4 Byungseon Shin 2015-01-19 10:48:50 PST
I have found an issue on "Testcase that asserts on non-Mac" of https://bugs.webkit.org/show_bug.cgi?id=138551. 
It does not work on second test.
Comment 5 Byungseon Shin 2015-01-21 08:17:01 PST
When container has border radius and clippingLayer with an offset value, it may need to apply border radius to container not to clippingLayer and then update offset value.
I have created a patch for it. 

One issue is when I change the offset value of clip Layer using inspector, it does not work well.

 // The clipping strategy depends on whether the rounded rect has equal corner radii.
 void GraphicsLayerCA::updateClippingStrategy(PlatformCALayer& clippingLayer, RefPtr<PlatformCALayer>& shapeMaskLayer, const FloatRoundedRect& roundedRect
)
 {
@@ -2085,7 +2072,15 @@ void GraphicsLayerCA::updateClippingStrategy(PlatformCALayer& clippingLayer, Ref
     clippingLayer.setCornerRadius(0);
     clippingLayer.setMask(shapeMaskLayer.get());
     
-    FloatRoundedRect offsetRoundedRect(clippingLayer.bounds(), roundedRect.radii());+
+    FloatRoundedRect offsetRoundedRect(roundedRect);
+
+    FloatRect clipRect = clippingLayer.bounds();
+    FloatPoint3D clipPos = clippingLayer.position();
+    FloatSize clipOffset = FloatSize(-(clipPos.x() - clipRect.width()/2), -(clipPos.y() - clipRect.height()/2));
+
+    offsetRoundedRect.move(clipOffset);
+
     shapeMaskLayer->setShapeRoundedRect(offsetRoundedRect);
 }
Comment 6 Byungseon Shin 2015-01-21 14:30:10 PST
Created attachment 245090 [details]
test-result
Comment 7 Byungseon Shin 2015-01-21 14:30:53 PST
Created attachment 245091 [details]
test-result-expected
Comment 8 Byungseon Shin 2015-01-21 14:34:31 PST
Created attachment 245093 [details]
clip and border radius test
Comment 9 Simon Fraser (smfr) 2015-01-26 20:27:45 PST
Created attachment 245405 [details]
Patch
Comment 10 WebKit Commit Bot 2015-01-29 14:57:53 PST
Comment on attachment 245405 [details]
Patch

Clearing flags on attachment: 245405

Committed r179369: <http://trac.webkit.org/changeset/179369>
Comment 11 WebKit Commit Bot 2015-01-29 14:57:57 PST
All reviewed patches have been landed.  Closing bug.