[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

simon.fraser at apple.com simon.fraser at apple.com
Mon Feb 21 00:19:53 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 790424712f5ffa850d0368cc96f058d48cb3b7dc
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Jan 29 19:43:41 2011 +0000

    2011-01-28  Simon Fraser  <simon.fraser at apple.com>
    
            Reviewed by Adam Barth.
    
            Use clampToInteger() functions in a few places
            https://bugs.webkit.org/show_bug.cgi?id=53363
    
            * css/CSSStyleSelector.cpp:
            (WebCore::CSSStyleSelector::applyProperty): Use clampToInteger() for z-index.
            (WebCore::CSSStyleSelector::createTransformOperations): Use clampToPositiveInteger().
            * platform/graphics/transforms/PerspectiveTransformOperation.cpp: Ditto.
            (WebCore::PerspectiveTransformOperation::blend): Ditto.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77064 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index b9a04d9..13cfc9b 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,16 @@
+2011-01-28  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Adam Barth.
+
+        Use clampToInteger() functions in a few places
+        https://bugs.webkit.org/show_bug.cgi?id=53363
+        
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::applyProperty): Use clampToInteger() for z-index.
+        (WebCore::CSSStyleSelector::createTransformOperations): Use clampToPositiveInteger().
+        * platform/graphics/transforms/PerspectiveTransformOperation.cpp: Ditto.
+        (WebCore::PerspectiveTransformOperation::blend): Ditto.
+
 2011-01-29  Patrick Gansterer  <paroga at webkit.org>
 
         Reviewed by David Kilzer.
diff --git a/Source/WebCore/css/CSSStyleSelector.cpp b/Source/WebCore/css/CSSStyleSelector.cpp
index 6536193..0c407a6 100644
--- a/Source/WebCore/css/CSSStyleSelector.cpp
+++ b/Source/WebCore/css/CSSStyleSelector.cpp
@@ -4296,9 +4296,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
         }
         
         // FIXME: Should clamp all sorts of other integer properties too.
-        const double minIntAsDouble = INT_MIN;
-        const double maxIntAsDouble = INT_MAX;
-        m_style->setZIndex(static_cast<int>(max(minIntAsDouble, min(primitiveValue->getDoubleValue(), maxIntAsDouble))));
+        m_style->setZIndex(clampToInteger(primitiveValue->getDoubleValue()));
         return;
     }
     case CSSPropertyWidows:
@@ -7061,7 +7059,7 @@ bool CSSStyleSelector::createTransformOperations(CSSValue* inValue, RenderStyle*
                     // This is a quirk that should go away when 3d transforms are finalized.
                     double val = firstValue->getDoubleValue();
                     ok = val >= 0;
-                    val = min<double>(val, numeric_limits<int>::max());
+                    val = clampToPositiveInteger(val);
                     p = Length(static_cast<int>(val), Fixed);
                 }
                 
diff --git a/Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.cpp b/Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.cpp
index 258cfbe..18bfe37 100644
--- a/Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.cpp
+++ b/Source/WebCore/platform/graphics/transforms/PerspectiveTransformOperation.cpp
@@ -26,18 +26,12 @@
 #include "config.h"
 #include "PerspectiveTransformOperation.h"
 
-#include <algorithm>
-#include <limits>
+#include <wtf/MathExtras.h>
 
 using namespace std;
 
 namespace WebCore {
 
-static int clampToPostiveInteger(double val)
-{
-    return static_cast<int>(max<double>(min<double>(val, numeric_limits<int>::max()), 0));
-}
-
 PassRefPtr<TransformOperation> PerspectiveTransformOperation::blend(const TransformOperation* from, double progress, bool blendToIdentity)
 {
     if (from && !from->isSameType(*this))
@@ -46,7 +40,7 @@ PassRefPtr<TransformOperation> PerspectiveTransformOperation::blend(const Transf
     if (blendToIdentity) {
         double p = m_p.calcFloatValue(1);
         p = p + (1. - p) * progress; // FIXME: this seems wrong. https://bugs.webkit.org/show_bug.cgi?id=52700
-        return PerspectiveTransformOperation::create(Length(clampToPostiveInteger(p), Fixed));
+        return PerspectiveTransformOperation::create(Length(clampToPositiveInteger(p), Fixed));
     }
     
     const PerspectiveTransformOperation* fromOp = static_cast<const PerspectiveTransformOperation*>(from);
@@ -63,7 +57,7 @@ PassRefPtr<TransformOperation> PerspectiveTransformOperation::blend(const Transf
 
     if (decomp.perspectiveZ) {
         double val = -1.0 / decomp.perspectiveZ;
-        return PerspectiveTransformOperation::create(Length(clampToPostiveInteger(val), Fixed));
+        return PerspectiveTransformOperation::create(Length(clampToPositiveInteger(val), Fixed));
     }
     return PerspectiveTransformOperation::create(Length(0, Fixed));
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list