Bug 205733
| Summary: | Unitless zero should not always be allowed | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Simon Fraser (smfr) <simon.fraser> |
| Component: | CSS | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED CONFIGURATION CHANGED | ||
| Severity: | Normal | CC: | ahmad.saleem792, annevk, ap, bfulgham, dino, emilio, graouts, koivisto, rniwa, sam, simon.fraser, zalan |
| Priority: | P2 | ||
| Version: | Safari Technology Preview | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=207439 | ||
Simon Fraser (smfr)
inline bool shouldAcceptUnitlessValue(double value, CSSParserMode cssParserMode, UnitlessQuirk unitless)
{
// FIXME: Presentational HTML attributes shouldn't use the CSS parser for lengths
return value == 0
|| isUnitLessValueParsingEnabledForMode(cssParserMode)
|| (cssParserMode == HTMLQuirksMode && unitless == UnitlessQuirk::Allow);
}
Note the "value == 0". This is wrong; unitless zero should only be accepted in some legacy situations. See https://www.w3.org/TR/css3-values/#angles and related.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Ahmad Saleem
This FIXME is present but the code is bit changed.
https://github.com/WebKit/WebKit/blob/10224b907dbca4a066401003bd0734bdefbadf1c/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp#L93
Is this still required? Thanks!
Anne van Kesteren
Comment 0 is addressed due to:
(value == 0 && unitlessZero == UnitlessZeroQuirk::Allow)
I.e., comparison to 0 is no longer done unconditionally.
The FIXME is a separate issue and sounds like it relates to callers of this method. Best tackled separately.