Title: [95096] trunk
Revision
95096
Author
hy...@apple.com
Date
2011-09-14 09:45:23 -0700 (Wed, 14 Sep 2011)

Log 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:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (95095 => 95096)


--- trunk/LayoutTests/ChangeLog	2011-09-14 16:27:27 UTC (rev 95095)
+++ trunk/LayoutTests/ChangeLog	2011-09-14 16:45:23 UTC (rev 95096)
@@ -1,3 +1,27 @@
+2011-09-13  David Hyatt  <hy...@apple.com>
+
+        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.
+
+        * fast/css/getComputedStyle/computed-style-expected.txt:
+        * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
+        * svg/css/getComputedStyle-basic-expected.txt:
+
 2011-09-14  Ilya Tikhonovsky  <loi...@chromium.org>
 
         Unreviewed. timeline-animation-frame.html was marked as TEXT.

Modified: trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt (95095 => 95096)


--- trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt	2011-09-14 16:27:27 UTC (rev 95095)
+++ trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt	2011-09-14 16:45:23 UTC (rev 95096)
@@ -162,7 +162,7 @@
 -webkit-mask-box-image: none;
 -webkit-mask-box-image-outset: 0px;
 -webkit-mask-box-image-repeat: stretch;
--webkit-mask-box-image-slice: 0;
+-webkit-mask-box-image-slice: 0 fill;
 -webkit-mask-box-image-source: none;
 -webkit-mask-box-image-width: auto;
 -webkit-mask-clip: border-box;

Modified: trunk/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt (95095 => 95096)


--- trunk/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt	2011-09-14 16:27:27 UTC (rev 95095)
+++ trunk/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt	2011-09-14 16:45:23 UTC (rev 95096)
@@ -161,7 +161,7 @@
     -webkit-mask-box-image: none
     -webkit-mask-box-image-outset: 0px
     -webkit-mask-box-image-repeat: stretch
-    -webkit-mask-box-image-slice: 0
+    -webkit-mask-box-image-slice: 0 fill
     -webkit-mask-box-image-source: none
     -webkit-mask-box-image-width: auto
     -webkit-mask-clip: border-box

Modified: trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt (95095 => 95096)


--- trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt	2011-09-14 16:27:27 UTC (rev 95095)
+++ trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt	2011-09-14 16:45:23 UTC (rev 95096)
@@ -322,7 +322,7 @@
 rect: style.getPropertyCSSValue(-webkit-mask-box-image-outset) : [object CSSPrimitiveValue]
 rect: style.getPropertyValue(-webkit-mask-box-image-repeat) : stretch
 rect: style.getPropertyCSSValue(-webkit-mask-box-image-repeat) : [object CSSPrimitiveValue]
-rect: style.getPropertyValue(-webkit-mask-box-image-slice) : 0
+rect: style.getPropertyValue(-webkit-mask-box-image-slice) : 0 fill
 rect: style.getPropertyCSSValue(-webkit-mask-box-image-slice) : [object CSSValue]
 rect: style.getPropertyValue(-webkit-mask-box-image-source) : none
 rect: style.getPropertyCSSValue(-webkit-mask-box-image-source) : [object CSSPrimitiveValue]
@@ -802,7 +802,7 @@
 g: style.getPropertyCSSValue(-webkit-mask-box-image-outset) : [object CSSPrimitiveValue]
 g: style.getPropertyValue(-webkit-mask-box-image-repeat) : stretch
 g: style.getPropertyCSSValue(-webkit-mask-box-image-repeat) : [object CSSPrimitiveValue]
-g: style.getPropertyValue(-webkit-mask-box-image-slice) : 0
+g: style.getPropertyValue(-webkit-mask-box-image-slice) : 0 fill
 g: style.getPropertyCSSValue(-webkit-mask-box-image-slice) : [object CSSValue]
 g: style.getPropertyValue(-webkit-mask-box-image-source) : none
 g: style.getPropertyCSSValue(-webkit-mask-box-image-source) : [object CSSPrimitiveValue]

Modified: trunk/Source/WebCore/ChangeLog (95095 => 95096)


--- trunk/Source/WebCore/ChangeLog	2011-09-14 16:27:27 UTC (rev 95095)
+++ trunk/Source/WebCore/ChangeLog	2011-09-14 16:45:23 UTC (rev 95096)
@@ -1,3 +1,32 @@
+2011-09-13  David Hyatt  <hy...@apple.com>
+
+        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.
+
+        * 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):
+
 2011-09-13  Pavel Feldman  <pfeld...@google.com>
 
         Web Inspector: InspectorInstrumentation::frameDestroyed is called after m_page has been reset.

Modified: trunk/Source/WebCore/css/CSSParser.cpp (95095 => 95096)


--- trunk/Source/WebCore/css/CSSParser.cpp	2011-09-14 16:27:27 UTC (rev 95095)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2011-09-14 16:45:23 UTC (rev 95096)
@@ -5416,12 +5416,6 @@
         m_valueList->next();
     }
 
-    if (context.allowNumber() && !context.top() && (propId == CSSPropertyWebkitMaskBoxImage || propId == CSSPropertyWebkitBoxReflect)) {
-        // Allow the slices to be omitted for images that don't fit to a border.  We just set the slices to be 0.
-        context.setTop(primitiveValueCache()->createValue(0, CSSPrimitiveValue::CSS_NUMBER));
-        context.setAllowFinalCommit();
-    }
-
     if (context.allowFinalCommit()) {
         // FIXME: For backwards compatibility, -webkit-border-image, -webkit-mask-box-image and -webkit-box-reflect have to do a fill by default.
         // FIXME: What do we do with -webkit-box-reflect and -webkit-mask-box-image? Probably just have to leave them filling...

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (95095 => 95096)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-09-14 16:27:27 UTC (rev 95095)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2011-09-14 16:45:23 UTC (rev 95096)
@@ -3034,10 +3034,8 @@
         }
 
         NinePieceImage image;
-        if (property == CSSPropertyWebkitMaskBoxImage) {
-            image.setImageSlices(LengthBox(0)); // For backwards compatibility, just make the mask box image slices 0 instead of 100%.
-            image.setBorderSlices(LengthBox()); // The slices default to auto.
-        }
+        if (property == CSSPropertyWebkitMaskBoxImage)
+            image.setMaskDefaults();
         mapNinePieceImage(property, value, image);
 
         if (id != CSSPropertyWebkitMaskBoxImage)
@@ -3177,8 +3175,7 @@
                 reflection->setOffset(reflectValue->offset()->computeLength<Length>(style(), m_rootElementStyle, zoomFactor));
         }
         NinePieceImage mask;
-        mask.setImageSlices(LengthBox(0)); // For backwards compatibility, just make the mask box image slices 0 instead of 100%.
-        mask.setBorderSlices(LengthBox()); // The slices default to auto.
+        mask.setMaskDefaults();
         mapNinePieceImage(property, reflectValue->mask(), mask);
         reflection->setMask(mask);
         

Modified: trunk/Source/WebCore/rendering/style/NinePieceImage.h (95095 => 95096)


--- trunk/Source/WebCore/rendering/style/NinePieceImage.h	2011-09-14 16:27:27 UTC (rev 95095)
+++ trunk/Source/WebCore/rendering/style/NinePieceImage.h	2011-09-14 16:45:23 UTC (rev 95096)
@@ -112,6 +112,13 @@
         m_verticalRule = other.m_verticalRule;
     }
 
+    void setMaskDefaults()
+    {
+        m_imageSlices = LengthBox(0);
+        m_fill = true;
+        m_borderSlices = LengthBox();
+    }
+
 private:
     RefPtr<StyleImage> m_image;
     LengthBox m_imageSlices;

Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp (95095 => 95096)


--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp	2011-09-14 16:27:27 UTC (rev 95095)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp	2011-09-14 16:45:23 UTC (rev 95096)
@@ -64,8 +64,7 @@
     , m_regionBreakBefore(RenderStyle::initialPageBreak())
     , m_regionBreakInside(RenderStyle::initialPageBreak())
 {
-    m_maskBoxImage.setImageSlices(LengthBox(0)); // Preserve the value of 0 for mask box image slices for backwards compatibility.
-    m_maskBoxImage.setBorderSlices(LengthBox()); // The border slices for a mask box image default to auto instead of 1.
+    m_maskBoxImage.setMaskDefaults();
 }
 
 StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInheritedData& o)

Modified: trunk/Source/WebCore/rendering/style/StyleReflection.h (95095 => 95096)


--- trunk/Source/WebCore/rendering/style/StyleReflection.h	2011-09-14 16:27:27 UTC (rev 95095)
+++ trunk/Source/WebCore/rendering/style/StyleReflection.h	2011-09-14 16:45:23 UTC (rev 95096)
@@ -58,8 +58,7 @@
         : m_direction(ReflectionBelow)
         , m_offset(0, Fixed)
     {
-         m_mask.setImageSlices(LengthBox(0)); // Preserve the value of 0 for mask image slices for backwards compatibility.
-         m_mask.setBorderSlices(LengthBox()); // The border slices for a mask image default to auto instead of 1.
+         m_mask.setMaskDefaults();
     }
     
     CSSReflectionDirection m_direction;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to