Title: [120103] trunk/Source
- Revision
- 120103
- Author
- commit-qu...@webkit.org
- Date
- 2012-06-12 12:17:54 -0700 (Tue, 12 Jun 2012)
Log Message
[chromium] Don't crash in CCLayerIterator if the root layer doesn't have a render surface
https://bugs.webkit.org/show_bug.cgi?id=88886
Patch by Sami Kyostila <skyos...@chromium.org> on 2012-06-12
Reviewed by James Robinson.
If we are iterating over a render render surface layer list where the
root layer does not have a render surface, fail gracefully instead of
crashing.
Tests: CCLayerIteratorTest.{emptyTree,rootLayerWithoutRenderSurface}
* platform/graphics/chromium/cc/CCLayerIterator.h:
(WebCore::CCLayerIterator::CCLayerIterator):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (120102 => 120103)
--- trunk/Source/WebCore/ChangeLog 2012-06-12 19:17:26 UTC (rev 120102)
+++ trunk/Source/WebCore/ChangeLog 2012-06-12 19:17:54 UTC (rev 120103)
@@ -1,3 +1,19 @@
+2012-06-12 Sami Kyostila <skyos...@chromium.org>
+
+ [chromium] Don't crash in CCLayerIterator if the root layer doesn't have a render surface
+ https://bugs.webkit.org/show_bug.cgi?id=88886
+
+ Reviewed by James Robinson.
+
+ If we are iterating over a render render surface layer list where the
+ root layer does not have a render surface, fail gracefully instead of
+ crashing.
+
+ Tests: CCLayerIteratorTest.{emptyTree,rootLayerWithoutRenderSurface}
+
+ * platform/graphics/chromium/cc/CCLayerIterator.h:
+ (WebCore::CCLayerIterator::CCLayerIterator):
+
2012-06-06 Ojan Vafai <o...@chromium.org>
Change default for flex-grow back to 0
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerIterator.h (120102 => 120103)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerIterator.h 2012-06-12 19:17:26 UTC (rev 120102)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerIterator.h 2012-06-12 19:17:54 UTC (rev 120103)
@@ -143,8 +143,9 @@
private:
CCLayerIterator(const LayerList* renderSurfaceLayerList, bool start)
: m_renderSurfaceLayerList(renderSurfaceLayerList)
+ , m_targetRenderSurfaceLayerIndex(0)
{
- if (start && !renderSurfaceLayerList->isEmpty())
+ if (start && !renderSurfaceLayerList->isEmpty() && targetRenderSurface())
m_actions.begin(*this);
else
m_actions.end(*this);
Modified: trunk/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp (120102 => 120103)
--- trunk/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp 2012-06-12 19:17:26 UTC (rev 120102)
+++ trunk/Source/WebKit/chromium/tests/CCLayerIteratorTest.cpp 2012-06-12 19:17:54 UTC (rev 120103)
@@ -82,6 +82,8 @@
renderSurfaceLayer->m_countRepresentingContributingSurface = -1;
renderSurfaceLayer->m_countRepresentingItself = -1;
+ if (!renderSurface)
+ continue;
for (unsigned layerIndex = 0; layerIndex < renderSurface->layerList().size(); ++layerIndex) {
TestLayerChromium* layer = static_cast<TestLayerChromium*>(renderSurface->layerList()[layerIndex].get());
@@ -122,6 +124,14 @@
}
}
+TEST(CCLayerIteratorTest, emptyTree)
+{
+ Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+
+ iterateBackToFront(&renderSurfaceLayerList);
+ iterateFrontToBack(&renderSurfaceLayerList);
+}
+
TEST(CCLayerIteratorTest, simpleTree)
{
RefPtr<TestLayerChromium> rootLayer = TestLayerChromium::create();
@@ -277,4 +287,17 @@
EXPECT_COUNT(root3, -1, -1, 0);
}
+TEST(CCLayerIteratorTest, rootLayerWithoutRenderSurface)
+{
+ RefPtr<TestLayerChromium> rootLayer = TestLayerChromium::create();
+ Vector<RefPtr<LayerChromium> > renderSurfaceLayerList;
+ renderSurfaceLayerList.append(rootLayer.get());
+
+ iterateBackToFront(&renderSurfaceLayerList);
+ EXPECT_COUNT(rootLayer, -1, -1, -1);
+
+ iterateFrontToBack(&renderSurfaceLayerList);
+ EXPECT_COUNT(rootLayer, -1, -1, -1);
+}
+
} // namespace
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes