Bug 1379516 - Get dom.animations.offscreen-throttling preference value just once at startup. r=birtles

MozReview-Commit-ID: KiZ3SRrsCOx

--HG--
extra : rebase_source : e63cd9e2c8c28d3e7c90c3c17fb25ea9844c3fe7
This commit is contained in:
Hiroyuki Ikezoe 2017-08-11 08:43:45 +09:00
parent 0d68d85768
commit 393dc8eb24

View File

@ -66,6 +66,8 @@ SimpleTest.waitForExplicitFinish();
var omtaEnabled = isOMTAEnabled();
var isAndroid = !!navigator.userAgent.includes("Android");
var offscreenThrottlingEnabled =
SpecialPowers.getBoolPref('dom.animations.offscreen-throttling');
function add_task_if_omta_enabled(test) {
if (!omtaEnabled) {
@ -204,7 +206,7 @@ waitForAllPaints(function() {
});
add_task_if_omta_enabled(async function no_restyling_compositor_animations_out_of_view_element() {
if (!SpecialPowers.getBoolPref('dom.animations.offscreen-throttling')) {
if (!offscreenThrottlingEnabled) {
return;
}
@ -224,7 +226,7 @@ waitForAllPaints(function() {
});
add_task(async function no_restyling_main_thread_animations_out_of_view_element() {
if (!SpecialPowers.getBoolPref('dom.animations.offscreen-throttling')) {
if (!offscreenThrottlingEnabled) {
return;
}
@ -242,7 +244,7 @@ waitForAllPaints(function() {
});
add_task_if_omta_enabled(async function no_restyling_compositor_animations_in_scrolled_out_element() {
if (!SpecialPowers.getBoolPref('dom.animations.offscreen-throttling')) {
if (!offscreenThrottlingEnabled) {
return;
}
@ -272,7 +274,7 @@ waitForAllPaints(function() {
});
add_task(async function no_restyling_main_thread_animations_in_scrolled_out_element() {
if (!SpecialPowers.getBoolPref('dom.animations.offscreen-throttling')) {
if (!offscreenThrottlingEnabled) {
return;
}
@ -302,7 +304,7 @@ waitForAllPaints(function() {
});
add_task(async function no_restyling_main_thread_animations_in_nested_scrolled_out_element() {
if (!SpecialPowers.getBoolPref('dom.animations.offscreen-throttling')) {
if (!offscreenThrottlingEnabled) {
return;
}
@ -351,7 +353,7 @@ waitForAllPaints(function() {
});
add_task(async function restyling_main_thread_animations_moved_in_view_by_scrolling() {
if (!SpecialPowers.getBoolPref('dom.animations.offscreen-throttling')) {
if (!offscreenThrottlingEnabled) {
return;
}
@ -393,7 +395,7 @@ waitForAllPaints(function() {
});
add_task(async function restyling_main_thread_animations_moved_in_view_by_scrolling() {
if (!SpecialPowers.getBoolPref('dom.animations.offscreen-throttling')) {
if (!offscreenThrottlingEnabled) {
return;
}
@ -431,7 +433,7 @@ waitForAllPaints(function() {
});
add_task(async function restyling_main_thread_animations_move_out_of_view_by_scrolling() {
if (!SpecialPowers.getBoolPref('dom.animations.offscreen-throttling')) {
if (!offscreenThrottlingEnabled) {
return;
}
@ -476,7 +478,7 @@ waitForAllPaints(function() {
});
add_task(async function restyling_main_thread_animations_moved_in_view_by_resizing() {
if (!SpecialPowers.getBoolPref('dom.animations.offscreen-throttling')) {
if (!offscreenThrottlingEnabled) {
return;
}
@ -810,7 +812,7 @@ waitForAllPaints(function() {
// Tests that additive animations don't throttle at all.
add_task(async function no_throttling_animations_out_of_view_element() {
if (!SpecialPowers.getBoolPref('dom.animations.offscreen-throttling') ||
if (!offscreenThrottlingEnabled ||
!SpecialPowers.getBoolPref('dom.animations-api.core.enabled')) {
return;
}
@ -831,7 +833,7 @@ waitForAllPaints(function() {
// Counter part of the above test.
add_task(async function no_restyling_discrete_animations_out_of_view_element() {
if (!SpecialPowers.getBoolPref('dom.animations.offscreen-throttling') ||
if (!offscreenThrottlingEnabled ||
!SpecialPowers.getBoolPref('dom.animations-api.core.enabled')) {
return;
}
@ -897,7 +899,7 @@ waitForAllPaints(function() {
});
add_task(async function throttling_animations_out_of_view_svg() {
if (!SpecialPowers.getBoolPref('dom.animations.offscreen-throttling')) {
if (!offscreenThrottlingEnabled) {
return;
}
@ -957,7 +959,7 @@ waitForAllPaints(function() {
});
add_task(async function throttling_animations_out_of_view_css_transform() {
if (!SpecialPowers.getBoolPref('dom.animations.offscreen-throttling')) {
if (!offscreenThrottlingEnabled) {
return;
}