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).
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+
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.