mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-19 09:30:44 +00:00
Treat a property value with trailing non-whitespace the same as a parse error. b=383075 r+sr=dbaron
This commit is contained in:
parent
9adc5b48b1
commit
783c6f54e4
@ -933,10 +933,6 @@ CSSParserImpl::ParseRule(const nsAString& aRule,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//XXXbz this function does not deal well with something like "foo
|
||||
//!important" as the aPropValue. It will parse the "foo" and set it
|
||||
//in the decl, then ignore the !important. It should either fail to
|
||||
//parse this or do !important correctly....
|
||||
NS_IMETHODIMP
|
||||
CSSParserImpl::ParseProperty(const nsCSSProperty aPropID,
|
||||
const nsAString& aPropValue,
|
||||
@ -977,9 +973,14 @@ CSSParserImpl::ParseProperty(const nsCSSProperty aPropID,
|
||||
mTempData.AssertInitialState();
|
||||
aDeclaration->ExpandTo(&mData);
|
||||
nsresult result = NS_OK;
|
||||
if (ParseProperty(errorCode, aPropID)) {
|
||||
PRBool parsedOK = ParseProperty(errorCode, aPropID);
|
||||
if (parsedOK && !GetToken(errorCode, PR_TRUE)) {
|
||||
TransferTempData(aDeclaration, aPropID, PR_FALSE, PR_FALSE, aChanged);
|
||||
} else {
|
||||
if (parsedOK) {
|
||||
// Junk at end of property value.
|
||||
REPORT_UNEXPECTED_TOKEN(PEExpectEndProperty);
|
||||
}
|
||||
NS_ConvertASCIItoUTF16 propName(nsCSSProps::GetStringValue(aPropID));
|
||||
const PRUnichar *params[] = {
|
||||
propName.get()
|
||||
|
@ -74,6 +74,7 @@ _TEST_FILES = test_bug221428.html \
|
||||
test_bug373293.html \
|
||||
test_bug379440.html \
|
||||
test_bug379741.html \
|
||||
test_bug383075.html \
|
||||
test_dont_use_document_colors.html \
|
||||
test_inherit_storage.html \
|
||||
test_inherit_computation.html \
|
||||
|
85
layout/style/test/test_bug383075.html
Normal file
85
layout/style/test/test_bug383075.html
Normal file
@ -0,0 +1,85 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=383075
|
||||
-->
|
||||
<head>
|
||||
<title>Test for bug 383075</title>
|
||||
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
<style type="text/css">
|
||||
|
||||
html,body {
|
||||
color:black; background-color:white; font-size:16px; font-family: Arial;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=383075">Mozilla bug 383075</a>
|
||||
<p id="display">
|
||||
|
||||
The X'es below should have the same size:<br>
|
||||
|
||||
<span id="a1" style="font-size:72px;">X</span>
|
||||
<span id="a2" style="font-size:72px;">X</span>
|
||||
<span id="a3" style="font-size:72px;">X</span>
|
||||
<span id="a4" style="font-size:72px;">X</span>
|
||||
<span id="a5" style="font-size:72px;">X</span>
|
||||
<span id="a6" style="font-size:72px;">X</span>
|
||||
<span id="a7" style="font-size:24px;">X</span>
|
||||
<span id="a8" style="font-size:72px;">X</span>
|
||||
<span id="a9" style="font:24px Arial;">X</span>
|
||||
|
||||
<br>
|
||||
|
||||
<span id="b1" style="font-size:72px;">X</span>
|
||||
<span id="b2" style="font-size:72px;">X</span>
|
||||
<span id="b3" style="font-size:72px;">X</span>
|
||||
<span id="b4" style="font-size:72px;">X</span>
|
||||
<span id="b5" style="font-size:72px;">X</span>
|
||||
<span id="b6" style="font-size:72px;">X</span>
|
||||
<span id="b7" style="font-size:24px;">X</span>
|
||||
<span id="b8" style="font-size:72px;">X</span>
|
||||
<span id="b9" style="font:24px Arial;">X</span>
|
||||
</p>
|
||||
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
document.getElementById("a1").style.fontSize = "illegal";
|
||||
document.getElementById("a2").style.fontSize = "24px;";
|
||||
document.getElementById("a3").style.fontSize = "24px; font-size-adjust:2";
|
||||
document.getElementById("a4").style.fontSize = ";";
|
||||
document.getElementById("a5").style.font = "24px Arial;";
|
||||
document.getElementById("a6").style.font = "24px;";
|
||||
document.getElementById("a7").style.fontSize = " 72px "; // correct
|
||||
document.getElementById("a8").style.font = ";";
|
||||
document.getElementById("a9").style.font = " 72px Arial "; // correct
|
||||
|
||||
document.getElementById("b1").style.setProperty("font-size", "illegal", null);
|
||||
document.getElementById("b2").style.setProperty("font-size", "24px;", null);
|
||||
document.getElementById("b3").style.setProperty("font-size", "24px; font-size-adjust:2", null);
|
||||
document.getElementById("b4").style.setProperty("font-size", ";", null);
|
||||
document.getElementById("b5").style.setProperty("font", "24px Arial;", null);
|
||||
document.getElementById("b6").style.setProperty("font", "24px;", null);
|
||||
document.getElementById("b7").style.setProperty("font-size", " 72px ", null); // correct
|
||||
document.getElementById("b8").style.setProperty("font", ";", null);
|
||||
document.getElementById("b9").style.setProperty("font", " 72px Arial ", null); // correct
|
||||
|
||||
|
||||
for (i=1; i <= 9; ++i)
|
||||
is($('a'+i).style.fontSize, '72px', "font size");
|
||||
|
||||
for (i=1; i <= 9; ++i)
|
||||
is($('b'+i).style.fontSize, '72px', "font size");
|
||||
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
x
Reference in New Issue
Block a user