Bug 902505 - Set a no-op CSS viewport on Metro to prevent clipping subframes improperly. r=jimm

This commit is contained in:
Matt Brubeck 2013-11-08 14:04:13 -05:00
parent 497f3af283
commit 6cd666f2ca

View File

@ -1312,6 +1312,9 @@ Tab.prototype = {
self._eventDeferred = null;
}
browser.addEventListener("pageshow", onPageShowEvent, true);
browser.addEventListener("DOMWindowCreated", this, false);
Elements.browsers.addEventListener("SizeChanged", this, false);
browser.messageManager.addMessageListener("Content:StateChange", this);
Services.obs.addObserver(this, "metro_viewstate_changed", false);
@ -1320,6 +1323,20 @@ Tab.prototype = {
this._loadUsingParams(browser, aURI, aParams);
},
updateViewport: function (aEvent) {
// <meta name=viewport> is not yet supported; just use the main window size.
this.browser.setWindowSize(window.innerWidth, window.innerHeight);
},
handleEvent: function (aEvent) {
switch (aEvent.type) {
case "DOMWindowCreated":
case "SizeChanged":
this.updateViewport();
break;
}
},
receiveMessage: function(aMessage) {
switch (aMessage.name) {
case "Content:StateChange":
@ -1348,6 +1365,8 @@ Tab.prototype = {
destroy: function destroy() {
this._browser.messageManager.removeMessageListener("Content:StateChange", this);
this._browser.removeEventListener("DOMWindowCreated", this, false);
Elements.browser.removeEventListener("SizeChanged", this, false);
Services.obs.removeObserver(this, "metro_viewstate_changed", false);
clearTimeout(this._updateThumbnailTimeout);