Modified: trunk/Source/WebCore/ChangeLog (101701 => 101702)
--- trunk/Source/WebCore/ChangeLog 2011-12-01 21:32:11 UTC (rev 101701)
+++ trunk/Source/WebCore/ChangeLog 2011-12-01 21:44:54 UTC (rev 101702)
@@ -1,3 +1,22 @@
+2011-12-01 Daniel Sievers <[email protected]>
+
+ [Chromium] Early returns in calculateDrawTransformsAndVisibilityInternal() are not respected by parent.
+ https://bugs.webkit.org/show_bug.cgi?id=73270
+
+ Non-drawing child trees should not be added to the parent render surface's layer list
+ and should neither extend the parent layer's drawable content rect.
+
+ This also fixes assertions from the content texture residency logic, which doesn't like it
+ if we try to use a render surface through a parent, while that surface itself was never 'used'
+ in the same frame.
+
+ Reviewed by James Robinson.
+
+ Added unit test.
+
+ * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
+ (WebCore::calculateDrawTransformsAndVisibilityInternal):
+
2011-12-01 David Reveman <[email protected]>
[Chromium] Use contentBounds instead of bounds for invalidation.
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp (101701 => 101702)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp 2011-12-01 21:32:11 UTC (rev 101701)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp 2011-12-01 21:44:54 UTC (rev 101702)
@@ -106,7 +106,7 @@
// Recursively walks the layer tree starting at the given node and computes all the
// necessary transformations, clipRects, render surfaces, etc.
template<typename LayerType, typename RenderSurfaceType, typename LayerSorter>
-static void calculateDrawTransformsAndVisibilityInternal(LayerType* layer, LayerType* rootLayer, const TransformationMatrix& parentMatrix, const TransformationMatrix& fullHierarchyMatrix, Vector<RefPtr<LayerType> >& renderSurfaceLayerList, Vector<RefPtr<LayerType> >& layerList, LayerSorter* layerSorter, int maxTextureSize)
+static bool calculateDrawTransformsAndVisibilityInternal(LayerType* layer, LayerType* rootLayer, const TransformationMatrix& parentMatrix, const TransformationMatrix& fullHierarchyMatrix, Vector<RefPtr<LayerType> >& renderSurfaceLayerList, Vector<RefPtr<LayerType> >& layerList, LayerSorter* layerSorter, int maxTextureSize)
{
typedef Vector<RefPtr<LayerType> > LayerList;
@@ -195,7 +195,7 @@
// via a render surface or explicitly if the parent preserves 3D), so the
// entire subtree can be skipped if this layer is fully transparent.
if (!drawOpacity)
- return;
+ return false;
IntSize bounds = layer->bounds();
FloatPoint anchorPoint = layer->anchorPoint();
@@ -363,18 +363,20 @@
for (size_t i = 0; i < layer->children().size(); ++i) {
LayerType* child = layer->children()[i].get();
- calculateDrawTransformsAndVisibilityInternal<LayerType, RenderSurfaceType, LayerSorter>(child, rootLayer, sublayerMatrix, nextHierarchyMatrix, renderSurfaceLayerList, descendants, layerSorter, maxTextureSize);
+ bool drawsContent = calculateDrawTransformsAndVisibilityInternal<LayerType, RenderSurfaceType, LayerSorter>(child, rootLayer, sublayerMatrix, nextHierarchyMatrix, renderSurfaceLayerList, descendants, layerSorter, maxTextureSize);
- if (child->renderSurface()) {
- RenderSurfaceType* childRenderSurface = child->renderSurface();
- IntRect drawableContentRect = layer->drawableContentRect();
- drawableContentRect.unite(enclosingIntRect(childRenderSurface->drawableContentRect()));
- layer->setDrawableContentRect(drawableContentRect);
- descendants.append(child);
- } else {
- IntRect drawableContentRect = layer->drawableContentRect();
- drawableContentRect.unite(child->drawableContentRect());
- layer->setDrawableContentRect(drawableContentRect);
+ if (drawsContent) {
+ if (child->renderSurface()) {
+ RenderSurfaceType* childRenderSurface = child->renderSurface();
+ IntRect drawableContentRect = layer->drawableContentRect();
+ drawableContentRect.unite(enclosingIntRect(childRenderSurface->drawableContentRect()));
+ layer->setDrawableContentRect(drawableContentRect);
+ descendants.append(child);
+ } else {
+ IntRect drawableContentRect = layer->drawableContentRect();
+ drawableContentRect.unite(child->drawableContentRect());
+ layer->setDrawableContentRect(drawableContentRect);
+ }
}
}
@@ -439,19 +441,21 @@
ASSERT(renderSurfaceLayerList.last() == layer);
renderSurfaceLayerList.removeLast();
layer->clearRenderSurface();
- return;
+ return false;
}
}
// If neither this layer nor any of its children were added, early out.
if (sortingStartIndex == descendants.size())
- return;
+ return false;
// If preserves-3d then sort all the descendants in 3D so that they can be
// drawn from back to front. If the preserves-3d property is also set on the parent then
// skip the sorting as the parent will sort all the descendants anyway.
if (descendants.size() && layer->preserves3D() && (!layer->parent() || !layer->parent()->preserves3D()))
sortLayers(&descendants.at(sortingStartIndex), descendants.end(), layerSorter);
+
+ return true;
}
// FIXME: Instead of using the following function to set visibility rects on a second
Modified: trunk/Source/WebKit/chromium/ChangeLog (101701 => 101702)
--- trunk/Source/WebKit/chromium/ChangeLog 2011-12-01 21:32:11 UTC (rev 101701)
+++ trunk/Source/WebKit/chromium/ChangeLog 2011-12-01 21:44:54 UTC (rev 101702)
@@ -1,3 +1,20 @@
+2011-12-01 Daniel Sievers <[email protected]>
+
+ [Chromium] Early returns in calculateDrawTransformsAndVisibilityInternal() are not respected by parent.
+ https://bugs.webkit.org/show_bug.cgi?id=73270
+
+ Non-drawing child trees should not be added to the parent render surface's layer list
+ and should neither extend the parent layer's drawable content rect.
+
+ This also fixes assertions from the content texture residency logic, which doesn't like it
+ if we try to use a render surface through a parent, while that surface itself was never 'used'
+ in the same frame.
+
+ Reviewed by James Robinson.
+
+ * tests/CCLayerTreeHostCommonTest.cpp:
+ (WebCore::TEST):
+
2011-12-01 David Reveman <[email protected]>
[Chromium] Use contentBounds instead of bounds for invalidation.
Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp (101701 => 101702)
--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp 2011-12-01 21:32:11 UTC (rev 101701)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp 2011-12-01 21:44:54 UTC (rev 101702)
@@ -481,6 +481,34 @@
EXPECT_EQ(renderSurfaceLayerList.size(), 0U);
}
+TEST(CCLayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild)
+{
+ RefPtr<LayerChromium> parent = LayerChromium::create(0);
+ RefPtr<LayerChromium> renderSurface1 = LayerChromium::create(0);
+ RefPtr<LayerChromiumWithForcedDrawsContent> child = adoptRef(new LayerChromiumWithForcedDrawsContent(0));
+ renderSurface1->setOpacity(0);
+
+ const TransformationMatrix identityMatrix;
+ setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
+
+ parent->createRenderSurface();
+ parent->addChild(renderSurface1);
+ renderSurface1->createRenderSurface();
+ renderSurface1->addChild(child);
+
+ Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ Vector<RefPtr<LayerChromium> > dummyLayerList;
+ int dummyMaxTextureSize = 512;
+ CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(parent.get(), parent.get(), identityMatrix, identityMatrix, renderSurfaceLayerList, dummyLayerList, dummyMaxTextureSize);
+
+ // Since the layer is transparent, renderSurface1->renderSurface() should not have gotten added anywhere.
+ // Also, the drawable content rect should not have been extended by the children.
+ EXPECT_EQ(parent->renderSurface()->layerList().size(), 0U);
+ EXPECT_EQ(renderSurfaceLayerList.size(), 0U);
+ EXPECT_EQ(parent->drawableContentRect(), IntRect());
+}
+
// FIXME:
// continue working on https://bugs.webkit.org/show_bug.cgi?id=68942
// - add a test to verify clipping that changes the "center point"