Source/WebCore: Fix a hang when combining tile cache layers with preserve-3d or refle...
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 20 Oct 2012 00:15:23 +0000 (00:15 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 20 Oct 2012 00:15:23 +0000 (00:15 +0000)
commitfafa95f17fc70442827e6b7905ef7c93147e05a2
tree63f7c3f4eca16d70fe61b5ab5995e338a031bcff
parentbb57d8afb74620d2a23faae943d22ab592f97c00
Source/WebCore: Fix a hang when combining tile cache layers with preserve-3d or reflections
https://bugs.webkit.org/show_bug.cgi?id=99890
<rdar://problem/12539560>

Reviewed by Dean Jackson.

The new tile cache code added an updateSublayers() call when switching to/from
tiled layers. This confused later sublayer rebuilding, causing us to attempt to
add a layer as a child of itself, causing a hang in CA.

Fix by removing all the explicit calls to updateFoo when updating the structural
layer and switching to/from tiled layers. Instead, we set dirty flags, and rely
on the fact that these flag-dirtying functions get called before the later functions
that process those dirty flags. This is assured by some reordering of the update
function calls.

A final wrinkle is that ensureStructuralLayer() can change the layer that our
parent GraphicsLayer put in its sublayer list. Rather than diddle with that sublayer
list directly like we used to, just call noteSublayersChanged() on the parent, and have
commitLayerChangesAfterSublayers() check the ChildrenChanged and do a second update
of sublayers if necessary (we clear the flag in commitLayerChangesBeforeSublayers(), so
only do this work if a sublayer requested it).

Tests: compositing/tiling/preserve3d-tiled.html
       compositing/tiling/reflected-tiled.html

* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
(WebCore::GraphicsLayerCA::commitLayerChangesAfterSublayers):
(WebCore::GraphicsLayerCA::ensureStructuralLayer):
(WebCore::GraphicsLayerCA::swapFromOrToTiledLayer):
* platform/graphics/ca/mac/PlatformCALayerMac.mm:
(PlatformCALayer::appendSublayer): Add assertion about adding a layer to itself.
(PlatformCALayer::insertSublayer): Ditto.
(PlatformCALayer::replaceSublayer): Ditto.

LayoutTests: Fix a hang when combining tile cache layers with preserve-3d or reflections
https://bugs.webkit.org/show_bug.cgi?id=99890

Reviewed by Dean Jackson.

Tests that combine tiled layers with preserve-3d and reflections.

* compositing/tiling/preserve3d-tiled-expected.txt: Added.
* compositing/tiling/preserve3d-tiled.html: Added.
* compositing/tiling/reflected-tiled-expected.txt: Added.
* compositing/tiling/reflected-tiled.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@131964 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/compositing/tiling/preserve3d-tiled-expected.txt [new file with mode: 0644]
LayoutTests/compositing/tiling/preserve3d-tiled.html [new file with mode: 0644]
LayoutTests/compositing/tiling/reflected-tiled-expected.txt [new file with mode: 0644]
LayoutTests/compositing/tiling/reflected-tiled.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm