Bug 98905
Summary: | CSS Error Handling does not handle malformed statement properly. | ||
---|---|---|---|
Product: | WebKit | Reporter: | Pravin D <pravind.2k4> |
Component: | CSS | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED WORKSFORME | ||
Severity: | Normal | CC: | bfulgham, darin, glenn, jchaffraix, kling, koivisto |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Pravin D
According to
http://www.w3.org/TR/CSS21/syndata.html#parsing-errors
Spec: Malformed statements. User agents must handle unexpected tokens encountered while parsing a statement by reading until the end of the statement, while observing the rules for matching pairs of (), [], {}, "", and '', and correctly handling escapes.
And
http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#parsed-as-a-css-color-value
Spec: user agents are required to close all open constructs upon finding the end of a style sheet unexpectedly. Thus, when parsing the string "rgb(0,0,0" (with a missing close-parenthesis) for a color value, the close parenthesis is implied by this error handling rule, and a value is obtained (the color 'black'). However, the similar construct "rgb(0,0," (with both a missing parenthesis and a missing "blue" value) cannot be parsed, as closing the open construct does not result in a viable value.
On Webkit
<style>
p {
background-color:rgb(255,0,0
};
</style>
<p>
This space must have RED background color.
</p>
When the style for <p> is examined using inspector,
the <p>'s style is changed to
background-color: rgb(255,0,0 };
However the css error handling code must have 1st matched/closed the "()" and then "{}".
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Antti Koivisto
What do other browsers do?
Pravin D
(In reply to comment #1)
> What do other browsers do?
>
Checked on other browsers IE8, FF15 and Opera12.
None see to handle this particular error scenario!
Glenn Adams
If you are implying that the error handling should consume all tokens to the end of style sheet because it doesn't find a matching right (close) paren, then I don't necessarily agree with your analysis, primarily because the CSS text you cite (about matching pairs) is sufficiently underspecified that it is difficult or impossible to translate to an interoperable implementation.
If WK's behavior matches other UA behavior for this example, then it is safe to assume that the behavior is a result of consensual agreement among implementers, and that what needs fixing is the spec language itself.
I would suggest you take up your concern with the CSS WG at www-style@w3.org.
Brent Fulgham
We should revisit this if the specification is amended with guidance.