Bug 709813 - Fix full-screen mode in native android fennec. r=mbrubeck
authorChris Lord <chrislord.net@gmail.com>
Mon, 20 Feb 2012 17:21:56 +0000
changeset 87233 db9349758f671449d48249722d97b03ba77b4922
parent 87232 28803f706b3a64f7934436cf5c45ae4208a0820c
child 87235 09072cd32bb924b12b4a27ce09324def9ad76163
push id22103
push userbmo@edmorley.co.uk
push dateTue, 21 Feb 2012 12:01:45 +0000
treeherdermozilla-central@4038ffaa5d82 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmbrubeck
bugs709813
milestone13.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 709813 - Fix full-screen mode in native android fennec. r=mbrubeck The style rule that gets set for full-screen mode was conflicting with how we size the browser element for viewport/displayport support. Size the browser using min-width/height to work around this.
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -2082,17 +2082,17 @@ Tab.prototype = {
         viewportH = viewportW * (screenH / screenW);
     }
 
     // Make sure the viewport height is not shorter than the window when
     // the page is zoomed out to show its full width.
     let minScale = this.getPageZoomLevel(screenW);
     viewportH = Math.max(viewportH, screenH / minScale);
 
-    let oldBrowserWidth = parseInt(this.browser.style.width);
+    let oldBrowserWidth = parseInt(this.browser.style.minWidth);
     this.setBrowserSize(viewportW, viewportH);
 
     // Avoid having the scroll position jump around after device rotation.
     let win = this.browser.contentWindow;
     this.userScrollPos.x = win.scrollX;
     this.userScrollPos.y = win.scrollY;
 
     // If the browser width changes, we change the zoom proportionally. This ensures sensible
@@ -2106,32 +2106,34 @@ Tab.prototype = {
     this.updateViewport(true, newZoom);
   },
 
   getDefaultZoomLevel: function getDefaultZoomLevel() {
     let md = this.metadata;
     if ("defaultZoom" in md && md.defaultZoom)
       return md.defaultZoom;
 
-    let browserWidth = parseInt(this.browser.style.width);
+    let browserWidth = parseInt(this.browser.style.minWidth);
     return gScreenWidth / browserWidth;
   },
 
   getPageZoomLevel: function getPageZoomLevel() {
     // This may get called during a Viewport:Change message while the document
     // has not loaded yet.
     if (!this.browser.contentDocument || !this.browser.contentDocument.body)
       return 1.0;
 
     return this._viewport.width / this.browser.contentDocument.body.clientWidth;
   },
 
   setBrowserSize: function(aWidth, aHeight) {
-    this.browser.style.width = aWidth + "px";
-    this.browser.style.height = aHeight + "px";
+    // Using min width/height so as not to conflict with the fullscreen style rule.
+    // See Bug #709813.
+    this.browser.style.minWidth = aWidth + "px";
+    this.browser.style.minHeight = aHeight + "px";
   },
 
   getRequestLoadContext: function(aRequest) {
     if (aRequest && aRequest.notificationCallbacks) {
       try {
         return aRequest.notificationCallbacks.getInterface(Ci.nsILoadContext);
       } catch (ex) { }
     }