зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1290420 Part 3: Set the metaViewportOverride flag when viewing a device with touch event support in Responsive Design Mode. r=gl
Depends on D3375 Differential Revision: https://phabricator.services.mozilla.com/D3376 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
53c3707fbc
Коммит
55fbd36216
|
@ -638,12 +638,19 @@ ResponsiveUI.prototype = {
|
|||
* Whether a reload is needed to apply the change.
|
||||
*/
|
||||
updateTouchSimulation(enabled) {
|
||||
if (!enabled) {
|
||||
return this.emulationFront.clearTouchEventsOverride();
|
||||
}
|
||||
return this.emulationFront.setTouchEventsOverride(
|
||||
let reloadNeeded;
|
||||
if (enabled) {
|
||||
reloadNeeded = this.emulationFront.setTouchEventsOverride(
|
||||
Ci.nsIDocShell.TOUCHEVENTS_OVERRIDE_ENABLED
|
||||
);
|
||||
reloadNeeded |= this.emulationFront.setMetaViewportOverride(
|
||||
Ci.nsIDocShell.META_VIEWPORT_OVERRIDE_ENABLED
|
||||
);
|
||||
} else {
|
||||
reloadNeeded = this.emulationFront.clearTouchEventsOverride();
|
||||
reloadNeeded |= this.emulationFront.clearMetaViewportOverride();
|
||||
}
|
||||
return reloadNeeded;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -206,6 +206,33 @@ const EmulationActor = protocol.ActorClassWithSpec(emulationSpec, {
|
|||
return false;
|
||||
},
|
||||
|
||||
/* Meta viewport override */
|
||||
|
||||
_previousMetaViewportOverride: undefined,
|
||||
|
||||
setMetaViewportOverride(flag) {
|
||||
if (this.getMetaViewportOverride() == flag) {
|
||||
return false;
|
||||
}
|
||||
if (this._previousMetaViewportOverride === undefined) {
|
||||
this._previousMetaViewportOverride = this.getMetaViewportOverride();
|
||||
}
|
||||
|
||||
this.docShell.metaViewportOverride = flag;
|
||||
return true;
|
||||
},
|
||||
|
||||
getMetaViewportOverride() {
|
||||
return this.docShell.metaViewportOverride;
|
||||
},
|
||||
|
||||
clearMetaViewportOverride() {
|
||||
if (this._previousMetaViewportOverride !== undefined) {
|
||||
return this.setMetaViewportOverride(this._previousMetaViewportOverride);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
/* User agent override */
|
||||
|
||||
_previousUserAgentOverride: undefined,
|
||||
|
|
|
@ -78,6 +78,29 @@ const emulationSpec = generateActorSpec({
|
|||
}
|
||||
},
|
||||
|
||||
setMetaViewportOverride: {
|
||||
request: {
|
||||
flag: Arg(0, "number")
|
||||
},
|
||||
response: {
|
||||
valueChanged: RetVal("boolean")
|
||||
}
|
||||
},
|
||||
|
||||
getMetaViewportOverride: {
|
||||
request: {},
|
||||
response: {
|
||||
flag: RetVal("number")
|
||||
}
|
||||
},
|
||||
|
||||
clearMetaViewportOverride: {
|
||||
request: {},
|
||||
response: {
|
||||
valueChanged: RetVal("boolean")
|
||||
}
|
||||
},
|
||||
|
||||
setUserAgentOverride: {
|
||||
request: {
|
||||
flag: Arg(0, "string")
|
||||
|
|
Загрузка…
Ссылка в новой задаче