Title: [124658] trunk/Source/WebCore
Revision
124658
Author
[email protected]
Date
2012-08-03 15:00:07 -0700 (Fri, 03 Aug 2012)

Log Message

Remove dependency on LayoutTypes.h from transformation code
https://bugs.webkit.org/show_bug.cgi?id=93037

Reviewed by Levi Weintraub.

TransformationMatrix and HitTestingTransformState includes LayoutTypes.h
which is in rendering. This is a layering violation.
Remove this dependency as it is no longer needed.

No new tests, no change in functionality.

* rendering/LayoutTypes.h:
Remove clampToLayoutUnit

* platform/FractionalLayoutUnit.h:
(WebCore::FractionalLayoutUnit::clamp):
Add FractionalLayoutUnit::clamp method that clamps a double to a FractionalLayoutUnit.
* platform/graphics/transforms/TransformationMatrix.cpp:
(WebCore::clampEdgeValue):
(WebCore::TransformationMatrix::clampedBoundsOfProjectedQuad):
Use clamp/max/min from FractionalLayoutUnit instead of going through LayoutUnit abstraction.
* platform/graphics/transforms/TransformationMatrix.h:
* rendering/HitTestingTransformState.cpp:
* rendering/HitTestingTransformState.h:
Replace use of LayoutRect with FractionalLayoutRect as LayoutRect maps to FractionalLayoutRect on all platforms.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (124657 => 124658)


--- trunk/Source/WebCore/ChangeLog	2012-08-03 21:57:35 UTC (rev 124657)
+++ trunk/Source/WebCore/ChangeLog	2012-08-03 22:00:07 UTC (rev 124658)
@@ -1,3 +1,31 @@
+2012-08-03  Emil A Eklund  <[email protected]>
+
+        Remove dependency on LayoutTypes.h from transformation code
+        https://bugs.webkit.org/show_bug.cgi?id=93037
+
+        Reviewed by Levi Weintraub.
+
+        TransformationMatrix and HitTestingTransformState includes LayoutTypes.h
+        which is in rendering. This is a layering violation.
+        Remove this dependency as it is no longer needed.
+
+        No new tests, no change in functionality.
+
+        * rendering/LayoutTypes.h:
+        Remove clampToLayoutUnit
+        
+        * platform/FractionalLayoutUnit.h:
+        (WebCore::FractionalLayoutUnit::clamp):
+        Add FractionalLayoutUnit::clamp method that clamps a double to a FractionalLayoutUnit.
+        * platform/graphics/transforms/TransformationMatrix.cpp:
+        (WebCore::clampEdgeValue):
+        (WebCore::TransformationMatrix::clampedBoundsOfProjectedQuad):
+        Use clamp/max/min from FractionalLayoutUnit instead of going through LayoutUnit abstraction.
+        * platform/graphics/transforms/TransformationMatrix.h:
+        * rendering/HitTestingTransformState.cpp:
+        * rendering/HitTestingTransformState.h:
+        Replace use of LayoutRect with FractionalLayoutRect as LayoutRect maps to FractionalLayoutRect on all platforms.
+
 2012-08-03  Dan Bernstein  <[email protected]>
 
         <rdar://problem/12005188> REGRESSION (Safari 5.1 - 6): Cannot correctly display Traditional Mongolian Script

Modified: trunk/Source/WebCore/platform/FractionalLayoutUnit.h (124657 => 124658)


--- trunk/Source/WebCore/platform/FractionalLayoutUnit.h	2012-08-03 21:57:35 UTC (rev 124657)
+++ trunk/Source/WebCore/platform/FractionalLayoutUnit.h	2012-08-03 22:00:07 UTC (rev 124658)
@@ -35,6 +35,7 @@
 #include <limits>
 #include <math.h>
 #include <stdlib.h>
+#include <wtf/MathExtras.h>
 
 #if PLATFORM(QT)
 #include <QDataStream>
@@ -181,6 +182,10 @@
         m.m_value = std::numeric_limits<int>::min();
         return m;
     }
+    static FractionalLayoutUnit clamp(double value)
+    {
+        return clampTo<FractionalLayoutUnit>(value, FractionalLayoutUnit::min(), FractionalLayoutUnit::max());
+    }
     
 private:
     static bool isInBounds(int value)

Modified: trunk/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp (124657 => 124658)


--- trunk/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp	2012-08-03 21:57:35 UTC (rev 124657)
+++ trunk/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp	2012-08-03 22:00:07 UTC (rev 124658)
@@ -28,7 +28,6 @@
 #include "TransformationMatrix.h"
 
 #include "AffineTransform.h"
-#include "FractionalLayoutRect.h"
 #include "FloatPoint3D.h"
 #include "FloatRect.h"
 #include "FloatQuad.h"
@@ -614,10 +613,10 @@
 static float clampEdgeValue(float f)
 {
     ASSERT(!isnan(f));
-    return min<float>(max<float>(f, -MAX_LAYOUT_UNIT / 2), MAX_LAYOUT_UNIT / 2);
+    return min<float>(max<float>(f, -FractionalLayoutUnit::max() / 2), FractionalLayoutUnit::max() / 2);
 }
 
-LayoutRect TransformationMatrix::clampedBoundsOfProjectedQuad(const FloatQuad& q) const
+FractionalLayoutRect TransformationMatrix::clampedBoundsOfProjectedQuad(const FloatQuad& q) const
 {
     FloatRect mappedQuadBounds = projectQuad(q).boundingBox();
 
@@ -626,18 +625,18 @@
 
     float right;
     if (isinf(mappedQuadBounds.x()) && isinf(mappedQuadBounds.width()))
-        right = MAX_LAYOUT_UNIT / 2;
+        right = FractionalLayoutUnit::max() / 2;
     else
         right = clampEdgeValue(ceilf(mappedQuadBounds.maxX()));
 
     float bottom;
     if (isinf(mappedQuadBounds.y()) && isinf(mappedQuadBounds.height()))
-        bottom = MAX_LAYOUT_UNIT / 2;
+        bottom = FractionalLayoutUnit::max() / 2;
     else
         bottom = clampEdgeValue(ceilf(mappedQuadBounds.maxY()));
-    
-    return LayoutRect(clampToLayoutUnit(left), clampToLayoutUnit(top), 
-                      clampToLayoutUnit(right - left), clampToLayoutUnit(bottom - top));
+
+    return FractionalLayoutRect(FractionalLayoutUnit::clamp(left), FractionalLayoutUnit::clamp(top), 
+                                FractionalLayoutUnit::clamp(right - left), FractionalLayoutUnit::clamp(bottom - top));
 }
 
 FloatPoint TransformationMatrix::mapPoint(const FloatPoint& p) const

Modified: trunk/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h (124657 => 124658)


--- trunk/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h	2012-08-03 21:57:35 UTC (rev 124657)
+++ trunk/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h	2012-08-03 22:00:07 UTC (rev 124658)
@@ -27,8 +27,8 @@
 #define TransformationMatrix_h
 
 #include "FloatPoint.h"
+#include "FractionalLayoutRect.h"
 #include "IntPoint.h"
-#include "LayoutTypes.h"
 #include <string.h> //for memcpy
 #include <wtf/FastAllocBase.h>
 
@@ -167,7 +167,7 @@
     FloatQuad projectQuad(const FloatQuad&) const;
     // Projects the four corners of the quad and takes a bounding box,
     // while sanitizing values created when the w component is negative.
-    LayoutRect clampedBoundsOfProjectedQuad(const FloatQuad&) const;
+    FractionalLayoutRect clampedBoundsOfProjectedQuad(const FloatQuad&) const;
 
     double m11() const { return m_matrix[0][0]; }
     void setM11(double f) { m_matrix[0][0] = f; }

Modified: trunk/Source/WebCore/rendering/HitTestingTransformState.cpp (124657 => 124658)


--- trunk/Source/WebCore/rendering/HitTestingTransformState.cpp	2012-08-03 21:57:35 UTC (rev 124657)
+++ trunk/Source/WebCore/rendering/HitTestingTransformState.cpp	2012-08-03 22:00:07 UTC (rev 124658)
@@ -79,7 +79,7 @@
     return m_accumulatedTransform.inverse().projectQuad(m_lastPlanarArea);
 }
 
-LayoutRect HitTestingTransformState::boundsOfMappedArea() const
+FractionalLayoutRect HitTestingTransformState::boundsOfMappedArea() const
 {
     return m_accumulatedTransform.inverse().clampedBoundsOfProjectedQuad(m_lastPlanarArea);
 }

Modified: trunk/Source/WebCore/rendering/HitTestingTransformState.h (124657 => 124658)


--- trunk/Source/WebCore/rendering/HitTestingTransformState.h	2012-08-03 21:57:35 UTC (rev 124657)
+++ trunk/Source/WebCore/rendering/HitTestingTransformState.h	2012-08-03 22:00:07 UTC (rev 124658)
@@ -59,7 +59,7 @@
     FloatPoint mappedPoint() const;
     FloatQuad mappedQuad() const;
     FloatQuad mappedArea() const;
-    LayoutRect boundsOfMappedArea() const;
+    FractionalLayoutRect boundsOfMappedArea() const;
     void flatten();
 
     FloatPoint m_lastPlanarPoint;

Modified: trunk/Source/WebCore/rendering/LayoutTypes.h (124657 => 124658)


--- trunk/Source/WebCore/rendering/LayoutTypes.h	2012-08-03 21:57:35 UTC (rev 124657)
+++ trunk/Source/WebCore/rendering/LayoutTypes.h	2012-08-03 22:00:07 UTC (rev 124658)
@@ -152,11 +152,6 @@
     return numerator.toInt() % denominator.toInt();
 }
 
-inline LayoutUnit clampToLayoutUnit(double value)
-{
-    return clampTo<FractionalLayoutUnit>(value, FractionalLayoutUnit::min(), FractionalLayoutUnit::max());
-}
-
 inline IntSize pixelSnappedIntSize(const FractionalLayoutSize& s, const FractionalLayoutPoint& p)
 {
     return IntSize(snapSizeToPixel(s.width(), p.x()), snapSizeToPixel(s.height(), p.y()));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to