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:
Botond Ballo ext:(%2C%20Brad%20Werth%20%3Cbwerth%40mozilla.com%3E) 2018-09-11 15:17:25 +00:00
Родитель 53c3707fbc
Коммит 55fbd36216
3 изменённых файлов: 62 добавлений и 5 удалений

Просмотреть файл

@ -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")