mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Don't eat up too much when we hit an error in the last media query in a list. (Bug 461266) r+sr=bzbarsky
This commit is contained in:
parent
9b86daea26
commit
e56f086139
17
layout/reftests/bugs/461266-1-ref.html
Normal file
17
layout/reftests/bugs/461266-1-ref.html
Normal file
@ -0,0 +1,17 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase for bug 461266</title>
|
||||
<style type="text/css">
|
||||
div {
|
||||
height: 100px; width: 100px;
|
||||
background-color: blue;
|
||||
float: right;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div></div>
|
||||
</body>
|
||||
</html>
|
20
layout/reftests/bugs/461266-1.html
Normal file
20
layout/reftests/bugs/461266-1.html
Normal file
@ -0,0 +1,20 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase for bug 461266</title>
|
||||
<style type="text/css">
|
||||
div { height: 100px; width: 100px; }
|
||||
|
||||
@media all and (min-width:0) {}
|
||||
div { background-color: blue; }
|
||||
|
||||
/* This line stops parsing of following selectors */
|
||||
@media all and(min-width:0) {}
|
||||
div { float: right; }
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div></div>
|
||||
</body>
|
||||
</html>
|
@ -931,4 +931,5 @@ fails == 441259-2.html 441259-2-ref.html # bug 441400
|
||||
== 455280-1.xhtml 455280-1-ref.xhtml
|
||||
fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") == 456147.xul 456147-ref.html # bug 456147, but not caused by it
|
||||
== 456484-1.html 456484-1-ref.html
|
||||
== 461266-1.html 461266-1-ref.html
|
||||
fails == 461512-1.html 461512-1-ref.html # Bug 461512
|
||||
|
@ -273,6 +273,7 @@ protected:
|
||||
PRBool CheckEndProperty();
|
||||
nsSubstring* NextIdent();
|
||||
void SkipUntil(PRUnichar aStopSymbol);
|
||||
void SkipUntilOneOf(const PRUnichar* aStopSymbolChars);
|
||||
void SkipRuleSet();
|
||||
PRBool SkipAtRule();
|
||||
PRBool SkipDeclaration(PRBool aCheckForBraces);
|
||||
@ -1591,10 +1592,18 @@ CSSParserImpl::GatherMedia(nsMediaList* aMedia,
|
||||
PRBool parsedSomething, hitStop;
|
||||
if (!ParseMediaQuery(aStopSymbol, getter_Transfers(query),
|
||||
&parsedSomething, &hitStop)) {
|
||||
NS_ASSERTION(!hitStop, "should return true when hit stop");
|
||||
if (NS_FAILED(mScanner.GetLowLevelError())) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
SkipUntil(',');
|
||||
const PRUnichar stopChars[] =
|
||||
{ PRUnichar(','), aStopSymbol /* may be null */, PRUnichar(0) };
|
||||
SkipUntilOneOf(stopChars);
|
||||
// Rely on SkipUntilOneOf leaving mToken around as the last token read.
|
||||
if (mToken.mType == eCSSToken_Symbol && mToken.mSymbol == aStopSymbol) {
|
||||
UngetToken();
|
||||
hitStop = PR_TRUE;
|
||||
}
|
||||
}
|
||||
if (parsedSomething) {
|
||||
aMedia->SetNonEmpty();
|
||||
@ -2157,6 +2166,30 @@ CSSParserImpl::SkipUntil(PRUnichar aStopSymbol)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CSSParserImpl::SkipUntilOneOf(const PRUnichar* aStopSymbolChars)
|
||||
{
|
||||
nsCSSToken* tk = &mToken;
|
||||
nsDependentString stopSymbolChars(aStopSymbolChars);
|
||||
for (;;) {
|
||||
if (!GetToken(PR_TRUE)) {
|
||||
break;
|
||||
}
|
||||
if (eCSSToken_Symbol == tk->mType) {
|
||||
PRUnichar symbol = tk->mSymbol;
|
||||
if (stopSymbolChars.FindChar(symbol) != -1) {
|
||||
break;
|
||||
} else if ('{' == symbol) {
|
||||
SkipUntil('}');
|
||||
} else if ('[' == symbol) {
|
||||
SkipUntil(']');
|
||||
} else if ('(' == symbol) {
|
||||
SkipUntil(')');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
CSSParserImpl::GetNonCloseParenToken(PRBool aSkipWS)
|
||||
{
|
||||
|
@ -57,13 +57,11 @@ function run() {
|
||||
.appendChild(parse_test_style_element);
|
||||
|
||||
function query_is_parseable(q) {
|
||||
parse_test_style_text.data = "@media " + q + " {}";
|
||||
parse_test_style_text.data = "@media screen, " + q + " {}";
|
||||
var sheet = parse_test_style_element.sheet; // XXX yikes, not live!
|
||||
if (sheet.cssRules.length == 0)
|
||||
return false;
|
||||
if (sheet.cssRules.length == 1 &&
|
||||
sheet.cssRules[0].type == CSSRule.MEDIA_RULE)
|
||||
return true;
|
||||
return sheet.cssRules[0].media.mediaText != "screen";
|
||||
ok(false, "unexpected result testing whether query " + q +
|
||||
" is parseable");
|
||||
return true; // doesn't matter, we already failed
|
||||
|
Loading…
Reference in New Issue
Block a user