GraphicsLayerCA::recursiveCommitChanges should not descend into subtrees without...
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Apr 2017 15:00:33 +0000 (15:00 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Apr 2017 15:00:33 +0000 (15:00 +0000)
commitd96435dc40a428196d1f7115f9ccaa865f80cae0
tree9d50d196e87e0c0f747fa9874c8c4ee6f1736046
parent4845f62b269d381145e8b3a9734ec6df4bd41dde
GraphicsLayerCA::recursiveCommitChanges should not descend into subtrees without changes
https://bugs.webkit.org/show_bug.cgi?id=170851

Reviewed by Simon Fraser.

With lots of layers this can be very slow as it always traverses the entire layer tree.
For example GIF animations on tumblr.com trigger expensive commits where almost nothing changes.

This patch adds m_hasDescendantsWithUncommittedChanges bit to GraphicsLayerCA. With this
we can avoid descending to branches without changes when committing.

This patch enabled the optimization on Mac.

* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::GraphicsLayerCA::syncPosition):

    Set PositionChanged flag when syncing layer position. This flag does nothing except makes
    next commit to update the coverage rect (so tiling gets updated).

(WebCore::GraphicsLayerCA::setVisibleAndCoverageRects):

    Do all setting of m_uncommittedChanges bits via addUncommittedChanges function.

(WebCore::GraphicsLayerCA::recursiveCommitChanges):

    Bail out if neither the current layer nor any of its descendants have any uncommited changes
    and none of the ancestors had changes.

(WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
(WebCore::GraphicsLayerCA::ensureStructuralLayer):
(WebCore::GraphicsLayerCA::changeLayerTypeTo):
(WebCore::GraphicsLayerCA::addUncommittedChanges):

    Set m_hasDescendantsWithUncommittedChanges bit in ancestors when mutating m_uncommittedChanges.

(WebCore::GraphicsLayerCA::noteLayerPropertyChanged):
* platform/graphics/ca/GraphicsLayerCA.h:
(WebCore::RenderLayerCompositor::frameViewDidScroll):

    Tell the scrolling layer that it needs to recompute coverage.
    This also schedules a layer flush so no need to do that separately.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215410 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/GraphicsLayer.h
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h
Source/WebCore/rendering/RenderLayerCompositor.cpp