mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-18 15:55:36 +00:00
Bug 1634556 Part 1: Make web extension sidebars listen to zoom enlarge/reduce events. r=mixedpuppy
These events are fired for all parent process documents by the code that handles native mousewheel events. This change adds listeners to those events and handles them similarly to how they are handled for browsers. Differential Revision: https://phabricator.services.mozilla.com/D84767
This commit is contained in:
parent
d77c6c3700
commit
5b1f5cfb74
@ -70,6 +70,33 @@ function getBrowser(panel) {
|
|||||||
|
|
||||||
stack.appendChild(browser);
|
stack.appendChild(browser);
|
||||||
|
|
||||||
|
browser.addEventListener(
|
||||||
|
"DoZoomEnlargeBy10",
|
||||||
|
() => {
|
||||||
|
let { ZoomManager } = browser.ownerGlobal;
|
||||||
|
let zoom = browser.fullZoom;
|
||||||
|
zoom += 0.1;
|
||||||
|
if (zoom > ZoomManager.MAX) {
|
||||||
|
zoom = ZoomManager.MAX;
|
||||||
|
}
|
||||||
|
browser.fullZoom = zoom;
|
||||||
|
},
|
||||||
|
true
|
||||||
|
);
|
||||||
|
browser.addEventListener(
|
||||||
|
"DoZoomReduceBy10",
|
||||||
|
() => {
|
||||||
|
let { ZoomManager } = browser.ownerGlobal;
|
||||||
|
let zoom = browser.fullZoom;
|
||||||
|
zoom -= 0.1;
|
||||||
|
if (zoom < ZoomManager.MIN) {
|
||||||
|
zoom = ZoomManager.MIN;
|
||||||
|
}
|
||||||
|
browser.fullZoom = zoom;
|
||||||
|
},
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
return readyPromise.then(() => {
|
return readyPromise.then(() => {
|
||||||
ExtensionParent.apiManager.emit(
|
ExtensionParent.apiManager.emit(
|
||||||
"extension-browser-inserted",
|
"extension-browser-inserted",
|
||||||
|
@ -338,7 +338,7 @@ var PanelMultiView = class extends AssociatedToNode {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
doc.getElementById(id) ||
|
doc.getElementById(id) ||
|
||||||
viewCacheTemplate.content.querySelector("#" + id)
|
viewCacheTemplate?.content.querySelector("#" + id)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,6 +133,12 @@ async function updateZoomUI(aBrowser, aAnimate = false) {
|
|||||||
win.document,
|
win.document,
|
||||||
"appMenu-zoomReset-button"
|
"appMenu-zoomReset-button"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Exit early if UI elements aren't present.
|
||||||
|
if (!appMenuZoomReset) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let customizableZoomControls = win.document.getElementById("zoom-controls");
|
let customizableZoomControls = win.document.getElementById("zoom-controls");
|
||||||
let customizableZoomReset = win.document.getElementById("zoom-reset-button");
|
let customizableZoomReset = win.document.getElementById("zoom-reset-button");
|
||||||
let urlbarZoomButton = win.document.getElementById("urlbar-zoom-button");
|
let urlbarZoomButton = win.document.getElementById("urlbar-zoom-button");
|
||||||
|
Loading…
Reference in New Issue
Block a user