Bug 1593170. Avoid useless painting work in queued up rects to paint by ignoring new rects that are already covered. r=mattwoodrow

I don't think this is strictly necessary but it lets us avoid a bunch of useless work, especially with webrender where these rects are always the full window size.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Timothy Nikkel 2019-11-18 00:45:46 +00:00
Родитель 6f7bbcfd74
Коммит d81e1df1af
1 изменённых файлов: 17 добавлений и 0 удалений

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

@ -650,9 +650,26 @@ function WaitForTestEnd(contentRootElement, inPrintMode, spellCheckedElements, f
return;
}
// true if rectA contains rectB
function Contains(rectA, rectB) {
return (rectA.left <= rectB.left && rectB.right <= rectA.right && rectA.top <= rectB.top && rectB.bottom <= rectA.bottom);
}
// true if some rect in rectList contains rect
function ContainedIn(rectList, rect) {
for (let i = 0; i < rectList.length; ++i) {
if (Contains(rectList[i], rect)) {
return true;
}
}
return false;
}
updateCanvasPending = true;
for (let i = 0; i < event.clientRects.length; ++i) {
let r = event.clientRects[i];
if (ContainedIn(updateCanvasRects, r)) {
continue;
}
// Copy the rect; it's content and we are chrome, which means if the
// document goes away (and it can in some crashtests) our reference