[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-142-g786665c

simon.fraser at apple.com simon.fraser at apple.com
Mon Dec 27 16:30:41 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit f61f180b87664843e108562034b7505e767926e5
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Dec 22 19:19:08 2010 +0000

    2010-12-22  Simon Fraser  <simon.fraser at apple.com>
    
            Reviewed by Dan Bernstein.
    
            CSS 2.1 failure: counter-increment-013 fails
            https://bugs.webkit.org/show_bug.cgi?id=51483
    
            Clamp the counter-increment property to the valid range of signed
            integers.
    
            Test: fast/css/counters/counter-increment-overflow.html
    
            * css/CSSParser.cpp:
            (WebCore::clampToSignedInteger):
            (WebCore::CSSParser::parseCounter):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74491 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index a6e8e62..3748a92 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-12-22  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        CSS 2.1 failure: counter-increment-013 fails
+        https://bugs.webkit.org/show_bug.cgi?id=51483
+        
+        Layout test version of CSS 2.1 counter-increment-013 test.
+
+        * fast/css/counters/counter-increment-overflow-expected.txt: Added.
+        * fast/css/counters/counter-increment-overflow.html: Added.
+
 2010-12-22  Chang Shu  <chang.shu at nokia.com>
 
         Unreviewed layout test fix.
diff --git a/LayoutTests/fast/css/counters/counter-increment-overflow-expected.txt b/LayoutTests/fast/css/counters/counter-increment-overflow-expected.txt
new file mode 100644
index 0000000..9c25739
--- /dev/null
+++ b/LayoutTests/fast/css/counters/counter-increment-overflow-expected.txt
@@ -0,0 +1,3 @@
+Test passes if the number '2147483647' appears below.
+
+2147483647
diff --git a/LayoutTests/fast/css/counters/counter-increment-overflow.html b/LayoutTests/fast/css/counters/counter-increment-overflow.html
new file mode 100644
index 0000000..48026e1
--- /dev/null
+++ b/LayoutTests/fast/css/counters/counter-increment-overflow.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+    <head>
+    <style type="text/css">
+        div
+        {
+            counter-increment: ident 2147483648;
+        }
+        div:before
+        {
+            content: counter(ident);
+        }
+    </style>
+    <script type="text/javascript">
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+
+        function doTest()
+        {
+            if (window.layoutTestController)
+                document.getElementById('counted').innerText = layoutTestController.counterValueForElementById('counted');
+        }
+
+        window.addEventListener('load', doTest, false);
+    </script>
+    </head>
+    <body>
+    <p>Test passes if the number '2147483647' appears below.</p>
+    <div id="counted"></div>
+
+    </body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index df2143d..832db55 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2010-12-22  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        CSS 2.1 failure: counter-increment-013 fails
+        https://bugs.webkit.org/show_bug.cgi?id=51483
+        
+        Clamp the counter-increment property to the valid range of signed
+        integers.
+
+        Test: fast/css/counters/counter-increment-overflow.html
+
+        * css/CSSParser.cpp:
+        (WebCore::clampToSignedInteger):
+        (WebCore::CSSParser::parseCounter):
+
 2010-12-22  Dan Bernstein  <mitz at apple.com>
 
         Rubber-stamped by Mark Rowe.
diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp
index 744d9b7..d9b133d 100644
--- a/WebCore/css/CSSParser.cpp
+++ b/WebCore/css/CSSParser.cpp
@@ -125,6 +125,13 @@ static bool hasPrefix(const char* string, unsigned length, const char* prefix)
     return false;
 }
 
+static int clampToSignedInteger(double d)
+{
+    const double minIntAsDouble = std::numeric_limits<int>::min();
+    const double maxIntAsDouble = std::numeric_limits<int>::max();
+    return static_cast<int>(max(minIntAsDouble, min(d, maxIntAsDouble)));
+}
+
 CSSParser::CSSParser(bool strictParsing)
     : m_strict(strictParsing)
     , m_important(false)
@@ -4625,7 +4632,7 @@ bool CSSParser::parseCounter(int propId, int defaultValue, bool important)
             case VAL: {
                 int i = defaultValue;
                 if (val && val->unit == CSSPrimitiveValue::CSS_NUMBER) {
-                    i = (int)val->fValue;
+                    i = clampToSignedInteger(val->fValue);
                     m_valueList->next();
                 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list