fixes
authorBenjamin Stover <bstover@mozilla.com>
Wed, 18 Aug 2010 19:12:28 -0700
changeset 66595 c22dc6c4e377b43481b87cc5039497ccc59764e5
parent 66594 e72162cf3b3378c0670f177cb1a09c19c6c9c3a3
child 66596 4e92db90e8dafaa15a21a47cdb06acc284552076
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
fixes
mobile/app/mobile.js
mobile/chrome/content/BrowserView.js
mobile/chrome/content/browser.js
mobile/chrome/content/content.css
--- a/mobile/app/mobile.js
+++ b/mobile/app/mobile.js
@@ -37,18 +37,18 @@
 #filter substitution
 
 pref("toolkit.defaultChromeURI", "chrome://browser/content/browser.xul");
 pref("general.useragent.extra.mobile", "@APP_UA_NAME_EXTRA@/@APP_VERSION_EXTRA@ Fennec/@APP_VERSION@");
 pref("browser.chromeURL", "chrome://browser/content/");
 
 pref("browser.tabs.warnOnClose", true);
 #ifdef MOZ_IPC
-//pref("browser.tabs.remote", false);
-pref("browser.tabs.remote", true);
+pref("browser.tabs.remote", false);
+//pref("browser.tabs.remote", true);
 #else
 pref("browser.tabs.remote", false);
 #endif
 
 pref("toolkit.screen.lock", false);
 
 // From libpref/src/init/all.js, extended to allow a slightly wider zoom range.
 pref("zoom.minPercent", 20);
--- a/mobile/chrome/content/BrowserView.js
+++ b/mobile/chrome/content/BrowserView.js
@@ -169,21 +169,16 @@ BrowserView.Util = {
   },
 
   initContainer: function initContainer(container, visibleRect) {
     container.style.width = visibleRect.width  + 'px';
     container.style.height = visibleRect.height + 'px';
     container.style.overflow = '-moz-hidden-unscrollable';
   },
 
-  resizeContainerToViewport: function resizeContainerToViewport(container, viewportRect) {
-    container.style.width = viewportRect.width  + 'px';
-    container.style.height = viewportRect.height + 'px';
-  },
-
   ensureMozScrolledAreaEvent: function ensureMozScrolledAreaEvent(aBrowser, aWidth, aHeight) {
     let message = {};
     message.target = aBrowser;
     message.name = "Browser:MozScrolledAreaChanged";
     message.json = { width: aWidth, height: aHeight };
 
     Browser._browserView.updateScrolledArea(message);
   }
@@ -225,17 +220,16 @@ BrowserView.prototype = {
           // Use a minimum number of tiles sice we don't know the device
           cacheSize = 6;
       }
     }
 
     this._visibleRectFactory = visibleRectFactory;
 
     messageManager.addMessageListener("Browser:MozScrolledAreaChanged", this);
-    messageManager.addMessageListener("Browser:PageScroll", this);
   },
 
   uninit: function uninit() {
   },
 
   getVisibleRect: function getVisibleRect() {
     return this._visibleRectFactory();
   },
@@ -253,30 +247,31 @@ BrowserView.prototype = {
     let bvs = this._browserViewportState;
     if (!bvs)
       throw "Cannot get viewport dimensions when no browser is set";
 
     return [bvs.viewportRect.right, bvs.viewportRect.bottom];
   },
 
   setZoomLevel: function setZoomLevel(zoomLevel) {
+    getBrowser().style.MozTransformOrigin = "left top";
+    getBrowser().style.MozTransform = "scale(" + zoomLevel + ")";
     return;
 
     let bvs = this._browserViewportState;
     if (!bvs)
       return;
 
     let newZoomLevel = this.clampZoomLevel(zoomLevel);
     if (newZoomLevel != bvs.zoomLevel) {
       let browserW = this.viewportToBrowser(bvs.viewportRect.right);
       let browserH = this.viewportToBrowser(bvs.viewportRect.bottom);
       bvs.zoomLevel = newZoomLevel; // side-effect: now scale factor in transformations is newZoomLevel
       bvs.viewportRect.right  = this.browserToViewport(browserW);
       bvs.viewportRect.bottom = this.browserToViewport(browserH);
-      this._viewportChanged(true, true);
 
       if (this._browser) {
         let event = document.createEvent("Events");
         event.initEvent("ZoomChanged", true, false);
         this._browser.dispatchEvent(event);
       }
     }
   },
@@ -302,46 +297,16 @@ BrowserView.prototype = {
 
       bounded = Math.max(bounded, this.getPageZoomLevel());
     }
 
     let rounded = Math.round(bounded * kBrowserViewZoomLevelPrecision) / kBrowserViewZoomLevelPrecision;
     return rounded || 1.0;
   },
 
-  beginOffscreenOperation: function beginOffscreenOperation(rect) {
-    return;
-
-    if (this._offscreenDepth == 0) {
-      let vis = this.getVisibleRect();
-      rect = rect || vis;
-      let zoomRatio = vis.width / rect.width;
-      let viewBuffer = Elements.viewBuffer;
-      viewBuffer.width = vis.width;
-      viewBuffer.height = vis.height;
-
-      this._tileManager.renderRectToCanvas(rect, viewBuffer, zoomRatio, zoomRatio, false);
-      viewBuffer.style.display = "block";
-      window.QueryInterface(Ci.nsIInterfaceRequestor)
-        .getInterface(Ci.nsIDOMWindowUtils).processUpdates();
-      this.pauseRendering();
-    }
-    this._offscreenDepth++;
-  },
-
-  commitOffscreenOperation: function commitOffscreenOperation() {
-    return;
-
-    this._offscreenDepth--;
-    if (this._offscreenDepth == 0) {
-      this.resumeRendering();
-      Elements.viewBuffer.style.display = "none";
-    }
-  },
-
   /**
    * Swap out the current browser and browser viewport state with a new pair.
    */
   setBrowser: function setBrowser(browser, browserViewportState) {
     if (browser && !browserViewportState) {
       throw "Cannot set non-null browser with null BrowserViewportState";
     }
 
@@ -356,48 +321,31 @@ BrowserView.prototype = {
 
     this._browser = browser;
     this._browserViewportState = browserViewportState;
 
     if (browser) {
       browser.setAttribute("type", "content-primary");
       browser.setAttribute("style", "display: block;");
       browser.messageManager.sendAsyncMessage("Browser:Focus", {});
-
-      if (browserChanged)
-        this._viewportChanged(true, true);
     }
   },
 
   getBrowser: function getBrowser() {
     return this._browser;
   },
 
   receiveMessage: function receiveMessage(aMessage) {
     switch (aMessage.name) {
-      case "Browser:PageScroll":
-        this.updatePageScroll(aMessage);
-        break;
       case "Browser:MozScrolledAreaChanged":
         this.updateScrolledArea(aMessage);
         break;
     }
   },
 
-  /** If browser scrolls, pan content to new scroll area. */
-  updatePageScroll: function updatePageScroll(aMessage) {
-    if (aMessage.target != this._browser || this._ignorePageScroll)
-      return;
-  },
-
-  _ignorePageScroll: false,
-  ignorePageScroll: function ignorePageScroll(aIgnoreScroll) {
-    this._ignorePageScroll = aIgnoreScroll;
-  },
-
   updateScrolledArea: function updateScrolledArea(aMessage) {
     let browser = aMessage.target;
     let tab = Browser.getTabForBrowser(browser);
     if (!browser || !tab)
       return;
 
     let json = aMessage.json;
     let bvs = tab.browserViewportState;
@@ -407,22 +355,21 @@ BrowserView.prototype = {
     let oldRight = viewport.right;
     let oldBottom = viewport.bottom;
     viewport.right  = bvs.zoomLevel * json.width;
     viewport.bottom = bvs.zoomLevel * json.height;
 
     if (browser == this._browser) {
       // Page has now loaded enough to allow zooming.
       let sizeChanged = oldRight != viewport.right || oldBottom != viewport.bottom;
-      this._viewportChanged(sizeChanged, false);
       this.updateDefaultZoom();
       if (vis.right > viewport.right || vis.bottom > viewport.bottom) {
         // Content has shrunk outside of the visible rectangle.
         // XXX for some reason scroller doesn't know it is outside its bounds
-//        Browser.contentScrollboxScroller.scrollBy(0, 0);
+        Browser.contentScrollboxScroller.scrollBy(0, 0);
       }
     }
   },
 
   /** Call when default zoom level may change. */
   updateDefaultZoom: function updateDefaultZoom() {
     let bvs = this._browserViewportState;
     if (!bvs)
@@ -487,55 +434,16 @@ BrowserView.prototype = {
 
   get allowZoom() {
     let bvs = this._browserViewportState;
     if (!bvs || !bvs.metaData)
       return true;
     return bvs.metaData.allowZoom;
   },
 
-  //
-  // MozAfterPaint events do not guarantee to inform us of all
-  // invalidated paints (See
-  // https://developer.mozilla.org/en/Gecko-Specific_DOM_Events#Important_notes
-  // for details on what the event *does* guarantee).  This is only an
-  // issue when the same current <browser> is used to navigate to a
-  // new page.  Unless a zoom was issued during the page transition
-  // (e.g. a call to setZoomLevel() or something of that nature), we
-  // aren't guaranteed that we've actually invalidated the entire
-  // page.  We don't want to leave bits of the previous page in the
-  // view of the new one, so this method exists as a way for Browser
-  // to inform us that the page is changing, and that we really ought
-  // to invalidate everything.  Ideally, we wouldn't have to rely on
-  // this being called, and we would get proper invalidates for the
-  // whole page no matter what is or is not visible.
-  //
-  // Note that calling this function isn't necessary in almost all
-  // cases, but should be done for correctness.  Most of the time, one
-  // of the following two conditions is satisfied.  Either
-  //
-  //   (1) Pages have different widths so the Browser calls a
-  //       updateDefaultZoom() which forces a dirtyAll, or
-  //   (2) MozAfterPaint does indeed inform us of dirtyRects covering
-  //       the entire page (everything that could possibly become
-  //       visible).
-  /**
-   * Invalidates the entire page by throwing away any cached graphical
-   * portions of the view and refusing to allow a updateDefaultZoom() until
-   * the next explicit update of the viewport dimensions.
-   *
-   * This method should be called when the <browser> last set by
-   * setBrowser() is about to navigate to a new page.
-   */
-  invalidateEntireView: function invalidateEntireView() {
-    if (this._browserViewportState) {
-      this._viewportChanged(false, true);
-    }
-  },
-
   /**
    * Render a rectangle within the browser viewport to the destination canvas
    * under the given scale.
    *
    * @param destCanvas The destination canvas into which the image is rendered.
    * @param destWidth Destination width
    * @param destHeight Destination height
    * @param srcRect [optional] The source rectangle in BrowserView coordinates.
@@ -588,31 +496,16 @@ BrowserView.prototype = {
     let f = this.browserToViewport(1.0);
     return rect.scale(f, f);
   },
 
   browserToViewportCanvasContext: function browserToViewportCanvasContext(ctx) {
     let f = this.browserToViewport(1.0);
     ctx.scale(f, f);
   },
-
-  // -----------------------------------------------------------
-  // Private instance methods
-  //
-
-  _viewportChanged: function _viewportChanged(viewportSizeChanged, dirtyAll) {
-    this._applyViewportChanges(viewportSizeChanged, dirtyAll);
-  },
-
-  _applyViewportChanges: function _applyViewportChanges(viewportSizeChanged, dirtyAll) {
-    let bvs = this._browserViewportState;
-    if (bvs) {
-      BrowserView.Util.resizeContainerToViewport(this._container, bvs.viewportRect);
-    }
-  },
 };
 
 
 // -----------------------------------------------------------
 // Helper structures
 //
 
 /**
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -374,28 +374,37 @@ var Browser = {
 
     this.contentScrollbox = container;
     this.contentScrollboxScroller = {
       scrollBy: function(x, y) {
         // FIXME ROMAXA
         if (getBrowser().contentWindow) {
           getBrowser().contentWindow.scrollBy(x, y);
         }
+        else {
+        }
       },
 
       scrollTo: function(x, y) {
         // FIXME ROMAXA
         if (getBrowser().contentWindow) {
           getBrowser().contentWindow.scrollTo(x, y);
         }
       },
 
       getPosition: function(scrollX, scrollY) {
-        let cwu = Util.getWindowUtils(getBrowser().contentWindow);
-        cwu.getScrollXY(false, scrollX, scrollY);
+        // FIXME ROMAXA
+        if (getBrowser().contentWindow) {
+          let cwu = Util.getWindowUtils(getBrowser().contentWindow);
+          cwu.getScrollXY(false, scrollX, scrollY);
+        }
+        else {
+          scrollX.value = 0;
+          scrollY.value = 0;
+        }
       }
     };
 
     /* horizontally scrolling box that holds the sidebars as well as the contentScrollbox */
     let controlsScrollbox = this.controlsScrollbox = document.getElementById("controls-scrollbox");
     this.controlsScrollboxScroller = controlsScrollbox.boxObject.QueryInterface(Ci.nsIScrollBoxObject);
     controlsScrollbox.customDragger = {
       isDraggable: function isDraggable(target, content) { return {}; },
@@ -1246,18 +1255,16 @@ var Browser = {
    * scrollBoxObject interface.  Returns the actual values instead of the
    * wrapping objects.
    *
    * @param scroller a scrollBoxObject on which to call scroller.getPosition()
    */
   getScrollboxPosition: function getScrollboxPosition(scroller) {
     let x = {};
     let y = {};
-    // FIXME ROMAXA
-    return new Point(0, 0);
     scroller.getPosition(x, y);
     return new Point(x.value, y.value);
   },
 
   forceChromeReflow: function forceChromeReflow() {
     let dummy = getComputedStyle(document.documentElement, "").width;
   },
 
@@ -1540,41 +1547,44 @@ ContentCustomClicker.prototype = {
     let aY = aY || 0;
     let aModifiers = aModifiers || null;
     let browser = this._browserView.getBrowser();
     let [x, y] = Browser.transformClientToBrowser(aX, aY);
     browser.messageManager.sendAsyncMessage(aName, { x: x, y: y, modifiers: aModifiers });
   },
 
   mouseDown: function mouseDown(aX, aY) {
-    // Ensure that the content process has gets an activate event
+// XXX disable highlight for now
+/*    // Ensure that the content process has gets an activate event
     let browser = this._browserView.getBrowser();
     let fl = browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
     try {
       fl.activateRemoteFrame();
     } catch (e) {}
-    this._dispatchMouseEvent("Browser:MouseDown", aX, aY);
+    this._dispatchMouseEvent("Browser:MouseDown", aX, aY); */
   },
 
   mouseUp: function mouseUp(aX, aY) {
   },
 
   panBegin: function panBegin() {
-    TapHighlightHelper.hide();
-
-    this._dispatchMouseEvent("Browser:MouseCancel");
+// XXX
+/*    TapHighlightHelper.hide();
+
+    this._dispatchMouseEvent("Browser:MouseCancel"); */
   },
 
   singleClick: function singleClick(aX, aY, aModifiers) {
-    TapHighlightHelper.hide();
+// XXX
+/*    TapHighlightHelper.hide();
 
     // Cancel the mouse click if we are showing a context menu
     if (!ContextHelper.popupState)
       this._dispatchMouseEvent("Browser:MouseUp", aX, aY, aModifiers);
-    this._dispatchMouseEvent("Browser:MouseCancel");
+    this._dispatchMouseEvent("Browser:MouseCancel"); */
   },
 
   doubleClick: function doubleClick(aX1, aY1, aX2, aY2) {
     TapHighlightHelper.hide();
 
     this._dispatchMouseEvent("Browser:MouseCancel");
 
     const kDoubleClickRadius = 32;
--- a/mobile/chrome/content/content.css
+++ b/mobile/chrome/content/content.css
@@ -43,16 +43,20 @@
 * > *:not(embed):focus, * > *:focus > font {
   outline: 2px solid #8db8d8 !important;
   /*
     XXX How do I preserve mac focusring without blowing focus color on other platforms?
     outline-color: -moz-mac-focusring !important;
   */
 }
 
+html {
+  background: white;
+}
+
 *:link:focus, *:visited:focus {
   outline-offset: -2px;
 }
 
 /* Style the scrollbars */
 xul|scrollbar {
   -moz-appearance: none !important;
   display: none !important;