Closed Bug 2036292 Opened 4 months ago Closed 3 months ago

Properly use dynamictoolbar aware visual viewport size for scrollIntoView

Categories

(Core :: Layout: Scrolling and Overflow, defect, P2)

defect

Tracking

()

RESOLVED FIXED
153 Branch
Tracking Status
firefox152 --- fixed
firefox153 --- fixed

People

(Reporter: hiro, Assigned: hiro)

References

Details

(Keywords: webcompat:platform-bug)

User Story

user-impact-score:1200

Attachments

(4 files)

This bug will fix bug 2028072.

Previously, GetVisualViewportSize() returned the raw mVisualViewportSize, so
callers via ScrollContainerFrame::GetVisualViewportSize() were unaware of the
dynamic toolbar state. The toolbar awareness logic that was inline in
VisualViewport.cpp is moved into GetVisualViewportSize() itself, so all callers
get the correct size when the toolbar is collapsing or collapsed.

When scrollIntoView() is called on a position:fixed element that is already
visible in the visual viewport, ScrollFrameIntoVisualViewport() was still
calling ScrollToVisual() unnecessarily, causing a spurious visual scroll.

Add a check to skip the visual scroll if the element's rect (converted to
layout coordinates) is already contained within the current visual viewport.
Using layout coordinates is necessary since the visual viewport may have been
panned from the origin, in which case a viewport-origin check would give a
false negative for elements positioned beyond the visual viewport height.

Attachment #9575783 - Attachment description: WIP: Bug 2036292 - Skip calling ScrollToVisual if the target frame is already in the visual viewport. → Bug 2036292 - Skip calling ScrollToVisual if the target frame is already in the visual viewport. r?botond
User Story: (updated)
Pushed by hikezoe.birchill@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/dcf39df52d88 https://hg.mozilla.org/integration/autoland/rev/f245a2481a91 Make PresShell::GetVisualViewportSize aware of the dynamic toolbar height. r=layout-reviewers,emilio https://github.com/mozilla-firefox/firefox/commit/b215f7c48f8e https://hg.mozilla.org/integration/autoland/rev/0d02fcfe6f39 Skip calling ScrollToVisual if the target frame is already in the visual viewport. r=botond,geckoview-reviewers,layout-reviewers,emilio,m_kato
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 153 Branch

The patch landed in nightly and beta is affected.
:hiro, is this bug important enough to require an uplift?

For more information, please visit BugBot documentation.

Flags: needinfo?(hikezoe.birchill)

Previously, GetVisualViewportSize() returned the raw mVisualViewportSize, so
callers via ScrollContainerFrame::GetVisualViewportSize() were unaware of the
dynamic toolbar state. The toolbar awareness logic that was inline in
VisualViewport.cpp is moved into GetVisualViewportSize() itself, so all callers
get the correct size when the toolbar is collapsing or collapsed.

Original Revision: https://phabricator.services.mozilla.com/D297841

Attachment #9590803 - Flags: approval-mozilla-beta?

When scrollIntoView() is called on a position:fixed element that is already
visible in the visual viewport, ScrollFrameIntoVisualViewport() was still
calling ScrollToVisual() unnecessarily, causing a spurious visual scroll.

Add a check to skip the visual scroll if the element's rect (converted to
layout coordinates) is already contained within the current visual viewport.
Using layout coordinates is necessary since the visual viewport may have been
panned from the origin, in which case a viewport-origin check would give a
false negative for elements positioned beyond the visual viewport height.

Original Revision: https://phabricator.services.mozilla.com/D297842

Attachment #9590804 - Flags: approval-mozilla-beta?

firefox-beta Uplift Approval Request

  • User impact if declined/Reason for urgency: Users are suffering from annoying/unexpected content scrolling up and down while typing comments on facebook
  • Code covered by automated testing?: yes
  • Fix verified in Nightly?: yes
  • Needs manual QE testing?: yes
  • Steps to reproduce for manual QE testing: It would be nice that someone (other than I) checks the facebook issue (bug 2028072) has been resolved.
  • Risk associated with taking this patch: low
  • Explanation of risk level: The change itself is relatively simple, also note that the change is only affecting on Android, not on desktops.
  • String changes made/needed?: none
  • Is Android affected?: yes
Flags: qe-verify+
Flags: in-testsuite+
Attachment #9590803 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9590804 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

The facebook issue (bug 2028072) seems to be an Android bug. Should this be also verified on Desktop version(on Windows, macOS or Ubuntu pperating system)?

No.

Flags: needinfo?(hikezoe.birchill)
QA Whiteboard: [qa-triage-done-c153/b152]

I am still seeing the glitches when commenting on a post.
Testing was performed on the Firefox for Android Nightly 153.0a1 from 6/11 using a Huawei Pura 70 (Android 12).

Flags: needinfo?(hikezoe.birchill)
Flags: qe-verify+
Flags: needinfo?(hikezoe.birchill)
Flags: needinfo?(hikezoe.birchill)

Mira, as far as I've tested I can no longer see bug 2028072 at all.

It would be nice to open a new bug for the glitches you saw. Thanks!

Flags: needinfo?(hikezoe.birchill) → needinfo?(mlobontiuroman)
See Also: → 2051595

Filed Bug 2051595.
Thank you!

Flags: needinfo?(mlobontiuroman)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: