REGRESSION (r207372) Visibility property is not inherited when used in an animation
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 May 2017 16:50:56 +0000 (16:50 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 May 2017 16:50:56 +0000 (16:50 +0000)
commit2d2e09514d2f8198d47c3a0db930c66b0dcc022e
tree23513cc2667f6c79a7e9da0f506bb3106b49951e
parentbb11f58fbfcad789b1473d8c16dcf19051abb260
REGRESSION (r207372) Visibility property is not inherited when used in an animation
https://bugs.webkit.org/show_bug.cgi?id=171883
<rdar://problem/32086550>

Reviewed by Simon Fraser.

Source/WebCore:

The problem here is that our animation code is tied to renderers. We don't have renderers during
the initial style resolution so animations are not applied yet. When constructing renderers we set
their style to the initial animated style but this step can't implement inheritance.

Normally this is invisible as the first animation frame will immediately inherit the style correctly.
However in this case the animation is discrete and the first frame is the same as the initial state.
With r207372 we optimize the descendant style change away.

This patch fixes the problem by tracking that the renderer has initial animated style and inheriting
it to descendants during next style resolution even if it doesn't change.

Test: animations/animation-initial-inheritance.html

* rendering/RenderElement.cpp:
(WebCore::RenderElement::RenderElement):
* rendering/RenderElement.h:
(WebCore::RenderElement::hasInitialAnimatedStyle):
(WebCore::RenderElement::setHasInitialAnimatedStyle):
* style/RenderTreeUpdater.cpp:
(WebCore::RenderTreeUpdater::createRenderer):

    Set a bit on renderer indicating it has initial animated style.

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

    Return at least 'Inherit' for style change when updating renderer with initial animated style.

LayoutTests:

* animations/animation-initial-inheritance-expected.html: Added.
* animations/animation-initial-inheritance.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216591 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/animations/animation-initial-inheritance-expected.html [new file with mode: 0644]
LayoutTests/animations/animation-initial-inheritance.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/RenderElement.h
Source/WebCore/style/RenderTreeUpdater.cpp
Source/WebCore/style/StyleTreeResolver.cpp