Closed Bug 139832 Opened 23 years ago Closed 22 years ago

Improve scroll position after window resize (a more intelligent method)

Categories

(Core :: Layout, enhancement, P4)

enhancement

Tracking

()

RESOLVED DUPLICATE of bug 19261
Future

People

(Reporter: mikko.rantalainen, Unassigned)

References

()

Details

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.9+) Gecko/20020412
BuildID:    2002041217

When a long document is resized radically the current document position doesn't
stay visible. See the URL above (any long page will do) and scroll to about
2/3th downwards. When the window is made wider the text keeps climbing upwards
and when window is made narrower the text goes downwards. Selecting some text
before resizing window makes this particularly visible.

Reproducible: Always
Steps to Reproduce:
1. Go to http://www.w3.org/MarkUp/
2. Scroll downwards to header "Discussion Forums"
3. Select some text in the document
4. Make window much wider or narrower (like 400% or 25% of the original size)

Actual Results:  Selected text moves out of view.

Expected Results:  Selected text should stay in view as well as possible (well,
technically Mozilla is doing this but I think it could do better:) Note that I'm
not proposing sniffing for selected text but to improve overall intelligence
with scrolling position to fix the issue.

The current implementation is from the fix of bug 16806, I think. I propose
following way: instead of storing absolute scroll-x and scroll-y pixel values
store the relative position. According to a few pages I tested moving vertical
scrollbar to same position after changing window width kept the selected text in
view. It's pretty safe to assume that long documents have roughly evenly
distributed text so regardless of window size previous position should be near
same relative position with new window size.

Example: Document content is originally 5300 pixels high and it's scrolled to
2000 pixels from top. After resizing window to make document content 10250
pixels high the same position should be at 10250 * (2000/5300) = 3870 pixels
(38%) from top. Apply the same for horizontal scrolling if needed - I don't
consider it as an issue because pages are normally scrolled from top to down
only. Algorithm might need to be tweaked to use viewport center or bottom as
scrolling position to make it work nicely for small documents too.
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 98 → All
Hardware: PC → All
Fixing bug 60307 might fix this bug.
Blocks: 168902
uid is being phased out.
Assignee: mpt → other
Component: User Interface Design → Layout
QA Contact: zach → gerardok
QA Contact: gerardok → moied
Priority: -- → P4
Target Milestone: --- → Future
See also bug 64926, Page does not rescroll after text zoom.
Depends on: 43114

*** This bug has been marked as a duplicate of 19261 ***
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
No longer depends on: 43114
No longer blocks: 168902
You need to log in before you can comment on or make changes to this bug.