Open Bug 1716524 Opened 4 years ago Updated 4 years ago

Reset RestoreResolution when initial viewport

Categories

(Core :: Layout, enhancement)

Unspecified
Android
enhancement

Tracking

()

UNCONFIRMED

People

(Reporter: noiseyou99, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.101 Safari/537.36

Steps to reproduce:

It can't reproduce on Firefox RDM, it just can reproduce on KaiOS device, reload [1] and sometime it will get the incorrect viewport.

[1] http://hzrd.tcl-ta.com:9000/wap/

I think maybe we can reset RestoreResolution when initial viewport

Attached patch viewport.diffSplinter Review

Should I reset RestoreResolution when initial viewport as attachment?

Flags: needinfo?(hikezoe.birchill)

Thanks for the bug report. Though I haven't looked at the test case, I don't think clearing mRestoreResolution in SetInitinalViewport is the right thing to do, it will break setting the resolution when we restore the last session.

Can you please clarify why you think we should do it?

Component: Untriaged → Layout
Flags: needinfo?(hikezoe.birchill)
OS: Unspecified → Android
Product: Firefox → Core

The normal case resolution is 0.25, I think the mRestoreResolution was keeping so the calculation state is different from normal case, the log as below,

normal case
=== execute reload ===
nsDocShell::Reload: aReloadFlags:0
nsDocShell::Reload: loadType: 2
DOCSHELL 0x9b60f000 InternalLoad http://hzrd.tcl-ta.com:9000/WAP/
nsHtml5StreamParser::GuessEncoding mTreeBuilder->NeedsCharsetSwitchTo
operator() mTreeBuilder->NeedsCharsetSwitchTo
CharsetChangeReloadDocument reload
nsDocShell::Reload: aReloadFlags:1024
nsDocShell::Reload: loadType: 67108866
DOCSHELL 0x9b60f000 InternalLoad http://hzrd.tcl-ta.com:9000/WAP/
PresShell::SetResolutionAndScaleTo aResolution:1.000000
UpdateResolutionForFirstPaint
PresShell::SetResolutionAndScaleTo aResolution:1.000000
PresShell::SetResolutionAndScaleTo aResolution:0.250000
PresShell::SetResolutionAndScaleTo aResolution:1.000000
UpdateResolutionForFirstPaint
PresShell::SetResolutionAndScaleTo aResolution:1.000000
PresShell::SetResolutionAndScaleTo aResolution:0.250000

NG case:
=== execute reload ===
nsDocShell::Reload: aReloadFlags:0
nsDocShell::Reload: loadType: 2
DOCSHELL 0x9b60f000 InternalLoad http://hzrd.tcl-ta.com:9000/WAP/
nsHtml5StreamParser::GuessEncoding mTreeBuilder->NeedsCharsetSwitchTo
PresShell::SetResolutionAndScaleTo aResolution:0.250000
operator() mTreeBuilder->NeedsCharsetSwitchTo
CharsetChangeReloadDocument reload
nsDocShell::Reload: aReloadFlags:1024
nsDocShell::Reload: loadType: 67108866
DOCSHELL 0x9b60f000 InternalLoad http://hzrd.tcl-ta.com:9000/WAP/
PresShell::SetResolutionAndScaleTo aResolution:1.000000
PresShell::SetResolutionAndScaleTo aResolution:1.000000
UpdateResolutionForFirstPaint
PresShell::SetResolutionAndScaleTo aResolution:1.000000

Flags: needinfo?(hikezoe.birchill)

A question is, where the 1.0 value comes from? It looks to me that we should stop calling SetResolutionAndScaleTo with 1.0 in this case, though it depends on where it comes from. Some of the call might be right things to do.

Flags: needinfo?(hikezoe.birchill)

Anyways, the comment 3 doesn't explain why we should reset mRestoreResolution in SetInitinalViewport, it does just explain what happened.

(In reply to Hiroyuki Ikezoe (:hiro) from comment #5)

Anyways, the comment 3 doesn't explain why we should reset mRestoreResolution in SetInitinalViewport, it does just explain what happened.

Because it set the mRestoreResolution when NG case first reload, and second reload will check mRestoreResolution on MobileViewportManager::UpdateResolutionForFirstPaint , so the NG case and normal case execute different ApplyNewZoom path.

(In reply to Hiroyuki Ikezoe (:hiro) from comment #4)

A question is, where the 1.0 value comes from? It looks to me that we should stop calling SetResolutionAndScaleTo with 1.0 in this case, though it depends on where it comes from. Some of the call might be right things to do.

I think in normal case it also get 1.0 value in calculation process.
In firefox RDM with url: http://hzrd.tcl-ta.com:9000/WAP/ log as below,

@@@ nsDocShell::Reload: aReloadFlags:0
@@@ nsDocShell::Reload: loadType: 2
@@@ nsHtml5StreamParser::GuessEncoding mTreeBuilder->NeedsCharsetSwitchTo
@@@ PresShell::SetResolutionAndScaleTo aResolution:0.250000
@@@ operator() mTreeBuilder->NeedsCharsetSwitchTo
@@@ nsDocShell::Reload: aReloadFlags:1024
@@@ nsDocShell::Reload: loadType: 67108866
@@@ PresShell::SetResolutionAndScaleTo aResolution:1.000000
@@@ MobileViewportManager::SetInitialViewport
@@@ MobileViewportManager::UpdateResolutionForFirstPaint
@@@ PresShell::SetResolutionAndScaleTo aResolution:0.250000
@@@ PresShell::SetResolutionAndScaleTo aResolution:0.250000
@@@ PresShell::SetResolutionAndScaleTo aResolution:1.000000
@@@ MobileViewportManager::SetInitialViewport
@@@ MobileViewportManager::UpdateResolutionForFirstPaint
@@@ PresShell::SetResolutionAndScaleTo aResolution:0.250000

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: