Bug 1634456 - Use double-raf to wait for caret scrolling to happen.

Before bug 1634153, we were using Dispatch(), so setTimeout(0) was the right
thing to wait for.

In bug 1634153 I used the existing mechanism which works as an early refresh
driver runner, so we need to wait for a refresh driver tick, not an event loop
turn.

Differential Revision: https://phabricator.services.mozilla.com/D73834
This commit is contained in:
Emilio Cobos Álvarez 2020-05-05 11:19:07 +00:00
parent 081eb32294
commit 6dd8794692
2 changed files with 6 additions and 2 deletions

View File

@ -11,7 +11,9 @@
synthesizeKey("KEY_ArrowDown");
// caret should now be at the start of the third line
document.body.offsetHeight;
setTimeout(function(){ document.documentElement.removeAttribute("class"); },0);
requestAnimationFrame(() => requestAnimationFrame(() => {
document.documentElement.removeAttribute("class");
}));
}
function runTests() {
document.querySelector('textarea').focus();

View File

@ -19,7 +19,9 @@
synthesizeKey("KEY_ArrowRight"); // collapse to the end of the selection
// caret should now be at the start of the third line
document.body.offsetHeight;
setTimeout(function(){ document.documentElement.removeAttribute("class"); },0);
requestAnimationFrame(() => requestAnimationFrame(() => {
document.documentElement.removeAttribute("class");
}));
}
function runTests() {
document.querySelector('textarea').focus();