mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 21:00:50 +00:00
Bug 1623469 - Add a pref to disable synchronization transform animations with geometric animations. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D67391 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
6cd54550a2
commit
1387af13ab
@ -19,6 +19,7 @@
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/DeclarationBlock.h"
|
||||
#include "mozilla/Maybe.h" // For Maybe
|
||||
#include "mozilla/StaticPrefs_dom.h"
|
||||
#include "mozilla/TypeTraits.h" // For std::forward<>
|
||||
#include "nsAnimationManager.h" // For CSSAnimation
|
||||
#include "nsComputedDOMStyle.h"
|
||||
@ -979,7 +980,9 @@ bool Animation::ShouldBeSynchronizedWithMainThread(
|
||||
// We check this before calling ShouldBlockAsyncTransformAnimations, partly
|
||||
// because it's cheaper, but also because it's often the most useful thing
|
||||
// to know when you're debugging performance.
|
||||
if (mSyncWithGeometricAnimations &&
|
||||
if (StaticPrefs::
|
||||
dom_animations_mainthread_synchronization_with_geometric_animations() &&
|
||||
mSyncWithGeometricAnimations &&
|
||||
keyframeEffect->HasAnimationOfPropertySet(
|
||||
nsCSSPropertyIDSet::TransformLikeProperties())) {
|
||||
aPerformanceWarning =
|
||||
|
@ -1658,6 +1658,10 @@ bool KeyframeEffect::ShouldBlockAsyncTransformAnimations(
|
||||
return true;
|
||||
}
|
||||
|
||||
const bool enableMainthreadSynchronizationWithGeometricAnimations =
|
||||
StaticPrefs::
|
||||
dom_animations_mainthread_synchronization_with_geometric_animations();
|
||||
|
||||
for (const AnimationProperty& property : mProperties) {
|
||||
// If there is a property for animations level that is overridden by
|
||||
// !important rules, it should not block other animations from running
|
||||
@ -1674,7 +1678,8 @@ bool KeyframeEffect::ShouldBlockAsyncTransformAnimations(
|
||||
continue;
|
||||
}
|
||||
// Check for geometric properties
|
||||
if (IsGeometricProperty(property.mProperty)) {
|
||||
if (enableMainthreadSynchronizationWithGeometricAnimations &&
|
||||
IsGeometricProperty(property.mProperty)) {
|
||||
aPerformanceWarning =
|
||||
AnimationPerformanceWarning::Type::TransformWithGeometricProperties;
|
||||
return true;
|
||||
|
@ -46,6 +46,7 @@ skip-if = (os == 'win' && bits == 64) # Bug 1363957
|
||||
[mozilla/test_distance_of_transform.html]
|
||||
[mozilla/test_document_timeline_origin_time_range.html]
|
||||
[mozilla/test_hide_and_show.html]
|
||||
[mozilla/test_mainthread_synchronization_pref.html]
|
||||
[mozilla/test_moz_prefixed_properties.html]
|
||||
[mozilla/test_pending_animation_tracker.html]
|
||||
[mozilla/test_restyles.html]
|
||||
|
@ -0,0 +1,42 @@
|
||||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../testcommon.js"></script>
|
||||
<style>
|
||||
.compositable {
|
||||
/* Element needs geometry to be eligible for layerization */
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-color: white;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
promise_test(async t => {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [[ 'dom.animations.mainthread-synchronization-with-geometric-animations', false ]]
|
||||
});
|
||||
|
||||
const elemA = addDiv(t, { class: 'compositable' });
|
||||
const elemB = addDiv(t, { class: 'compositable' });
|
||||
|
||||
const animA = elemA.animate({ transform: [ 'translate(0px)',
|
||||
'translate(100px)' ] },
|
||||
100 * MS_PER_SEC);
|
||||
const animB = elemB.animate({ marginLeft: [ '0px', '100px' ] },
|
||||
100 * MS_PER_SEC);
|
||||
|
||||
await waitForPaints();
|
||||
|
||||
assert_true(SpecialPowers.wrap(animA).isRunningOnCompositor,
|
||||
'Transform animation should not synchronize with margin-left animation ' +
|
||||
'created within the same tick with disabling the corresponding pref');
|
||||
}, 'Transform animation should not synchronize with margin-left animation '
|
||||
+ 'created within the same tick with disabling the corresponding pref');
|
||||
|
||||
</script>
|
||||
</body>
|
@ -1367,6 +1367,13 @@
|
||||
value: true
|
||||
mirror: always
|
||||
|
||||
# Synchronize transform animations with geometric animations on the
|
||||
# main thread.
|
||||
- name: dom.animations.mainthread-synchronization-with-geometric-animations
|
||||
type: bool
|
||||
value: true
|
||||
mirror: always
|
||||
|
||||
# Is support for AudioWorklet enabled?
|
||||
- name: dom.audioworklet.enabled
|
||||
type: bool
|
||||
|
Loading…
x
Reference in New Issue
Block a user