Ensure io_service is QId to nsIIOService2
[conkeror.git] / modules / popup.js
blob75f4525d900cf77c462fb4f9d045c23674d5040e
2 function popup_manager(frame)
4     this.frame = frame;
5     this.container = create_XUL(frame, "popupset");
6     frame.document.documentElement.appendChild(this.container);
7     this.active_popup = null;
10 define_keywords("$lose_focus_callback", "$gain_focus_callback");
11 popup_manager.prototype = {
12     create : function () {
13         var node = create_XUL(this.frame, "popup");
14         var obj = this;
15         node.addEventListener("popupshowing", function () {
16                 obj.active_popup = node;
17             },
18             true /* capture */,
19             false /* ignore untrusted events */);
20         node.addEventListener("popuphidden", function () {
21                 if (obj.active_popup == node)
22                     obj.active_popup = null;
23             },
24             true /* capture */,
25             false /* ignore untrusted events */);
26         this.container.appendChild(node);
27         return node;
28     },
29     remove : function (popup) {
30         this.container.removeChild(popup);
31     },
32     show_absolute : function (popup, x, y) {
33         popup.showPopup(this.frame.document.documentElement, x, y);
34     },
35     show_relative : function (popup, element, anchor, align) {
36         popup.showPopup(element, -1, -1, anchor, align);
37     }
40 function popup_initialize_frame(frame)
42     frame.popups = new popup_manager(frame);
45 add_hook("frame_initialize_early_hook", popup_initialize_frame);