Computing animated style should not require renderers
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Sep 2017 12:33:04 +0000 (12:33 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 16 Sep 2017 12:33:04 +0000 (12:33 +0000)
commitacb750cf2799bcc745e21e9e9b4b4b9b0190d459
tree4ac2dcc0a8ede173c66e017e5bf5bf8cc274f632
parent89ceb6cb6269effaeaf15ee2d25a1d9116e3caef
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@222129 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