Bug 1307134 - Only flush in ancestor documents for window.mozInnerScreenX/Y. r=tnikkel

This reduces the amount of flushing we do when these APIs are called on
the root document, but increases the amount of flushing we do (probably
fixing existing bugs) when these APIs are called in a document at depth
three or more (if you consider the root depth one).

I considered the idea of adding a EnsurePositionUpToDate alias, but it
seems that some of the existing users of EnsureSizeUpToDate actually
care about position (e.g.,
nsLayoutUtils::GetDeviceContextForScreenInfo), so I just added a comment
instead.

MozReview-Commit-ID: B3L5DDQ5krc

--HG--
extra : transplant_source : J%05%F1%20M%40%88Wz%F5s_%FB%0D%0C%D6%F2%103%9B
This commit is contained in:
L. David Baron 2017-04-18 11:28:50 +09:00
Родитель c39bb259da
Коммит 05bfb6bf19
2 изменённых файлов: 6 добавлений и 4 удалений

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

@ -5983,10 +5983,7 @@ nsGlobalWindow::GetInnerScreenRect()
return nsRect();
}
nsGlobalWindow* rootWindow = nsGlobalWindow::Cast(GetPrivateRoot());
if (rootWindow) {
rootWindow->FlushPendingNotifications(FlushType::Layout);
}
EnsureSizeUpToDate();
if (!mDocShell) {
return nsRect();

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

@ -313,6 +313,11 @@ public:
virtual void SetOpenerWindow(nsPIDOMWindowOuter* aOpener,
bool aOriginalOpener) = 0;
/**
* Ensure the size and position of this window are up-to-date by doing
* a layout flush in the parent (which will in turn, do a layout flush
* in its parent, etc.).
*/
virtual void EnsureSizeUpToDate() = 0;
/**