Closed Bug 1587921 Opened 6 years ago Closed 5 years ago

Context menu covers blue carets when the input field is near the top of the screen

Categories

(GeckoView :: IME, defect, P3)

Unspecified
Android
defect

Tracking

(firefox70 affected, firefox71 affected)

RESOLVED WORKSFORME
Tracking Status
firefox70 --- affected
firefox71 --- affected

People

(Reporter: TYLin, Unassigned)

References

Details

Attachments

(2 files)

Filed this per discussion in bug 1581007 comment 8.

STR

  1. Open Wikipedia: https://en.m.wikipedia.org.
  2. Enter some words, such as "Mozilla Firefox" in the "Search Wikipedia" text field.
  3. Try to select an individual word by long pressing it.

Expected Result

The context menu doesn't cover the blue carets.

Actual Result

The context menu covers the blue carets. Users are unable to move blue carets.

TYLin, what's your hardware & Android version?

I'm using a Pixel 3 with Android 10 (Q), and I can't reproduce this bug here (my just-fine screenshot: attachment 9100316 [details]). I'm guessing our differing behavior might be due to a pixel-density difference, or an Android-API difference.

Flags: needinfo?(aethanyc)

I'm using a Pixel 2 (not XL) with Android 10, and I can still reproduce the issue on Firefox Preview Nightly version 191011 13:15 (Build #12841339).

Flags: needinfo?(aethanyc)

This is another screenshot on my device that the context menu is too far away from the blue carets.

IIUC, dholbert's bug 1581007 comment 15 says Fenix issue https://github.com/mozilla-mobile/fenix/issues/2038 can be worked around if this caret bug is fixed.

OS: All → Android
Whiteboard: [geckoview:p2]

The app is responsible for drawing the menu. This bug might caused by Gecko giving GV wrong page coordinates, GV incorrectly mapping page coordinates to screen coordinates, and/or Fenix incorrectly positioning the menu's screen coordinates.

GV engineers are unable to reproduce in Fenix Release or Nightly.

P3

Priority: -- → P3

I can take a look later since I can reproduce this bug.

Flags: needinfo?(aethanyc)

If I set layout.css.devPixelsPerPx=1, the context menu position looks correct to me. However its position shifts as soon as I pinch-zoom in, so I guess there's something wrong when GV mapping page coordinates (or CSS coordinates) to screen coordinates. On Fennec, I don't see this issue.

My normal window.devicePixelRatio is 2.61 (by looking at the MDN cod example), but no matter what layout.css.devPixelsPerPx I set, I always see the same resolution and displaySize in geckoview_example log like

GeckoViewActivity: New Session state: {"scrolldata":{"zoom":{"resolution":1,"displaySize":{"height":1584,"width":1080}}}

But if I pinch-zoom in, the value of resolution does become larger than 1.

Botond, any idea offhand where else I can look? (Not sure why this bug happens only on my Pixel 2 ...)

Flags: needinfo?(aethanyc) → needinfo?(botond)

I also cannot reproduce the issue.

(In reply to Ting-Yu Lin [:TYLin] (UTC-7) from comment #7)

My normal window.devicePixelRatio is 2.61 (by looking at the MDN cod example), but no matter what layout.css.devPixelsPerPx I set, I always see the same resolution and displaySize in geckoview_example log like

GeckoViewActivity: New Session state: {"scrolldata":{"zoom":{"resolution":1,"displaySize":{"height":1584,"width":1080}}}

But if I pinch-zoom in, the value of resolution does become larger than 1.

I think this part is expected. The resolution includes the pinch zoom scale but not the device scale, and the display size is likely in screen coordinates.

Botond, any idea offhand where else I can look? (Not sure why this bug happens only on my Pixel 2 ...)

I did some investigation of the positioning of this menu in bug 1484597 comment 2, although that was for Fennec.

Assuming GeckoView still uses that same code, I would suggest logging the bounding client rect in the places linked to from that comment, and seeing if the values are reasonable.

If GeckoView does not use that code, we would need to find the corresponding code that GeckoView uses to position the menu.

Flags: needinfo?(botond)

GeckoView uses onGetContentRect in Callback2Wrapper to provide the coordinate for the ActionMode, i.e. the "copy/select all/..." menu.

It calls onGetContentRect in BasicSelectionActionDelegate, which further calls GeckoSession's getClientToScreenMatrix. What's interesting is that the client coordinate from Accessiblecaret is in CSS pixels, but the Screen coordinate should be something similar to device pixels. I cannot find anything in GeckoSession.java that translates between these two coordinates.

Whiteboard: [geckoview:p2]

Not sure what had been changed, but I cannot reproduce this on fenix nightly with my Pixel 2.

Nightly 200114 18:01 (Build #20141812)
28.0.0, f4ddf4e26
GV: 74.0a1-20200113093823
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → WORKSFORME

(In reply to Ting-Yu Lin [:TYLin] (UTC-8) from comment #10)

Not sure what had been changed

It might have been fixed by bug 1600652.

Moving some input bugs to the new GeckoView::IME component.

Component: General → IME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: