Changeset 112321 in webkit


Ignore:
Timestamp:
Mar 27, 2012 3:01:03 PM (12 years ago)
Author:
rniwa@webkit.org
Message:

cssText should not generate literal 'initial' in shorthand properties
https://bugs.webkit.org/show_bug.cgi?id=82364

Reviewed by Antti Koivisto.

Source/WebCore:

Fixed the bug by treating initial value as if the value is not set.
While this is incorrect for properties that inherits by default,
it's strictly better than generating unparsable value as we do today.

The proper fix is for CSSInitialValue::cssText to fetch the respective
default value from what's currently in CSSStyleSelector code but that requires
a considerable amount of refactoring and work.

  • css/StylePropertySet.cpp:

(WebCore::StylePropertySet::getShorthandValue):
(WebCore::StylePropertySet::getCommonValue):

LayoutTests:

  • fast/css/cssText-shorthand-expected.txt: Rebaselined.
  • fast/css/cssText-shorthand.html:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r112314 r112321  
     12012-03-27  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        cssText should not generate literal 'initial' in shorthand properties
     4        https://bugs.webkit.org/show_bug.cgi?id=82364
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * fast/css/cssText-shorthand-expected.txt: Rebaselined.
     9        * fast/css/cssText-shorthand.html:
     10
    1112012-03-27  Dirk Pranke  <dpranke@chromium.org>
    212
  • trunk/LayoutTests/fast/css/cssText-shorthand-expected.txt

    r112254 r112321  
    44
    55
    6 PASS normalizeCssText(element.style.cssText) is "border: 1px initial initial"
     6PASS normalizeCssText(element.style.cssText) is "border: 1px"
    77PASS normalizeCssText(element.style.cssText) is "border: 1px solid red"
    8 PASS normalizeCssText(element.style.cssText) is "border: 1px initial red"
    9 PASS normalizeCssText(element.style.cssText) is "border: initial initial red"
    10 PASS normalizeCssText(element.style.cssText) is "border: 1px initial initial"
     8PASS normalizeCssText(element.style.cssText) is "border: 1px red"
     9PASS normalizeCssText(element.style.cssText) is "border: red"
     10PASS normalizeCssText(element.style.cssText) is "border: 1px"
    1111PASS normalizeCssText(element.style.cssText) is "border-bottom-width: 3px; border-left-width: 4px; border-right-width: 2px; border-top-width: 1px"
    1212PASS normalizeCssText(element.style.cssText) is "border-bottom-width: 1px; border-left-width: 1px; border-right-width: 1px; border-top-width: 2px"
    1313PASS normalizeCssText(element.style.cssText) is "border-bottom-width: 1px; border-left-width: 1px; border-right-width: 1px; border-top-width: 1px !important"
    1414PASS normalizeCssText(element.style.cssText) is "border-bottom-width: 1px; border-left-width: 1px; border-right-width: 1px; border-top-color: red; border-top-width: 1px"
    15 PASS normalizeCssText(element.style.cssText) is "border: initial dotted initial"
     15PASS normalizeCssText(element.style.cssText) is "border: dotted"
    1616PASS normalizeCssText(element.style.cssText) is "border-spacing: 1px 2px"
    1717PASS normalizeCssText(element.style.cssText) is "font-family: sans-serif; font-size: 3em; font-style: italic; font-weight: bold; line-height: 2em"
  • trunk/LayoutTests/fast/css/cssText-shorthand.html

    r112254 r112321  
    99var tests = [
    1010    // FIXME: This exhibits a bug. We shouldn't be outputing border-image here.
    11     ['border: 1px; border-top: 1px;', 'border: 1px initial initial;'],
     11    ['border: 1px; border-top: 1px;', 'border: 1px;'],
    1212    ['border: 1px solid red;', 'border: 1px solid red;'],
    13     ['border: 1px red;', 'border: 1px initial red;'],
    14     ['border: red;', 'border: initial initial red;'],
    15     ['border-top: 1px; border-right: 1px; border-bottom: 1px; border-left: 1px;', 'border: 1px initial initial;'],
     13    ['border: 1px red;', 'border: 1px red;'],
     14    ['border: red;', 'border: red;'],
     15    ['border-top: 1px; border-right: 1px; border-bottom: 1px; border-left: 1px;', 'border: 1px;'],
    1616    ['border-top: 1px; border-right: 2px; border-bottom: 3px; border-left: 4px;',
    1717    'border-top-width: 1px; border-right-width: 2px; border-bottom-width: 3px; border-left-width: 4px;'],
     
    2222    ['border: 1px; border-top-color: red;',
    2323    'border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-width: 1px; border-top-color: red;'],
    24     ['border: solid; border-style: dotted', 'border: initial dotted initial;'],
     24    ['border: solid; border-style: dotted', 'border: dotted;'],
    2525
    2626    ['-webkit-border-horizontal-spacing: 1px; -webkit-border-vertical-spacing: 2px;', 'border-spacing: 1px 2px;'],
  • trunk/Source/WebCore/ChangeLog

    r112318 r112321  
     12012-03-27  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        cssText should not generate literal 'initial' in shorthand properties
     4        https://bugs.webkit.org/show_bug.cgi?id=82364
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Fixed the bug by treating initial value as if the value is not set.
     9        While this is incorrect for properties that inherits by default,
     10        it's strictly better than generating unparsable value as we do today.
     11
     12        The proper fix is for CSSInitialValue::cssText to fetch the respective
     13        default value from what's currently in CSSStyleSelector code but that requires
     14        a considerable amount of refactoring and work.
     15
     16        * css/StylePropertySet.cpp:
     17        (WebCore::StylePropertySet::getShorthandValue):
     18        (WebCore::StylePropertySet::getCommonValue):
     19
    1202012-03-26  Adam Klein  <adamk@chromium.org>
    221
  • trunk/Source/WebCore/css/StylePropertySet.cpp

    r112220 r112321  
    383383        if (!isPropertyImplicit(longhand.properties()[i])) {
    384384            RefPtr<CSSValue> value = getPropertyCSSValue(longhand.properties()[i]);
    385             // FIXME: provide default value if !value
    386             if (value) {
     385            // FIXME: provide default value if !value or value is initial value
     386            if (value && !value->isInitialValue()) {
    387387                if (!res.isNull())
    388388                    res += " ";
     
    400400    for (unsigned i = 0; i < longhand.length(); ++i) {
    401401        RefPtr<CSSValue> value = getPropertyCSSValue(longhand.properties()[i]);
    402         if (!value)
     402        // FIXME: CSSInitialValue::cssText should generate the right value.
     403        if (!value || value->isInitialValue())
    403404            return String();
    404405        String text = value->cssText();
Note: See TracChangeset for help on using the changeset viewer.