Bug 1488953 - Allows toolbar background paint flash along with the urlbar flickers on MacOSX in browser_windowopen.js. r=mconley

On MacOSX, especially on MacOS 10.10, the toolbar paint flush happens along
with the urlbar flickers.

Differential Revision: https://phabricator.services.mozilla.com/D34489

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Hiroyuki Ikezoe 2019-06-13 02:30:25 +00:00
Родитель ec9ad7bde1
Коммит 6ce88e6013
1 изменённых файлов: 16 добавлений и 11 удалений

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

@ -21,12 +21,14 @@ const EXPECTED_REFLOWS = [
// We'll assume the changes we are seeing are due to this focus change if
// there are at least 5 areas that changed near the top of the screen, or if
// the toolbar background is involved on OSX, but will only ignore this once.
function isLikelyFocusChange(rects) {
if (rects.length > 5 && rects.every(r => r.y2 < 100))
return true;
if (Services.appinfo.OS == "Darwin" && rects.length == 2 && rects.every(r => r.y1 == 0 && r.h == 33))
return true;
return false;
function filterLikelyFocusChange(rects) {
if (rects.length > 5 && rects.every(r => r.y2 < 100)) {
return [];
}
if (Services.appinfo.OS == "Darwin" && rects.length >= 2) {
return rects.filter(r => r.y1 != 0 || r.h != 33);
}
return rects;
}
/*
@ -52,12 +54,15 @@ add_task(async function() {
filter(rects, frame, previousFrame) {
// The first screenshot we get in OSX / Windows shows an unfocused browser
// window for some reason. See bug 1445161.
if (!alreadyFocused && isLikelyFocusChange(rects)) {
if (!alreadyFocused) {
alreadyFocused = true;
let filteredRects = filterLikelyFocusChange(rects);
if (rects !== filteredRects) {
todo(false,
"bug 1445161 - the window should be focused at first paint, " +
rects.toSource());
return [];
rects.filter(r => !filteredRects.includes(r)).toSource());
}
return filteredRects;
}
return rects;