Bug 1430884 - Throttle animations producing nsChangeHint_UpdateOverflow change hint if the target element is not visible. r=birtles

In the case where the target element is scrolled out or visibility:hidden and
has no visible descendants, we can treat nsChangeHint_UpdateOverflow just like
transform animations which produce nsChangeHint_UpdatePostTransformOverflow,
i.e. unthrottle the animations periodically if the target element is inside a
scrollable element.  Some transform animations produce UpdateOverflow hint,
so it would be really nice to optimize the hint.

MozReview-Commit-ID: E1MgPZRi8mW

--HG--
extra : rebase_source : d29a29e137742f88a64b3b18a5a7d4e64e76f54f
This commit is contained in:
Hiroyuki Ikezoe 2018-06-25 11:50:56 +09:00
Родитель f0ecedfe01
Коммит 636e9381d5
3 изменённых файлов: 29 добавлений и 2 удалений

Просмотреть файл

@ -446,8 +446,9 @@ private:
// observers reflected by the transform.
bool HasPropertiesThatMightAffectOverflow() const
{
return mCumulativeChangeHint & (nsChangeHint_UpdatePostTransformOverflow |
nsChangeHint_AddOrRemoveTransform |
return mCumulativeChangeHint & (nsChangeHint_AddOrRemoveTransform |
nsChangeHint_UpdateOverflow |
nsChangeHint_UpdatePostTransformOverflow |
nsChangeHint_UpdateTransformLayer);
}

Просмотреть файл

@ -134,6 +134,7 @@ function waitForWheelEvent(aTarget) {
const omtaEnabled = isOMTAEnabled();
const isAndroid = !!navigator.userAgent.includes("Android");
const isWebRender =
SpecialPowers.DOMWindowUtils.layerManagerType == 'WebRender';
@ -1731,6 +1732,30 @@ waitForAllPaints(() => {
await ensureElementRemoval(div);
});
add_task(async function restyling_outline_offset_animations_on_invisible_element() {
if (isAndroid) {
// FIXME: Bug 1470798: Enable this test on Android.
return;
}
const div = addDiv(null,
{ style: 'visibility: hidden; ' +
'outline-style: solid; ' +
'outline-width: 1px;' });
const animation =
div.animate({ outlineOffset: [ '0px', '10px' ] },
{ duration: 100 * MS_PER_SEC,
iterations: Infinity });
await waitForAnimationReadyToRestyle(animation);
const markers = await observeStyling(5);
is(markers.length, 0,
'Outline offset animation running on the main-thread on invisible ' +
'element should be throttled');
await ensureElementRemoval(div);
});
});
</script>

Просмотреть файл

@ -461,6 +461,7 @@ static_assert(!(nsChangeHint_Hints_AlwaysHandledForDescendants &
nsChangeHint_NeutralChange | \
nsChangeHint_UpdateOpacityLayer | \
nsChangeHint_AddOrRemoveTransform | \
nsChangeHint_UpdateOverflow | \
nsChangeHint_UpdatePostTransformOverflow | \
nsChangeHint_UpdateTransformLayer | \
nsChangeHint_UpdateUsesOpacity | \