Bug 1312605 - Part 1 - Don't clobber resolution changes that happen before first paint on Fennec. r=kats

When going back/forward through a tab's session history, the saved resolution from the LayoutHistoryState is set on the PresShell before first paint. On Fennec, this means that it is subsequently going to be overwritten by the MobileViewportManager's default zoom calculation.

To fix this, we make use of the MVM's feature to set a "restored" resolution that will then be taken into account on first paint.

MozReview-Commit-ID: 43o97M6fiaZ

--HG--
extra : rebase_source : 45d29057de137cb306617481311622c6ca620fa3
This commit is contained in:
Jan Henning 2017-06-28 16:13:01 -07:00
Родитель af9f59581a
Коммит 657e52aaed
3 изменённых файлов: 17 добавлений и 2 удалений

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

@ -88,12 +88,18 @@ void
MobileViewportManager::SetRestoreResolution(float aResolution,
LayoutDeviceIntSize aDisplaySize)
{
mRestoreResolution = Some(aResolution);
SetRestoreResolution(aResolution);
ScreenIntSize restoreDisplaySize = ViewAs<ScreenPixel>(aDisplaySize,
PixelCastJustification::LayoutDeviceIsScreenForBounds);
mRestoreDisplaySize = Some(restoreDisplaySize);
}
void
MobileViewportManager::SetRestoreResolution(float aResolution)
{
mRestoreResolution = Some(aResolution);
}
void
MobileViewportManager::RequestReflow()
{
@ -105,6 +111,11 @@ void
MobileViewportManager::ResolutionUpdated()
{
MVM_LOG("%p: resolution updated\n", this);
if (!mPainted) {
// Save the value, so our default zoom calculation
// can take it into account later on.
SetRestoreResolution(mPresShell->GetResolution());
}
RefreshSPCSPS();
}

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

@ -37,6 +37,10 @@ public:
void SetRestoreResolution(float aResolution,
mozilla::LayoutDeviceIntSize aDisplaySize);
private:
void SetRestoreResolution(float aResolution);
public:
/* Notify the MobileViewportManager that a reflow was requested in the
* presShell.*/
void RequestReflow();

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

@ -211,7 +211,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1265818
utils.getResolution(zoom);
utils.getScrollXY(false, scrollX, scrollY);
todo(fuzzyEquals(zoom.value, ZOOM), "zoom restored correctly"); // Bug 1312605
is(fuzzyEquals(zoom.value, ZOOM), "zoom restored correctly");
is(scrollX.value, SCROLL_X, "scrollX restored correctly");
is(scrollY.value, SCROLL_Y, "scrollY restored correctly");