Caret disappears when zoomed out




5 years ago
5 years ago


(Reporter: CoJaBo, Unassigned)


Firefox Tracking Flags

(Not tracked)




5 years ago
Cursor disappears when zoomed out
1. Switch to portrait orientation.
2. Select the comment box below.
3. Zoom out the whole way.

The cursor disappears.

The cursor should maintain a minimum of 1px wide regardless of zoom.

This generally presents as an intermittent aliasing glitch at modest zoom levels where the cursor will disappear every few characters.

This is Bug 673408, which appears to have been closed in error; not sure how to reopen it.
Component: Keyboards and IME → Graphics, Panning and Zooming
What device are you seeing this on? I can't reproduce on the Nexus 4.
Flags: needinfo?(CoJaBo-Bugzilla)

Comment 2

5 years ago
My device is a Droid X, running Android 2.3 (CyanogenMod).
Screen res is 228 ppi.
See Bug 673408 Comment 4 and Bug 729549 for reports of different devices.

I suspect the visibility of this issue is related to the screen PPI; Nexus 4 has considerably higher res (316 ppi) than other/lower-end devices, which still experience the problem. You should still see "intermittent aliasing glitch" at least, when fully zoomed out, though it is possible it isn't reproducible at all on high-res devices, as you cannot zoom out far enough to see it.
Flags: needinfo?(CoJaBo-Bugzilla)
That makes sense. I can also reproduce this on a lower-res device. This is very similar to bug 750828 and bug 628662. I don't know where the code to fix this would be, though.

Jonathan, do you know if we enforce some minimum width for narrow glyphs in text when the user is zoomed out? I imagine that characters like '1' or 'i' would be subject to the same problem, but that the font rendering engine does some magic to handle this. I'm hoping you can point me to some relevant code that might be applicable in this scenario.
Ever confirmed: true
Flags: needinfo?(jfkthame)
OS: Linux → Android
Hardware: x86_64 → All
I don't think glyph-rendering code is going to help here; that's a different case. For fonts, the rasterizer is antialiasing the glyphs, so lines that are less than one device pixel wide will tend to render as gray (becoming fainter as the nominal line width decreases); depending where such elements fall on the device pixel grid, their antialiased rendering may even span a couple of device pixels even though their nominal width is much less than a single pixel.

For the cursor, on the other hand, we're attempting to snap its position and thickness to whole device pixels, so that it always appears sharp and black rather than getting blurry edges (depending where it falls on the grid). See nsCaret::ComputeMetrics. At this point, I believe we ensure a minimum width of one pixel.

However, this doesn't account for transforms that might subsequently scale what's drawn, including (as I understand it) the scaling of a zoomed-out page on mobile. So then when we draw the caret with FillRect (see nsCaret::PaintCaret), which internally snaps the rect it's given to device pixels again, it's possible it may disappear.

Possibly it'd be better to disable dev-px snapping of the width when we're so far zoomed out, and allow the caret to become faint/blurry in preference to vanishing.
Flags: needinfo?(jfkthame)
Thanks for the pointers! I looked at the code and I think your explanation makes sense to me. However based on my understanding of the problem I don't know if this can be fixed easily for just this code path without affecting everything that uses the FillRect call.
Component: Graphics, Panning and Zooming → Graphics
Product: Firefox for Android → Core
You need to log in before you can comment on or make changes to this bug.