Commit 23d1feae authored by Kevin Ellis's avatar Kevin Ellis Committed by Commit Bot

Update running CSS animations when the text direction or writing mode changes.

Bug: 865579
Change-Id: I6cad7c4fb4704b83dcd806b8bf7a96cdf5855ee6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2416390Reviewed-by: default avatarAnders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Kevin Ellis <kevers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808030}
parent 5d9fcd53
...@@ -609,6 +609,13 @@ void CSSAnimations::CalculateAnimationUpdate(CSSAnimationUpdate& update, ...@@ -609,6 +609,13 @@ void CSSAnimations::CalculateAnimationUpdate(CSSAnimationUpdate& update,
} }
#endif #endif
// Rebuild the keyframe model for a CSS animation if it may have been
// invalidated by a change to the text direction or writing mode.
const ComputedStyle* old_style = animating_element->GetComputedStyle();
bool logical_property_mapping_change =
old_style && (old_style->Direction() != style.Direction() ||
old_style->GetWritingMode() != style.GetWritingMode());
const CSSAnimationData* animation_data = style.Animations(); const CSSAnimationData* animation_data = style.Animations();
const CSSAnimations* css_animations = const CSSAnimations* css_animations =
element_animations ? &element_animations->CssAnimations() : nullptr; element_animations ? &element_animations->CssAnimations() : nullptr;
...@@ -696,7 +703,7 @@ void CSSAnimations::CalculateAnimationUpdate(CSSAnimationUpdate& update, ...@@ -696,7 +703,7 @@ void CSSAnimations::CalculateAnimationUpdate(CSSAnimationUpdate& update,
keyframes_rule->Version() != keyframes_rule->Version() !=
existing_animation->style_rule_version || existing_animation->style_rule_version ||
existing_animation->specified_timing != specified_timing || existing_animation->specified_timing != specified_timing ||
is_paused != was_paused) { is_paused != was_paused || logical_property_mapping_change) {
DCHECK(!is_animation_style_change); DCHECK(!is_animation_style_change);
update.UpdateAnimation( update.UpdateAnimation(
existing_animation_index, animation, existing_animation_index, animation,
......
This is a testharness.js-based test.
PASS Logical properties can be animated
PASS Logical properties in animations respect the writing-mode
PASS Logical properties in animations respect the direction
PASS Declaration order is respected within @keyframes declaration blocks
PASS Logical properties are able to override physical properties in @keyframes declaration blocks
PASS Declaration order is respected amongst logical properties within @keyframes declaration blocks
PASS Physical properties and logical properties can be mixed
PASS Declaration order is respected on each keyframe individually
FAIL Animations update when the writing-mode is changed assert_equals: expected "50px" but got "0px"
FAIL Filling animations update when the writing-mode is changed assert_equals: expected "100px" but got "0px"
FAIL The number of interpolating properties can be increased when the writing-mode is changed assert_equals: expected "50px" but got "0px"
FAIL The number of interpolating properties can be decreased when the writing-mode is changed assert_equals: expected "150px" but got "200px"
FAIL Animations update when the writing-mode is changed through a CSS variable assert_equals: expected "50px" but got "0px"
PASS Logical shorthand with variable references animates correctly
FAIL Animations update when the direction is changed assert_equals: expected "0px" but got "50px"
Harness: the test ran to completion.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment