Closed Bug 987443 Opened 7 years ago Closed 7 years ago

Rounding error of Zoom Widget %label

Categories

(Firefox :: Toolbars and Customization, defect)

29 Branch
x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 31
Tracking Status
firefox29 --- fixed
firefox30 --- fixed
firefox31 --- fixed

People

(Reporter: alice0775, Assigned: mikedeboer)

References

(Blocks 1 open bug)

Details

(Whiteboard: [qa-])

Attachments

(1 file)

Steps To Reproduce.
1. Preparation
   set devtools.chrome.enabled = true in about:config
   Open Scratchpad (Shift+F4)
   Check Environment > Browser
2. Open any web page
3. Paste following code to Scratchpad and run
   ZoomManager.setZoomForBrowser(gBrowser.selectedBrowser , 0.95);
   FullZoom._applyZoomToPref(gBrowser.selectedBrowser);
4. Observe %lebel of Zoom Widget

Actual Results
 94%

Expected Results:
 95%
Assignee: nobody → mdeboer
Status: NEW → ASSIGNED
Using the zoom +/- buttons I get the following values for `window.ZoomManager.zoom`:

zoom value: 1
zoom value: 0.949999988079071
zoom value: 1
zoom value: 0.8999999761581421
zoom value: 0.800000011920929
zoom value: 0.6700000166893005
zoom value: 0.5
zoom value: 0.30000001192092896
zoom value: 1
zoom value: 1.100000023841858
zoom value: 1.2000000476837158
zoom value: 1.3300000429153442
zoom value: 1.5
zoom value: 1.7000000476837158
zoom value: 2
zoom value: 1
zoom value: 1

This is on OSX, retina.

The `0.949999988079071` value is what I get when using Alice's STR. This lead to the following patch.
Attachment #8396286 - Flags: review?(gijskruitbosch+bugs)
Comment on attachment 8396286 [details] [diff] [review]
Patch v1: fix zoom button label rounding

Review of attachment 8396286 [details] [diff] [review]:
-----------------------------------------------------------------

Math in JS is hard. :-(
Attachment #8396286 - Flags: review?(gijskruitbosch+bugs) → review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/aa558a14a770
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 31
Comment on attachment 8396286 [details] [diff] [review]
Patch v1: fix zoom button label rounding

[Approval Request Comment]
Bug caused by (feature/regressing bug #): Australis
User impact if declined: User might see an invalid zoom percentage for non-default zoom levels. It's rare, but theoretically possible.
Testing completed (on m-c, etc.): landed on m-c.
Risk to taking this patch (and alternatives if risky): minor.
String or IDL/UUID changes made by this patch: n/a
Attachment #8396286 - Flags: approval-mozilla-beta?
Attachment #8396286 - Flags: approval-mozilla-aurora?
Attachment #8396286 - Flags: approval-mozilla-beta?
Attachment #8396286 - Flags: approval-mozilla-beta+
Attachment #8396286 - Flags: approval-mozilla-aurora?
Attachment #8396286 - Flags: approval-mozilla-aurora+
Flags: in-testsuite?
Whiteboard: [qa-]
I don't think this is worth writing and running a testcase for.
Flags: in-testsuite? → in-testsuite-
You need to log in before you can comment on or make changes to this bug.