Don't access the CACFLayerRef's sublayers directly from PlatformCALayer
authoraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Jan 2011 01:44:40 +0000 (01:44 +0000)
committeraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Jan 2011 01:44:40 +0000 (01:44 +0000)
commit216e3d19a973ae57978823bae3d76c054591214b
treee3fa464c848ca0e561603aee47f102f502223664
parenta1a7983842fa3ffe460924b4c473236beef28648
Don't access the CACFLayerRef's sublayers directly from PlatformCALayer

There might be a secret extra sublayer (the tile parent layer) that
PlatformCALayer doesn't know about. When PlatformCALayer would
encounter this, it would try to use the tile parent layer's
PlatformCALayer wrapper, which was null, and then would crash. We now
ask PlatformCALayerWinInternal for the sublayer list, since that class
knows about the tile parent layer and can exclude it from the sublayer
list.

Covered by compositing/tiling/huge-layer-resize.html.

Fixes <http://webkit.org/b/52597> Crash beneath
PlatformCALayer::adoptSublayers when switching out of tiling mode
(null-dereference of a PlatformCALayer)

Reviewed by Darin Adler and Chris Marrin.

LayoutTests:

Make compositing/tiling/huge-layer-resize.html faster, more reliable,
and more crashy (when there's a WebKit bug)

This test was trying to cause a layout/paint to happen by returning to
the event loop for a certain amount of time via setTimeout. But this
didn't always result in a layout/paint (at least on Windows). We now
force the layout/paint explicitly, which also lets us speed up the test
by removing the setTimeouts.

* compositing/tiling/huge-layer-resize.html:
(testOnLoad): Changed to use recordLayerTree, which forces a
layout/paint, instead of hoping that setTimeout will do the trick.
(recordLayerTree): Forces a layout/paint, then dumps the layer tree.

Source/WebCore:

* platform/graphics/ca/win/PlatformCALayerWin.cpp:
(PlatformCALayer::adoptSublayers):
(printLayer):
Changed to use PlatformCALayerWinInternal::getSublayers.

* platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
(PlatformCALayerWinInternal::getSublayers): Added. Retrieves the list
of PlatformCALayers that represent our sublayers. Significantly, this
code knows about the tile parent layer and can thus exclude it.

* platform/graphics/ca/win/PlatformCALayerWinInternal.h: Added
getSublayers.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@75985 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/compositing/tiling/huge-layer-resize.html
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp
Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp
Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.h