Bug 414638 - Disallow mixed space/comma syntax for CSS rect() value; r=dbaron

This commit is contained in:
Ms2ger 2011-05-08 20:14:16 +02:00
parent fc89f5809d
commit 6bc5540bc3
4 changed files with 70 additions and 3 deletions

View File

@ -0,0 +1,27 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>CSS Test: clip: Missing commas in rect()</title>
<link rel="author" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/">
<link rel="help" href="http://www.w3.org/TR/CSS21/visufx.html#clipping">
<meta name="flags" content="invalid may">
<meta name="assert" content="User agents may support separation of values within rect() by whitespace instead of commas, but not a combination of whitespace and commas.">
<style type="text/css">
div {
background: red;
width: 100px; height: 100px;
}
.inner {
position: absolute;
background: green;
}
</style>
</head>
<body>
<p>There must be a green box below and no red.</p>
<div class="outer">
<div class="inner"></div>
</div>
</body>
</html>

View File

@ -0,0 +1,33 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>CSS Test: clip: Missing commas in rect()</title>
<link rel="author" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/">
<link rel="help" href="http://www.w3.org/TR/CSS21/visufx.html#clipping">
<meta name="flags" content="invalid may">
<meta name="assert" content="User agents may support separation of values within rect() by whitespace instead of commas, but not a combination of whitespace and commas.">
<style type="text/css">
div {
background: red;
width: 100px; height: 100px;
}
.inner {
position: absolute;
background: green;
clip: rect(0,0,0,0);
clip: rect( 0 auto auto 0 );
clip: rect(0,0 0,0);
clip: rect(0 0,0,0);
clip: rect(0,0,0 0);
clip: rect(0 0,0 0);
}
</style>
</head>
<body>
<p>There must be a green box below and no red.</p>
<div class="outer">
<div class="inner"></div>
</div>
</body>
</html>

View File

@ -967,6 +967,7 @@ skip-if(cocoaWidget) == 413292-1.html 413292-1-ref.html # disabling due to failu
== 413840-bullet-first-line.html 413840-bullet-first-line-ref.html
== 413982.html 413982-ref.html
== 414123.xhtml 414123-ref.xhtml
== 414638.html 414638-ref.html
== 414851-1.html 414851-1-ref.html
== 416106-1.xhtml 416106-1-ref.xhtml
== 416752-1.html 416752-1-ref.html

View File

@ -6869,14 +6869,20 @@ CSSParserImpl::ParseRect(nsCSSProperty aPropID)
} else if (mToken.mType == eCSSToken_Function &&
mToken.mIdent.LowerCaseEqualsLiteral("rect")) {
nsCSSRect& rect = val.SetRectValue();
PRBool useCommas;
NS_FOR_CSS_SIDES(side) {
if (! ParseVariant(rect.*(nsCSSRect::sides[side]),
VARIANT_AL, nsnull)) {
return PR_FALSE;
}
if (side < 3) {
// skip optional commas between elements
(void)ExpectSymbol(',', PR_TRUE);
if (side == 0) {
useCommas = ExpectSymbol(',', PR_TRUE);
} else if (useCommas && side < 3) {
// Skip optional commas between elements, but only if the first
// separator was a comma.
if (!ExpectSymbol(',', PR_TRUE)) {
return PR_FALSE;
}
}
}
if (!ExpectSymbol(')', PR_TRUE)) {