Correct parenthesis-matching inside of :not(). (Bug 586070) r=bzbarsky a2.0=bsmedberg

This commit is contained in:
L. David Baron
2010-08-15 08:42:29 -04:00
parent 3e9b99bbed
commit 0839a99fc7
2 changed files with 27 additions and 0 deletions

View File

@@ -3223,11 +3223,13 @@ CSSParserImpl::ParseNegatedSimpleSelector(PRInt32& aDataMask,
} }
if (eSelectorParsingStatus_Error == parsingStatus) { if (eSelectorParsingStatus_Error == parsingStatus) {
REPORT_UNEXPECTED_TOKEN(PENegationBadInner); REPORT_UNEXPECTED_TOKEN(PENegationBadInner);
SkipUntil(')');
return parsingStatus; return parsingStatus;
} }
// close the parenthesis // close the parenthesis
if (!ExpectSymbol(')', PR_TRUE)) { if (!ExpectSymbol(')', PR_TRUE)) {
REPORT_UNEXPECTED_TOKEN(PENegationNoClose); REPORT_UNEXPECTED_TOKEN(PENegationNoClose);
SkipUntil(')');
return eSelectorParsingStatus_Error; return eSelectorParsingStatus_Error;
} }

View File

@@ -137,6 +137,19 @@ var declarations = [
"border-top-width: -moz-calc((2em) ", "border-top-width: -moz-calc((2em) ",
]; ];
var selectors = [
":not(",
":not( ",
":not(-",
":not(- ",
":not(>",
":not(> ",
":not(div p",
":not(div p ",
":not(div >",
":not(div > ",
];
var textNode = document.createTextNode(""); var textNode = document.createTextNode("");
document.getElementById("style").appendChild(textNode); document.getElementById("style").appendChild(textNode);
var cs = getComputedStyle(document.getElementById("display"), ""); var cs = getComputedStyle(document.getElementById("display"), "");
@@ -152,6 +165,18 @@ for (var i = 0; i < declarations.length; ++i) {
"z-index for declaration '" + declarations[i] + "'"); "z-index for declaration '" + declarations[i] + "'");
} }
for (var i = 0; i < selectors.length; ++i) {
var sheet = "@namespace html url(http://www.w3.org/1999/xhtml);\n" +
"#display { color: green } " +
selectors[i] + " x x x x x x x , #display { color: red } #display { color: red } ) , #display { color: red } " +
"#display { z-index: " + (i + 1) + " }";
textNode.data = sheet;
is(cs.color, "rgb(0, 128, 0)",
"color for selector '" + selectors[i] + "'");
is(cs.zIndex, i+1,
"z-index for selector '" + selectors[i] + "'");
}
</script> </script>
</pre> </pre>
</body> </body>