mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-30 05:35:31 +00:00
Bug 556619 - portrait mode - about:config rows shorter than a touchheight [r=vingtetun]
This commit is contained in:
parent
35e1a8079a
commit
7adc4a3d4b
@ -226,6 +226,16 @@ BrowserView.Util = {
|
||||
resizeContainerToViewport: function resizeContainerToViewport(container, viewportRect) {
|
||||
container.style.width = viewportRect.width + 'px';
|
||||
container.style.height = viewportRect.height + 'px';
|
||||
},
|
||||
|
||||
ensureMozScrolledAreaEvent: function ensureMozScrolledAreaEvent(aBrowser, aWidth, aHeight) {
|
||||
let event = document.createEvent("Event");
|
||||
event.initEvent("MozScrolledAreaChanged", true, false);
|
||||
event.x = 0;
|
||||
event.y = 0;
|
||||
event.width = aWidth;
|
||||
event.height = aHeight;
|
||||
aBrowser.dispatchEvent(event);
|
||||
}
|
||||
};
|
||||
|
||||
@ -602,10 +612,8 @@ BrowserView.prototype = {
|
||||
if (!browser)
|
||||
return 0;
|
||||
|
||||
let metaData = Util.contentIsHandheld(browser);
|
||||
if (metaData.reason == "handheld" || metaData.reason == "doctype")
|
||||
return 1;
|
||||
else if (metaData.reason == "viewport" && metaData.scale > 0)
|
||||
let metaData = Util.getViewportMetadata(browser);
|
||||
if (metaData.reason)
|
||||
return metaData.scale;
|
||||
|
||||
let zl = this.getPageZoomLevel();
|
||||
|
@ -113,17 +113,20 @@ let Util = {
|
||||
return makeURI(url, null, makeURI(base)).spec;
|
||||
},
|
||||
|
||||
contentIsHandheld: function contentIsHandheld(browser) {
|
||||
getViewportMetadata: function getViewportMetadata(browser) {
|
||||
let doctype = browser.contentDocument.doctype;
|
||||
if (doctype && /(WAP|WML|Mobile)/.test(doctype.publicId))
|
||||
return {reason: "doctype", result: true};
|
||||
return { reason: "doctype", result: true, scale: 1.0 };
|
||||
|
||||
let windowUtils = browser.contentWindow
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let handheldFriendly = windowUtils.getDocumentMetadata("HandheldFriendly");
|
||||
if (handheldFriendly == "true")
|
||||
return {reason: "handheld", result: true};
|
||||
return { reason: "handheld", result: true, scale: 1.0 };
|
||||
|
||||
if (browser.contentDocument instanceof XULDocument)
|
||||
return { reason: "chrome", result: true, scale: 1.0, autoSize: true, allowZoom: false };
|
||||
|
||||
// viewport details found here
|
||||
// http://developer.apple.com/safari/library/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html
|
||||
@ -147,11 +150,12 @@ let Util = {
|
||||
scale: viewportScale,
|
||||
width: viewportWidth,
|
||||
height: viewportHeight,
|
||||
autoSize: viewportWidthStr == "device-width" || viewportHeightStr == "device-height"
|
||||
autoSize: viewportWidthStr == "device-width" || viewportHeightStr == "device-height",
|
||||
allowZoom: windowUtils.getDocumentMetadata("viewport-user-scalable") != "no"
|
||||
}
|
||||
}
|
||||
|
||||
return {reason: "", result: false};
|
||||
return { reason: "", result: false, allowZoom: true };
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -379,7 +379,6 @@ var Browser = {
|
||||
}
|
||||
|
||||
function resizeHandler(e) {
|
||||
|
||||
if (e.target != window)
|
||||
return;
|
||||
|
||||
@ -404,7 +403,12 @@ var Browser = {
|
||||
Browser.styles["browser-handheld"].width = window.screen.width + "px";
|
||||
Browser.styles["browser-handheld"].height = scaledScreenH + "px";
|
||||
|
||||
// Tell the UI to resize the browser controls before calling updateSize
|
||||
// Cause a resize of the viewport if the current browser holds a XUL document
|
||||
let browser = Browser.selectedBrowser;
|
||||
if (browser.contentDocument instanceof XULDocument)
|
||||
BrowserView.Util.ensureMozScrolledAreaEvent(browser, w, h);
|
||||
|
||||
// Tell the UI to resize the browser controls
|
||||
BrowserUI.sizeControls(w, h);
|
||||
|
||||
bv.updateDefaultZoom();
|
||||
@ -2965,12 +2969,14 @@ Tab.prototype = {
|
||||
|
||||
// Determine at what resolution the browser is rendered based on meta tag
|
||||
let browser = this._browser;
|
||||
let metaData = Util.contentIsHandheld(browser);
|
||||
let metaData = Util.getViewportMetadata(browser);
|
||||
|
||||
// Remove any fixed size properties
|
||||
browser.style.removeProperty("width");
|
||||
browser.style.removeProperty("height");
|
||||
|
||||
if (metaData.reason == "handheld" || metaData.reason == "doctype") {
|
||||
browser.className = "browser-handheld";
|
||||
browser.style.removeProperty("width");
|
||||
browser.style.removeProperty("height");
|
||||
} else if (metaData.reason == "viewport") {
|
||||
browser.className = "browser-viewport";
|
||||
if (metaData.autoSize) {
|
||||
@ -2997,24 +3003,18 @@ Tab.prototype = {
|
||||
browser.style.width = viewportW + "px";
|
||||
browser.style.height = viewportH + "px";
|
||||
}
|
||||
} else if (metaData.reason == "chrome") {
|
||||
browser.className = "browser-chrome window-width window-height";
|
||||
} else {
|
||||
browser.className = "browser";
|
||||
browser.style.removeProperty("width");
|
||||
browser.style.removeProperty("height");
|
||||
}
|
||||
|
||||
// Some documents are not firing MozScrolledAreaChanged and/or fired it for
|
||||
// sub-documents only
|
||||
let doc = browser.contentDocument;
|
||||
if (doc instanceof XULDocument || doc.body instanceof HTMLFrameSetElement) {
|
||||
let [w, h] = BrowserView.Util.getBrowserDimensions(browser);
|
||||
let event = document.createEvent("Event");
|
||||
event.initEvent("MozScrolledAreaChanged", true, false);
|
||||
event.x = 0;
|
||||
event.y = 0;
|
||||
event.width = w;
|
||||
event.height = h;
|
||||
browser.dispatchEvent(event);
|
||||
let [width, height] = BrowserView.Util.getBrowserDimensions(browser);
|
||||
BrowserView.Util.ensureMozScrolledAreaEvent(browser, width, height);
|
||||
}
|
||||
|
||||
this.setIcon(browser.mIconURL);
|
||||
|
@ -195,7 +195,7 @@ var ViewConfig = {
|
||||
_handleWindowResize: function _handleWindowResize() {
|
||||
let mainBox = document.getElementById("main-container");
|
||||
let textbox = document.getElementById("textbox");
|
||||
let height = window.outerHeight - textbox.getBoundingClientRect().height;
|
||||
let height = window.innerHeight - textbox.getBoundingClientRect().height;
|
||||
|
||||
mainBox.setAttribute("height", height);
|
||||
},
|
||||
|
@ -34,6 +34,12 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@media all and (orientation: portrait) {
|
||||
#editor-container > hbox {
|
||||
-moz-box-orient: vertical;
|
||||
}
|
||||
}
|
||||
|
||||
richlistitem {
|
||||
-moz-box-align: center;
|
||||
}
|
||||
|
@ -34,6 +34,12 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
@media all and (orientation: portrait) {
|
||||
#editor-container > hbox {
|
||||
-moz-box-orient: vertical;
|
||||
}
|
||||
}
|
||||
|
||||
richlistitem {
|
||||
-moz-box-align: center;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user