Changeset 117622 in webkit


Ignore:
Timestamp:
May 18, 2012 1:52:24 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

background-size specified by a single value in background shorthand fails to parse.
https://bugs.webkit.org/show_bug.cgi?id=86739

Patch by Joe Thomas <joethomas@motorola.com> on 2012-05-18
Reviewed by Tony Chang.

While parsing the background shorthand property, if the second parsedValue is not a valid unit,
parseFillSize should return the first parsedValue instead of failing.

Source/WebCore:

  • css/CSSParser.cpp:

(WebCore::CSSParser::parseFillSize):

LayoutTests:

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

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r117616 r117622  
     12012-05-18  Joe Thomas  <joethomas@motorola.com>
     2
     3        background-size specified by a single value in background shorthand fails to parse.
     4        https://bugs.webkit.org/show_bug.cgi?id=86739
     5
     6        Reviewed by Tony Chang.
     7
     8        While parsing the background shorthand property, if the second parsedValue is not a valid unit,
     9        parseFillSize should return the first parsedValue instead of failing.
     10
     11        * fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt:
     12        * fast/backgrounds/background-shorthand-with-backgroundSize-style.html:
     13
    1142012-05-18  Raphael Kubo da Costa  <rakuco@webkit.org>
    215
  • trunk/LayoutTests/fast/backgrounds/background-shorthand-with-backgroundSize-style-expected.txt

    r117603 r117622  
    3939PASS checkComputedStyleValue() is true
    4040
     41PASS e.style.background is 'red url(dummy://test.png) no-repeat fixed 50px 60px / 50%'
     42PASS e.style.backgroundSize is '50%'
     43PASS checkStyle() is true
     44PASS computedStyle.getPropertyValue("background") is 'rgb(255, 0, 0) url(dummy://test.png) no-repeat fixed 50px 60px / 50%'
     45PASS computedStyle.getPropertyValue("background-size") is '50%'
     46PASS checkComputedStyleValue() is true
     47
     48PASS e.style.background is 'red url(dummy://test.png) repeat scroll padding-box padding-box 0% 0% / 100px'
     49PASS e.style.backgroundSize is '100px'
     50PASS checkStyle() is true
     51PASS computedStyle.getPropertyValue("background") is 'rgb(255, 0, 0) url(dummy://test.png) repeat scroll 0% 0% / 100px'
     52PASS computedStyle.getPropertyValue("background-size") is '100px'
     53PASS checkComputedStyleValue() is true
     54
     55PASS e.style.background is 'red url(dummy://test.png) repeat fixed content-box content-box 50% 50% / auto'
     56PASS e.style.backgroundSize is 'auto'
     57PASS checkStyle() is true
     58PASS 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
    4162PASS e.style.background is ''
    4263PASS e.style.backgroundSize is ''
  • trunk/LayoutTests/fast/backgrounds/background-shorthand-with-backgroundSize-style.html

    r117603 r117622  
    6868 debug("")
    6969
     70 e.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%'");
     72 shouldBe("e.style.backgroundSize", "'50%'");
     73 shouldBe("checkStyle()", "true");
     74 shouldBe('computedStyle.getPropertyValue("background")', "'rgb(255, 0, 0) url(dummy://test.png) no-repeat fixed 50px 60px / 50%'");
     75 shouldBe('computedStyle.getPropertyValue("background-size")', "'50%'");
     76 shouldBe("checkComputedStyleValue()", "true");
     77 debug("")
     78
     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'");
     81 shouldBe("e.style.backgroundSize", "'100px'");
     82 shouldBe("checkStyle()", "true");
     83 shouldBe('computedStyle.getPropertyValue("background")', "'rgb(255, 0, 0) url(dummy://test.png) repeat scroll 0% 0% / 100px'");
     84 shouldBe('computedStyle.getPropertyValue("background-size")', "'100px'");
     85 shouldBe("checkComputedStyleValue()", "true");
     86 debug("")
     87
     88 e.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'");
     90 shouldBe("e.style.backgroundSize", "'auto'");
     91 shouldBe("checkStyle()", "true");
     92 shouldBe('computedStyle.getPropertyValue("background")', "'rgb(255, 0, 0) url(dummy://test.png) repeat fixed 50% 50% / auto'");
     93 shouldBe('computedStyle.getPropertyValue("background-size")', "'auto'");
     94 shouldBe("checkComputedStyleValue()", "true");
     95 debug("")
     96
    7097 e.style.background = "";
    7198 e.style.background = "red / cover url(dummy://test.png) repeat";
  • trunk/Source/WebCore/ChangeLog

    r117613 r117622  
     12012-05-18  Joe Thomas  <joethomas@motorola.com>
     2
     3        background-size specified by a single value in background shorthand fails to parse.
     4        https://bugs.webkit.org/show_bug.cgi?id=86739
     5
     6        Reviewed by Tony Chang.
     7
     8        While parsing the background shorthand property, if the second parsedValue is not a valid unit,
     9        parseFillSize should return the first parsedValue instead of failing.
     10
     11        * css/CSSParser.cpp:
     12        (WebCore::CSSParser::parseFillSize):
     13
    1142012-05-18  Tony Chang  <tony@chromium.org>
    215
  • trunk/Source/WebCore/css/CSSParser.cpp

    r117613 r117622  
    33763376            allowComma = false;
    33773377        else if (value->id != CSSValueAuto) {
    3378             if (!validUnit(value, FLength | FPercent))
    3379                 return 0;
    3380             parsedValue2 = createPrimitiveNumericValue(value);
     3378            if (!validUnit(value, FLength | FPercent)) {
     3379                if (!inShorthand())
     3380                    return 0;
     3381                // We need to rewind the value list, so that when it is advanced we'll end up back at this value.
     3382                m_valueList->previous();
     3383            } else
     3384                parsedValue2 = createPrimitiveNumericValue(value);
    33813385        }
    33823386    } else if (!parsedValue2 && propId == CSSPropertyWebkitBackgroundSize) {
Note: See TracChangeset for help on using the changeset viewer.