Title: [138026] trunk
Revision
138026
Author
[email protected]
Date
2012-12-18 08:45:04 -0800 (Tue, 18 Dec 2012)

Log Message

Have kFixedPointDenominator be constant across ports
https://bugs.webkit.org/show_bug.cgi?id=104843

Source/WebCore:

Reviewed by Julien Chaffraix.

Currently the kFixedPointDenominator constant is set to either
64 or 1 depending on the SUBPIXEL_LAYOUT flag. As this constant
is used to limit the range of supported values this results in
inconsistencies across ports.

Change kFixedPointDenominator to always be 64 and introduce a
new constant (kEffectiveFixedPointDenominator) that varies.
This ensures that the same range of values are supported across
ports regardless of the SUBPIXEL_LAYOUT flag.

Covered by fast/css/large-numbers.html and fast/css/large-number-round-trip.html

* platform/LayoutUnit.h:
Add kEffectiveFixedPointDenominator constant and change
LayoutUnit code to use it instead of kFixedPointDenominator
which is now set to 64 regardless of the SUBPIXEL_LAYOUT flag.

LayoutTests:

Reviewed by Julien Chaffraix.

Unskip the following tests on efl, qt and gtk:
fast/css/large-number-round-trip.html
fast/css/large-numbers.html

Remove platform specific results for large-number-round-trip.html.

* fast/css/large-number-round-trip-expected.txt:
* platform/chromium/fast/css/large-number-round-trip-expected.txt: Removed.
* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
* platform/mac/fast/css/large-number-round-trip-expected.txt: Removed.
* platform/qt/TestExpectations:

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (138025 => 138026)


--- trunk/LayoutTests/ChangeLog	2012-12-18 16:39:15 UTC (rev 138025)
+++ trunk/LayoutTests/ChangeLog	2012-12-18 16:45:04 UTC (rev 138026)
@@ -1,3 +1,23 @@
+2012-12-18  Emil A Eklund  <[email protected]>
+
+        Have kFixedPointDenominator be constant across ports
+        https://bugs.webkit.org/show_bug.cgi?id=104843
+
+        Reviewed by Julien Chaffraix.
+        
+        Unskip the following tests on efl, qt and gtk:
+        fast/css/large-number-round-trip.html
+        fast/css/large-numbers.html 
+
+        Remove platform specific results for large-number-round-trip.html.
+
+        * fast/css/large-number-round-trip-expected.txt:
+        * platform/chromium/fast/css/large-number-round-trip-expected.txt: Removed.
+        * platform/efl/TestExpectations:
+        * platform/gtk/TestExpectations:
+        * platform/mac/fast/css/large-number-round-trip-expected.txt: Removed.
+        * platform/qt/TestExpectations:
+
 2012-12-18  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r137979.

Modified: trunk/LayoutTests/fast/css/large-number-round-trip-expected.txt (138025 => 138026)


--- trunk/LayoutTests/fast/css/large-number-round-trip-expected.txt	2012-12-18 16:39:15 UTC (rev 138025)
+++ trunk/LayoutTests/fast/css/large-number-round-trip-expected.txt	2012-12-18 16:45:04 UTC (rev 138026)
@@ -1 +1,3 @@
-PASS: read 90010000px back as 90010000px, read again as 90010000px
+PASS: read 90010000px back as 33554428px, read again as 33554428px
+PASS: read -33554430px back as -33554430px, read again as -33554430px
+PASS: read -90010000px back as -33554430px, read again as -33554430px

Deleted: trunk/LayoutTests/platform/chromium/fast/css/large-number-round-trip-expected.txt (138025 => 138026)


--- trunk/LayoutTests/platform/chromium/fast/css/large-number-round-trip-expected.txt	2012-12-18 16:39:15 UTC (rev 138025)
+++ trunk/LayoutTests/platform/chromium/fast/css/large-number-round-trip-expected.txt	2012-12-18 16:45:04 UTC (rev 138026)
@@ -1,3 +0,0 @@
-PASS: read 90010000px back as 33554428px, read again as 33554428px
-PASS: read -33554430px back as -33554430px, read again as -33554430px
-PASS: read -90010000px back as -33554430px, read again as -33554430px

Modified: trunk/LayoutTests/platform/efl/TestExpectations (138025 => 138026)


--- trunk/LayoutTests/platform/efl/TestExpectations	2012-12-18 16:39:15 UTC (rev 138025)
+++ trunk/LayoutTests/platform/efl/TestExpectations	2012-12-18 16:45:04 UTC (rev 138026)
@@ -1677,8 +1677,6 @@
 webkit.org/b/104571 http/tests/xmlhttprequest/origin-exact-matching.html [ Failure ]
 
 webkit.org/b/104788 css3/flexbox/flex-algorithm.html [ Failure ]
-webkit.org/b/104788 fast/css/large-number-round-trip.html [ Failure ]
-webkit.org/b/104788 fast/css/large-numbers.html [ Failure ]
 
 # Fixed positioning reftest failing
 webkit.org/b/104808 compositing/geometry/fixed-position-composited-page-scale-smaller-than-viewport.html [ ImageOnlyFailure ]

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (138025 => 138026)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2012-12-18 16:39:15 UTC (rev 138025)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2012-12-18 16:45:04 UTC (rev 138026)
@@ -1400,8 +1400,6 @@
 webkit.org/b/104686 http/tests/xmlhttprequest/redirect-cross-origin-tripmine.html [ Failure ]
 
 webkit.org/b/104788 css3/flexbox/flex-algorithm.html [ Failure ]
-webkit.org/b/104788 fast/css/large-number-round-trip.html [ Failure ]
-webkit.org/b/104788 fast/css/large-numbers.html [ Failure ]
 
 webkit.org/b/87734 svg/dom/SVGViewSpec.html [ Failure ]
 webkit.org/b/87734 svg/dom/complex-svgView-specification.html [ ImageOnlyFailure ]

Deleted: trunk/LayoutTests/platform/mac/fast/css/large-number-round-trip-expected.txt (138025 => 138026)


--- trunk/LayoutTests/platform/mac/fast/css/large-number-round-trip-expected.txt	2012-12-18 16:39:15 UTC (rev 138025)
+++ trunk/LayoutTests/platform/mac/fast/css/large-number-round-trip-expected.txt	2012-12-18 16:45:04 UTC (rev 138026)
@@ -1,3 +0,0 @@
-PASS: read 90010000px back as 33554428px, read again as 33554428px
-PASS: read -33554430px back as -33554430px, read again as -33554430px
-PASS: read -90010000px back as -33554430px, read again as -33554430px

Modified: trunk/LayoutTests/platform/qt/TestExpectations (138025 => 138026)


--- trunk/LayoutTests/platform/qt/TestExpectations	2012-12-18 16:39:15 UTC (rev 138025)
+++ trunk/LayoutTests/platform/qt/TestExpectations	2012-12-18 16:45:04 UTC (rev 138026)
@@ -2452,5 +2452,3 @@
 http/tests/xmlhttprequest/post-blob-content-type-sync.html
 
 webkit.org/b/104788 css3/flexbox/flex-algorithm.html [ Failure ]
-webkit.org/b/104788 fast/css/large-number-round-trip.html [ Failure ]
-webkit.org/b/104788 fast/css/large-numbers.html [ Failure ]

Modified: trunk/Source/WebCore/ChangeLog (138025 => 138026)


--- trunk/Source/WebCore/ChangeLog	2012-12-18 16:39:15 UTC (rev 138025)
+++ trunk/Source/WebCore/ChangeLog	2012-12-18 16:45:04 UTC (rev 138026)
@@ -1,3 +1,27 @@
+2012-12-18  Emil A Eklund  <[email protected]>
+
+        Have kFixedPointDenominator be constant across ports
+        https://bugs.webkit.org/show_bug.cgi?id=104843
+
+        Reviewed by Julien Chaffraix.
+
+        Currently the kFixedPointDenominator constant is set to either
+        64 or 1 depending on the SUBPIXEL_LAYOUT flag. As this constant
+        is used to limit the range of supported values this results in
+        inconsistencies across ports.
+
+        Change kFixedPointDenominator to always be 64 and introduce a
+        new constant (kEffectiveFixedPointDenominator) that varies.
+        This ensures that the same range of values are supported across
+        ports regardless of the SUBPIXEL_LAYOUT flag.
+        
+        Covered by fast/css/large-numbers.html and fast/css/large-number-round-trip.html
+
+        * platform/LayoutUnit.h:
+        Add kEffectiveFixedPointDenominator constant and change
+        LayoutUnit code to use it instead of kFixedPointDenominator
+        which is now set to 64 regardless of the SUBPIXEL_LAYOUT flag.
+
 2012-12-18  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r137979.

Modified: trunk/Source/WebCore/platform/LayoutUnit.h (138025 => 138026)


--- trunk/Source/WebCore/platform/LayoutUnit.h	2012-12-18 16:39:15 UTC (rev 138025)
+++ trunk/Source/WebCore/platform/LayoutUnit.h	2012-12-18 16:45:04 UTC (rev 138026)
@@ -54,13 +54,15 @@
 
 #endif
 
+static const int kFixedPointDenominator = 64;
+
 #if ENABLE(SUBPIXEL_LAYOUT)
-static const int kFixedPointDenominator = 64;
+static const int kEffectiveFixedPointDenominator = kFixedPointDenominator;
 #else
-static const int kFixedPointDenominator = 1;
+static const int kEffectiveFixedPointDenominator = 1;
 #endif
-const int intMaxForLayoutUnit = INT_MAX / kFixedPointDenominator;
-const int intMinForLayoutUnit = INT_MIN / kFixedPointDenominator;
+const int intMaxForLayoutUnit = INT_MAX / kEffectiveFixedPointDenominator;
+const int intMinForLayoutUnit = INT_MIN / kEffectiveFixedPointDenominator;
 
 class LayoutUnit {
 public:
@@ -76,19 +78,19 @@
     LayoutUnit(float value)
     {
 #if ENABLE(SATURATED_LAYOUT_ARITHMETIC)
-        m_value = clampTo<float>(value * kFixedPointDenominator, static_cast<float>(INT_MIN), static_cast<float>(INT_MAX));
+        m_value = clampTo<float>(value * kEffectiveFixedPointDenominator, static_cast<float>(INT_MIN), static_cast<float>(INT_MAX));
 #else
         REPORT_OVERFLOW(isInBounds(value));
-        m_value = value * kFixedPointDenominator;
+        m_value = value * kEffectiveFixedPointDenominator;
 #endif
     }
     LayoutUnit(double value)
     {
 #if ENABLE(SATURATED_LAYOUT_ARITHMETIC)
-        m_value = clampTo<double>(value * kFixedPointDenominator, static_cast<double>(INT_MIN), static_cast<double>(INT_MAX));
+        m_value = clampTo<double>(value * kEffectiveFixedPointDenominator, static_cast<double>(INT_MIN), static_cast<double>(INT_MAX));
 #else
         REPORT_OVERFLOW(isInBounds(value));
-        m_value = value * kFixedPointDenominator;
+        m_value = value * kEffectiveFixedPointDenominator;
 #endif
     }
 #else
@@ -104,10 +106,10 @@
     {
         LayoutUnit v;
 #if ENABLE(SATURATED_LAYOUT_ARITHMETIC)
-        v.m_value = clampToInteger(ceilf(value * kFixedPointDenominator));
+        v.m_value = clampToInteger(ceilf(value * kEffectiveFixedPointDenominator));
 #else
         REPORT_OVERFLOW(isInBounds(value));
-        v.m_value = ceilf(value * kFixedPointDenominator);
+        v.m_value = ceilf(value * kEffectiveFixedPointDenominator);
 #endif
         return v;
     }
@@ -116,10 +118,10 @@
     {
         LayoutUnit v;
 #if ENABLE(SATURATED_LAYOUT_ARITHMETIC)
-        v.m_value = clampToInteger(floorf(value * kFixedPointDenominator));
+        v.m_value = clampToInteger(floorf(value * kEffectiveFixedPointDenominator));
 #else
         REPORT_OVERFLOW(isInBounds(value));
-        v.m_value = floorf(value * kFixedPointDenominator);
+        v.m_value = floorf(value * kEffectiveFixedPointDenominator);
 #endif
         return v;
     }
@@ -141,13 +143,13 @@
     }
 
 #if ENABLE(SUBPIXEL_LAYOUT)
-    int toInt() const { return m_value / kFixedPointDenominator; }
-    float toFloat() const { return static_cast<float>(m_value) / kFixedPointDenominator; }
-    double toDouble() const { return static_cast<double>(m_value) / kFixedPointDenominator; }
+    int toInt() const { return m_value / kEffectiveFixedPointDenominator; }
+    float toFloat() const { return static_cast<float>(m_value) / kEffectiveFixedPointDenominator; }
+    double toDouble() const { return static_cast<double>(m_value) / kEffectiveFixedPointDenominator; }
     float ceilToFloat() const
     {
         float floatValue = toFloat();
-        if (static_cast<int>(floatValue * kFixedPointDenominator) == m_value)
+        if (static_cast<int>(floatValue * kEffectiveFixedPointDenominator) == m_value)
             return floatValue;
         if (floatValue > 0)
             return nextafterf(floatValue, std::numeric_limits<float>::max());
@@ -169,7 +171,7 @@
 
     LayoutUnit operator++(int)
     {
-        m_value += kFixedPointDenominator;
+        m_value += kEffectiveFixedPointDenominator;
         return *this;
     }
 
@@ -195,7 +197,7 @@
     {
 #if ENABLE(SUBPIXEL_LAYOUT)
         if (m_value >= 0)
-            return (m_value + kFixedPointDenominator - 1) / kFixedPointDenominator;
+            return (m_value + kEffectiveFixedPointDenominator - 1) / kEffectiveFixedPointDenominator;
         return toInt();
 #else
         return m_value;
@@ -205,12 +207,12 @@
     {
 #if ENABLE(SUBPIXEL_LAYOUT) && ENABLE(SATURATED_LAYOUT_ARITHMETIC)
         if (m_value > 0)
-            return saturatedAddition(rawValue(), kFixedPointDenominator / 2) / kFixedPointDenominator;
-        return saturatedSubtraction(rawValue(), kFixedPointDenominator / 2) / kFixedPointDenominator;
+            return saturatedAddition(rawValue(), kEffectiveFixedPointDenominator / 2) / kEffectiveFixedPointDenominator;
+        return saturatedSubtraction(rawValue(), kEffectiveFixedPointDenominator / 2) / kEffectiveFixedPointDenominator;
 #elif ENABLE(SUBPIXEL_LAYOUT)
         if (m_value > 0)
-            return (m_value + (kFixedPointDenominator / 2)) / kFixedPointDenominator;
-        return (m_value - (kFixedPointDenominator / 2)) / kFixedPointDenominator;
+            return (m_value + (kEffectiveFixedPointDenominator / 2)) / kEffectiveFixedPointDenominator;
+        return (m_value - (kEffectiveFixedPointDenominator / 2)) / kEffectiveFixedPointDenominator;
 #else
         return m_value;
 #endif
@@ -221,7 +223,7 @@
 #if ENABLE(SUBPIXEL_LAYOUT)
         if (m_value >= 0)
             return toInt();
-        return (m_value - kFixedPointDenominator + 1) / kFixedPointDenominator;
+        return (m_value - kEffectiveFixedPointDenominator + 1) / kEffectiveFixedPointDenominator;
 #else
         return m_value;
 #endif
@@ -232,12 +234,12 @@
         // Add the fraction to the size (as opposed to the full location) to avoid overflows.
         // Compute fraction using the mod operator to preserve the sign of the value as it may affect rounding.
         LayoutUnit fraction;
-        fraction.setRawValue(rawValue() % kFixedPointDenominator);
+        fraction.setRawValue(rawValue() % kEffectiveFixedPointDenominator);
         return fraction;
     }
 
 #if ENABLE(SUBPIXEL_LAYOUT)
-    static float epsilon() { return 1.0f / kFixedPointDenominator; }
+    static float epsilon() { return 1.0f / kEffectiveFixedPointDenominator; }
 #else
     static int epsilon() { return 0; }
 #endif
@@ -258,13 +260,13 @@
     static const LayoutUnit nearlyMax()
     {
         LayoutUnit m;
-        m.m_value = std::numeric_limits<int>::max() - kFixedPointDenominator / 2;
+        m.m_value = std::numeric_limits<int>::max() - kEffectiveFixedPointDenominator / 2;
         return m;
     }
     static const LayoutUnit nearlyMin()
     {
         LayoutUnit m;
-        m.m_value = std::numeric_limits<int>::min() + kFixedPointDenominator / 2;
+        m.m_value = std::numeric_limits<int>::min() + kEffectiveFixedPointDenominator / 2;
         return m;
     }
     
@@ -276,15 +278,15 @@
 private:
     static bool isInBounds(int value)
     {
-        return ::abs(value) <= std::numeric_limits<int>::max() / kFixedPointDenominator;
+        return ::abs(value) <= std::numeric_limits<int>::max() / kEffectiveFixedPointDenominator;
     }
     static bool isInBounds(unsigned value)
     {
-        return value <= static_cast<unsigned>(std::numeric_limits<int>::max()) / kFixedPointDenominator;
+        return value <= static_cast<unsigned>(std::numeric_limits<int>::max()) / kEffectiveFixedPointDenominator;
     }
     static bool isInBounds(double value)
     {
-        return ::fabs(value) <= std::numeric_limits<int>::max() / kFixedPointDenominator;
+        return ::fabs(value) <= std::numeric_limits<int>::max() / kEffectiveFixedPointDenominator;
     }
     
     inline void setValue(int value)
@@ -295,10 +297,10 @@
         else if (value < intMinForLayoutUnit)
             m_value = std::numeric_limits<int>::min();
         else
-            m_value = value * kFixedPointDenominator;
+            m_value = value * kEffectiveFixedPointDenominator;
 #else
         REPORT_OVERFLOW(isInBounds(value));
-        m_value = value * kFixedPointDenominator;
+        m_value = value * kEffectiveFixedPointDenominator;
 #endif
     }
     inline void setValue(unsigned value)
@@ -307,10 +309,10 @@
         if (value >= static_cast<unsigned>(intMaxForLayoutUnit))
             m_value = std::numeric_limits<int>::max();
         else
-            m_value = value * kFixedPointDenominator;
+            m_value = value * kEffectiveFixedPointDenominator;
 #else
         REPORT_OVERFLOW(isInBounds(value));
-        m_value = value * kFixedPointDenominator;
+        m_value = value * kEffectiveFixedPointDenominator;
 #endif
     }
 
@@ -482,7 +484,7 @@
 {
 #if ENABLE(SUBPIXEL_LAYOUT)
     LayoutUnit returnVal;
-    long long rawVal = static_cast<long long>(a.rawValue()) * b.rawValue() / kFixedPointDenominator;
+    long long rawVal = static_cast<long long>(a.rawValue()) * b.rawValue() / kEffectiveFixedPointDenominator;
     if (rawVal > std::numeric_limits<int>::max())
         return LayoutUnit::max();
     if (rawVal < std::numeric_limits<int>::min())
@@ -500,7 +502,7 @@
     return boundedMultiply(a, b);
 #elif ENABLE(SUBPIXEL_LAYOUT)
     LayoutUnit returnVal;
-    long long rawVal = static_cast<long long>(a.rawValue()) * b.rawValue() / kFixedPointDenominator;
+    long long rawVal = static_cast<long long>(a.rawValue()) * b.rawValue() / kEffectiveFixedPointDenominator;
     returnVal.setRawValue(rawVal);
     return returnVal;
 #else
@@ -552,7 +554,7 @@
 {
 #if ENABLE(SUBPIXEL_LAYOUT)
     LayoutUnit returnVal;
-    long long rawVal = static_cast<long long>(kFixedPointDenominator) * a.rawValue() / b.rawValue();
+    long long rawVal = static_cast<long long>(kEffectiveFixedPointDenominator) * a.rawValue() / b.rawValue();
 #if ENABLE(SATURATED_LAYOUT_ARITHMETIC)
     returnVal.setRawValue(clampTo<int>(rawVal));
 #else
@@ -706,8 +708,8 @@
 #if ENABLE(SUBPIXEL_LAYOUT)
     // This calculates the modulo so that: a = (a / b) * b + a % b.
     LayoutUnit returnVal;
-    long long rawVal = (static_cast<long long>(kFixedPointDenominator) * a.rawValue()) % b.rawValue();
-    returnVal.setRawValue(rawVal / kFixedPointDenominator);
+    long long rawVal = (static_cast<long long>(kEffectiveFixedPointDenominator) * a.rawValue()) % b.rawValue();
+    returnVal.setRawValue(rawVal / kEffectiveFixedPointDenominator);
     return returnVal;
 #else
     return a.rawValue() % b.rawValue();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to