Closed Bug 688990 (desktop-zoom-mac) Opened 13 years ago Closed 4 years ago

Implement "Pinch to zoom" like Safari (and not like it used to be in Firefox)

Categories

(Core :: Panning and Zooming, enhancement, P3)

x86
macOS
enhancement

Tracking

()

RESOLVED DUPLICATE of bug 1620056
Webcompat Priority ?

People

(Reporter: bugzilla, Unassigned)

References

(Depends on 1 open bug, Blocks 2 open bugs)

Details

(4 keywords, Whiteboard: [DevRel:P2][gfx-noted] [webcompat])

Attachments

(1 file, 1 obsolete file)

Firefox is currently the only browser on Mac OS X Lion that does not support "pinch to zoom".

My understanding is that this was WONTFIX'ed due to that it was not possible to zoom back to the original page zoom.

Safari 5.1 in Lion solves this issue by not allowing to zoom back more than the original zoom state. You can only zoom in and zoom back to the default size. 

This bug request does not request to only enable the pinch to zoom feature, but to implement it like Safari 5.1 does.
Summary: Implement "Pinch to zoom" like Safari 5.1 → Implement "Pinch to zoom" like Safari 5.1 (and not like it used to be in Firefox)
Severity: normal → enhancement
Related to bug 674371?
Summary: Implement "Pinch to zoom" like Safari 5.1 (and not like it used to be in Firefox) → [10.7] Implement "Pinch to zoom" like Safari 5.1 (and not like it used to be in Firefox)
Whiteboard: [parity-safari]
We didn't want to support it since the thresholds were all wrong and we only zoom 20% at a time, etc.

If we could zoom the way Safari 5.1 does it, I'd be all for it. I don't think it's trivial, but I'd love to see it. :)
Referencing the older bugs about this: bug 613909 where the old-style handling of the gestures was disabled and bug 632733 and bug 481092 related to the old implementation. They can be closed once this is fixed.
Can we use the zoom behavior from Firefox for Android for this?
Assignee: nobody → waterlo1
Status: NEW → ASSIGNED
We want this on Windows 8 too (in both "Metro" and desktop modes); see bug 789906.  If I understand correctly, the right way to do this is to use the AsyncPanZoomController from B2G (bug 745136).
(In reply to Stefan Arentz [:st3fan] from comment #6)
> Can we use the zoom behavior from Firefox for Android for this?

Possible, but we probably shouldn't. Firefox for Android reflows text, and it probably shouldn't. We really want this like Safari, or a more iOS-like zooming. That is, where everything gets bigger and does not move its' contents, just allows you to pan around the larger view.
The text reflow in Firefox for Android is controlled by prefs and can be disabled.

More importantly, the Android version of this code is mostly implemented in Java and can't be used on other platforms; however, the B2G port of that same code (bug 745136) is already part of Gecko, and we are already planning to use it on Windows 8.
Attached patch Patch v0.2.0 (obsolete) — Splinter Review
This is a very rough version for pinch zooming. It is compatible with rotation.  It works a lot better for ImageDocuments than regular documents.
Attachment #714526 - Flags: feedback?(jAwS)
Apologies for bitrot in previous patch, forgot to update from central before diff'ing.
I have a fixed version of the patch ready, just building real quick to make sure it works.
Attached patch Patch v0.2.1Splinter Review
Same as the last patch, but with way less bit rot!
Attachment #714526 - Attachment is obsolete: true
Attachment #714526 - Flags: feedback?(jAwS)
Attachment #714536 - Flags: feedback?(jAwS)
(In reply to Josiah [:JosiahOne] from comment #13)
> I have a fixed version of the patch ready, just building real quick to make
> sure it works.

Scratch that. Brandon got it fixed. :)
The big-picture plan for panning and zooming across all platforms is to get off-main-thread-compositing working for all platforms (builds on the layers refactoring work being done currently on the gfx branch) and use the AsyncPanZoomController we built for B2G on desktop (and ultimately Android too). In other words, port the stuff we built for B2G to the desktop.
Comment on attachment 714536 [details] [diff] [review]
Patch v0.2.1

Most of the code looks fine, but this is probably not something that we will end up shipping in Firefox since the plans for AZPC are too near.

Can you please convert this patch in to an add-on? See https://addons.mozilla.org/en-US/developers/docs/sdk/latest/ for more information and feel free to ask questions on IRC as you work on it.
Attachment #714536 - Flags: feedback?(jAwS) → review-
As per https://bugzilla.mozilla.org/show_bug.cgi?id=688990#c17, we'll be moving our work into an add-on.  Once OMTC / APZC is ready to go, the add-on will be deprecated.

The add-on depends on bugs 851128 and 853490.  It will be called "Multi-Touch Gestures" (or something very similar), and will be available on addons.mozilla.org before the end of April.

Unassigning myself from the bug.
Status: ASSIGNED → NEW
Assignee: waterlo1 → nobody
No longer depends on: desktop-zoom-win
Blocks: apz-desktop
No longer blocks: apz-desktop
Depends on: apz-desktop
I keep going back from Firefox to Safari because of this missing feature, i prefer an open platform over proprietary software but ****, the zooming in Firefox feels like going back in time 5 years :'(
See Also: → 674371
Keywords: DevAdvocacy
Whiteboard: [parity-safari] → [parity-safari] [parity-chrome]
(In reply to Brandon Waterloo from comment #18)
> As per https://bugzilla.mozilla.org/show_bug.cgi?id=688990#c17, we'll be
> moving our work into an add-on.  Once OMTC / APZC is ready to go, the add-on
> will be deprecated.
> 
> The add-on depends on bugs 851128 and 853490.  It will be called
> "Multi-Touch Gestures" (or something very similar), and will be available on
> addons.mozilla.org before the end of April.
> 
> Unassigning myself from the bug.

Any progress?
Depends on: 1180706
No longer depends on: apz-desktop
I too would really love a soft 'pinch to zoom'. I've recently moved back to Firefox from Google Chrome and it sucks that I can't have this feature anymore.
I'm trying to see if we can find a way to move forward with issues that can benefit from APZ awesomeness.

Is there prior art that we can 'copy' from b2g or Android implementations?
[cont comment 24]

Is there some kind of API that the frontend team can use to wire things up, or do we need support from platform?
Flags: needinfo?(mstange)
Flags: needinfo?(bugmail.mozilla)
This needs to be implemented in the platform. I think the plan is to look at it once scrolling is solid.
Flags: needinfo?(mstange)
Yeah, what Markus said. There's a bunch of work that needs to be done to handle zoom properly on desktop. With some pref flips you can enable it on Windows touch devices but it exposes a number of bugs that will need to be fixed before it's ready to be used. Once we have shipped the basic APZ scrolling feature we can look into this in more detail.
Flags: needinfo?(bugmail.mozilla)
Whiteboard: [parity-safari] [parity-chrome] → [parity-safari] [parity-chrome][DevRel:P2]
We've had async scrolling for a while now. Any updates on this?

> With some pref flips you can enable it on Windows touch devices

Is there a similar pref incantation for enabling it on macOS or are we still lacking code there?
Would you mind forwarding this bug to the appropriate people / triagers, please?
Flags: needinfo?(bugmail)
Summary: [10.7] Implement "Pinch to zoom" like Safari 5.1 (and not like it used to be in Firefox) → Implement "Pinch to zoom" like Safari (and not like it used to be in Firefox)
Component: General → Panning and Zooming
Flags: needinfo?(bugmail)
Keywords: feature
Priority: -- → P3
Product: Firefox → Core
Whiteboard: [parity-safari] [parity-chrome][DevRel:P2] → [parity-safari] [parity-chrome][DevRel:P2][gfx-noted]
Looks like this has been in development hell for a while, but this is the only missing feature stopping me from switching to Firefox full-time and I would love to see it implemented.
Yeah it seems like now that APZ has landed (as of 57.0) that now might be a good time to readdress this
This bug deserves a higher priority. I will not use Firefox until the browser zoom behavior and multi-touch support is responsive and matches other browsers.
It's possible to add smooth multi-touch zooming to current Firefox - I've developed an extension to demo https://addons.mozilla.org/en-GB/firefox/addon/multi-touch-zoom/?src=userprofile

(macOS only)
(In reply to haxiomic from comment #35)
> It's possible to add smooth multi-touch zooming to current Firefox - I've
> developed an extension to demo
> https://addons.mozilla.org/en-GB/firefox/addon/multi-touch-zoom/
> ?src=userprofile
> 
> (macOS only)

This seems to work as expected. Thanks!
That is fantastic news ! Hope to see the windows equivalent (it works with SHIFT + pinch on touchpad now) !
One day I'll switch back to firefox, very soon I hope !
Amazing work haxiomic, only took 6 years! I hope this is a big step forward in squashing this bug.
haxiomic, would you be interested in landing that directly in Firefox?
Flags: needinfo?(haxiomic)
I think it could use some tweaking and fine tuning to make it more responsive. Seems to be a delay after zooming that prevents the user from immediately being able to scroll.

Should also assess resource consumption and possible optimization.
Hey Sylvestre, I'm keen to help the feature land in Firefox if I can. I expect it'll take a different approach to the one used in the add-on (which does some ugly things with transform: perspective). Is there someone who owns the gesture code that I should get in touch with?

mixxster, I agree, I think there's lots of room for optimization – I'd love to see it as smooth as Safari. That delay seems to be down to a re-paint of the page when the scroll bars become visible which I suspect could be avoided.
Flags: needinfo?(haxiomic)
(In reply to haxiomic from comment #41)
> Hey Sylvestre, I'm keen to help the feature land in Firefox if I can. I
> expect it'll take a different approach to the one used in the add-on (which
> does some ugly things with transform: perspective). Is there someone who
> owns the gesture code that I should get in touch with?

Most existing methods for manipulating the view (such as scrolling, or zooming on mobile) are implemented in native (C++) code using our "asynchronous panning and zooming" (APZ) infrastructure. 

The "asynchronous" part means that the processing of the input events and the progress of the animation that is changing the view is independent of the browser's main loop, and thus can be smooth and responsive even if the main loop is busy running JS or the page is slow to repaint.

We would definitely like to add APZ-based support for desktop zooming (that's what this bug tracks). As mentioned earlier, it's a nontrivial undertaking and the timeline for it is uncertain.

The idea of landing a JS-based solution like this one as a stopgap, until the APZ-based implementation is ready to take its place, is an interesting one. I'm not opposed to it, but I think the decision is up to the owners of the relevant Firefox front-end code that would need to be modified. :jaws, do you have any thoughts on whether there might be interest in accepting such a contribution?
Flags: needinfo?(jaws)
I looked at the code of the extension[1] and it does this pretty much how I would do this for an extension but I don't think we can ship this built-in as part of Firefox since it works by setting style properties directly on the root element[2] which would be visible from content as well as could have conflicts with some pages that expect various styles set on the root to hold at all times.

If haxiomic wants to try to write a patch that implements this without being visible to content (possibly by creating and updating a user agent stylesheet in tab-content.js[3]) then that might work and I would be happy to accept the contribution.

[1] https://github.com/haxiomic/firefox-multi-touch-zoom/blob/master/extension/pinch-zoom.js
[2] https://github.com/haxiomic/firefox-multi-touch-zoom/blob/master/extension/pinch-zoom.js#L156
[3] https://searchfox.org/mozilla-central/rev/51cd1093c5c2113e7b041e8cc5c9bf2186abda13/browser/base/content/tab-content.js
Flags: needinfo?(jaws)
Touchscreen zooming has been implemented into haxiomic's extension.
Anyone still interested in implementing this?
Mass bug change to replace various 'parity' whiteboard flags with the new canonical keywords. (See bug 1443764 comment 13.)
Whiteboard: [parity-safari] [parity-chrome][DevRel:P2][gfx-noted] → [DevRel:P2][gfx-noted]
IMHO it's crazy that Firefox doesn't implement this natively. I think "people might leave" Firefox as soon as they realise they can't easily pinch zoom that image or whatever like they've been doing for years on Safari. I think most won't bother to install an add-on. They'll just leave. 

Haxiomatic's extension is fantastic and makes Firefox useable for me, but IMHO Firefox really needs to do this nicely right out of the box. Soon.

Could you not just repurpose the Firefox Android pinch zoom code? It works well enough.
The patch is unassigned, triaged and P3 and available for grabs. If you want to write a patch, take it, if not, wait until someone else does.

If the triage owner will decide to mark is as wontfix, they will. No need to ask about it.

Please, familiarize yourself with the Bugzilla etiquette. Your comment is not adding any technical value to the issue at hand.
Depends on: desktop-zoom-xp
Depends on: 1458711
We definitely haven't forgotten about this, and we are working on it (as other priorities permit).

We do plan to reuse most of the Android pinch-zoom code, but there are issues specific to desktop that are not present on mobile that need to be tackled (e.g. different scrollbar behavior). 

I reorganized the dependency tree of bug 1245183 to make the dependencies of this work more clear. Most of the work involved is not specific to Mac, but common to all desktop platforms; you can follow the progress of that work in the dependencies of bug 1461360.
Thanks for the heads up
Flags: webcompat?
Whiteboard: [DevRel:P2][gfx-noted] → [DevRel:P2][gfx-noted] [webcompat]

Migrating Webcompat whiteboard priorities to project flags. See bug 1547409.

Webcompat Priority: --- → ?

See bug 1547409. Migrating whiteboard priority tags to program flags.

I'm actively working on this, but it's been slow going as the details (e.g. scrollbar interactions) are quite tricky. You can follow the progress more specifically in the dependencies of bug 1461360. I'm currently working on bug 1556556.

Alias: desktop-zoom-mac
Depends on: 1591799
Depends on: 1601185
Depends on: 1601527
Depends on: 1641300
Depends on: 1643517

For anyone who's following this bug but not the more recent tracking bugs like bug 1620056: this feature is slated to be released as part of Firefox 83.

Thank you to everyone who helped test the feature in Nightly, and to everyone else for your patience.

Botond, shall we close/dupe this bug then, or what's left to do here?

Flags: needinfo?(botond)

Botond, are there any plans to also support zooming to the width of the box when two-finger double-tapping on the trackpad, as in Safari/Chrome on Mac? Is there an issue to follow for this?

I think we can close this bug as a dupe of bug 1620056, yes. It looks like the remaining open dependencies are also blocking the desktop-zoom-post bug so there's not much value in leaving this one open.

(In reply to Szabolcs Horvát from comment #60)

Botond, are there any plans to also support zooming to the width of the box when two-finger double-tapping on the trackpad, as in Safari/Chrome on Mac? Is there an issue to follow for this?

Yes, bug 674371 tracks this feature.

Status: NEW → RESOLVED
Closed: 4 years ago
Flags: needinfo?(botond)
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: