Commit 4479a6c7 authored by George Steel's avatar George Steel Committed by Commit Bot

Enable CompositeRelativeKeyframes for css boxes

This allows transform animations on css boxes to be composited
regardless of whether keyframes are absolute of contain percents.

Exclude SVG targets from flag (keeping keyframes with percents
non-composited) as they do not support compositor animation invalidation
on box-size changes, and supporting this requires SVG transform logic in
the paint property tree builder to become stable.

Design doc: https://docs.google.com/document/d/1zgr5CHRMpvlqodn1e0eM9J3MjL2eEMfAHrHsZUK7gMM/

Bug: 389359
Change-Id: I6c774d4adfdb1dfea4ed252e92642a0aaa256030
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2495604Reviewed-by: default avatarRobert Flack <flackr@chromium.org>
Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Commit-Queue: George Steel <gtsteel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#820441}
parent 42f9b90a
......@@ -244,7 +244,12 @@ CompositorAnimations::CheckCanStartEffectOnCompositor(
case CSSPropertyID::kScale:
case CSSPropertyID::kTranslate:
case CSSPropertyID::kTransform:
if (!RuntimeEnabledFeatures::CompositeRelativeKeyframesEnabled()) {
// TODO(crbug.com/389359): Currently only CSS boxes support
// compositing box-size-dependent transform animations. Once such
// support is fully working for SVG, this section (and the flag)
// should be removed.
if (!RuntimeEnabledFeatures::CompositeRelativeKeyframesEnabled() ||
(layout_object && layout_object->IsSVGChild())) {
if (keyframe->GetCompositorKeyframeValue() &&
To<CompositorKeyframeTransform>(
keyframe->GetCompositorKeyframeValue())
......@@ -732,12 +737,9 @@ void CompositorAnimations::GetAnimationOnCompositor(
case CSSPropertyID::kScale:
case CSSPropertyID::kTranslate:
case CSSPropertyID::kTransform: {
FloatSize box_size;
if (RuntimeEnabledFeatures::CompositeRelativeKeyframesEnabled()) {
box_size = ComputedStyleUtils::ReferenceBoxForTransform(
FloatSize box_size = ComputedStyleUtils::ReferenceBoxForTransform(
*target_element.GetLayoutObject())
.Size();
}
target_property = compositor_target_property::TRANSFORM;
auto transform_curve =
std::make_unique<CompositorTransformAnimationCurve>();
......
......@@ -562,6 +562,8 @@ TEST_P(AnimationCompositorAnimationsTest,
TEST_P(AnimationCompositorAnimationsTest,
IsNotCandidateForCompositorAnimationTransformDependsOnBoxSize) {
ScopedCompositeRelativeKeyframesForTest no_relative_keyframes(false);
// Absolute transforms can be animated on the compositor.
String transform = "translateX(2px) translateY(2px)";
StringKeyframe* good_keyframe =
......
......@@ -346,6 +346,7 @@
},
{
name: "CompositeRelativeKeyframes",
status: "stable",
},
{
name: "CompositeSVG",
......
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