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 22:23:11 +0000 (22:23 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 May 2017 22:23:11 +0000 (22:23 +0000)
commit940f7dc35e681d2eeac4dd024d39b0cb87d4d74d
tree6debec15907515eb48e383b40e1631925b4bd99f
parentcf444c116ca0c849205af51f2d9e5169d13bdd20
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@216631 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