Title: [119663] trunk
Revision
119663
Author
[email protected]
Date
2012-06-06 19:22:17 -0700 (Wed, 06 Jun 2012)

Log Message

Fix border-image-slice failures on http://css3test.com.
https://bugs.webkit.org/show_bug.cgi?id=88328

Reviewed by Tony Chang.

Source/WebCore:

The old parsing code was assuming that the fill keyword comes after the
numbers or the percentage values. http://www.w3.org/TR/css3-background/#the-border-image-slice
defines the property like this : [<number> | <percentage>]{1,4} && fill? where the fill
keyword is not mandatory. But according to http://www.w3.org/TR/CSS2/about.html "&&"
separates two or more components, all of which must occur, in any order. So the previous
code was wrong the fill can come first following by the percentages or the numbers. http://css3test.com
was covering this particular case. I took the opportunity to extend our coverage
by adding tests on many different values the boder-image-slice property could take. I
also did a small cleanup by removing unused functions in BorderImageSliceParseContext.

Test: fast/css/getComputedStyle/getComputedStyle-border-image-slice.html

* css/CSSParser.cpp:
(WebCore::BorderImageSliceParseContext::BorderImageSliceParseContext):
(WebCore::BorderImageSliceParseContext::commitNumber):
(WebCore::BorderImageSliceParseContext::commitFill):

LayoutTests:

Make sure we cover more border-image-slice parsing.

* fast/css/getComputedStyle/getComputedStyle-border-image-slice-expected.txt: Added.
* fast/css/getComputedStyle/getComputedStyle-border-image-slice.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (119662 => 119663)


--- trunk/LayoutTests/ChangeLog	2012-06-07 01:46:38 UTC (rev 119662)
+++ trunk/LayoutTests/ChangeLog	2012-06-07 02:22:17 UTC (rev 119663)
@@ -1,3 +1,15 @@
+2012-06-06  Alexis Menard  <[email protected]>
+
+        Fix border-image-slice failures on http://css3test.com.
+        https://bugs.webkit.org/show_bug.cgi?id=88328
+
+        Reviewed by Tony Chang.
+
+        Make sure we cover more border-image-slice parsing.
+
+        * fast/css/getComputedStyle/getComputedStyle-border-image-slice-expected.txt: Added.
+        * fast/css/getComputedStyle/getComputedStyle-border-image-slice.html: Added.
+
 2012-06-06  Levi Weintraub  <[email protected]>
 
         Use enclosingIntRect instead of pixelSnappedIntRect in RenderFileUploadControl

Added: trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-image-slice-expected.txt (0 => 119663)


--- trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-image-slice-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-image-slice-expected.txt	2012-06-07 02:22:17 UTC (rev 119663)
@@ -0,0 +1,51 @@
+Test to make sure border-image-slice is correctly parsed.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS computedStyle.getPropertyValue('border-image-slice') is '10'
+PASS computedStyle.getPropertyCSSValue('border-image-slice').cssText is '10'
+PASS computedStyle.getPropertyValue('border-image-slice') is '30%'
+PASS computedStyle.getPropertyCSSValue('border-image-slice').cssText is '30%'
+PASS computedStyle.getPropertyValue('border-image-slice') is '10'
+PASS computedStyle.getPropertyCSSValue('border-image-slice').cssText is '10'
+PASS computedStyle.getPropertyValue('border-image-slice') is '10 30%'
+PASS computedStyle.getPropertyCSSValue('border-image-slice').cssText is '10 30%'
+PASS computedStyle.getPropertyValue('border-image-slice') is '30%'
+PASS computedStyle.getPropertyCSSValue('border-image-slice').cssText is '30%'
+PASS computedStyle.getPropertyValue('border-image-slice') is '10'
+PASS computedStyle.getPropertyCSSValue('border-image-slice').cssText is '10'
+PASS computedStyle.getPropertyValue('border-image-slice') is '30% 10 10'
+PASS computedStyle.getPropertyCSSValue('border-image-slice').cssText is '30% 10 10'
+PASS computedStyle.getPropertyValue('border-image-slice') is '10 30%'
+PASS computedStyle.getPropertyCSSValue('border-image-slice').cssText is '10 30%'
+PASS computedStyle.getPropertyValue('border-image-slice') is '30% 30% 30% 10'
+PASS computedStyle.getPropertyCSSValue('border-image-slice').cssText is '30% 30% 30% 10'
+PASS computedStyle.getPropertyValue('border-image-slice') is '10'
+PASS computedStyle.getPropertyCSSValue('border-image-slice').cssText is '10'
+PASS computedStyle.getPropertyValue('border-image-slice') is '30% 30% 30% 10'
+PASS computedStyle.getPropertyCSSValue('border-image-slice').cssText is '30% 30% 30% 10'
+PASS computedStyle.getPropertyValue('border-image-slice') is '30%'
+PASS computedStyle.getPropertyCSSValue('border-image-slice').cssText is '30%'
+PASS computedStyle.getPropertyValue('border-image-slice') is '30% fill'
+PASS computedStyle.getPropertyCSSValue('border-image-slice').cssText is '30% fill'
+PASS computedStyle.getPropertyValue('border-image-slice') is '10 fill'
+PASS computedStyle.getPropertyCSSValue('border-image-slice').cssText is '10 fill'
+PASS computedStyle.getPropertyValue('border-image-slice') is '2 4 8% 16% fill'
+PASS computedStyle.getPropertyCSSValue('border-image-slice').cssText is '2 4 8% 16% fill'
+PASS computedStyle.getPropertyValue('border-image-slice') is '30% fill'
+PASS computedStyle.getPropertyCSSValue('border-image-slice').cssText is '30% fill'
+PASS computedStyle.getPropertyValue('border-image-slice') is '10 fill'
+PASS computedStyle.getPropertyCSSValue('border-image-slice').cssText is '10 fill'
+PASS computedStyle.getPropertyValue('border-image-slice') is '2 4 8% 16% fill'
+PASS computedStyle.getPropertyCSSValue('border-image-slice').cssText is '2 4 8% 16% fill'
+PASS computedStyle.getPropertyValue('border-image-slice') is '100%'
+PASS computedStyle.getPropertyCSSValue('border-image-slice').cssText is '100%'
+PASS computedStyle.getPropertyValue('border-image-slice') is '100%'
+PASS computedStyle.getPropertyCSSValue('border-image-slice').cssText is '100%'
+PASS computedStyle.getPropertyValue('border-image-slice') is '100%'
+PASS computedStyle.getPropertyCSSValue('border-image-slice').cssText is '100%'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-image-slice.html (0 => 119663)


--- trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-image-slice.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-image-slice.html	2012-06-07 02:22:17 UTC (rev 119663)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+</head>
+<body>
+<script>
+
+description("Test to make sure border-image-slice is correctly parsed.")
+
+var testContainer = document.createElement("div");
+document.body.appendChild(testContainer);
+
+testContainer.innerHTML = '<div style="width:100px;height:100px"><div id="test">hello</div></div>';
+
+e = document.getElementById('test');
+computedStyle = window.getComputedStyle(e, null);
+
+var testValues = [ "10", "30%", "10 10", "10 30%", "30% 30%", "10 10 10", "30% 10 10", "10 30% 10", "30% 30% 30% 10", "10 10 10 10", "30% 30% 30% 10", "30% 30% 30% 30%", "fill 30%", "fill 10", "fill 2 4 8% 16%", "30% fill", "10 fill", "2 4 8% 16% fill", "10 fill 10", "solid", "fill fill" ];
+
+var expectedValues = [ "'10'", "'30%'", "'10'", "'10 30%'", "'30%'", "'10'", "'30% 10 10'", "'10 30%'", "'30% 30% 30% 10'", "'10'", "'30% 30% 30% 10'", "'30%'", "'30% fill'", "'10 fill'", "'2 4 8% 16% fill'", "'30% fill'", "'10 fill'", "'2 4 8% 16% fill'", "'100%'", "'100%'", "'100%'" ];
+
+for (i = 0; i < testValues.length; i++) {
+    e.style.borderImageSlice = "";
+    e.style.borderImageSlice = testValues[i];
+    shouldBe("computedStyle.getPropertyValue('border-image-slice')", expectedValues[i]);
+    shouldBe("computedStyle.getPropertyCSSValue('border-image-slice').cssText", expectedValues[i]);
+}
+document.body.removeChild(testContainer);
+
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (119662 => 119663)


--- trunk/Source/WebCore/ChangeLog	2012-06-07 01:46:38 UTC (rev 119662)
+++ trunk/Source/WebCore/ChangeLog	2012-06-07 02:22:17 UTC (rev 119663)
@@ -1,3 +1,27 @@
+2012-06-06  Alexis Menard  <[email protected]>
+
+        Fix border-image-slice failures on http://css3test.com.
+        https://bugs.webkit.org/show_bug.cgi?id=88328
+
+        Reviewed by Tony Chang.
+
+        The old parsing code was assuming that the fill keyword comes after the
+        numbers or the percentage values. http://www.w3.org/TR/css3-background/#the-border-image-slice
+        defines the property like this : [<number> | <percentage>]{1,4} && fill? where the fill
+        keyword is not mandatory. But according to http://www.w3.org/TR/CSS2/about.html "&&" 
+        separates two or more components, all of which must occur, in any order. So the previous
+        code was wrong the fill can come first following by the percentages or the numbers. http://css3test.com
+        was covering this particular case. I took the opportunity to extend our coverage 
+        by adding tests on many different values the boder-image-slice property could take. I
+        also did a small cleanup by removing unused functions in BorderImageSliceParseContext.
+
+        Test: fast/css/getComputedStyle/getComputedStyle-border-image-slice.html
+
+        * css/CSSParser.cpp:
+        (WebCore::BorderImageSliceParseContext::BorderImageSliceParseContext):
+        (WebCore::BorderImageSliceParseContext::commitNumber):
+        (WebCore::BorderImageSliceParseContext::commitFill):
+
 2012-06-06  Levi Weintraub  <[email protected]>
 
         Use enclosingIntRect instead of pixelSnappedIntRect in RenderFileUploadControl

Modified: trunk/Source/WebCore/css/CSSParser.cpp (119662 => 119663)


--- trunk/Source/WebCore/css/CSSParser.cpp	2012-06-07 01:46:38 UTC (rev 119662)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2012-06-07 02:22:17 UTC (rev 119663)
@@ -5842,7 +5842,7 @@
     BorderImageSliceParseContext(CSSParser* parser)
     : m_parser(parser)
     , m_allowNumber(true)
-    , m_allowFill(false)
+    , m_allowFill(true)
     , m_allowFinalCommit(false)
     , m_fill(false)
     { }
@@ -5867,15 +5867,11 @@
         }
 
         m_allowNumber = !m_left;
-        m_allowFill = true;
         m_allowFinalCommit = true;
     }
 
-    void commitFill() { m_fill = true; m_allowFill = false; m_allowNumber = false; }
+    void commitFill() { m_fill = true; m_allowFill = false; m_allowNumber = !m_top; }
 
-    void setAllowFinalCommit() { m_allowFinalCommit = true; }
-    void setTop(PassRefPtr<CSSPrimitiveValue> val) { m_top = val; }
-
     PassRefPtr<CSSBorderImageSliceValue> commitBorderImageSlice()
     {
         // We need to clone and repeat values for any omissions.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to