Commit f46a4f83 authored by Alison Maher's avatar Alison Maher Committed by Commit Bot

Animations in forced colors mode

The effects of animating properties affected by forced colors mode
should be overridden in forced colors mode if forced-color-adjust is
set to auto.

Bug: 970285
Change-Id: I5d0c86319204848ca7eea54bc5d68b4396700d34
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1783338Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Reviewed-by: default avatarKevin Babbitt <kbabbitt@microsoft.com>
Commit-Queue: Alison Maher <almaher@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#693874}
parent e513ff04
...@@ -1263,6 +1263,10 @@ void StyleResolver::ApplyAnimatedStandardProperties( ...@@ -1263,6 +1263,10 @@ void StyleResolver::ApplyAnimatedStandardProperties(
: entry.key.PresentationAttribute().PropertyID(); : entry.key.PresentationAttribute().PropertyID();
if (!CSSPropertyPriorityData<priority>::PropertyHasPriority(property)) if (!CSSPropertyPriorityData<priority>::PropertyHasPriority(property))
continue; continue;
if (IsForcedColorsModeEnabled() && entry.key.IsCSSProperty() &&
entry.key.GetCSSProperty().IsAffectedByForcedColors() &&
state.Style()->ForcedColorAdjust() != EForcedColorAdjust::kNone)
continue;
const Interpolation& interpolation = *entry.value.front(); const Interpolation& interpolation = *entry.value.front();
if (interpolation.IsInvalidatableInterpolation()) { if (interpolation.IsInvalidatableInterpolation()) {
CSSInterpolationTypesMap map(state.GetDocument().GetPropertyRegistry(), CSSInterpolationTypesMap map(state.GetDocument().GetPropertyRegistry(),
......
FAIL - "color" property for "box" element at 0s expected: rgb(0, 0, 0) but saw: rgb(255, 0, 0)
FAIL - "color" property for "box" element at 0.5s expected: rgb(0, 0, 0) but saw: rgb(128, 64, 0)
FAIL - "color" property for "box" element at 1s expected: rgb(0, 0, 0) but saw: rgb(255, 0, 0)
FAIL - "color" property for "box" element at 0s expected: rgb(255, 0, 255) but saw: rgb(255, 0, 0) FAIL - "color" property for "box" element at 0s expected: rgb(0, 0, 0) but saw: rgb(255, 0, 255)
FAIL - "color" property for "box" element at 0.5s expected: rgb(255, 0, 255) but saw: rgb(128, 64, 0) FAIL - "color" property for "box" element at 0.5s expected: rgb(0, 0, 0) but saw: rgb(255, 0, 255)
FAIL - "color" property for "box" element at 1s expected: rgb(255, 0, 255) but saw: rgb(255, 0, 0) FAIL - "color" property for "box" element at 1s expected: rgb(0, 0, 0) but saw: rgb(255, 0, 255)
PASS - "color" property for "box" element at 0s saw something close to: rgb(0, 0, 0)
PASS - "color" property for "box" element at 0.5s saw something close to: rgb(0, 0, 0)
PASS - "color" property for "box" element at 1s saw something close to: rgb(0, 0, 0)
<!DOCTYPE html>
<head>
<title>
Forced colors mode - animations.
For properties affected by forced colors mode, animations should not run
unless forced-color-adjust is none.
</title>
<style type="text/css" media="screen">
#box {
animation-duration: 1s;
animation-iteration-count: infinite;
animation-timing-function: linear;
animation-name: anim;
}
@keyframes anim {
from { color: red; }
to { color: green; }
}
</style>
<script src="../../../../../animations/resources/animation-test-helpers.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
const expectedValues = [
// [time, element-id, property, expected-value, tolerance]
[0.0, "box", "color", "rgb(0, 0, 0)", 1],
[0.5, "box", "color", "rgb(0, 0, 0)", 1],
[1.0, "box", "color", "rgb(0, 0, 0)", 1],
];
runAnimationTest(expectedValues);
</script>
</head>
<body>
<div id="box"></div>
</body>
PASS - "color" property for "box" element at 0s saw something close to: rgb(255, 0, 0)
PASS - "color" property for "box" element at 0.5s saw something close to: rgb(128, 64, 0)
PASS - "color" property for "box" element at 1s saw something close to: rgb(255, 0, 0)
...@@ -2,38 +2,33 @@ ...@@ -2,38 +2,33 @@
<head> <head>
<title> <title>
Forced colors mode - animations. Forced colors mode - animations.
Tests that animation colors are overridden in forced colors mode. For properties affected by forced colors mode, animations should run if
forced-color-adjust is none.
</title> </title>
<style type="text/css" media="screen"> <style type="text/css" media="screen">
#forcedtextcolor {
color: WindowText;
forced-color-adjust: none;
}
#box { #box {
animation-duration: 1s; animation-duration: 1s;
animation-iteration-count: infinite; animation-iteration-count: infinite;
animation-timing-function: linear; animation-timing-function: linear;
animation-name: anim; animation-name: anim;
forced-color-adjust: none;
} }
@keyframes anim { @keyframes anim {
from { color: red; } from { color: red; }
to { color: green; } to { color: green; }
} }
</style> </style>
<script src="../../../../../animations/resources/animation-test-helpers.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
const expectedValues = [
// [time, element-id, property, expected-value, tolerance]
[0.0, "box", "color", "rgb(255, 0, 0)", 1],
[0.5, "box", "color", "rgb(128, 64, 0)", 1],
[1.0, "box", "color", "rgb(255, 0, 0)", 1],
];
runAnimationTest(expectedValues);
</script>
</head> </head>
<body> <body>
<div id="box"></div> <div id="box"></div>
<p id="forcedtextcolor"></p>
</body> </body>
<script src="../../../animations/resources/animation-test-helpers.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
var textcolor = getComputedStyle(forcedtextcolor).color;
const expectedValues = [
// [time, element-id, property, expected-value, tolerance]
[0.0, "box", "color", textcolor, 1],
[0.5, "box", "color", textcolor, 1],
[1.0, "box", "color", textcolor, 1],
];
runAnimationTest(expectedValues);
</script>
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