Changeset 117694 in webkit


Ignore:
Timestamp:
May 19, 2012 11:25:34 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

The order of CSS properties is wrong in background shorthand
https://bugs.webkit.org/show_bug.cgi?id=86152

Patch by Joe Thomas <joethomas@motorola.com> on 2012-05-19
Reviewed by Ryosuke Niwa.

Corrected the order of properties returned in StylePropertySet::getPropertyValue for background shorthand property to match the specification
http://www.w3.org/TR/css3-background/#background.

Source/WebCore:

  • css/StylePropertyShorthand.cpp:

(WebCore::backgroundShorthand):

LayoutTests:

  • fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt:
  • fast/backgrounds/background-shorthand-with-backgroundSize-style.html:
  • fast/dom/background-shorthand-csstext-expected.txt:
  • fast/dom/background-shorthand-csstext.html:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r117693 r117694  
     12012-05-19  Joe Thomas  <joethomas@motorola.com>
     2
     3        The order of CSS properties is wrong in background shorthand
     4        https://bugs.webkit.org/show_bug.cgi?id=86152
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Corrected the order of properties returned in StylePropertySet::getPropertyValue for background shorthand property to match the specification 
     9        http://www.w3.org/TR/css3-background/#background.
     10
     11        * fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt:
     12        * fast/backgrounds/background-shorthand-with-backgroundSize-style.html:
     13        * fast/dom/background-shorthand-csstext-expected.txt:
     14        * fast/dom/background-shorthand-csstext.html:
     15
    1162012-05-19  Zan Dobersek  <zandobersek@gmail.com>
    217
  • trunk/LayoutTests/fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt

    r117622 r117694  
    44
    55
    6 PASS e.style.background is 'red url(dummy://test.png) no-repeat border-box border-box 50% 50% / cover'
     6PASS e.style.background is 'url(dummy://test.png) 50% 50% / cover no-repeat border-box border-box red'
    77PASS e.style.backgroundSize is 'cover'
    88PASS checkStyle() is true
     
    1111PASS checkComputedStyleValue() is true
    1212
    13 PASS e.style.background is 'red url(dummy://test.png) no-repeat padding-box padding-box 20px 50% / contain'
     13PASS e.style.background is 'url(dummy://test.png) 20px 50% / contain no-repeat padding-box padding-box red'
    1414PASS e.style.backgroundSize is 'contain'
    1515PASS checkStyle() is true
     
    1818PASS checkComputedStyleValue() is true
    1919
    20 PASS e.style.background is 'red url(dummy://test.png) no-repeat 50px 60px / 50% 75%'
     20PASS e.style.background is 'url(dummy://test.png) 50px 60px / 50% 75% no-repeat red'
    2121PASS e.style.backgroundSize is '50% 75%'
    2222PASS checkStyle() is true
     
    2525PASS checkComputedStyleValue() is true
    2626
    27 PASS e.style.background is 'red url(dummy://test.png) repeat border-box border-box 0% 0% / 100px 200px'
     27PASS e.style.background is 'url(dummy://test.png) 0% 0% / 100px 200px repeat border-box content-box red'
    2828PASS e.style.backgroundSize is '100px 200px'
    2929PASS checkStyle() is true
     
    3232PASS checkComputedStyleValue() is true
    3333
    34 PASS e.style.background is 'red url(dummy://test.png) repeat content-box content-box 50% 50% / auto'
     34PASS e.style.background is 'url(dummy://test.png) 50% 50% / auto repeat content-box padding-box red'
    3535PASS e.style.backgroundSize is 'auto'
    3636PASS checkStyle() is true
     
    3939PASS checkComputedStyleValue() is true
    4040
    41 PASS e.style.background is 'red url(dummy://test.png) no-repeat fixed 50px 60px / 50%'
     41PASS e.style.background is 'url(dummy://test.png) 50px 60px / 50% no-repeat fixed red'
    4242PASS e.style.backgroundSize is '50%'
    4343PASS checkStyle() is true
     
    4646PASS checkComputedStyleValue() is true
    4747
    48 PASS e.style.background is 'red url(dummy://test.png) repeat scroll padding-box padding-box 0% 0% / 100px'
     48PASS e.style.background is 'url(dummy://test.png) 0% 0% / 100px repeat scroll padding-box border-box red'
    4949PASS e.style.backgroundSize is '100px'
    5050PASS checkStyle() is true
     
    5353PASS checkComputedStyleValue() is true
    5454
    55 PASS e.style.background is 'red url(dummy://test.png) repeat fixed content-box content-box 50% 50% / auto'
     55PASS e.style.background is 'url(dummy://test.png) 50% 50% / auto repeat fixed content-box content-box red'
    5656PASS e.style.backgroundSize is 'auto'
    5757PASS checkStyle() is true
    5858PASS computedStyle.getPropertyValue("background") is 'rgb(255, 0, 0) url(dummy://test.png) repeat fixed 50% 50% / auto'
     59PASS computedStyle.getPropertyValue("background-size") is 'auto'
     60PASS checkComputedStyleValue() is true
     61
     62PASS e.style.background is '0% 0% / 50%'
     63PASS e.style.backgroundSize is '50%'
     64PASS checkStyle() is true
     65PASS computedStyle.getPropertyValue("background") is 'rgba(0, 0, 0, 0) none repeat scroll 0% 0% / 50%'
     66PASS computedStyle.getPropertyValue("background-size") is '50%'
     67PASS checkComputedStyleValue() is true
     68
     69PASS e.style.background is 'fixed red'
     70PASS e.style.backgroundSize is 'initial'
     71PASS checkStyle() is true
     72PASS computedStyle.getPropertyValue("background") is 'rgb(255, 0, 0) none repeat fixed 0% 0% / auto'
    5973PASS computedStyle.getPropertyValue("background-size") is 'auto'
    6074PASS checkComputedStyleValue() is true
  • trunk/LayoutTests/fast/backgrounds/background-shorthand-with-backgroundSize-style.html

    r117641 r117694  
    2424
    2525e.style.background = "center / cover red url(dummy://test.png) no-repeat border-box";
    26 shouldBe("e.style.background", "'red url(dummy://test.png) no-repeat border-box border-box 50% 50% / cover'");
     26shouldBe("e.style.background", "'url(dummy://test.png) 50% 50% / cover no-repeat border-box border-box red'");
    2727shouldBe("e.style.backgroundSize", "'cover'");
    2828shouldBe("checkStyle()", "true");
     
    3333
    3434e.style.background = "red 20px / contain url(dummy://test.png) no-repeat padding-box";
    35 shouldBe("e.style.background", "'red url(dummy://test.png) no-repeat padding-box padding-box 20px 50% / contain'");
     35shouldBe("e.style.background", "'url(dummy://test.png) 20px 50% / contain no-repeat padding-box padding-box red'");
    3636shouldBe("e.style.backgroundSize", "'contain'");
    3737shouldBe("checkStyle()", "true");
     
    4242
    4343e.style.background = "red url(dummy://test.png) 50px 60px / 50% 75% no-repeat";
    44 shouldBe("e.style.background", "'red url(dummy://test.png) no-repeat 50px 60px / 50% 75%'");
     44shouldBe("e.style.background", "'url(dummy://test.png) 50px 60px / 50% 75% no-repeat red'");
    4545shouldBe("e.style.backgroundSize", "'50% 75%'");
    4646shouldBe("checkStyle()", "true");
     
    5050debug("")
    5151
    52 e.style.background = "red url(dummy://test.png) repeat top left / 100px 200px border-box border-box";
    53 shouldBe("e.style.background", "'red url(dummy://test.png) repeat border-box border-box 0% 0% / 100px 200px'");
     52e.style.background = "red url(dummy://test.png) repeat top left / 100px 200px border-box content-box";
     53shouldBe("e.style.background", "'url(dummy://test.png) 0% 0% / 100px 200px repeat border-box content-box red'");
    5454shouldBe("e.style.backgroundSize", "'100px 200px'");
    5555shouldBe("checkStyle()", "true");
     
    5959debug("")
    6060
    61 e.style.background = "red url(dummy://test.png) repeat 50% / auto auto content-box content-box";
    62 shouldBe("e.style.background", "'red url(dummy://test.png) repeat content-box content-box 50% 50% / auto'");
     61e.style.background = "red url(dummy://test.png) repeat 50% / auto auto content-box padding-box";
     62shouldBe("e.style.background", "'url(dummy://test.png) 50% 50% / auto repeat content-box padding-box red'");
    6363shouldBe("e.style.backgroundSize", "'auto'");
    6464shouldBe("checkStyle()", "true");
     
    6969
    7070e.style.background = "url(dummy://test.png) red 50px 60px / 50% no-repeat fixed";
    71 shouldBe("e.style.background", "'red url(dummy://test.png) no-repeat fixed 50px 60px / 50%'");
     71shouldBe("e.style.background", "'url(dummy://test.png) 50px 60px / 50% no-repeat fixed red'");
    7272shouldBe("e.style.backgroundSize", "'50%'");
    7373shouldBe("checkStyle()", "true");
     
    7777debug("")
    7878
    79 e.style.background = "red repeat scroll padding-box padding-box top left / 100px url(dummy://test.png)";
    80 shouldBe("e.style.background", "'red url(dummy://test.png) repeat scroll padding-box padding-box 0% 0% / 100px'");
     79e.style.background = "red repeat scroll padding-box border-box top left / 100px url(dummy://test.png)";
     80shouldBe("e.style.background", "'url(dummy://test.png) 0% 0% / 100px repeat scroll padding-box border-box red'");
    8181shouldBe("e.style.backgroundSize", "'100px'");
    8282shouldBe("checkStyle()", "true");
     
    8787
    8888e.style.background = "50% / auto fixed url(dummy://test.png) repeat content-box red";
    89 shouldBe("e.style.background", "'red url(dummy://test.png) repeat fixed content-box content-box 50% 50% / auto'");
     89shouldBe("e.style.background", "'url(dummy://test.png) 50% 50% / auto repeat fixed content-box content-box red'");
    9090shouldBe("e.style.backgroundSize", "'auto'");
    9191shouldBe("checkStyle()", "true");
    9292shouldBe('computedStyle.getPropertyValue("background")', "'rgb(255, 0, 0) url(dummy://test.png) repeat fixed 50% 50% / auto'");
     93shouldBe('computedStyle.getPropertyValue("background-size")', "'auto'");
     94shouldBe("checkComputedStyleValue()", "true");
     95debug("")
     96
     97e.style.background = "top left / 50%";
     98shouldBe("e.style.background", "'0% 0% / 50%'");
     99shouldBe("e.style.backgroundSize", "'50%'");
     100shouldBe("checkStyle()", "true");
     101shouldBe('computedStyle.getPropertyValue("background")', "'rgba(0, 0, 0, 0) none repeat scroll 0% 0% / 50%'");
     102shouldBe('computedStyle.getPropertyValue("background-size")', "'50%'");
     103shouldBe("checkComputedStyleValue()", "true");
     104debug("")
     105
     106e.style.background = "red fixed";
     107shouldBe("e.style.background", "'fixed red'");
     108shouldBe("e.style.backgroundSize", "'initial'");
     109shouldBe("checkStyle()", "true");
     110shouldBe('computedStyle.getPropertyValue("background")', "'rgb(255, 0, 0) none repeat fixed 0% 0% / auto'");
    93111shouldBe('computedStyle.getPropertyValue("background-size")', "'auto'");
    94112shouldBe("checkComputedStyleValue()", "true");
  • trunk/LayoutTests/fast/dom/background-shorthand-csstext-expected.txt

    r48040 r117694  
    22
    33PASS: document.body.style.background == 'green' should be true and is.
    4 PASS: document.getElementById('div1').style.background == 'repeat-x, white repeat-y' should be true and is.
    5 PASS: document.getElementById('div2').style.background == 'blue 50% 50%' should be true and is.
    6 PASS: document.getElementById('div3').style.background == 'rgb(255, 255, 255) none repeat scroll' should be true and is.
     4PASS: document.getElementById('div1').style.background == 'repeat-x, repeat-y white' should be true and is.
     5PASS: document.getElementById('div2').style.background == '50% 50% blue' should be true and is.
     6PASS: document.getElementById('div3').style.background == 'none repeat scroll rgb(255, 255, 255)' should be true and is.
  • trunk/LayoutTests/fast/dom/background-shorthand-csstext.html

    r48040 r117694  
    3333   
    3434    shouldBe("document.body.style.background == 'green'", true);
    35     shouldBe("document.getElementById('div1').style.background == 'repeat-x, white repeat-y'", true);
    36     shouldBe("document.getElementById('div2').style.background == 'blue 50% 50%'", true);
    37     shouldBe("document.getElementById('div3').style.background == 'rgb(255, 255, 255) none repeat scroll'", true);
     35    shouldBe("document.getElementById('div1').style.background == 'repeat-x, repeat-y white'", true);
     36    shouldBe("document.getElementById('div2').style.background == '50% 50% blue'", true);
     37    shouldBe("document.getElementById('div3').style.background == 'none repeat scroll rgb(255, 255, 255)'", true);
    3838}
    3939</script>
  • trunk/Source/WebCore/ChangeLog

    r117684 r117694  
     12012-05-19  Joe Thomas  <joethomas@motorola.com>
     2
     3        The order of CSS properties is wrong in background shorthand
     4        https://bugs.webkit.org/show_bug.cgi?id=86152
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Corrected the order of properties returned in StylePropertySet::getPropertyValue for background shorthand property to match the specification 
     9        http://www.w3.org/TR/css3-background/#background.
     10
     11        * css/StylePropertyShorthand.cpp:
     12        (WebCore::backgroundShorthand):
     13
    1142012-05-19  Ryosuke Niwa  <rniwa@webkit.org>
    215
  • trunk/Source/WebCore/css/StylePropertyShorthand.cpp

    r116645 r117694  
    2929{
    3030    static const CSSPropertyID backgroundProperties[] = {
    31         CSSPropertyBackgroundColor,
    3231        CSSPropertyBackgroundImage,
     32        CSSPropertyBackgroundPositionX,
     33        CSSPropertyBackgroundPositionY,
     34        CSSPropertyBackgroundSize,
    3335        CSSPropertyBackgroundRepeatX,
    3436        CSSPropertyBackgroundRepeatY,
    3537        CSSPropertyBackgroundAttachment,
     38        CSSPropertyBackgroundOrigin,
    3639        CSSPropertyBackgroundClip,
    37         CSSPropertyBackgroundOrigin,
    38         CSSPropertyBackgroundPositionX,
    39         CSSPropertyBackgroundPositionY,
    40         CSSPropertyBackgroundSize
     40        CSSPropertyBackgroundColor
    4141    };
    4242    DEFINE_STATIC_LOCAL(StylePropertyShorthand, backgroundShorthand, (backgroundProperties, WTF_ARRAY_LENGTH(backgroundProperties)));
Note: See TracChangeset for help on using the changeset viewer.