Title: [115647] trunk/Source
Revision
115647
Author
[email protected]
Date
2012-04-30 10:03:41 -0700 (Mon, 30 Apr 2012)

Log Message

Add ENABLE_SUBPIXEL_LAYOUT controlling FractionalLayoutUnit denominator
https://bugs.webkit.org/show_bug.cgi?id=85146

Source/WebCore: 

Patch by Emil A Eklund  <[email protected]> and Levi Weintraub <[email protected]> on 2012-04-28
Reviewed by Eric Seidel.

Add a new flag for controlling the fixed point denominator in
FractionalLayoutUnit. Controls whether the denominator is set to 60 or 1.
Until we change the LayoutUnit typedef this change will have no effect.

No new tests, no change in functionality.

* platform/FractionalLayoutUnit.h:
(WebCore):
(WebCore::FractionalLayoutUnit::operator++):
(WebCore::operator/):
(WebCore::operator+):
Add ++, / double and and + double operators. These are needed when
ENABLE_SUBPIXEL_LAYOUT is not enabled.
        
* platform/graphics/FractionalLayoutRect.cpp:
(WebCore::enclosingFractionalLayoutRect):

Source/WTF: 

Reviewed by Eric Seidel.

Add a new flag for controlling the fixed point denominator in
FractionalLayoutUnit. Controls whether the denominator is set to 60 or 1.
Until we change the LayoutUnit typedef this change will have no effect.

* wtf/Platform.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (115646 => 115647)


--- trunk/Source/WTF/ChangeLog	2012-04-30 16:59:50 UTC (rev 115646)
+++ trunk/Source/WTF/ChangeLog	2012-04-30 17:03:41 UTC (rev 115647)
@@ -1,3 +1,16 @@
+2012-04-28  Emil A Eklund  <[email protected]>
+
+        Add ENABLE_SUBPIXEL_LAYOUT controlling FractionalLayoutUnit denominator
+        https://bugs.webkit.org/show_bug.cgi?id=85146
+
+        Reviewed by Eric Seidel.
+
+        Add a new flag for controlling the fixed point denominator in
+        FractionalLayoutUnit. Controls whether the denominator is set to 60 or 1.
+        Until we change the LayoutUnit typedef this change will have no effect.
+
+        * wtf/Platform.h:
+
 2012-04-29  Kent Tamura  <[email protected]>
 
         [Mac] Add LocalizedDateMac

Modified: trunk/Source/WTF/wtf/Platform.h (115646 => 115647)


--- trunk/Source/WTF/wtf/Platform.h	2012-04-30 16:59:50 UTC (rev 115646)
+++ trunk/Source/WTF/wtf/Platform.h	2012-04-30 17:03:41 UTC (rev 115647)
@@ -807,6 +807,10 @@
 #define ENABLE_GLOBAL_FASTMALLOC_NEW 1
 #endif
 
+#if !defined(ENABLE_SUBPIXEL_LAYOUT)
+#define ENABLE_SUBPIXEL_LAYOUT 0
+#endif
+
 #define ENABLE_DEBUG_WITH_BREAKPOINT 0
 #define ENABLE_SAMPLING_COUNTERS 0
 #define ENABLE_SAMPLING_FLAGS 0

Modified: trunk/Source/WebCore/ChangeLog (115646 => 115647)


--- trunk/Source/WebCore/ChangeLog	2012-04-30 16:59:50 UTC (rev 115646)
+++ trunk/Source/WebCore/ChangeLog	2012-04-30 17:03:41 UTC (rev 115647)
@@ -1,3 +1,27 @@
+2012-04-28  Emil A Eklund  <[email protected]> and Levi Weintraub  <[email protected]>
+
+        Add ENABLE_SUBPIXEL_LAYOUT controlling FractionalLayoutUnit denominator
+        https://bugs.webkit.org/show_bug.cgi?id=85146
+
+        Reviewed by Eric Seidel.
+
+        Add a new flag for controlling the fixed point denominator in
+        FractionalLayoutUnit. Controls whether the denominator is set to 60 or 1.
+        Until we change the LayoutUnit typedef this change will have no effect.
+
+        No new tests, no change in functionality.
+
+        * platform/FractionalLayoutUnit.h:
+        (WebCore):
+        (WebCore::FractionalLayoutUnit::operator++):
+        (WebCore::operator/):
+        (WebCore::operator+):
+        Add ++, / double and and + double operators. These are needed when
+        ENABLE_SUBPIXEL_LAYOUT is not enabled.
+        
+        * platform/graphics/FractionalLayoutRect.cpp:
+        (WebCore::enclosingFractionalLayoutRect):
+
 2012-04-30  Justin Schuh  <[email protected]>
 
         loadOrRedirectSubframe should return the owner element's frame

Modified: trunk/Source/WebCore/platform/FractionalLayoutUnit.h (115646 => 115647)


--- trunk/Source/WebCore/platform/FractionalLayoutUnit.h	2012-04-30 16:59:50 UTC (rev 115646)
+++ trunk/Source/WebCore/platform/FractionalLayoutUnit.h	2012-04-30 17:03:41 UTC (rev 115647)
@@ -38,7 +38,11 @@
 
 namespace WebCore {
 
+#if ENABLE(SUBPIXEL_LAYOUT)
 static const int kFixedPointDenominator = 60;
+#else
+static const int kFixedPointDenominator = 1;
+#endif
 const int intMaxForLayoutUnit = INT_MAX / kFixedPointDenominator;
 const int intMinForLayoutUnit = -intMaxForLayoutUnit;
 
@@ -67,6 +71,12 @@
     operator double() const { return toDouble(); }
     operator bool() const { return m_value; }
 
+    inline FractionalLayoutUnit operator++(int)
+    {
+        m_value += kFixedPointDenominator;
+        return *this;
+    }
+
     inline int rawValue() const { return m_value; }
     inline void setRawValue(int value) { m_value = value; }
     inline void setRawValue(long long value)
@@ -388,6 +398,11 @@
     return a / b.toFloat();
 }
 
+inline double operator/(const double a, const FractionalLayoutUnit& b)
+{
+    return a / b.toDouble();
+}
+
 inline FractionalLayoutUnit operator/(const int a, const FractionalLayoutUnit& b)
 {
     return FractionalLayoutUnit(a) / b;
@@ -430,6 +445,11 @@
     return a + b.toFloat();
 }
 
+inline double operator+(const double a, const FractionalLayoutUnit& b)
+{
+    return a + b.toDouble();
+}
+
 inline FractionalLayoutUnit operator-(const FractionalLayoutUnit& a, const FractionalLayoutUnit& b)
 {
     FractionalLayoutUnit returnVal;

Modified: trunk/Source/WebCore/platform/graphics/FractionalLayoutRect.cpp (115646 => 115647)


--- trunk/Source/WebCore/platform/graphics/FractionalLayoutRect.cpp	2012-04-30 16:59:50 UTC (rev 115646)
+++ trunk/Source/WebCore/platform/graphics/FractionalLayoutRect.cpp	2012-04-30 17:03:41 UTC (rev 115647)
@@ -139,9 +139,13 @@
 
 FractionalLayoutRect enclosingFractionalLayoutRect(const FloatRect& rect)
 {
+#if ENABLE(SUBPIXEL_LAYOUT)
     return FractionalLayoutRect(rect.x(), rect.y(),
                      rect.maxX() - rect.x() + FractionalLayoutUnit::epsilon(),
                      rect.maxY() - rect.y() + FractionalLayoutUnit::epsilon());
+#else
+    return enclosingIntRect(rect);
+#endif
 }
 
 IntRect pixelSnappedIntRect(const FractionalLayoutRect& rect)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to