Title: [139620] branches/chromium/1364
Revision
139620
Author
le...@chromium.org
Date
2013-01-14 09:40:35 -0800 (Mon, 14 Jan 2013)

Log Message

Merge 139479
> 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.
> 

TBR=le...@chromium.org
Review URL: https://codereview.chromium.org/11880024

Modified Paths

Added Paths

Diff

Copied: branches/chromium/1364/LayoutTests/fast/layers/geometry-map-transform-state-translation-mismatch-expected.txt (from rev 139479, trunk/LayoutTests/fast/layers/geometry-map-transform-state-translation-mismatch-expected.txt) (0 => 139620)


--- branches/chromium/1364/LayoutTests/fast/layers/geometry-map-transform-state-translation-mismatch-expected.txt	                        (rev 0)
+++ branches/chromium/1364/LayoutTests/fast/layers/geometry-map-transform-state-translation-mismatch-expected.txt	2013-01-14 17:40:35 UTC (rev 139620)
@@ -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.
+

Copied: branches/chromium/1364/LayoutTests/fast/layers/geometry-map-transform-state-translation-mismatch.html (from rev 139479, trunk/LayoutTests/fast/layers/geometry-map-transform-state-translation-mismatch.html) (0 => 139620)


--- branches/chromium/1364/LayoutTests/fast/layers/geometry-map-transform-state-translation-mismatch.html	                        (rev 0)
+++ branches/chromium/1364/LayoutTests/fast/layers/geometry-map-transform-state-translation-mismatch.html	2013-01-14 17:40:35 UTC (rev 139620)
@@ -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: branches/chromium/1364/Source/WebCore/platform/graphics/transforms/TransformState.cpp (139619 => 139620)


--- branches/chromium/1364/Source/WebCore/platform/graphics/transforms/TransformState.cpp	2013-01-14 17:30:59 UTC (rev 139619)
+++ branches/chromium/1364/Source/WebCore/platform/graphics/transforms/TransformState.cpp	2013-01-14 17:40:35 UTC (rev 139620)
@@ -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: branches/chromium/1364/Source/WebCore/platform/graphics/transforms/TransformState.h (139619 => 139620)


--- branches/chromium/1364/Source/WebCore/platform/graphics/transforms/TransformState.h	2013-01-14 17:30:59 UTC (rev 139619)
+++ branches/chromium/1364/Source/WebCore/platform/graphics/transforms/TransformState.h	2013-01-14 17:40:35 UTC (rev 139620)
@@ -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