Title: [94259] trunk/Source/WebCore
Revision
94259
Author
simon.fra...@apple.com
Date
2011-08-31 18:20:23 -0700 (Wed, 31 Aug 2011)

Log Message

TransformState.move() should be negated in the unapply code path
https://bugs.webkit.org/show_bug.cgi?id=66246

Reviewed by Chris Marrin.

Code using TransformState was confused about when to negate the arguments
to move() in the "UnapplyInverseTransform" direction (used by mapAbsoluteToLocal).

Made the move() path equivalent to the applyTransform() path by not requiring
the caller to negate, and instead negating inside move().

Fixed the erroneous negation in TransformState::move() when accumulating;
that negation will happen later via matrix inversion.

No behavior change.

* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::recursiveCommitChanges):
* platform/graphics/transforms/TransformState.cpp:
(WebCore::TransformState::move):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::mapAbsoluteToLocalPoint):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::mapAbsoluteToLocalPoint):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (94258 => 94259)


--- trunk/Source/WebCore/ChangeLog	2011-09-01 01:11:28 UTC (rev 94258)
+++ trunk/Source/WebCore/ChangeLog	2011-09-01 01:20:23 UTC (rev 94259)
@@ -1,3 +1,30 @@
+2011-08-31  Simon Fraser  <simon.fra...@apple.com>
+
+        TransformState.move() should be negated in the unapply code path
+        https://bugs.webkit.org/show_bug.cgi?id=66246
+
+        Reviewed by Chris Marrin.
+
+        Code using TransformState was confused about when to negate the arguments
+        to move() in the "UnapplyInverseTransform" direction (used by mapAbsoluteToLocal).
+        
+        Made the move() path equivalent to the applyTransform() path by not requiring
+        the caller to negate, and instead negating inside move().
+        
+        Fixed the erroneous negation in TransformState::move() when accumulating;
+        that negation will happen later via matrix inversion.
+
+        No behavior change.
+
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::recursiveCommitChanges):
+        * platform/graphics/transforms/TransformState.cpp:
+        (WebCore::TransformState::move):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::mapAbsoluteToLocalPoint):
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::mapAbsoluteToLocalPoint):
+
 2011-08-31  Pratik Solanki  <psola...@apple.com>
 
         Fix compile issues when enabling HAVE(CFNETWORK_DATA_ARRAY_CALLBACK)

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (94258 => 94259)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2011-09-01 01:11:28 UTC (rev 94258)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2011-09-01 01:20:23 UTC (rev 94259)
@@ -831,7 +831,7 @@
     TransformState localState = state;
     
     TransformState::TransformAccumulation accumulation = preserves3D() ? TransformState::AccumulateTransform : TransformState::FlattenTransform;
-    localState.move(-m_position.x(), -m_position.y(), accumulation);
+    localState.move(m_position.x(), m_position.y(), accumulation);
     
     if (!transform().isIdentity()) {
         TransformationMatrix transformWithAnchorPoint;

Modified: trunk/Source/WebCore/platform/graphics/transforms/TransformState.cpp (94258 => 94259)


--- trunk/Source/WebCore/platform/graphics/transforms/TransformState.cpp	2011-09-01 01:11:28 UTC (rev 94258)
+++ trunk/Source/WebCore/platform/graphics/transforms/TransformState.cpp	2011-09-01 01:20:23 UTC (rev 94259)
@@ -56,13 +56,17 @@
         if (m_direction == ApplyTransformDirection)
             m_accumulatedTransform->translateRight(x, y);
         else
-            m_accumulatedTransform->translate(-x, -y);  // We're unapplying, so negate
+            m_accumulatedTransform->translate(x, y);
         
         // Then flatten if necessary.
         if (accumulate == FlattenTransform)
             flatten();
     } else {
         // Just move the point and, optionally, the quad.
+        if (m_direction == UnapplyInverseTransformDirection) {
+            x = -x;
+            y = -y;
+        }
         if (m_mapPoint)
             m_lastPlanarPoint.move(x, y);
         if (m_mapQuad)

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (94258 => 94259)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2011-09-01 01:11:28 UTC (rev 94258)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2011-09-01 01:20:23 UTC (rev 94259)
@@ -1305,7 +1305,7 @@
         getTransformFromContainer(o, containerOffset, t);
         transformState.applyTransform(t, preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform);
     } else
-        transformState.move(-containerOffset.width(), -containerOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform);
+        transformState.move(containerOffset.width(), containerOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform);
 }
 
 LayoutSize RenderBox::offsetFromContainer(RenderObject* o, const LayoutPoint& point) const

Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (94258 => 94259)


--- trunk/Source/WebCore/rendering/RenderInline.cpp	2011-09-01 01:11:28 UTC (rev 94258)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp	2011-09-01 01:20:23 UTC (rev 94259)
@@ -1180,7 +1180,7 @@
         getTransformFromContainer(o, containerOffset, t);
         transformState.applyTransform(t, preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform);
     } else
-        transformState.move(-containerOffset.width(), -containerOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform);
+        transformState.move(containerOffset.width(), containerOffset.height(), preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform);
 }
 
 void RenderInline::updateDragState(bool dragOn)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to