Bug 1455999 - Drop isStyleByServo() in dom/animation/. r?birtles
We have already dropped the old style sytem.
MozReview-Commit-ID: I4RUlLHLAxr
--- a/dom/animation/test/chrome/test_animation_properties.html
+++ b/dom/animation/test/chrome/test_animation_properties.html
@@ -19,21 +19,16 @@
}
div {
font-size: 10px; /* For calculating em-based units */
}
</style>
<script>
'use strict';
-// Stylo matches the spec more closely wrt serialization of specified calc().
-//
-// See https://github.com/w3c/csswg-drafts/issues/1731
-const isStylo = SpecialPowers.DOMWindowUtils.isStyledByServo;
-
var gTests = [
// ---------------------------------------------------------------------
//
// Tests for property-indexed specifications
//
// ---------------------------------------------------------------------
@@ -566,17 +561,17 @@ var gTests = [
expected: [ { property: 'left',
values: [ valueFormat(0, '100px', 'replace', 'linear'),
valueFormat(1, '200px', 'replace') ] } ]
},
{ desc: 'calc() expressions are resolved to the equivalent units',
frames: { left: ['calc(10em + 10px)', 'calc(10em + 10%)'] },
expected: [ { property: 'left',
values: [ valueFormat(0, 'calc(110px)', 'replace', 'linear'),
- valueFormat(1, isStylo ? 'calc(10% + 100px)' : 'calc(100px + 10%)', 'replace') ] } ]
+ valueFormat(1, 'calc(10% + 100px)', 'replace') ] } ]
},
// ---------------------------------------------------------------------
//
// Tests for CSS variable handling conversion
//
// ---------------------------------------------------------------------
@@ -585,17 +580,17 @@ var gTests = [
expected: [ { property: 'left',
values: [ valueFormat(0, '10px', 'replace', 'linear'),
valueFormat(1, '100px', 'replace') ] } ]
},
{ desc: 'CSS variables in calc() expressions are resolved',
frames: { left: ['10px', 'calc(var(--var-100px) / 2 - 10%)'] },
expected: [ { property: 'left',
values: [ valueFormat(0, '10px', 'replace', 'linear'),
- valueFormat(1, isStylo ? 'calc(-10% + 50px)' : 'calc(50px + -10%)', 'replace') ] } ]
+ valueFormat(1, 'calc(-10% + 50px)', 'replace') ] } ]
},
{ desc: 'CSS variables in shorthands are resolved to their corresponding'
+ ' values',
frames: { margin: ['10px', 'var(--var-100px-200px)'] },
expected: [ { property: 'margin-top',
values: [ valueFormat(0, '10px', 'replace', 'linear'),
valueFormat(1, '100px', 'replace') ] },
{ property: 'margin-right',
--- a/dom/animation/test/mozilla/file_restyles.html
+++ b/dom/animation/test/mozilla/file_restyles.html
@@ -159,17 +159,16 @@ function tweakExpectedRestyleCount(aAnim
return aExpectedRestyleCount + 1;
}
return aExpectedRestyleCount;
}
var omtaEnabled = isOMTAEnabled();
var isAndroid = !!navigator.userAgent.includes("Android");
-var isServo = isStyledByServo();
var hasConformantPromiseHandling;
function add_task_if_omta_enabled(test) {
if (!omtaEnabled) {
info(test.name + " is skipped because OMTA is disabled");
return;
}
add_task(test);
@@ -1265,34 +1264,22 @@ waitForAllPaints(() => {
add_task(async function necessary_update_should_be_invoked() {
var div = addDiv(null, { style: 'animation: background-color 100s' });
var animation = div.getAnimations()[0];
await animation.ready;
await waitForAnimationFrames(5);
// Apply another animation style
div.style.animation = 'background-color 110s';
var markers = await observeStyling(1);
- if (isServo) {
- // There should be two restyles.
- // 1) Animation-only restyle for before applying the new animation style
- // 2) Animation-only restyle for after applying the new animation style
- is(markers.length, 2,
- 'Applying animation style with different duration ' +
- 'should restyle twice');
- } else {
- // There should be three restyles.
- // 1) Animation-only restyle for before applying the new animation style
- // 2) Restyle for applying the new animation style
- // Note: In gecko styling for animations is not separated.
- // 3) Restyle triggered by updating an existing animation (specifically
- // the animation-duration)
- is(markers.length, 3,
- 'Applying animation style with different duration ' +
- 'should restyles three times');
- }
+ // There should be two restyles.
+ // 1) Animation-only restyle for before applying the new animation style
+ // 2) Animation-only restyle for after applying the new animation style
+ is(markers.length, 2,
+ 'Applying animation style with different duration ' +
+ 'should restyle twice');
await ensureElementRemoval(div);
});
add_task_if_omta_enabled(
async function changing_cascading_result_for_main_thread_animation() {
var div = addDiv(null, { style: 'background-color: blue' });
var animation = div.animate({ opacity: [0, 1],
backgroundColor: ['green', 'red'] },
@@ -1723,25 +1710,19 @@ waitForAllPaints(() => {
var animation = div.animate({ opacity: [0, 1] }, 100 * MS_PER_SEC);
await animation.ready;
ok(SpecialPowers.wrap(animation).isRunningOnCompositor,
'The opacity animation is running on the compositor');
div.style.setProperty('color', 'blue', '');
var markers = await observeStyling(5);
- if (isServo) {
- is(markers.length, 0,
- 'The opacity animation keeps running on the compositor when ' +
- 'color style is changed');
- } else {
- todo_is(markers.length, 0,
- 'Bug 1307341 The opacity animation keeps running on the ' +
- 'compositor when color style is changed');
- }
+ is(markers.length, 0,
+ 'The opacity animation keeps running on the compositor when ' +
+ 'color style is changed');
await ensureElementRemoval(div);
}
);
add_task(
async function no_overflow_transform_animations_in_scrollable_element() {
await SpecialPowers.pushPrefEnv({ set: [["ui.showHideScrollbars", 1]] });
@@ -1789,26 +1770,19 @@ waitForAllPaints(() => {
await animation.ready;
ok(SpecialPowers.wrap(animation).isRunningOnCompositor);
var markers = observeAnimSyncStyling(() => {
div.style.animationDuration = '0s';
is(div.getAnimations().length, 0, 'There should be no animation');
});
- if (isServo) {
- is(markers.length, 1, // For discarding the throttled animation.
- 'Element.getAnimations() should flush throttled animation style so ' +
- 'that the throttled animation is discarded');
- } else {
- is(markers.length, 2, // One is done through UpdateOnlyAnimationStyles(),
- // the other is for discarding the animation.
- 'Element.getAnimations() should flush throttled animation style that ' +
- 'the throttled animation is discarded');
- }
+ is(markers.length, 1, // For discarding the throttled animation.
+ 'Element.getAnimations() should flush throttled animation style so ' +
+ 'that the throttled animation is discarded');
await ensureElementRemoval(div);
});
add_task(
async function no_restyling_for_throttled_animation_on_querying_play_state() {
var div = addDiv(null, { style: 'animation: opacity 100s' });
var animation = div.getAnimations()[0];
--- a/dom/animation/test/mozilla/test_restyling_xhr_doc.html
+++ b/dom/animation/test/mozilla/test_restyling_xhr_doc.html
@@ -79,39 +79,28 @@ promise_test(t => {
// Gecko currently skips applying animation styles to elements in documents
// without browsing contexts.
assert_not_equals(getComputedStyle(div).opacity, '0',
'Style should NOT be updated');
});
}, 'Forcing an animation targetting an element in a document without a'
+ ' browsing context to play does not cause style to update');
-// Following is an additional Gecko-specific test to confirm the behavior
-// when we have an element with an animation restyle and then move it to
-// a document without a pres shell.
-
promise_test(t => {
let anim;
return getXHRDoc(t).then(xhrdoc => {
const div = addDiv(t);
anim = div.animate({ opacity: [ 0, 1 ] }, 1000);
assert_equals(getComputedStyle(div).opacity, '0',
'Style should be updated');
// Trigger an animation restyle to be queued
anim.currentTime = 0.1;
// Adopt node into XHR doc
xhrdoc.body.appendChild(div);
// We should skip applying animation styles to elements in documents
// without a pres shell.
- //
- // The Gecko style backend, however, does not do this. Since we expect the
- // Gecko style backend to be obsolete in the near future, we only perform
- // this check when the Servo backend is in use.
- let isServo = SpecialPowers.DOMWindowUtils.isStyledByServo;
- if (isServo) {
- assert_equals(getComputedStyle(div).opacity, '1',
- 'Style should NOT be updated');
- }
+ assert_equals(getComputedStyle(div).opacity, '1',
+ 'Style should NOT be updated');
});
}, 'Moving an element with a pending animation restyle to a document without'
+ ' a browsing context resets animation style');
</script>
--- a/dom/animation/test/mozilla/test_underlying_discrete_value.html
+++ b/dom/animation/test/mozilla/test_underlying_discrete_value.html
@@ -3,18 +3,16 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
"use strict";
-const isGecko = !isStyledByServo();
-
// Tests that we correctly extract the underlying value when the animation
// type is 'discrete'.
const discreteTests = [
{
stylesheet: {
"@keyframes keyframes":
"from { align-content: flex-start; } to { align-content: flex-end; } "
},
@@ -28,36 +26,26 @@ const discreteTests = [
stylesheet: {
"@keyframes keyframes": "from { align-content: flex-start; }"
},
expectedKeyframes: [
{ computedOffset: 0, alignContent: "flex-start" },
{ computedOffset: 1, alignContent: "normal" }
],
explanation: "Test for 0% keyframe only",
- // The value of 100% should be 'normal',
- // but we are not supporting underlying value for Gecko.
- // https://bugzilla.mozilla.org/show_bug.cgi?id=1295401
- // So, we skip this test case.
- skip: isGecko
},
{
stylesheet: {
"@keyframes keyframes": "to { align-content: flex-end; }"
},
expectedKeyframes: [
{ computedOffset: 0, alignContent: "normal" },
{ computedOffset: 1, alignContent: "flex-end" }
],
explanation: "Test for 100% keyframe only",
- // The value of 0% should be 'normal',
- // but we are not supporting underlying value for Gecko.
- // https://bugzilla.mozilla.org/show_bug.cgi?id=1295401
- // So, we skip this test case.
- skip: isGecko
},
{
stylesheet: {
"@keyframes keyframes": "50% { align-content: center; }",
"#target": "align-content: space-between;"
},
expectedKeyframes: [
{ computedOffset: 0, alignContent: "space-between" },
@@ -89,21 +77,16 @@ const discreteTests = [
},
expectedKeyframes: [
{ computedOffset: 0, alignContent: "normal" },
{ computedOffset: 0.5, alignContent: "center" },
{ computedOffset: 1, alignContent: "normal" }
],
explanation: "Test for no 0%/100% keyframes " +
"and 'inherit' specified on target element",
- // The value of 0%/100% should be 'normal',
- // but we are not supporting underlying value for Gecko.
- // https://bugzilla.mozilla.org/show_bug.cgi?id=1295401
- // So, we skip this test case.
- skip: isGecko
},
{
stylesheet: {
"@keyframes keyframes": "50% { align-content: center; }",
".target": "align-content: space-between;"
},
attributes: {
class: "target"
--- a/dom/animation/test/testcommon.js
+++ b/dom/animation/test/testcommon.js
@@ -359,23 +359,16 @@ function useTestRefreshMode(t) {
*/
function isOMTAEnabled() {
const OMTAPrefKey = 'layers.offmainthreadcomposition.async-animations';
return SpecialPowers.DOMWindowUtils.layerManagerRemote &&
SpecialPowers.getBoolPref(OMTAPrefKey);
}
/**
- * Returns true if the document is styled by servo.
- */
-function isStyledByServo() {
- return SpecialPowers.DOMWindowUtils.isStyledByServo;
-}
-
-/**
* Append an SVG element to the target element.
*
* @param target The element which want to append.
* @param attrs A array object with attribute name and values to set on
* the SVG element.
* @return An SVG outer element.
*/
function addSVGElement(target, tag, attrs) {