Closed Bug 663023 Opened 13 years ago Closed 13 years ago

Cache system dpi

Categories

(Firefox for Android Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 7

People

(Reporter: wesj, Assigned: wesj)

Details

(Whiteboard: QA?)

Attachments

(1 file, 1 obsolete file)

Attached patch Patch (obsolete) — Splinter Review
I've been implementing touch events, and noticed 3 or 4 getDPI calls coming across the AndroidBridge for every tap. Since this shouldn't ever change, we might as well cache it.
Attachment #538165 - Flags: review?(mbrubeck)
Comment on attachment 538165 [details] [diff] [review]
Patch

># HG changeset patch
># Parent b9354cf9282d8b4f8fae3bf43144e3bcf0e6c592
>
>+++ b/mobile/chrome/content/Util.js

>+  get displayDPI() function() {
>+    delete this.displayDPI;
>+    return this.displayDPI = this.getWindowUtils(window).displayDPI;
>   }
> };

Perhaps add a comment that this will only work in the parent process.

>+++ b/mobile/chrome/content/browser.js
>@@ -1112,7 +1112,7 @@
>     if (prefValue > 0)
>       return prefValue / 100;
> 
>+    let dpi = Utils.displayDPI;
>     if (dpi < 200) // Includes desktop displays, and LDPI and MDPI Android devices
>       return 1;

s/Utils/Util/

>   updateCanCancel: function(aX, aY) {
>+    let dpi = Utils.displayDPI;
> 
>     const kSafetyX = Services.prefs.getIntPref("dom.w3c_touch_events.safetyX") / 240 * dpi;
>     const kSafetyY = Services.prefs.getIntPref("dom.w3c_touch_events.safetyY") / 240 * dpi;

here too
Attachment #538165 - Attachment is patch: true
Attachment #538165 - Flags: review?(mbrubeck) → review+
Assignee: nobody → wjohnston
Status: NEW → ASSIGNED
Whiteboard: [inbound]
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Whiteboard: [inbound]
Target Milestone: --- → Firefox 7
backed out due to general bustage;

http://hg.mozilla.org/mozilla-central/rev/46dbe6bfd8fe
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Attached patch Patch v2Splinter Review
Sorry about that. This fixes the errors (missed Utils->Util and getter returning a function). I've been browsing around with this for a bit and things that depend on dpi adjustments seem to be working fine.
Attachment #538165 - Attachment is obsolete: true
Attachment #538566 - Flags: review?(mbrubeck)
Attachment #538566 - Flags: review?(mbrubeck) → review+
Whiteboard: [inbound]
http://hg.mozilla.org/mozilla-central/rev/b36ae2b20ae1
Status: REOPENED → RESOLVED
Closed: 13 years ago13 years ago
Resolution: --- → FIXED
Whiteboard: [inbound]
Whiteboard: QA?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: