Skip to content

Commit

Permalink
Bug 1179078 - Recover from parse errors inside image values in border…
Browse files Browse the repository at this point in the history
…-image properly. r=dholbert
  • Loading branch information
heycam committed Jul 1, 2015
1 parent 6535b63 commit e5fd805
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 4 deletions.
8 changes: 8 additions & 0 deletions layout/reftests/bugs/1179078-1-ref.html
Original file line number Diff line number Diff line change
@@ -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>
9 changes: 9 additions & 0 deletions layout/reftests/bugs/1179078-1.html
Original file line number Diff line number Diff line change
@@ -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>
1 change: 1 addition & 0 deletions layout/reftests/bugs/reftest.list
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions layout/reftests/w3c-css/submitted/variables/reftest.list
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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:[email protected]">
<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>
Original file line number Diff line number Diff line change
@@ -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:[email protected]">
<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>
12 changes: 8 additions & 4 deletions layout/style/nsCSSParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit e5fd805

Please sign in to comment.