Bug 1428692 - Don't use tweakExpectedRestyleCount in the case where we don't use the returned count for observeStyling called right after. r=birtles

tweakExpectedRestyleCount() is supposed to work with observeStyle() which is
called right after tweakExpectedRestyleCount().  That's because
tweakExpectedRestyleCount() adjusts the expected restyle count which will
happen in continuous frames that begins from the startsRightNow() call,
especially a redundant restyle might be observed in the last frame if the
animation did not begin at the current timeline time and if the Promise inside
the last requestAnimationFrame is fulfilled after restyling happened.

Instead of using tweakExpectedRestyleCount(), we need to check whether the
animation begun at the current timeline time when the animation started, and if
the animation begun at the current timeline time, we don't observe the
superfluous restyle in a frame after the animation element was re-attached.

MozReview-Commit-ID: 6TLQERSSbjU

--HG--
extra : rebase_source : 1a1dcb56b889bebedb44346bbc315ec01870cf79
This commit is contained in:
Hiroyuki Ikezoe 2018-01-30 06:41:31 +09:00
Родитель b5221fcdf8
Коммит 0bb119e341
1 изменённых файлов: 2 добавлений и 2 удалений

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

@ -1002,7 +1002,7 @@ waitForAllPaints(() => {
// It's possible that the animation begins at this moment. If this is the
// case, an additional superfluous restyle request that we will check later
// can't be observed.
const expectedRestyleCount = tweakExpectedRestyleCount(animation, 1);
const superfluousRestyle = startsRightNow(animation) ? 0 : 1;
var markers = await observeStyling(5);
is(markers.length, 0,
@ -1027,7 +1027,7 @@ waitForAllPaints(() => {
// Bug 1417354: There will be an additional superfluous restyle request
// which results when we detach an element from the document between
// the Animation tick and styling, and then re-attach it.
is(markers.length, expectedRestyleCount,
is(markers.length, 1 + superfluousRestyle,
'We should observe one restyle in the first frame right after ' +
're-attaching to the document');
} else {