Uneven border-radius / box-shadow combination bug?

I can't access the developer forums and the bug search page returns cero for any query, so I'm posting it here too. There could be some talk about it, but I can't find any.


Here's the description:


Summary: box shadows appear square (ignores border radius) when some corner is uneven (two values) AND some other is set to 0 (cero)



Steps to Reproduce: Use the following values in some div css rule to see the bug (add some fill and back to help visually)



-webkit-border-top-left-radius: 12px;

-webkit-border-top-right-radius: 36px 74px;

-webkit-border-bottom-right-radius: 0px;

-webkit-border-bottom-left-radius: 1px;

-webkit-box-shadow: 7px 10px 15px 0px #000;



Compare with the following working code (no corner is cero or undefined)



-webkit-border-top-left-radius: 12px;

-webkit-border-top-right-radius: 36px 74px;

-webkit-border-bottom-right-radius: 1px;

-webkit-border-bottom-left-radius: 1px;

-webkit-box-shadow: 7px 10px 15px 0px #000;





Expected Results: The shadow to be clipped with the round corner's shape.



Actual Results: The round corners are ignored in the shadow and the shadow appears square, while the corners appear rounded.



Is there a way to fix that? (e.g. combining it with another css property)


Thanks.

MacBook Pro, Mac OS X (10.6.4), 17" Mid 2010

Posted on Jun 11, 2012 2:38 AM

Reply
Question marked as Top-ranking reply

Posted on Jun 12, 2012 6:21 PM

UPDATE:


The error happens when safari tries to round the intersecting curves.

It seems there's some smoothing happening when one curve overlaps the other. If there was no smoothing, the curve would stop growing when you set a radius larger than the available area (either because your element is too short, or the adjacent curve has claiming that area too).

Safari tries to "round up" the two curves (or one curve against the next rect corner) and it fails.


In most of cases the error happens when:

1) Some value results bigger than the available width/height

2) The adjacent corner radius is cero, or its value invades the other corner's.


Using percent values fixes most of the non-cero cases. It seems the conversion to pixels always leaves some decimal noise that prevents some math resulting in cero.


I've put online my website in construction. You can test it changing the right-bottom border radius to 0px, from the three tabs at the top, and the shadow will fail (because I specified a corner radius bigger than the element's height)

http://flakeyfish.com/wp-content/themes/wee/index.html


7 replies
Question marked as Top-ranking reply

Jun 12, 2012 6:21 PM in response to ra5ul

UPDATE:


The error happens when safari tries to round the intersecting curves.

It seems there's some smoothing happening when one curve overlaps the other. If there was no smoothing, the curve would stop growing when you set a radius larger than the available area (either because your element is too short, or the adjacent curve has claiming that area too).

Safari tries to "round up" the two curves (or one curve against the next rect corner) and it fails.


In most of cases the error happens when:

1) Some value results bigger than the available width/height

2) The adjacent corner radius is cero, or its value invades the other corner's.


Using percent values fixes most of the non-cero cases. It seems the conversion to pixels always leaves some decimal noise that prevents some math resulting in cero.


I've put online my website in construction. You can test it changing the right-bottom border radius to 0px, from the three tabs at the top, and the shadow will fail (because I specified a corner radius bigger than the element's height)

http://flakeyfish.com/wp-content/themes/wee/index.html


Jun 12, 2012 6:15 PM in response to Sergio Zambrano

There are other non-cero values that also make the curved corner clipping into the shadow to fail.

It seems the curves, by allowing you to enter values larger than the available lenght, are averaged, smoothed, or something like that, which works fine for the element itself, but the same invalid-curve-dealing-feature hasn't been translated to the shape that clips the inside of the shadow.


I wrote about this in detail, as how to work around it, and included some code too.

http://socialblogsitewebdesign.com/watch-out-safaris-border-radius-specific-valu es-breaking-box-shadow/


You can also test it here.

http://jsfiddle.net/jzpV6/2/

Jun 11, 2012 3:36 PM in response to Sergio Zambrano

i can't reproduce your results with either your testcase or this simpliifed one:


-webkit-border-radius: 5px 6px 7px 0px;

-webkit-box-shadow: 10px 10px black;


the corners are uneven and one is set to zero but the shadow is still properly rounded. did you test safari 5.1.7? do you get the same results with the normal css3 border-radius property (sans the -webkit- prefix)?

Jun 13, 2012 2:09 AM in response to Sergio Zambrano

careless mistake on my part misreading your post. i still can't reproduce your original bug using this modified code (with or without the -webkit- prefix):


div {

background-color: grey;

margin: 5% 40%;

border-top-left-radius: 10px;

border-top-right-radius: 20px 30px;

border-bottom-left-radius: 10px;

box-shadow: 10px 10px black;

}


div#one { border-bottom-right-radius: 0px; }


div#two { border-bottom-right-radius: 10px; }

User uploaded file

i don't see the bug in div#one in either safari or firefox. you seem confident however that the problem extends beyond zero values to the math underlying the bezier function so you're welcome to report it (https://bugs.webkit.org).

Jun 15, 2012 12:46 AM in response to ra5ul

As I explained before, and as my example at jsfiddle.net, the issue happens when the height or width available for the curve is less than the specified radius.


If it was not possible to declare values greater than the available space, there would be no problem.


In your examples you didn't specify height or width.


I already submitted a bug, but since I can't "search" (all queries return cero matches) I was waiting until the search engine is fixed… but I'll try to update my original bug report… if I find it.


PS: It only fails in Safari. Not every webkit browser.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Uneven border-radius / box-shadow combination bug?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.