Changeset 50108 in webkit


Ignore:
Timestamp:
Oct 26, 2009, 3:41:45 PM (15 years ago)
Author:
mitz@apple.com
Message:

background-size: X treated as background-size: X X, not background-size: X auto
https://bugs.webkit.org/show_bug.cgi?id=28440

Reviewed by Beth Dakin.

WebCore:

Updated fast/backgrounds/size/resources/parsing-background-size-values.js
and fast/backgrounds/size/resources/parsing-inherit.js

Reinstated -webkit-background-size and kept its behavior of filling in
the second value with the first one; and changed background-size to have
the behavior of filling in the second value with 'auto'.

  • css/CSSComputedStyleDeclaration.cpp:

(computedProperties): Re-added CSSPropertyWebkitBackgroundSize.
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Ditto.

  • css/CSSParser.cpp:

(WebCore::CSSParser::parseValue): Ditto.
(WebCore::CSSParser::parseFillSize): Adapted for the new parsing rule.
(WebCore::CSSParser::parseFillProperty): Re-added
CSSPropertyWebkitBackgroundSize.
(WebCore::cssPropertyID): Removed mapping of -webkit-background-size to
background-size.

  • css/CSSParser.h:
  • css/CSSPropertyNames.in: Re-added -webkit-background-size.
  • css/CSSStyleSelector.cpp:

(WebCore::CSSStyleSelector::applyProperty): Re-added
CSSPropertyWebkitBackgroundSize.

LayoutTests:

  • fast/backgrounds/size/parsing-background-size-values-expected.txt:
  • fast/backgrounds/size/parsing-inherit-expected.txt:
  • fast/backgrounds/size/resources/parsing-background-size-values.js:

(test):

  • fast/backgrounds/size/resources/parsing-inherit.js:
  • platform/mac/fast/css/getComputedStyle/computed-style-expected.txt:
  • platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r50100 r50108  
     12009-10-26  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Beth Dakin.
     4
     5        background-size: X treated as background-size: X X, not background-size: X auto
     6        https://bugs.webkit.org/show_bug.cgi?id=28440
     7
     8        * fast/backgrounds/size/parsing-background-size-values-expected.txt:
     9        * fast/backgrounds/size/parsing-inherit-expected.txt:
     10        * fast/backgrounds/size/resources/parsing-background-size-values.js:
     11        (test):
     12        * fast/backgrounds/size/resources/parsing-inherit.js:
     13        * platform/mac/fast/css/getComputedStyle/computed-style-expected.txt:
     14        * platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
     15
    1162009-10-26  Dimitri Glazkov  <dglazkov@chromium.org>
    217
  • trunk/LayoutTests/fast/backgrounds/size/parsing-background-size-values-expected.txt

    r47716 r50108  
    1313PASS test("background-size: 30% 20%;") is "30% 20%"
    1414PASS test("background-size: 4em auto;") is "4em "
    15 PASS test("background-size: 5em ;") is "5em 5em"
     15PASS test("background-size: 5em;") is "5em "
     16PASS test("-webkit-background-size: 5em ;") is "5em 5em"
    1617PASS test("background-size: 100 100 100;") is null
    1718PASS test("background-size: coconut;") is null
    1819PASS test("background-size: 100px,;") is null
    19 PASS test("background-size: 100px, 50%;") is "100px 100px, 50% 50%"
    20 PASS test("background-size: 50% 100px, 2em, 100px 50%;") is "50% 100px, 2em 2em, 100px 50%"
     20PASS test("background-size: 100px, 50%;") is "100px , 50% "
     21PASS test("-webkit-background-size: 100px, 50%;") is "100px 100px, 50% 50%"
     22PASS test("background-size: 50% 100px, 2em, 100px 50%;") is "50% 100px, 2em , 100px 50%"
     23PASS test("-webkit-background-size: 50% 100px, 2em, 100px 50%;") is "50% 100px, 2em 2em, 100px 50%"
    2124PASS successfullyParsed is true
    2225
  • trunk/LayoutTests/fast/backgrounds/size/parsing-inherit-expected.txt

    r47630 r50108  
    1313PASS test("background-size: 30% 20%;") is "30% 20%"
    1414PASS test("background-size: 4em auto;") is "64px auto"
    15 PASS test("background-size: 5em ;") is "80px 80px"
     15PASS test("background-size: 5em ;") is "80px auto"
     16PASS test("-webkit-background-size: 5em ;") is "80px 80px"
    1617PASS test("background-size: 100 100 100;") is "auto auto"
    1718PASS test("background-size: coconut;") is "auto auto"
  • trunk/LayoutTests/fast/backgrounds/size/resources/parsing-background-size-values.js

    r47716 r50108  
    77    document.body.appendChild(div);
    88   
    9     var result = div.style.getPropertyValue("background-size");
     9    var result = div.style.getPropertyValue(value.substring(0, value.indexOf(":")));
    1010    document.body.removeChild(div);
    1111    return result;
     
    2121shouldBe('test("background-size: 30% 20%;")', '"30% 20%"');
    2222shouldBe('test("background-size: 4em auto;")', '"4em "');
    23 shouldBe('test("background-size: 5em ;")', '"5em 5em"');
     23shouldBe('test("background-size: 5em;")', '"5em "');
     24shouldBe('test("-webkit-background-size: 5em ;")', '"5em 5em"');
    2425
    2526shouldBe('test("background-size: 100 100 100;")', 'null');
     
    2728
    2829shouldBe('test("background-size: 100px,;")', 'null');
    29 shouldBe('test("background-size: 100px, 50%;")', '"100px 100px, 50% 50%"');
    30 shouldBe('test("background-size: 50% 100px, 2em, 100px 50%;")', '"50% 100px, 2em 2em, 100px 50%"');
     30shouldBe('test("background-size: 100px, 50%;")', '"100px , 50% "');
     31shouldBe('test("-webkit-background-size: 100px, 50%;")', '"100px 100px, 50% 50%"');
     32shouldBe('test("background-size: 50% 100px, 2em, 100px 50%;")', '"50% 100px, 2em , 100px 50%"');
     33shouldBe('test("-webkit-background-size: 50% 100px, 2em, 100px 50%;")', '"50% 100px, 2em 2em, 100px 50%"');
    3134
    3235var successfullyParsed = true;
  • trunk/LayoutTests/fast/backgrounds/size/resources/parsing-inherit.js

    r47630 r50108  
    2525shouldBe('test("background-size: 30% 20%;")', '"30% 20%"');
    2626shouldBe('test("background-size: 4em auto;")', '"64px auto"');
    27 shouldBe('test("background-size: 5em ;")', '"80px 80px"');
     27shouldBe('test("background-size: 5em ;")', '"80px auto"');
     28shouldBe('test("-webkit-background-size: 5em ;")', '"80px 80px"');
    2829
    2930shouldBe('test("background-size: 100 100 100;")', '"auto auto"');
  • trunk/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-expected.txt

    r49959 r50108  
    106106-webkit-background-composite: source-over;
    107107-webkit-background-origin: padding-box;
     108-webkit-background-size: auto auto;
    108109-webkit-border-fit: border;
    109110-webkit-border-horizontal-spacing: 0px;
  • trunk/LayoutTests/platform/mac/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt

    r49959 r50108  
    105105    -webkit-background-composite: source-over
    106106    -webkit-background-origin: padding-box
     107    -webkit-background-size: auto auto
    107108    -webkit-border-fit: border
    108109    -webkit-border-horizontal-spacing: 0px
  • trunk/WebCore/ChangeLog

    r50103 r50108  
     12009-10-26  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Beth Dakin.
     4
     5        background-size: X treated as background-size: X X, not background-size: X auto
     6        https://bugs.webkit.org/show_bug.cgi?id=28440
     7
     8        Updated fast/backgrounds/size/resources/parsing-background-size-values.js
     9        and fast/backgrounds/size/resources/parsing-inherit.js
     10
     11        Reinstated -webkit-background-size and kept its behavior of filling in
     12        the second value with the first one; and changed background-size to have
     13        the behavior of filling in the second value with 'auto'.
     14
     15        * css/CSSComputedStyleDeclaration.cpp:
     16        (computedProperties): Re-added CSSPropertyWebkitBackgroundSize.
     17        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Ditto.
     18        * css/CSSParser.cpp:
     19        (WebCore::CSSParser::parseValue): Ditto.
     20        (WebCore::CSSParser::parseFillSize): Adapted for the new parsing rule.
     21        (WebCore::CSSParser::parseFillProperty): Re-added
     22        CSSPropertyWebkitBackgroundSize.
     23        (WebCore::cssPropertyID): Removed mapping of -webkit-background-size to
     24        background-size.
     25        * css/CSSParser.h:
     26        * css/CSSPropertyNames.in: Re-added -webkit-background-size.
     27        * css/CSSStyleSelector.cpp:
     28        (WebCore::CSSStyleSelector::applyProperty): Re-added
     29        CSSPropertyWebkitBackgroundSize.
     30
    1312009-10-26  Laszlo Gombos  <laszlo.1.gombos@nokia.com>
    232
  • trunk/WebCore/css/CSSComputedStyleDeclaration.cpp

    r49959 r50108  
    158158    CSSPropertyWebkitBackgroundComposite,
    159159    CSSPropertyWebkitBackgroundOrigin,
     160    CSSPropertyWebkitBackgroundSize,
    160161    CSSPropertyWebkitBorderFit,
    161162    CSSPropertyWebkitBorderHorizontalSpacing,
     
    680681                return style->backgroundImage()->cssValue();
    681682            return CSSPrimitiveValue::createIdentifier(CSSValueNone);
    682         case CSSPropertyBackgroundSize: {
     683        case CSSPropertyBackgroundSize:
     684        case CSSPropertyWebkitBackgroundSize: {
    683685            EFillSizeType size = style->backgroundSizeType();
    684686            if (size == Contain)
  • trunk/WebCore/css/CSSParser.cpp

    r49959 r50108  
    874874    case CSSPropertyBackgroundPositionY:
    875875    case CSSPropertyBackgroundSize:
     876    case CSSPropertyWebkitBackgroundSize:
    876877    case CSSPropertyBackgroundRepeat:
    877878    case CSSPropertyBackgroundRepeatX:
     
    23302331}
    23312332
    2332 PassRefPtr<CSSValue> CSSParser::parseFillSize(bool& allowComma)
     2333PassRefPtr<CSSValue> CSSParser::parseFillSize(int propId, bool& allowComma)
    23332334{
    23342335    allowComma = true;
     
    23392340
    23402341    RefPtr<CSSPrimitiveValue> parsedValue1;
    2341    
     2342
    23422343    if (value->id == CSSValueAuto)
    23432344        parsedValue1 = CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_UNKNOWN);
     
    23472348        parsedValue1 = CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit);
    23482349    }
    2349    
    2350     RefPtr<CSSPrimitiveValue> parsedValue2 = parsedValue1;
     2350
     2351    CSSPropertyID property = static_cast<CSSPropertyID>(propId);
     2352    RefPtr<CSSPrimitiveValue> parsedValue2;
    23512353    if ((value = m_valueList->next())) {
    23522354        if (value->id == CSSValueAuto)
     
    23602362        }
    23612363    }
    2362    
     2364    if (!parsedValue2) {
     2365        if (property == CSSPropertyWebkitBackgroundSize || property == CSSPropertyWebkitMaskSize)
     2366            parsedValue2 = parsedValue1;
     2367        else
     2368            parsedValue2 = CSSPrimitiveValue::create(0, CSSPrimitiveValue::CSS_UNKNOWN);
     2369    }
     2370
    23632371    return CSSPrimitiveValue::create(Pair::create(parsedValue1.release(), parsedValue2.release()));
    23642372}
     
    24792487                    break;
    24802488                case CSSPropertyBackgroundSize:
     2489                case CSSPropertyWebkitBackgroundSize:
    24812490                case CSSPropertyWebkitMaskSize: {
    2482                     currValue = parseFillSize(allowComma);
     2491                    currValue = parseFillSize(propId, allowComma);
    24832492                    if (currValue)
    24842493                        m_valueList->next();
     
    51955204                name = opacity;
    51965205                length = strlen(opacity);
    5197             } else if (strcmp(buffer, "-webkit-background-size") == 0) {
    5198                 // CSS Backgrounds/Borders.  -webkit-background-size worked in Safari 4 and earlier.
    5199                 const char* const backgroundSize = "background-size";
    5200                 name = backgroundSize;
    5201                 length = strlen(backgroundSize);
    52025206            } else if (hasPrefix(buffer + 7, length - 7, "-border-")) {
    52035207                // -webkit-border-*-*-radius worked in Safari 4 and earlier. -webkit-border-radius syntax
  • trunk/WebCore/css/CSSParser.h

    r47906 r50108  
    8484        void parseFillPosition(RefPtr<CSSValue>&, RefPtr<CSSValue>&);
    8585        void parseFillRepeat(RefPtr<CSSValue>&, RefPtr<CSSValue>&);
    86         PassRefPtr<CSSValue> parseFillSize(bool &allowComma);
     86        PassRefPtr<CSSValue> parseFillSize(int propId, bool &allowComma);
    8787       
    8888        bool parseFillProperty(int propId, int& propId1, int& propId2, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
  • trunk/WebCore/css/CSSPropertyNames.in

    r49003 r50108  
    161161-webkit-background-composite
    162162-webkit-background-origin
     163# -webkit-background-size differs from background-size only in the interpretation of
     164# a single value: -webkit-background-size: l; is equivalent to background-size: l l;
     165# whereas background-size: l; is equivalent to background-size: l auto;
     166-webkit-background-size
    163167-webkit-binding
    164168-webkit-border-fit
  • trunk/WebCore/css/CSSStyleSelector.cpp

    r49103 r50108  
    29622962        return;
    29632963    case CSSPropertyBackgroundSize:
     2964    case CSSPropertyWebkitBackgroundSize:
    29642965        HANDLE_BACKGROUND_VALUE(size, Size, value)
    29652966        return;
Note: See TracChangeset for help on using the changeset viewer.