[Bug]: Browser width/height are not updated when orientation changes
Categories
(Core :: Layout: Scrolling and Overflow, defect, P3)
Tracking
()
People
(Reporter: petru, Unassigned)
References
(Depends on 1 open bug, Blocks 1 open bug)
Details
Attachments
(1 obsolete file)
From github: https://github.com/mozilla-mobile/fenix/issues/27052.
Steps to reproduce
- activate 'Scroll to hide toolbar' in the settings ( settings -> customize -> scroll to hide toolbar )
- open an html file and scroll to hide the toolbar
- set your device in 'portrait' orientation
- look the values of height and width in window. visualViewport. The height is greater than the width (ok it's portait)
- set your device in 'landscape' orientation
- look the values of height and width in window. visualViewport. The height remains greater than the width ( not ok )
- scroll to show the toolbar and do the same tests. Height and width are now correct and adapted to the device rotation
- see in the device logs the html file used for tests (renamed index.txt...)
Expected behaviour
The width and height have to be adapted with the device orientation.
Actual behaviour
width and height are not changed when the toolbar is hidden with a scroll
Device name
Samsung Galaxy tab A7 lite SM-T225
Android version
Android 11
Firefox release type
Firefox
Firefox version
104.2.0
Device logs
Additional information
No response
┆Issue is synchronized with this Jira Task
Change performed by the Move to Bugzilla add-on.
| Reporter | ||
Comment 1•3 years ago
|
||
Issue following https://github.com/wwwouaiebe/TravelNotes/issues/56
Comment 2•3 years ago
|
||
Hmm, the bug might be that we call presShell->GetVisualViewportSizeUpdatedByDynamicToolbar() here
https://searchfox.org/mozilla-central/rev/d8d75a05deaba7e89a6f1d4c1f197d01e2361d43/dom/base/VisualViewport.cpp#78
which can return mMobileViewportManager->GetVisualViewportSizeUpdatedByDynamicToolbar()
https://searchfox.org/mozilla-central/rev/d8d75a05deaba7e89a6f1d4c1f197d01e2361d43/layout/base/PresShell.cpp#11409
And the value that that function returns is only updated when nsPresContext::UpdateDynamicToolbarOffset is called. Presumably we need to update it also when the visual viewport changes too.
Comment 3•3 years ago
|
||
nsPresContext::UpdateDynamicToolbarOffset isn't the one, it's supposed to be called when the dynamic toolbar is moving, i.e. being collapsed or being expanded. nsPresContext::SetDynamicToolbarMaxHeight is the one, but it makes me suspect Fenix (or GeckoView) doesn't invoke GeckoView.setDynamicToolbarMaxHeight on the device rotation?
Comment 4•3 years ago
|
||
I suppose that the toolbar height can vary on portrait/landscape modes so that the browsers (in this case it's Fenix) need to invoke GeckoView.setDynamicToolbarMaxHeight, no? Petru?
| Reporter | ||
Comment 5•3 years ago
•
|
||
(In reply to Hiroyuki Ikezoe (:hiro) from comment #4)
I suppose that the toolbar height can vary on portrait/landscape modes so that the browsers (in this case it's Fenix) need to invoke GeckoView.setDynamicToolbarMaxHeight, no? Petru?
We don't technically have different layouts for portrait / landscape - as that would mean we support Android restarting the Activity upon rotation, which we want to avoid.
So the toolbar height is the same in portrait or landscape and once set we don't call again setDynamicToolbarMaxHeight in changing orientation scenarios - we would afterwards call this method again only for fullscreen changes.
Comment 6•3 years ago
|
||
Oh okay, then my wild guess is this is a case of bug 1641166, I guess visualViewport.scale values on portrait/landcape modes are different. I suppose the index.txt is a test case to see this issue, it's an HTML file though, there's no meta viewport tag, so that it's laid out on 980px width just as desktop mode so that it's basically scaled to the minimum-scale size.
Updated•3 years ago
|
Comment 7•3 years ago
|
||
Setting P3:S3 since minimum-scale size is relatively uncommon. Petru, if you see this issue on normal documents having <meta name=viewport content=device-width> or some such. Please attach the case here. Thanks!
Updated•2 years ago
|
Description
•