Closed Bug 444858 Opened 12 years ago Closed 12 years ago

improve zoom-to-element behavior

Categories

(Firefox for Android Graveyard :: Panning/Zooming, defect, P2)

defect

Tracking

(Not tracked)

VERIFIED FIXED
fennec1.0m7

People

(Reporter: Gavin, Assigned: Gavin)

Details

Attachments

(1 file, 1 obsolete file)

Right now we're just zooming directly to the clicked on element. Some ideas for improving this:

- add a margin (trivial)
- search through document tree and determine a reasonable zoom level based on size/position of parents/children of the selected element
- look for non-inline elements and use those as a guide (some of the previous zooming code looked for the first block ancestor and zoomed to that, iirc)
Flags: wanted-fennec1.0+
Priority: -- → P2
Target Milestone: --- → Fennec M6
Assignee: nobody → gavin.sharp
Status: NEW → ASSIGNED
Attached patch add a margin (checked in) (obsolete) — Splinter Review
This just puts a 15px margin around the zoom area instead of zooming directly to the element.
Attachment #331168 - Flags: review?(pavlov)
(We don't need to worry about coordinates that stretch outside the viewport, since the rest of the code handles those appropriately.)
Attachment #331168 - Flags: review?(pavlov) → review+
Attachment #331168 - Attachment description: add a margin → add a margin (checked in)
Can this be closed?
I can close it and open a new bug, but I still want to investigate further improvements.
Let's just keep this open then :)
Target Milestone: Fennec M6 → Fennec M7
Attached patch patchSplinter Review
Two fixes:
1) Look for block or table ancestors when zooming
2) Rework client to content coordinate conversion code to work with zoomed out pages (e.g. cnn.com). 

2) fixes two bugs that affected zooming or clicking near the bottom edge of the page when the page was zoomed out (e.g. on cnn.com).

The first bug was that zooming and click redispatching used slightly different ways of coordinating event coordinates (one was adjusting for browserTop before dividing by zoomLevel, while the other was doing it after), so I consolidated that into _clientToContentCoords.

The second bug was that for zoomed out pages, it was possible for content displayed near the bottom of the page to be offscreen in the hidden <browser>, which means that elementFromPoint was returning null, which explains bug 446509. I fixed that by trying to scroll to the clicked point directly instead of just to the pageoffset, and adjusting the values returned by _clientToContentCoords accordingly (also added a comment).
Attachment #331168 - Attachment is obsolete: true
Attachment #334636 - Flags: review?
Attachment #334636 - Flags: review? → review+
http://hg.mozilla.org/mobile-browser/index.cgi/rev/260be7825cdd
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
verified in beta3
Status: RESOLVED → VERIFIED
Component: General → Panning/Zooming
You need to log in before you can comment on or make changes to this bug.