Bug 1179078 - Recover from parse errors inside image values in border-image properly. r=dholbert

This commit is contained in:
Cameron McCormack 2015-07-01 16:42:31 +10:00
parent c77a743583
commit 10e8f744a3
7 changed files with 58 additions and 4 deletions

View File

@ -0,0 +1,8 @@
<!DOCTYPE html>
<style>
p {
border: 2px solid transparent;
border-image: linear-gradient(to right, orange, blue) 1 1;
}
</style>
<p>This paragraph must have an orange/blue gradient border.</p>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<style>
p {
border: 2px solid transparent;
border-image: linear-gradient(to right, orange, blue) 1 1;
border-image: linear-gradient(to right, garbage) 1 1;
}
</style>
<p>This paragraph must have an orange/blue gradient border.</p>

View File

@ -1927,4 +1927,5 @@ skip-if(B2G||Mulet) == 1150021-1.xul 1150021-1-ref.xul
== 1155828-1.html 1155828-1-ref.html
== 1156129-1.html 1156129-1-ref.html
== 1169331-1.html 1169331-1-ref.html
== 1179078-1.html 1179078-1-ref.html
fuzzy(1,74) == 1174332-1.html 1174332-1-ref.html

View File

@ -104,6 +104,7 @@ default-preferences pref(layout.css.variables.enabled,true)
== variable-reference-37.html variable-reference-37-ref.html
== variable-reference-38.html variable-reference-38-ref.html
== variable-reference-39.html support/color-green-ref.html
== variable-reference-40.html variable-reference-40-ref.html
== variable-supports-01.html support/color-green-ref.html
== variable-supports-02.html support/color-green-ref.html
== variable-supports-03.html support/color-green-ref.html

View File

@ -0,0 +1,14 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<title>CSS Reftest Reference</title>
<link rel="author" title="Cameron McCormack" href="mailto:cam@mcc.id.au">
<style>
p {
border: 2px solid transparent;
border-image: linear-gradient(to right, orange, blue) 1 1;
}
</style>
<p>This paragraph must have an orange/blue gradient border.</p>

View File

@ -0,0 +1,17 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<title>CSS Test: Test that a variable reference within a gradient value in a border-image shorthand parses correctly.</title>
<link rel="author" title="Cameron McCormack" href="mailto:cam@mcc.id.au">
<link rel="help" href="http://www.w3.org/TR/css-variables-1/#using-variables">
<link rel="match" href="variable-reference-40-ref.html">
<style>
p {
--orange: orange;
border: 2px solid transparent;
border-image: linear-gradient(to right, var(--orange), blue) 1 1;
}
</style>
<p>This paragraph must have an orange/blue gradient border.</p>

View File

@ -11347,10 +11347,14 @@ CSSParserImpl::ParseBorderImage()
nsCSSValue imageSourceValue;
while (!CheckEndProperty()) {
// <border-image-source>
if (!foundSource && ParseVariant(imageSourceValue, VARIANT_IMAGE, nullptr)) {
AppendValue(eCSSProperty_border_image_source, imageSourceValue);
foundSource = true;
continue;
if (!foundSource) {
nsAutoCSSParserInputStateRestorer stateRestorer(this);
if (ParseVariant(imageSourceValue, VARIANT_IMAGE, nullptr)) {
AppendValue(eCSSProperty_border_image_source, imageSourceValue);
foundSource = true;
stateRestorer.DoNotRestore();
continue;
}
}
// <border-image-slice>