Permalink
Browse files

Fixed DFL-2837: Can't reactivate complex background property when sho…

…rthands are collapsed.
  • Loading branch information...
1 parent ef4534b commit 212bdda83e4fef369c0a42bd0d8acb9d3217882f @hzr hzr committed Feb 14, 2012
Showing with 25 additions and 4 deletions.
  1. +3 −2 src/style/css_shorthand_resolver.js
  2. +22 −2 tests/sniper/css_shorthand_tests.js
@@ -298,16 +298,17 @@ CssShorthandResolver.shorthands = (function() {
{
var template_len = template.length;
var is_final_bg_layer = (i == len-1);
+ var is_default_bg_size = declarations["background-size"][i].value == get_initial_value("background-size");
// Always add background-image, unless we're in the final background layer and
// it has the default value.
if (!(is_final_bg_layer && declarations["background-image"][i].value == get_initial_value("background-image")))
template.push(" ", declarations["background-image"][i]);
- if (declarations["background-position"][i].value != get_initial_value("background-position"))
+ if (!is_default_bg_size || declarations["background-position"][i].value != get_initial_value("background-position"))
template.push(" ", declarations["background-position"][i]);
- if (declarations["background-size"][i].value != get_initial_value("background-size"))
+ if (!is_default_bg_size)
template.push("/", declarations["background-size"][i]);
if (declarations["background-repeat"][i].value != get_initial_value("background-repeat"))
@@ -1,5 +1,5 @@
-// Test dependencies (included with testFile):
-// css_shorthand_tests.js, stylesheets.js, css_shorthand_resolver.js, element_style.js, css_rule.js, css_value_tokenizer.js
+// This test has dependencies. Example of running:
+// sniper.html?testFile=stylesheets.js&testFile=element_style.js&testFile=css_rule.js&testFile=css_value_tokenizer.js&testFile=css_shorthand_resolver.js&testFile=css_shorthand_tests.js
addModule("CSS shorthands");
@@ -589,6 +589,26 @@ addTest("Resolving CSS shorthands", function () {
set_properties(
{
+ "background": "url(\"data:image/png;1\")",
+ "background-size": "1px",
+ }
+ );
+
+ assert_rule(
+ {
+ properties: [
+ "background",
+ ],
+ values: [
+ "url(\"data:image/png;1\") 0% 0%/1px transparent",
+ ],
+ }
+ );
+
+ clear_properties();
+
+ set_properties(
+ {
"overflow-x": "hidden",
"overflow-y": "hidden",
}

0 comments on commit 212bdda

Please sign in to comment.