Bug 41425

Summary: Negative shadow radius should make shadow properties invalid
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: CSSAssignee: Simon Fraser (smfr) <simon.fraser>
Status: RESOLVED FIXED    
Severity: Normal CC: ahmad.saleem792, bdakin, karlcow, mitz, ntim
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: OS X 10.5   
Attachments:
Description Flags
test for negative values in box|text-shadow none

Description Simon Fraser (smfr) 2010-06-30 13:17:46 PDT
We should throw out box-shadow and text-shadow properties when the blur radius is negative; the rule should be considered invalid.
Comment 1 Ahmad Saleem 2022-07-23 07:24:42 PDT
https://wpt.fyi/results/css/css-backgrounds/box-shadow-radius-001.html?label=master&label=experimental&aligned&q=shadow-radius

It has box-shadow negative values coverage. Ignore my comment, if I am wrong. Thanks!
Comment 2 Karl Dubost 2023-01-25 16:39:49 PST
Created attachment 464659 [details]
test for negative values in box|text-shadow

The negative values in these tests are the spread-radius (4th value), not the border radius. Negative values are authorized on the 4th value.


https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow
box-shadow: offset-x | offset-y | blur-radius | spread-radius | color


3rd <length [0,∞]>
Specifies the blur radius. Negative values are invalid. If the blur value is zero, the shadow’s edge is sharp. Otherwise, the larger the value, the more the shadow’s edge is blurred. See Shadow Blurring, below.
— https://w3c.github.io/csswg-drafts/css-backgrounds/#box-shadow


https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow
text-shadow: offset-x | offset-y | blur-radius | color 
OR 
text-shadow: color | offset-x | offset-y | blur-radius


https://w3c.github.io/csswg-drafts/css-text-decor/#text-shadow-property 
doesn't really forbid the negative value apart a reference to the length where it says it can be problematic.

The story is slightly different in text-shadow 4
https://drafts.csswg.org/css-text-decor-4/#text-shadow-property

where it explicitly reference the box-shadow way of doing things. 
https://drafts.csswg.org/css-backgrounds-3/#typedef-shadow

I uploaded a test.

There's no styling going on when the values are negative. So probably this has been solved in the past. 

And we can also see this in the Web Inspector.