support HandheldFriendly meta tag

RESOLVED FIXED

Status

()

RESOLVED FIXED
9 years ago
8 years ago

People

(Reporter: blassey, Assigned: blassey)

Tracking

({mobile})

Trunk
mobile
Points:
---
Bug Flags:
wanted-fennec1.0 +

Firefox Tracking Flags

(status1.9.2 beta1-fixed, fennec1.0b1-wm+)

Details

Attachments

(2 attachments, 3 obsolete attachments)

When a page specifies this we shouldn't scale the page, just fit to actual screen width.
Flags: wanted-fennec1.0+
Created attachment 398333 [details] [diff] [review]
content patch
Assignee: nobody → bugmail
Attachment #398333 - Flags: review?
Created attachment 398334 [details] [diff] [review]
mobile patch
Attachment #398334 - Flags: review?(mark.finkle)
Comment on attachment 398334 [details] [diff] [review]
mobile patch


>-    let [w, h] = BrowserView.Util.getBrowserDimensions(browser);
>-    this.setZoomLevel(BrowserView.Util.pageZoomLevel(this.getVisibleRect(), w, h));
>+    var windowUtils = browser.contentWindow.QueryInterface(Components.interfaces
>+							   .nsIInterfaceRequestor)
>+                                .getInterface(Components.interfaces.nsIDOMWindowUtils);

Use Ci in these two places

>+    if (handheldFriendly == "true") {
>+	 browser.setAttribute("style", "width: " + window.screen.width + "px;");
>+	 this.setZoomLevel(1);
>+	 browser.markupDocumentViewer.textZoom = 1;

There is code in the window resize handler that updates the height of the browsers based on the width. However, the code assumes the width is always the default:

http://mxr.mozilla.org/mobile-browser/source/chrome/content/browser.js#401

When we create the browser, we default the width:

http://mxr.mozilla.org/mobile-browser/source/chrome/content/browser.js#2404

So, you could change the code at line 401 to use the parseInt(browser.style.width) instead of the hardcoded default.
Attachment #398334 - Flags: review?(mark.finkle) → review-
Created attachment 398379 [details] [diff] [review]
mobile patch v.2

I untabified browser.js, which led to some ws changes outside the code I'm modifying.  Mark said he welcomed that clean up, so I've included it in the patch.
Attachment #398334 - Attachment is obsolete: true
Attachment #398379 - Flags: review?(mark.finkle)
(Assignee)

Updated

9 years ago
Attachment #398333 - Flags: review? → review?(jonas)
Created attachment 398415 [details] [diff] [review]
mobile patch v.3

changes suggested on irc
Attachment #398379 - Attachment is obsolete: true
Attachment #398415 - Flags: review?(mark.finkle)
Attachment #398379 - Flags: review?(mark.finkle)
Comment on attachment 398415 [details] [diff] [review]
mobile patch v.3

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

>+    if (handheldFriendly == "true") {
>+      browser.handheld = true;
>+      browser.setAttribute("style", "width: " + window.screen.width + "px;");
>+      this.setZoomLevel(1);
>+      browser.markupDocumentViewer.textZoom = 1;
>+    } else {
>+        let [w, h] = BrowserView.Util.getBrowserDimensions(browser);
>+        this.setZoomLevel(BrowserView.Util.pageZoomLevel(this.getVisibleRect(), w, h));
>+    }

You probably want to remove the property in the else clause: delete browser.handheld;

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

>   let scrollbox = document.getElementById("tile-container-container")
>-		.boxObject
>-		.QueryInterface(Components.interfaces.nsIScrollBoxObject);
>+                .boxObject
>+                .QueryInterface(Components.interfaces.nsIScrollBoxObject);

Ci. while you're here?

>-        let scaledH = (kDefaultBrowserWidth * (h / w));
>+        let scaledDefaultH = (kDefaultBrowserWidth * (h / w));
>+        let scaledScreenH = (window.screen.width * (h/w));

Add spaces: (h / w)

>+          browserStyle.height = ((browser.hasOwnProperty("handheld") && 
>+                                  browser.handheld) ? 
>+                                 scaledScreenH : scaledDefaultH) + 'px';

Oops: there is no "browser" variable in this block. need to make one or use "browsers[i]"
and use "px" (double quotes)

Sorry I didn't catch some of these earlier
Attachment #398415 - Flags: review?(mark.finkle) → review-
Created attachment 398418 [details] [diff] [review]
mobile patch v.4
Attachment #398415 - Attachment is obsolete: true
Attachment #398418 - Flags: review?(mark.finkle)
Attachment #398418 - Flags: review?(mark.finkle) → review+
this meta tag was originally defined by AvantGo.  Its fairly common on the web and signifies that the page is designed to work well with small screens.  It is used by m.cnn.com and referenced by blackberry in their docs: 
http://docs.blackberry.com/en/developers/deliverables/6176/HTML_ref_meta_564143_11.jsp

Comment 9

9 years ago
i'd really much rather we support the viewport meta tag, than this tag...
(Assignee)

Updated

9 years ago
Assignee: bugmail → nobody
Component: General → DOM
Product: Fennec → Core
QA Contact: general → general
(Assignee)

Updated

9 years ago
Attachment #398333 - Flags: approval1.9.2?
pushed http://hg.mozilla.org/mozilla-central/rev/bb5d0b3c624a
Status: NEW → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → FIXED
(Assignee)

Updated

9 years ago
tracking-fennec: --- → 1.0b1-wm+
Keywords: mobile

Updated

9 years ago
Attachment #398333 - Flags: approval1.9.2? → approval1.9.2+
pushed http://hg.mozilla.org/releases/mozilla-1.9.2/rev/f3b8ed7b59ae


the mobile-browser patch has bitrotted or has landed already?
status1.9.2: --- → beta1-fixed
(In reply to comment #11)
> the mobile-browser patch has bitrotted or has landed already?

It has landed

Updated

8 years ago
Assignee: nobody → blassey.bugs
You need to log in before you can comment on or make changes to this bug.