Closed Bug 621888 Opened 9 years ago Closed 9 years ago

Fennec zoom to the wrong area when the search result is at the bottom of the page

Categories

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

defect
Not set

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: vingtetun, Assigned: vingtetun)

References

Details

Attachments

(2 files)

Attached patch PatchSplinter Review
Because most of the zoom calculation is done using browser.getBoundingClientRect().height, zooming to an element using the form helper or the find helper could result into zooming to the wrong area.

Steps to reproduce:
 * go to http://www.google.com (non-mobile version)
 * go to the site menu and click on "Find in page"
 * in the search textbox type "back"

Actual result:
 * The UI try to zoom near the bottom of the page but fail

Expected result:
 * The UI zoom and show the "Change Background Image" link at the bottom left corner of the page.
Attachment #500191 - Flags: review?(mbrubeck)
Attachment #500191 - Flags: review?(mark.finkle)
Comment on attachment 500191 [details] [diff] [review]
Patch

Looks good to me.
Attachment #500191 - Flags: review?(mbrubeck) → review+
http://hg.mozilla.org/mobile-browser/rev/c126e042c0d7
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Attached patch PatchSplinter Review
Some cleanup as asked on IRC
Assignee: nobody → 21
Comment on attachment 500218 [details] [diff] [review]
Patch

>diff --git a/chrome/content/browser.js b/chrome/content/browser.js

>-  update: function va_update(aIsVKB) {
>-    Browser.styles["viewable-height"].height = (this.height - Elements.contentNavigator.getBoundingClientRect().height) + "px";
>-    Browser.styles["viewable-width"].width = this.width + "px";
>+  update: function va_update() {
>+    let oldHeight = parseInt(Browser.styles["viewable-height"].height);
>+    let newHeight = this.height - Elements.contentNavigator.getBoundingClientRect().height;
>+    if (newHeight != oldHeight) {
>+      Browser.styles["viewable-height"].height = (this.height - Elements.contentNavigator.getBoundingClientRect().height) + "px";

just use newHeight, so we can avoid anther call to getBoundingClientRect:

>+      Browser.styles["viewable-height"].height = newHeight + "px";

r+ with that change
Attachment #500218 - Flags: review?(mark.finkle) → review+
verified FIXED on build:

Mozilla/5.0 (Android; Linux armv71; rv:2.0b9pre) Gecko/20101230 Namoroka/4.0b9pre Fennec/4.0b4pre
Status: RESOLVED → VERIFIED
No longer blocks: 622342
Depends on: 622342
You need to log in before you can comment on or make changes to this bug.