Computing animated style should not require renderers
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Sep 2017 19:18:25 +0000 (19:18 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Sep 2017 19:18:25 +0000 (19:18 +0000)
commitb21b50c872f26310f77ba515ae70cbbd49a9c5d2
tree9fcdcf0c6404fa6d2d3b61c3a3e6816bf9332073
parenta2ec779aa1e96d7d0ef8aeb70b1740a70913ea3b
Computing animated style should not require renderers
https://bugs.webkit.org/show_bug.cgi?id=171926
<rdar://problem/34428035>

Reviewed by Sam Weinig.

Source/WebCore:

CSS animation system is now element rather than renderer based. This allows cleaning up
style resolution and render tree update code.

This also fixes bug animation doesn't run if display property is animated from one rendered type
to another. Added a test case for this.

Test: transitions/transition-display-property-2.html

* page/animation/CSSAnimationController.cpp:
(WebCore::CSSAnimationController::updateAnimations):

    Pass in the old style instead of getting it from the renderer.
    Factor to return the animated style as a return value.

* page/animation/CSSAnimationController.h:
* rendering/RenderElement.cpp:
(WebCore::RenderElement::RenderElement):
(WebCore::RenderElement::willBeDestroyed):

    Animation are now canceled by RenderTreeUpdater::tearDownRenderers.

* rendering/RenderElement.h:
(WebCore::RenderElement::hasInitialAnimatedStyle const): Deleted.
(WebCore::RenderElement::setHasInitialAnimatedStyle): Deleted.

    We no longer need to this concept.

* style/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::updateElementRenderer):
(WebCore::RenderTreeUpdater::createRenderer):

    We now get correct animated style from style resolution in all cases so we don't need to compute
    it separately for new renderers.

(WebCore::RenderTreeUpdater::tearDownRenderers):

    Cancel animations when render tree is fully torn down. Keep them when updating style.

* style/RenderTreeUpdater.h:
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::createAnimatedElementUpdate):

    We can now compute animated style without renderer. Special cases dealing with rendererless case
    can be removed.

LayoutTests:

* transitions/transition-display-property-2-expected.html: Added.
* transitions/transition-display-property-2.html: Added.
* transitions/transition-display-property.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222040 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
LayoutTests/ChangeLog
LayoutTests/transitions/transition-display-property-2-expected.html [new file with mode: 0644]
LayoutTests/transitions/transition-display-property-2.html [new file with mode: 0644]
LayoutTests/transitions/transition-display-property.html
Source/WebCore/ChangeLog
Source/WebCore/page/animation/CSSAnimationController.cpp
Source/WebCore/page/animation/CSSAnimationController.h
Source/WebCore/page/animation/CompositeAnimation.cpp
Source/WebCore/page/animation/CompositeAnimation.h
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/RenderElement.h
Source/WebCore/style/RenderTreeUpdater.cpp
Source/WebCore/style/RenderTreeUpdater.h
Source/WebCore/style/StyleTreeResolver.cpp