Open Bug 1792682 Opened 3 years ago Updated 2 years ago

Selected text in a zoomed Google Doc is rendered with a different zoom level when "Zoom text only" is enabled

Categories

(Core :: Layout, defect, P3)

73 Branch
defect

Tracking

()

Tracking Status
firefox-esr102 --- affected
firefox105 --- affected
firefox106 --- affected
firefox107 --- affected

People

(Reporter: cpeterson, Unassigned)

References

Details

Attachments

(2 files)

Attached image screenshot.png

Steps to reproduce

  1. Open Firefox settings and search for "Zoom text only".
  2. Enable "Zoom text only".
  3. Open a Google Doc, such as https://docs.google.com/document/d/146LoJ1E3N3E6fb4zDh92HPQc6yhRpNI7DSKlJjaYlLw/edit
  4. Using the Ctrl++ or Ctrl+- keyboard shortcuts to zoom the page's text.
  5. The page text that is part of the Google Docs UI, such as the menu names, will scale up or down but the document's text won't scale.
  6. Use the mouse or touchpad to select some of the document's text.

Expected result

The document's selected text should not be zoomed.

Actual result

The document's selected text now has a different zoom level than the rest of the document's text. See the attached screenshot.

If you switch to another tab and then back to the Google Doc, all of the document's text will have the new zoom level.

I tried bisecting this bug with mozregression, but the bug was reproducible all the way back to Firefox 73 (when bug 1608348 made the "Zoom text only" setting work).

The severity field is not set for this bug.
:bhood, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(bhood)

This should probably start its journey in Layout. (or perhaps Canvas). Not getting a good feeling that it's WebRender (Graphics).

Component: Graphics → Layout
Flags: needinfo?(bhood)

I guess when Zoom Text Only is used, changing the zoom percentage doesn't cause the size of the <canvas> to change, and therefore doesn't cause GDocs to redraw all its content. (I don't know exactly what events etc they depend on, but it makes sense they'd check for size changes and refresh their layout...) So the scaling of the rendered text only shows up when it happens to get redrawn, e.g. as a result of selecting, or deactivating and reactivating the tab, or reloading the page, etc.

I notice that in Chrome, the GDoc content seems to completely ignore changes to the font size (including setting a large "minimum font size") in the Settings, which is the nearest thing I can see to a "zoom text only"-like behavior.

It's not clear to me what, if anything, we should do about this; it seems like basically a GDocs issue where they're making some poor assumptions.

(Maybe Zoom Text Only should not affect Canvas2d text rendering? I think that would avoid the issue here, and give us behavior more like Chrome's; but OTOH it would be removing functionality that some people may specifically want.)

Daniel, any thoughts here -- can we do something to improve this, or is it really "not our problem"?

Flags: needinfo?(dholbert)
Severity: -- → S3
Priority: -- → P3

(In reply to Chris Peterson [:cpeterson] from comment #0)

If you switch to another tab and then back to the Google Doc, all of the document's text will have the new zoom level.

FWIW: this ^ is just an accident of how Google Docs works. The content that was previously drawn to the canvas remains unchanged -- but the tab-switch prompts Google Docs to redraw-from-scratch their entire canvas, and that happens with the updated settings.

(In reply to Jonathan Kew [:jfkthame] from comment #3)

(Maybe Zoom Text Only should not affect Canvas2d text rendering? I think that would avoid the issue here, and give us behavior more like Chrome's; but OTOH it would be removing functionality that some people may specifically want.)

I agree, that seems like the only thing we could do here. I'm not sure about the cost/benefit tradeoff but it seems potentially worth doing.

FWIW our current implementation isn't actually too robust against dynamic changes. Based on testing, it seems we apply the text zoom at the moment that the font style is parsed, not at the moment that text is drawn. So if you set the font style and draw some text, and then the user zooms, and then you draw some more text, the new text and the old text will still be the same size (until/unless you touch the font style again). I'll post a testcase to demonstrate.

Flags: needinfo?(dholbert)
Attached file testcase 1

STR to trigger some interesting behavior here:
(1) Enable "Zoom text only" in Firefox Settings.
(2) Load testcase
(3) Click the first button to draw some text.
(4) Ctrl+ several times, to zoom in
(5) Click the first button again to draw more text.
(6) Click the second button to initialize the font style (NOTE that this isn't actually changing the font style; the JS is just setting it to the same value again).
(7) Click the first button again to draw more text.

ACTUAL RESULTS:
The canvas text that's drawn in step 3 and step 5 is the same size, though the text in step 7 is bigger.

EXPECTED RESULTS:
Unclear, but you might expect that the zoom operation would take effect immediately for text that's drawn from that point on (i.e. text in step 5 should be bigger).
Or alternately, all the canvas's text should be the same size (the text zoom shouldn't affect it).

It's also notable that even when this "works" (i.e. even when the canvas gets drawn with larger text, e.g. if you establish a large text-zoom level before loading the Google Doc in comment 0), Google Docs is pretty much just entirely broken by this text-zooming feature, if you have any more than a little bit of a zoom applied. Text gets clipped and overlapped, as shown in the screenshot in comment 0.

I lean towards just disabling this feature in canvas, because it doesn't really work for several reasons:
(a) Text that was already drawn doesn't get dynamically zoomed (e.g. if you're looking at a canvas and want to make the text-that-you-see bigger, this feature won't let you, unless/until the canvas gets repopulated from scratch e.g. after a reload)
(b) Text that has yet-to-be-drawn doesn't get dynamically zoomed either, unless the website happens to update the ctx.font style after your dynamic zoom operation (as shown by my STR in comment 5)
(c) When text is in fact zoomed (when the feature "works"), it will almost certainly look broken/clipped/overlapping as shown in the comment 0 screenshot, because the text is placed at specific author-controlled points on the canvas and I don't think the author has a great way to introspect & discover that we're actually rendering a substantially-larger font-size than the one that they asked for.

So it's not really helping users right now, and arguably breaks stuff more than it helps, and there's arguably webcompat reasons to disable it per the similar feature in Chrome that jfkthame noted in comment 3.

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

Attachment

General

Created:
Updated:
Size: