Bug 1192281: Uplift Add-on SDK to fx-team. a=me

96ae8d914f...5ac44b7e08
This commit is contained in:
Dave Townsend
2015-09-04 14:49:04 -07:00
parent 48c0541f6d
commit 0372b17850
7 changed files with 113 additions and 14 deletions

View File

@@ -223,6 +223,20 @@ function show(panel, options, anchor) {
}
exports.show = show
function onPanelClick(event) {
let { target, metaKey, ctrlKey, shiftKey, button } = event;
let accel = platform === "darwin" ? metaKey : ctrlKey;
let isLeftClick = button === 0;
let isMiddleClick = button === 1;
if ((isLeftClick && (accel || shiftKey)) || isMiddleClick) {
let link = target.closest('a');
if (link && link.href)
getMostRecentBrowserWindow().openUILink(link.href, event)
}
}
function setupPanelFrame(frame) {
frame.setAttribute("flex", 1);
frame.setAttribute("transparent", "transparent");
@@ -301,6 +315,8 @@ function make(document) {
panel.addEventListener("popupshown", onPanelStateChange, false);
panel.addEventListener("popuphidden", onPanelStateChange, false);
panel.addEventListener("click", onPanelClick, false);
// Panel content document can be either in panel `viewFrame` or in
// a `backgroundFrame` depending on panel state. Listeners are set
// on both to avoid setting and removing listeners on panel state changes.