Bug 944255 - about:start bookmarks and history tiles cut off when using split views r=sfoster a=lsblakk
authorRodrigo Silveira <rsilveira@mozilla.com>
Mon, 09 Dec 2013 10:41:58 -0800
changeset 175263 69a98ae06f1b92dff33037d9bd0aa17899df2f53
parent 175262 934314077dd1e2fa42be83ba3f9ff8a39c6e11db
child 175264 bab4f38bfe7c4376388b086185b08e28f706429e
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfoster, lsblakk
bugs944255
milestone28.0a2
Bug 944255 - about:start bookmarks and history tiles cut off when using split views r=sfoster a=lsblakk
browser/metro/base/tests/mochitest/helpers/ViewStateHelper.js
browser/metro/modules/View.jsm
--- a/browser/metro/base/tests/mochitest/helpers/ViewStateHelper.js
+++ b/browser/metro/base/tests/mochitest/helpers/ViewStateHelper.js
@@ -41,24 +41,26 @@ function setPortraitViewstate() {
   browser.style.borderRight = padding + "px solid gray";
 
   // cap the height to create more even surface for testing on
   if (fullHeight > maxPortraitHeight)
     browser.style.borderBottom = (fullHeight - maxPortraitHeight) + "px solid gray";
 
   ContentAreaObserver._updateViewState("portrait");
   ContentAreaObserver._dispatchBrowserEvent("SizeChanged");
+  yield waitForMessage("Content:SetWindowSize:Complete", browser.messageManager);
 
   // Make sure it renders the new mode properly
   yield waitForMs(0);
 }
 
 function restoreViewstate() {
   ContentAreaObserver._updateViewState("landscape");
   ContentAreaObserver._dispatchBrowserEvent("SizeChanged");
+  yield waitForMessage("Content:SetWindowSize:Complete", Browser.selectedBrowser.messageManager);
 
   ok(isLandscapeMode(), "restoreViewstate should restore landscape mode.");
 
   Browser.selectedBrowser.style.removeProperty("border-right");
   Browser.selectedBrowser.style.removeProperty("border-bottom");
 
   yield waitForMs(0);
 }
--- a/browser/metro/modules/View.jsm
+++ b/browser/metro/modules/View.jsm
@@ -22,28 +22,28 @@ function makeURI(aURL, aOriginCharset, a
 
 
 // --------------------------------
 // View prototype for shared functionality
 
 function View(aSet) {
   this._set = aSet;
   this._set.controller = this;
+  this._window = aSet.ownerDocument.defaultView;
 
-  this.viewStateObserver = {
-    observe: (aSubject, aTopic, aData) => this._adjustDOMforViewState(aData)
-  };
-  Services.obs.addObserver(this.viewStateObserver, "metro_viewstate_changed", false);
+  this.onResize = () => this._adjustDOMforViewState();
+  this._window.addEventListener("resize", this.onResize);
+
   ColorUtils.init();
   this._adjustDOMforViewState();
 }
 
 View.prototype = {
   destruct: function () {
-    Services.obs.removeObserver(this.viewStateObserver, "metro_viewstate_changed");
+    this._window.removeEventListener("resize", this.onResize);
   },
 
   _adjustDOMforViewState: function _adjustDOMforViewState(aState) {
     let grid = this._set;
     if (!grid) {
       return;
     }
     if (!aState) {