Modified: trunk/Source/WebCore/ChangeLog (125485 => 125486)
--- trunk/Source/WebCore/ChangeLog 2012-08-14 00:57:27 UTC (rev 125485)
+++ trunk/Source/WebCore/ChangeLog 2012-08-14 01:03:48 UTC (rev 125486)
@@ -1,3 +1,23 @@
+2012-08-12 Shawn Singh <[email protected]>
+
+ [chromium] renderSurface in incorrect space if owning layer has empty but non-zero bounds
+ https://bugs.webkit.org/show_bug.cgi?id=93795
+
+ Reviewed by Adrienne Walker.
+
+ If a renderSurface is created by a layer that had zero
+ area (empty) but non-zero bounds (either width or height was
+ non-zero), then one translation transform was accidentally being
+ skipped, causing the renderSurface drawTransform to be incorrect.
+ The fix is simply to move that transform outside of the
+ if-statement so it is not skipped.
+
+ Unit test added:
+ CCLayerTreeHostCommonTest.verifyTransformsForDegenerateIntermediateLayer()
+
+ * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
+ (WebCore::calculateDrawTransformsInternal):
+
2012-08-13 Kentaro Hara <[email protected]>
[V8] Remove [TreatReturnedNullAs=False]
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp (125485 => 125486)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp 2012-08-14 00:57:27 UTC (rev 125485)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp 2012-08-14 01:03:48 UTC (rev 125486)
@@ -502,10 +502,10 @@
// The drawTransform that gets computed below is effectively the layer's drawTransform, unless
// the layer itself creates a renderSurface. In that case, the renderSurface re-parents the transforms.
WebTransformationMatrix drawTransform = combinedTransform;
+ // M[draw] = M[parent] * LT * Tr[anchor2center] * Tr[center2origin]
+ drawTransform.translate(-layer->bounds().width() / 2.0, -layer->bounds().height() / 2.0);
if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) {
- // M[draw] = M[parent] * LT * Tr[anchor2center] * Tr[center2anchor]
- drawTransform.translate(-layer->bounds().width() / 2.0, -layer->bounds().height() / 2.0);
- // M[draw] = M[parent] * LT * Tr[anchor2origin] * S[content2layer]
+ // M[draw] = M[parent] * LT * Tr[anchor2origin] * S[layer2content]
drawTransform.scaleNonUniform(layer->bounds().width() / static_cast<double>(layer->contentBounds().width()),
layer->bounds().height() / static_cast<double>(layer->contentBounds().height()));
}
Modified: trunk/Source/WebKit/chromium/ChangeLog (125485 => 125486)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-08-14 00:57:27 UTC (rev 125485)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-08-14 01:03:48 UTC (rev 125486)
@@ -1,3 +1,12 @@
+2012-08-12 Shawn Singh <[email protected]>
+
+ [chromium] renderSurface in incorrect space if owning layer has empty but non-zero bounds
+ https://bugs.webkit.org/show_bug.cgi?id=93795
+
+ Reviewed by Adrienne Walker.
+
+ * tests/CCLayerTreeHostCommonTest.cpp:
+
2012-08-13 James Robinson <[email protected]>
[chromium] Make WebAnimation a pure virtual interface to hide implementation and avoid unresolved symbols
Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp (125485 => 125486)
--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp 2012-08-14 00:57:27 UTC (rev 125485)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp 2012-08-14 01:03:48 UTC (rev 125486)
@@ -609,6 +609,36 @@
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedGrandChildScreenSpaceTransform, grandChild->screenSpaceTransform());
}
+TEST(CCLayerTreeHostCommonTest, verifyTransformsForDegenerateIntermediateLayer)
+{
+ // A layer that is empty in one axis, but not the other, was accidentally skipping a necessary translation.
+ // Without that translation, the coordinate space of the layer's drawTransform is incorrect.
+ //
+ // Normally this isn't a problem, because the layer wouldn't be drawn anyway, but if that layer becomes a renderSurface, then
+ // its drawTransform is implicitly inherited by the rest of the subtree, which then is positioned incorrectly as a result.
+
+ RefPtr<LayerChromium> root = LayerChromium::create();
+ RefPtr<LayerChromium> child = LayerChromium::create();
+ RefPtr<LayerChromiumWithForcedDrawsContent> grandChild = adoptRef(new LayerChromiumWithForcedDrawsContent());
+
+ // The child height is zero, but has non-zero width that should be accounted for while computing drawTransforms.
+ const WebTransformationMatrix identityMatrix;
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(100, 100), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 0), false);
+ setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
+
+ root->addChild(child);
+ child->addChild(grandChild);
+ child->setForceRenderSurface(true);
+
+ executeCalculateDrawTransformsAndVisibility(root.get());
+
+ ASSERT_TRUE(child->renderSurface());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->renderSurface()->drawTransform()); // This is the real test, the rest are sanity checks.
+ EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->drawTransform());
+ EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, grandChild->drawTransform());
+}
+
TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForRenderSurfaceWithClippedLayer)
{
RefPtr<LayerChromium> parent = LayerChromium::create();