mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Back out b3bdec87d963 (bug 840722) for causing bug 842418. r=me
This commit is contained in:
parent
d07e148677
commit
e3dae9a442
@ -1083,7 +1083,7 @@ var BrowserApp = {
|
||||
if (focused) {
|
||||
// _zoomToElement will handle not sending any message if this input is already mostly filling the screen
|
||||
BrowserEventHandler._zoomToElement(focused, -1, false,
|
||||
aAllowZoom && !this.isTablet && !ViewportHandler.getViewportMetadata(aBrowser.contentWindow).isSpecified);
|
||||
aAllowZoom && !this.isTablet && !ViewportHandler.getViewportMetadata(aBrowser.contentWindow).hasMetaViewport);
|
||||
}
|
||||
},
|
||||
|
||||
@ -3777,13 +3777,13 @@ Tab.prototype = {
|
||||
aMetadata.minZoom = aMetadata.maxZoom = NaN;
|
||||
}
|
||||
|
||||
let scaleRatio = aMetadata.scaleRatio;
|
||||
let scaleRatio = aMetadata.scaleRatio = ViewportHandler.getScaleRatio();
|
||||
|
||||
if (aMetadata.defaultZoom > 0)
|
||||
if ("defaultZoom" in aMetadata && aMetadata.defaultZoom > 0)
|
||||
aMetadata.defaultZoom *= scaleRatio;
|
||||
if (aMetadata.minZoom > 0)
|
||||
if ("minZoom" in aMetadata && aMetadata.minZoom > 0)
|
||||
aMetadata.minZoom *= scaleRatio;
|
||||
if (aMetadata.maxZoom > 0)
|
||||
if ("maxZoom" in aMetadata && aMetadata.maxZoom > 0)
|
||||
aMetadata.maxZoom *= scaleRatio;
|
||||
|
||||
ViewportHandler.setMetadataForDocument(this.browser.contentDocument, aMetadata);
|
||||
@ -3809,8 +3809,13 @@ Tab.prototype = {
|
||||
|
||||
let metadata = this.metadata;
|
||||
if (metadata.autoSize) {
|
||||
viewportW = screenW / metadata.scaleRatio;
|
||||
viewportH = screenH / metadata.scaleRatio;
|
||||
if ("scaleRatio" in metadata) {
|
||||
viewportW = screenW / metadata.scaleRatio;
|
||||
viewportH = screenH / metadata.scaleRatio;
|
||||
} else {
|
||||
viewportW = screenW;
|
||||
viewportH = screenH;
|
||||
}
|
||||
} else {
|
||||
viewportW = metadata.width;
|
||||
viewportH = metadata.height;
|
||||
@ -3891,8 +3896,8 @@ Tab.prototype = {
|
||||
type: "Tab:ViewportMetadata",
|
||||
allowZoom: metadata.allowZoom,
|
||||
defaultZoom: metadata.defaultZoom || metadata.scaleRatio,
|
||||
minZoom: metadata.minZoom,
|
||||
maxZoom: metadata.maxZoom,
|
||||
minZoom: metadata.minZoom || 0,
|
||||
maxZoom: metadata.maxZoom || 0,
|
||||
tabID: this.id
|
||||
});
|
||||
},
|
||||
@ -5459,7 +5464,14 @@ var ViewportHandler = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the ViewportMetadata object.
|
||||
* Returns an object with the page's preferred viewport properties:
|
||||
* defaultZoom (optional float): The initial scale when the page is loaded.
|
||||
* minZoom (optional float): The minimum zoom level.
|
||||
* maxZoom (optional float): The maximum zoom level.
|
||||
* width (optional int): The CSS viewport width in px.
|
||||
* height (optional int): The CSS viewport height in px.
|
||||
* autoSize (boolean): Resize the CSS viewport when the window resizes.
|
||||
* allowZoom (boolean): Let the user zoom in or out.
|
||||
*/
|
||||
getViewportMetadata: function getViewportMetadata(aWindow) {
|
||||
let windowUtils = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
||||
@ -5491,22 +5503,12 @@ var ViewportHandler = {
|
||||
if (isNaN(scale) && isNaN(minScale) && isNaN(maxScale) && allowZoomStr == "" && widthStr == "" && heightStr == "") {
|
||||
// Only check for HandheldFriendly if we don't have a viewport meta tag
|
||||
let handheldFriendly = windowUtils.getDocumentMetadata("HandheldFriendly");
|
||||
if (handheldFriendly == "true") {
|
||||
return new ViewportMetadata({
|
||||
defaultZoom: 1,
|
||||
autoSize: true,
|
||||
allowZoom: true
|
||||
});
|
||||
}
|
||||
if (handheldFriendly == "true")
|
||||
return { defaultZoom: 1, autoSize: true, allowZoom: true };
|
||||
|
||||
let doctype = aWindow.document.doctype;
|
||||
if (doctype && /(WAP|WML|Mobile)/.test(doctype.publicId)) {
|
||||
return new ViewportMetadata({
|
||||
defaultZoom: 1,
|
||||
autoSize: true,
|
||||
allowZoom: true
|
||||
});
|
||||
}
|
||||
if (doctype && /(WAP|WML|Mobile)/.test(doctype.publicId))
|
||||
return { defaultZoom: 1, autoSize: true, allowZoom: true };
|
||||
|
||||
hasMetaViewport = false;
|
||||
let defaultZoom = Services.prefs.getIntPref("browser.viewport.defaultZoom");
|
||||
@ -5526,7 +5528,7 @@ var ViewportHandler = {
|
||||
(!widthStr && (heightStr == "device-height" || scale == 1.0)));
|
||||
}
|
||||
|
||||
return new ViewportMetadata({
|
||||
return {
|
||||
defaultZoom: scale,
|
||||
minZoom: minScale,
|
||||
maxZoom: maxScale,
|
||||
@ -5534,8 +5536,8 @@ var ViewportHandler = {
|
||||
height: height,
|
||||
autoSize: autoSize,
|
||||
allowZoom: allowZoom,
|
||||
isSpecified: hasMetaViewport
|
||||
});
|
||||
hasMetaViewport: hasMetaViewport
|
||||
};
|
||||
},
|
||||
|
||||
clamp: function(num, min, max) {
|
||||
@ -5570,7 +5572,7 @@ var ViewportHandler = {
|
||||
* metadata is available for that document.
|
||||
*/
|
||||
getMetadataForDocument: function getMetadataForDocument(aDocument) {
|
||||
let metadata = this._metadata.get(aDocument, new ViewportMetadata());
|
||||
let metadata = this._metadata.get(aDocument, this.getDefaultMetadata());
|
||||
return metadata;
|
||||
},
|
||||
|
||||
@ -5580,48 +5582,18 @@ var ViewportHandler = {
|
||||
this._metadata.delete(aDocument);
|
||||
else
|
||||
this._metadata.set(aDocument, aMetadata);
|
||||
},
|
||||
|
||||
/** Returns the default viewport metadata for a document. */
|
||||
getDefaultMetadata: function getDefaultMetadata() {
|
||||
return {
|
||||
autoSize: false,
|
||||
allowZoom: true,
|
||||
scaleRatio: ViewportHandler.getScaleRatio()
|
||||
};
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* An object which represents the page's preferred viewport properties:
|
||||
* width (int): The CSS viewport width in px.
|
||||
* height (int): The CSS viewport height in px.
|
||||
* defaultZoom (float): The initial scale when the page is loaded.
|
||||
* minZoom (float): The minimum zoom level.
|
||||
* maxZoom (float): The maximum zoom level.
|
||||
* autoSize (boolean): Resize the CSS viewport when the window resizes.
|
||||
* allowZoom (boolean): Let the user zoom in or out.
|
||||
* isSpecified (boolean): Whether the page viewport is specified or not.
|
||||
* scaleRatio (float): The device-pixel-to-CSS-px ratio.
|
||||
*/
|
||||
function ViewportMetadata(aMetadata = {}) {
|
||||
this.width = ("width" in aMetadata) ? aMetadata.width : 0;
|
||||
this.height = ("height" in aMetadata) ? aMetadata.height : 0;
|
||||
this.defaultZoom = ("defaultZoom" in aMetadata) ? aMetadata.defaultZoom : 0;
|
||||
this.minZoom = ("minZoom" in aMetadata) ? aMetadata.minZoom : 0;
|
||||
this.maxZoom = ("maxZoom" in aMetadata) ? aMetadata.maxZoom : 0;
|
||||
this.autoSize = ("autoSize" in aMetadata) ? aMetadata.autoSize : false;
|
||||
this.allowZoom = ("allowZoom" in aMetadata) ? aMetadata.allowZoom : true;
|
||||
this.isSpecified = ("isSpecified" in aMetadata) ? aMetadata.isSpecified : false;
|
||||
this.scaleRatio = ViewportHandler.getScaleRatio();
|
||||
Object.seal(this);
|
||||
}
|
||||
|
||||
ViewportMetadata.prototype = {
|
||||
width: null,
|
||||
height: null,
|
||||
defaultZoom: null,
|
||||
minZoom: null,
|
||||
maxZoom: null,
|
||||
autoSize: null,
|
||||
allowZoom: null,
|
||||
isSpecified: null,
|
||||
scaleRatio: null,
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Handler for blocked popups, triggered by DOMUpdatePageReport events in browser.xml
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user