Ignore:
Timestamp:
Oct 24, 2012, 1:18:36 PM (13 years ago)
Author:
[email protected]
Message:

image-set doesn't round-trip properly with cssText
https://bugs.webkit.org/show_bug.cgi?id=99725

Patch by Rick Byers <[email protected]> on 2012-10-24
Reviewed by Beth Dakin.

Source/WebCore:

Fix serialization of -webkit-image-set rules to use the same format as
is used for parsing.

Test: fast/css/image-set-setting.html

  • css/CSSImageSetValue.cpp:

(WebCore::CSSImageSetValue::customCssText):

  • css/CSSValueList.h:

(WebCore::CSSValueList::item): Add const overload

LayoutTests:

Update image-set-setting test to expect the css text to round-trip properly.

  • fast/css/image-set-setting-expected.txt:
  • fast/css/script-tests/image-set-setting.js:

(testComputedStyle):
(testImageSetRule):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/CSSImageSetValue.cpp

    r132157 r132388  
    141141String CSSImageSetValue::customCssText() const
    142142{
    143     return "-webkit-image-set(" + CSSValueList::customCssText() + ")";
     143    StringBuilder result;
     144    result.append("-webkit-image-set(");
     145
     146    size_t length = this->length();
     147    size_t i = 0;
     148    while (i < length) {
     149        if (i > 0)
     150            result.append(", ");
     151
     152        const CSSValue* imageValue = item(i);
     153        result.append(imageValue->cssText());
     154        result.append(' ');
     155
     156        ++i;
     157        ASSERT(i < length);
     158        const CSSValue* scaleFactorValue = item(i);
     159        result.append(scaleFactorValue->cssText());
     160        // FIXME: Eventually the scale factor should contain it's own unit http://wkb.ug/100120.
     161        // For now 'x' is hard-coded in the parser, so we hard-code it here too.
     162        result.append('x');
     163
     164        ++i;
     165    }
     166
     167    result.append(")");
     168    return result.toString();
    144169}
    145170
Note: See TracChangeset for help on using the changeset viewer.