Changeset 95096 in webkit


Ignore:
Timestamp:
Sep 14, 2011 9:45:23 AM (13 years ago)
Author:
hyatt@apple.com
Message:

https://bugs.webkit.org/show_bug.cgi?id=68050

Regressions in some layout tests from making border/mask/reflection nine-piece-image
parsing match the spec, which allows any of the pieces to be omitted and to also be
specifiable in any order.

When the higher level code suddenly allowed the image slices to be omitted, the fixup
for legacy compatibility for reflections and masks in the parseBorderImageSlice function
no longer happened because that function no longer got called.

The fix is to properly set the defaults to include the "fill" keyword, so the fixup is
applied to the NinePieceImages you create before you ever map anything in from the rules.

This also has the side effect of fixing -webkit-max-box-image-slice to actually dump as
"0 fill" instead of just "0", which is the correct initial value for this property.

Reviewed by Adam Roben.

Source/WebCore:

  • css/CSSParser.cpp:

(WebCore::CSSParser::parseBorderImageSlice):

  • css/CSSStyleSelector.cpp:

(WebCore::CSSStyleSelector::applyProperty):

  • rendering/style/StyleRareNonInheritedData.cpp:

(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):

  • rendering/style/StyleReflection.h:

(WebCore::StyleReflection::StyleReflection):

LayoutTests:

  • fast/css/getComputedStyle/computed-style-expected.txt:
  • fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
  • svg/css/getComputedStyle-basic-expected.txt:
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r95095 r95096  
     12011-09-13  David Hyatt  <hyatt@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=68050
     4       
     5        Regressions in some layout tests from making border/mask/reflection nine-piece-image
     6        parsing match the spec, which allows any of the pieces to be omitted and to also be
     7        specifiable in any order.
     8       
     9        When the higher level code suddenly allowed the image slices to be omitted, the fixup
     10        for legacy compatibility for reflections and masks in the parseBorderImageSlice function
     11        no longer happened because that function no longer got called.
     12       
     13        The fix is to properly set the defaults to include the "fill" keyword, so the fixup is
     14        applied to the NinePieceImages you create before you ever map anything in from the rules.
     15       
     16        This also has the side effect of fixing -webkit-max-box-image-slice to actually dump as
     17        "0 fill" instead of just "0", which is the correct initial value for this property.
     18
     19        Reviewed by Adam Roben.
     20
     21        * fast/css/getComputedStyle/computed-style-expected.txt:
     22        * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
     23        * svg/css/getComputedStyle-basic-expected.txt:
     24
    1252011-09-14  Ilya Tikhonovsky  <loislo@chromium.org>
    226
  • trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt

    r94912 r95096  
    163163-webkit-mask-box-image-outset: 0px;
    164164-webkit-mask-box-image-repeat: stretch;
    165 -webkit-mask-box-image-slice: 0;
     165-webkit-mask-box-image-slice: 0 fill;
    166166-webkit-mask-box-image-source: none;
    167167-webkit-mask-box-image-width: auto;
  • trunk/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt

    r94912 r95096  
    162162    -webkit-mask-box-image-outset: 0px
    163163    -webkit-mask-box-image-repeat: stretch
    164     -webkit-mask-box-image-slice: 0
     164    -webkit-mask-box-image-slice: 0 fill
    165165    -webkit-mask-box-image-source: none
    166166    -webkit-mask-box-image-width: auto
  • trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt

    r94912 r95096  
    323323rect: style.getPropertyValue(-webkit-mask-box-image-repeat) : stretch
    324324rect: style.getPropertyCSSValue(-webkit-mask-box-image-repeat) : [object CSSPrimitiveValue]
    325 rect: style.getPropertyValue(-webkit-mask-box-image-slice) : 0
     325rect: style.getPropertyValue(-webkit-mask-box-image-slice) : 0 fill
    326326rect: style.getPropertyCSSValue(-webkit-mask-box-image-slice) : [object CSSValue]
    327327rect: style.getPropertyValue(-webkit-mask-box-image-source) : none
     
    803803g: style.getPropertyValue(-webkit-mask-box-image-repeat) : stretch
    804804g: style.getPropertyCSSValue(-webkit-mask-box-image-repeat) : [object CSSPrimitiveValue]
    805 g: style.getPropertyValue(-webkit-mask-box-image-slice) : 0
     805g: style.getPropertyValue(-webkit-mask-box-image-slice) : 0 fill
    806806g: style.getPropertyCSSValue(-webkit-mask-box-image-slice) : [object CSSValue]
    807807g: style.getPropertyValue(-webkit-mask-box-image-source) : none
  • trunk/Source/WebCore/ChangeLog

    r95093 r95096  
     12011-09-13  David Hyatt  <hyatt@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=68050
     4       
     5        Regressions in some layout tests from making border/mask/reflection nine-piece-image
     6        parsing match the spec, which allows any of the pieces to be omitted and to also be
     7        specifiable in any order.
     8       
     9        When the higher level code suddenly allowed the image slices to be omitted, the fixup
     10        for legacy compatibility for reflections and masks in the parseBorderImageSlice function
     11        no longer happened because that function no longer got called.
     12       
     13        The fix is to properly set the defaults to include the "fill" keyword, so the fixup is
     14        applied to the NinePieceImages you create before you ever map anything in from the rules.
     15       
     16        This also has the side effect of fixing -webkit-max-box-image-slice to actually dump as
     17        "0 fill" instead of just "0", which is the correct initial value for this property.
     18
     19        Reviewed by Adam Roben.
     20
     21        * css/CSSParser.cpp:
     22        (WebCore::CSSParser::parseBorderImageSlice):
     23        * css/CSSStyleSelector.cpp:
     24        (WebCore::CSSStyleSelector::applyProperty):
     25        * rendering/style/StyleRareNonInheritedData.cpp:
     26        (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
     27        * rendering/style/StyleReflection.h:
     28        (WebCore::StyleReflection::StyleReflection):
     29
    1302011-09-13  Pavel Feldman  <pfeldman@google.com>
    231
  • trunk/Source/WebCore/css/CSSParser.cpp

    r95077 r95096  
    54175417    }
    54185418
    5419     if (context.allowNumber() && !context.top() && (propId == CSSPropertyWebkitMaskBoxImage || propId == CSSPropertyWebkitBoxReflect)) {
    5420         // Allow the slices to be omitted for images that don't fit to a border.  We just set the slices to be 0.
    5421         context.setTop(primitiveValueCache()->createValue(0, CSSPrimitiveValue::CSS_NUMBER));
    5422         context.setAllowFinalCommit();
    5423     }
    5424 
    54255419    if (context.allowFinalCommit()) {
    54265420        // FIXME: For backwards compatibility, -webkit-border-image, -webkit-mask-box-image and -webkit-box-reflect have to do a fill by default.
  • trunk/Source/WebCore/css/CSSStyleSelector.cpp

    r95052 r95096  
    30353035
    30363036        NinePieceImage image;
    3037         if (property == CSSPropertyWebkitMaskBoxImage) {
    3038             image.setImageSlices(LengthBox(0)); // For backwards compatibility, just make the mask box image slices 0 instead of 100%.
    3039             image.setBorderSlices(LengthBox()); // The slices default to auto.
    3040         }
     3037        if (property == CSSPropertyWebkitMaskBoxImage)
     3038            image.setMaskDefaults();
    30413039        mapNinePieceImage(property, value, image);
    30423040
     
    31783176        }
    31793177        NinePieceImage mask;
    3180         mask.setImageSlices(LengthBox(0)); // For backwards compatibility, just make the mask box image slices 0 instead of 100%.
    3181         mask.setBorderSlices(LengthBox()); // The slices default to auto.
     3178        mask.setMaskDefaults();
    31823179        mapNinePieceImage(property, reflectValue->mask(), mask);
    31833180        reflection->setMask(mask);
  • trunk/Source/WebCore/rendering/style/NinePieceImage.h

    r94912 r95096  
    113113    }
    114114
     115    void setMaskDefaults()
     116    {
     117        m_imageSlices = LengthBox(0);
     118        m_fill = true;
     119        m_borderSlices = LengthBox();
     120    }
     121
    115122private:
    116123    RefPtr<StyleImage> m_image;
  • trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp

    r94593 r95096  
    6565    , m_regionBreakInside(RenderStyle::initialPageBreak())
    6666{
    67     m_maskBoxImage.setImageSlices(LengthBox(0)); // Preserve the value of 0 for mask box image slices for backwards compatibility.
    68     m_maskBoxImage.setBorderSlices(LengthBox()); // The border slices for a mask box image default to auto instead of 1.
     67    m_maskBoxImage.setMaskDefaults();
    6968}
    7069
  • trunk/Source/WebCore/rendering/style/StyleReflection.h

    r94593 r95096  
    5959        , m_offset(0, Fixed)
    6060    {
    61          m_mask.setImageSlices(LengthBox(0)); // Preserve the value of 0 for mask image slices for backwards compatibility.
    62          m_mask.setBorderSlices(LengthBox()); // The border slices for a mask image default to auto instead of 1.
     61         m_mask.setMaskDefaults();
    6362    }
    6463   
Note: See TracChangeset for help on using the changeset viewer.