| Issue 29427: | Inset box shadow escapes content when border radius present | |
| 535 people starred this issue and may be notified of changes. | Back to list |
Restricted
Sign in to add a comment
|
What steps will reproduce the problem? Create a div with rounded corners and an inset box shadow. <div style=" border: 1px solid black; width: 100px; height: 100px; -webkit-box-shadow: inset 2px 2px 2px red; -webkit-border-radius: 10px; -moz-box-shadow: inset 2px 2px 2px red; -moz-border-radius: 10px; "></div> http://www.plexode.com/cgi- bin/eval3.py#ht=%3Cdiv%20style%3D%22%0A%20%20border%3A%202px%20solid%20black%3B%0A%20%20width%3A%20100px %3B%0A%20%20height%3A%20100px%3B%0A%20%20-webkit-box- shadow%3A%20inset%205px%205px%205px%20red%3B%0A%20%20-webkit-border-radius%3A%2020px%3B%0A%20%20-moz- box-shadow%3A%20inset%205px%205px%205px%20red%3B%0A%20%20-moz-border- radius%3A%2020px%3B%0A%22%3E%3C%2Fdiv%3E%0A&ohh=1&ohj=1&jt=&ojh=1&ojj=1&ms=100&oth=0&otj=0&cex=1 What is the expected output? What do you see instead? The shadow must not escape the content. It seems like the inset box shadow ignores the rounded corners. This works correctly in Safari and Chrome on Mac. It fails on Chrome Windows and Linux so it is probably Skia issue.
Apr 1, 2010
Bulk update
Labels:
Mstone-6
Apr 8, 2010
you can work around this by defining the border
yourBox
{
background: #505050;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-webkit-box-shadow: inset 0 1px 6px rgba( 0, 0, 0, 0.9 );
-moz-box-shadow: inset 0 1px 6px rgba( 0, 0, 0, 0.9 );
border:1px solid #505050;
}
Apr 8, 2010
@jhlagado: it looks slightly better but far from a rounded corner ;)
Apr 22, 2010
Assigning to someone who might actually have a chance to fix this.
Status:
Assigned
Owner: senorbla...@chromium.org Cc: -senorbla...@chromium.org a...@chromium.org
Apr 27, 2010
Issue 31448 has been merged into this issue.
May 29, 2010
This looks like the same bug: http://stackoverflow.com/questions/2937731/box-shadow-and-border-radius-bug-in-chrome
Jun 20, 2010
Issue 44460 has been merged into this issue.
Jun 20, 2010
Issue 42656 has been merged into this issue.
Jun 21, 2010
Issue 45751 has been merged into this issue.
Jun 22, 2010
I have an example too, which works fine in Mozilla but fails in Chrome on form inputs: http://www.devseo.co.uk/examples/beautiful-css3-form/
Jun 29, 2010
I'm not actively working on this, so I'm unowning in the hopes that someone adopts it.
Owner:
---
Jul 3, 2010
This fixes the problem for me: Index: RenderBoxModelObject.cpp =================================================================== --- RenderBoxModelObject.cpp (revision 62294) +++ RenderBoxModelObject.cpp (working copy) @@ -1680,7 +1680,7 @@ context->save(); if (hasBorderRadius) - context->clip(Path::createRoundedRectangle(rect, topLeft, topRight, bottomLeft, bottomRight)); + context->canvasClip(Path::createRoundedRectangle(rect, topLeft, topRight, bottomLeft, bottomRight)); I'm not entirely sure why, though. It looks like the rounded rect hack that agl put in gets confused with inset shadows, and it's not needed anyway, so sidestepping makes the problem go away. agl, since this is potentially a one-line fix (it just needs a better explanation than "uhh – now it works!" :-) ) and in code you wrote, do you want to take this on? Else, please assign to me and I'll dig some more.
Owner:
a...@chromium.org
Cc: -a...@chromium.org tha...@chromium.org
Jul 3, 2010
And for my reference: http://trac.webkit.org/changeset/49641 (patch where agl added canvasClip()).
Jul 3, 2010
I think my patch above is mostly correct. It seems that agl's antialiasing hack doesn't work with shadows. Non-inset shadows are clipped by a call to context->clipOut() (first big branch in RenderBoxModelObject::paintBoxShadow), which happens to not use the antialiasing hack. Inset shadows call context->clipPath(), which uses the antialiasing hack in GraphicsContext::clipPath(). So the patch makes inset shadows work as nice as normal shadows. It's not the prettiest patch as it somewhat exposes skia implementation details to RenderBoxModel, but in a way that's already happened in http://trac.webkit.org/changeset/49641 . (Note that using skia's normal clipping for shadows isn't all that great: Since skia's clip paths use only 1 bit of transparency – http://www.imperialviolet.org/2009/09/02/anti-aliased-clipping.html – shadows are pretty aliased. This is for example very visible when drawing a div with border radius 20px, background-color:rgba(255, 0, 0, 0.5), border:3px solid green, and -webkit-box-shadow:4px 4px 8px black. Note the ugly edge with color bleeding and all.) I guess I'll try to get the patch above landed in webkit.
Owner:
tha...@chromium.org
Cc: -tha...@chromium.org a...@chromium.org
Jul 3, 2010
https://bugs.webkit.org/show_bug.cgi?id=41576
Jul 4, 2010
That didn't go so well :-) Mitz is right though, we need some way to clip shadows with antialiasing – see screenshot (in addition to the aliased shadow, there are also some jpeg artifacts due to nxclient, sorry about that).
Status:
Available
Owner: ---
Jul 9, 2010
For status see http://neugierig.org/software/chromium/notes/ AGL
Jul 12, 2010
(No comment was entered for this change.)
Labels:
-Skia
Jul 21, 2010
(No comment was entered for this change.)
Labels:
Mstone-X
Aug 26, 2010
(No comment was entered for this change.)
Labels:
Fidelity
Aug 28, 2010
So, nobody is working on this? I have tested Safari on Windows and works as it should.
I can see too that there's an inset shadow when not setting border. I mean:
.field {
border: 1px solid #333;
-webkit-border-radius: 15px;
-webkit-box-shadow: inset 0 1px 1px #999;
}
Will show this bug, but:
.field {
-webkit-border-radius: 15px;
}
Will show an inset shadow properly rendering!! I can´t understand why.
Sep 1, 2010
article about these bugs in russian (but everything is clear and with sources): http://habrahabr.ru/blogs/css/103170/
Sep 3, 2010
still no fix for this bug in the latest verion of Chrome For Windows(6.0.472.53)
Sep 27, 2010
example of the error http://cssdesk.com/KKHC7
Oct 4, 2010
Crazy. So, if this works in Safari... can someone confirm the patch has been merged into Webkit? If so, why does Chromium not have it yet?
Oct 4, 2010
Still here in the beta (7.0.517.24). Are you guys waiting on webkit to fix this?
Oct 4, 2010
Safari uses Cor
Oct 4, 2010
eGraphics, while chrome uses Skia for drawing on windows and linux. This is mostly a Skia bug.
Oct 4, 2010
Opened an issue there and I'm cross-linking >> https://code.google.com/p/skia/issues/detail?id=82
Oct 5, 2010
WebKit assumes that it has immediate mode clipping which Skia doesn't do. See http://neugierig.org/software/chromium/notes/2010/07/clipping.html Fixing this means rewriting clipping in Skia and the main Skia developer changed jobs. You're correct that this has been hanging around for too long. However, given the vitriolic abuse that usually ends up being thrown around on graphics issues, I'm not too keen to go near them now.
Labels:
Restrict-AddIssueComment-Commit
Oct 29, 2010
Issue 61185 has been merged into this issue.
Nov 29, 2010
Issue 64674 has been merged into this issue.
Dec 21, 2010
Is this fixed as of http://trac.webkit.org/changeset/74089 ?
Status:
Assigned
Owner: morr...@google.com
Dec 23, 2010
Issue 65587 has been merged into this issue.
Mar 13, 2011
Issue 73312 has been merged into this issue.
Mar 23, 2011
(No comment was entered for this change.)
Labels:
-Area-Compat-Web bulkmove Area-Compat
Jun 26, 2012
(No comment was entered for this change.)
Labels:
VerifyIn-21
Blocking: -48277 -67723 chromium:48277 chromium:67723
Jul 16, 2012
(No comment was entered for this change.)
Status:
Verified
Mar 10, 2013
(No comment was entered for this change.)
Labels:
-Type-Bug -Area-Internals -Internals-Skia -Area-Compat Cr-Internals-Skia Type-Compat Cr-Internals
Blocking: -chromium:48277 -chromium:67723 chromium:48277 chromium:67723 |
||||||||||
| ► Sign in to add a comment | |||||||||||
I'm experiencing the same problem, here is my test code and a screenshot. yourBox { background: #505050; -webkit-border-radius: 5px; -moz-border-radius: 5px; -webkit-box-shadow: inset 0 1px 6px rgba( 0, 0, 0, 0.9 ); -moz-box-shadow: inset 0 1px 6px rgba( 0, 0, 0, 0.9 ); }747 bytes View Download