Title: [139479] trunk
Revision
139479
Author
le...@chromium.org
Date
2013-01-11 11:59:48 -0800 (Fri, 11 Jan 2013)

Log Message

RenderGeometryMap and TransformState disagree with sub-pixel layout and translations
https://bugs.webkit.org/show_bug.cgi?id=106047

Reviewed by Simon Fraser.

Source/WebCore:

Mirror RenderGeometryMap's optimization for integer-translated transforms in TransformState.
This avoids the current behavior where the two can disagree on mappings, since RenderGeometryMap
pixel-snapped later when a translation occurred between two sub-pixel containers.

Test: fast/layers/geometry-map-transform-state-translation-mismatch.html

* platform/graphics/transforms/TransformState.h:
(WebCore::TransformState::setQuad): Clear accumulatedOffset when setting a new quad. Note: this
implementation only works properly when only tracking a quad.
* platform/graphics/transforms/TransformState.cpp:
(WebCore::TransformState::applyTransform): apply integral translations to the accumulatedOffset
for performance and consistency with RenderGeometryMap.

LayoutTests:

* fast/layers/geometry-map-transform-state-translation-mismatch-expected.txt: Added.
* fast/layers/geometry-map-transform-state-translation-mismatch.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (139478 => 139479)


--- trunk/LayoutTests/ChangeLog	2013-01-11 19:58:00 UTC (rev 139478)
+++ trunk/LayoutTests/ChangeLog	2013-01-11 19:59:48 UTC (rev 139479)
@@ -1,3 +1,13 @@
+2013-01-11  Levi Weintraub  <le...@chromium.org>
+
+        RenderGeometryMap and TransformState disagree with sub-pixel layout and translations
+        https://bugs.webkit.org/show_bug.cgi?id=106047
+
+        Reviewed by Simon Fraser.
+
+        * fast/layers/geometry-map-transform-state-translation-mismatch-expected.txt: Added.
+        * fast/layers/geometry-map-transform-state-translation-mismatch.html: Added.
+
 2013-01-11  Stephen Chenney  <schen...@chromium.org>
 
         [Chromium] Mac editing test rebaseline

Added: trunk/LayoutTests/fast/layers/geometry-map-transform-state-translation-mismatch-expected.txt (0 => 139479)


--- trunk/LayoutTests/fast/layers/geometry-map-transform-state-translation-mismatch-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/layers/geometry-map-transform-state-translation-mismatch-expected.txt	2013-01-11 19:59:48 UTC (rev 139479)
@@ -0,0 +1,2 @@
+This tests that RenderGeometryMap and TransformState both avoid pixel snapping prior to applying translation-only transforms. The test passes if it doesn't assert on Debug.
+

Added: trunk/LayoutTests/fast/layers/geometry-map-transform-state-translation-mismatch.html (0 => 139479)


--- trunk/LayoutTests/fast/layers/geometry-map-transform-state-translation-mismatch.html	                        (rev 0)
+++ trunk/LayoutTests/fast/layers/geometry-map-transform-state-translation-mismatch.html	2013-01-11 19:59:48 UTC (rev 139479)
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<style>
+.wrapper {
+  width: 200px;
+  margin-left: 101.7px;
+}
+
+.content {
+  background: rgba(255, 0, 0, 0.2);
+  -webkit-transform: translateZ(0);
+  width: 100px;
+}
+
+.inner {
+  background: rgba(0, 0, 255, 0.2);
+  position: relative;
+  left: -6.25px;   
+}
+</style>
+<script>
+if (window.testRunner)
+	testRunner.dumpAsText();
+</script>
+<body>
+<div id="description">This tests that RenderGeometryMap and TransformState both avoid pixel snapping prior to applying translation-only transforms.
+The test passes if it doesn't assert on Debug.</div>
+<div class="wrapper">
+    <div class="content">
+        <div class="inner"></div>
+    </div>
+</div>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (139478 => 139479)


--- trunk/Source/WebCore/ChangeLog	2013-01-11 19:58:00 UTC (rev 139478)
+++ trunk/Source/WebCore/ChangeLog	2013-01-11 19:59:48 UTC (rev 139479)
@@ -1,3 +1,23 @@
+2013-01-11  Levi Weintraub  <le...@chromium.org>
+
+        RenderGeometryMap and TransformState disagree with sub-pixel layout and translations
+        https://bugs.webkit.org/show_bug.cgi?id=106047
+
+        Reviewed by Simon Fraser.
+
+        Mirror RenderGeometryMap's optimization for integer-translated transforms in TransformState.
+        This avoids the current behavior where the two can disagree on mappings, since RenderGeometryMap
+        pixel-snapped later when a translation occurred between two sub-pixel containers.
+
+        Test: fast/layers/geometry-map-transform-state-translation-mismatch.html
+
+        * platform/graphics/transforms/TransformState.h:
+        (WebCore::TransformState::setQuad): Clear accumulatedOffset when setting a new quad. Note: this
+        implementation only works properly when only tracking a quad.
+        * platform/graphics/transforms/TransformState.cpp:
+        (WebCore::TransformState::applyTransform): apply integral translations to the accumulatedOffset
+        for performance and consistency with RenderGeometryMap.
+
 2013-01-11  Abhishek Arya  <infe...@chromium.org>
 
         Heap-use-after-free in WebCore::RenderText::computePreferredLogicalWidths

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


--- trunk/Source/WebCore/platform/graphics/transforms/TransformState.cpp	2013-01-11 19:58:00 UTC (rev 139478)
+++ trunk/Source/WebCore/platform/graphics/transforms/TransformState.cpp	2013-01-11 19:59:48 UTC (rev 139479)
@@ -111,6 +111,11 @@
     if (wasClamped)
         *wasClamped = false;
 
+    if (transformFromContainer.isIntegerTranslation()) {
+        move(LayoutSize(transformFromContainer.e(), transformFromContainer.f()), accumulate);
+        return;
+    }
+
     applyAccumulatedOffset();
 
     // If we have an accumulated transform from last time, multiply in this transform

Modified: trunk/Source/WebCore/platform/graphics/transforms/TransformState.h (139478 => 139479)


--- trunk/Source/WebCore/platform/graphics/transforms/TransformState.h	2013-01-11 19:58:00 UTC (rev 139478)
+++ trunk/Source/WebCore/platform/graphics/transforms/TransformState.h	2013-01-11 19:59:48 UTC (rev 139479)
@@ -73,7 +73,14 @@
 
     TransformState& operator=(const TransformState&);
     
-    void setQuad(const FloatQuad& quad) { m_lastPlanarQuad = quad; }
+    void setQuad(const FloatQuad& quad)
+    {
+        // FIXME: this assumes that the quad being added is in the coordinate system of the current state.
+        // This breaks if we're simultaneously mapping a point. https://bugs.webkit.org/show_bug.cgi?id=106680
+        ASSERT(!m_mapPoint);
+        m_accumulatedOffset = LayoutSize();
+        m_lastPlanarQuad = quad;
+    }
 
     void move(LayoutUnit x, LayoutUnit y, TransformAccumulation accumulate = FlattenTransform)
     {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to