Closed Bug 599132 Opened 14 years ago Closed 14 years ago

Clean up updateViewportSize

Categories

(Firefox for Android Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mbrubeck, Assigned: mbrubeck)

References

Details

Attachments

(1 file)

Followup to bug 597230 to address Stover's concerns:

* Does this really belong in updateViewportSize? It's convenient because it's
always called on a resize, but it does an orthogonal task which is flagged by
whether aRatio is passed in. Smells like a separate function to me
(preserveViewport(ratio)?)
* Preserving the viewport may still be useful in autosize layout, but I'm not
sure. Also, there is a case where not-autosize layout does change (when
kDefaultBrowserWidth is not used).
Attached patch patchSplinter Review
This patch moves the code into a new "restoreViewportPosition" function.  It also adds a check to call the function only if the layout hasn't changed.  (If the viewport size changes, then we don't have a reliable way to keep the same content visible... but maybe we can find some compromize solution for that case.)

Includes some minor cleanup to related code (changing code order and variable names) and fixes a strict-mode warning about window.cachedWidth.

All tests are green with this patch.  It shouldn't change behavior except in the somewhat rare case that a non-autoSize page changes its viewport width on orientation change.
Attachment #481912 - Flags: review?(webapps)
Comment on attachment 481912 [details] [diff] [review]
patch

Thanks for the refactor.
Attachment #481912 - Flags: review?(webapps) → review+
http://hg.mozilla.org/mobile-browser/rev/604c4cbfc091
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Flags: in-testsuite?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: