mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 899608 - Remove cruft from XULWidgetGroupWrapper, and move areaType getter into group wrappers. r=Gijs, rs=mak.
This commit is contained in:
parent
5df8cdb40d
commit
8b15c76968
@ -998,10 +998,11 @@ let PlacesToolbarHelper = {
|
||||
|
||||
let BookmarkingUI = {
|
||||
get button() {
|
||||
let widget = CustomizableUI.getWidget("bookmarks-menu-button")
|
||||
.forWindow(window);
|
||||
return widget.areaType == CustomizableUI.TYPE_TOOLBAR ? widget.node
|
||||
: null;
|
||||
let widgetGroup = CustomizableUI.getWidget("bookmarks-menu-button");
|
||||
if (widgetGroup.areaType == CustomizableUI.TYPE_TOOLBAR) {
|
||||
return widgetGroup.forWindow(window).node;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
get star() {
|
||||
@ -1233,9 +1234,9 @@ let BookmarkingUI = {
|
||||
}
|
||||
|
||||
// Handle special case when the button is in the panel.
|
||||
let widget = CustomizableUI.getWidget("bookmarks-menu-button")
|
||||
.forWindow(window);
|
||||
if (widget.areaType == CustomizableUI.TYPE_MENU_PANEL) {
|
||||
let widgetGroup = CustomizableUI.getWidget("bookmarks-menu-button");
|
||||
let widget = widgetGroup.forWindow(window);
|
||||
if (widgetGroup.areaType == CustomizableUI.TYPE_MENU_PANEL) {
|
||||
let view = document.getElementById("PanelUI-bookmarks");
|
||||
view.addEventListener("ViewShowing", this.onPanelMenuViewShowing);
|
||||
view.addEventListener("ViewHiding", this.onPanelMenuViewHiding);
|
||||
|
@ -2043,6 +2043,10 @@ function WidgetGroupWrapper(aWidget) {
|
||||
return wrapper;
|
||||
};
|
||||
|
||||
this.__defineGetter__("areaType", function() {
|
||||
return gAreas.get(aWidget.currentArea).get("type");
|
||||
});
|
||||
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
@ -2081,10 +2085,6 @@ function WidgetSingleWrapper(aWidget, aNode) {
|
||||
: aNode;
|
||||
});
|
||||
|
||||
this.__defineGetter__("areaType", function() {
|
||||
return aNode.getAttribute("customizableui-areatype") || "";
|
||||
});
|
||||
|
||||
this.__defineGetter__("overflowed", function() {
|
||||
return aNode.classList.contains("overflowedItem");
|
||||
});
|
||||
@ -2102,16 +2102,6 @@ function WidgetSingleWrapper(aWidget, aNode) {
|
||||
//XXXunf Going to need to hook this up to some events to keep it all live.
|
||||
function XULWidgetGroupWrapper(aWidgetId) {
|
||||
this.isGroup = true;
|
||||
|
||||
let nodes = [];
|
||||
|
||||
let placement = CustomizableUIInternal.getPlacementOfWidget(aWidgetId);
|
||||
if (placement) {
|
||||
let buildAreas = gBuildAreas.get(placement.area) || [];
|
||||
for (let areaNode of buildAreas)
|
||||
nodes.push(areaNode.ownerDocument.getElementById(aWidgetId));
|
||||
}
|
||||
|
||||
this.id = aWidgetId;
|
||||
this.type = "custom";
|
||||
this.provider = CustomizableUI.PROVIDER_XUL;
|
||||
@ -2132,6 +2122,15 @@ function XULWidgetGroupWrapper(aWidgetId) {
|
||||
return wrapper;
|
||||
};
|
||||
|
||||
this.__defineGetter__("areaType", function() {
|
||||
let placement = CustomizableUIInternal.getPlacementOfWidget(aWidgetId);
|
||||
if (!placement) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return gAreas.get(placement.area).get("type");
|
||||
});
|
||||
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
@ -2154,10 +2153,6 @@ function XULWidgetSingleWrapper(aWidgetId, aNode) {
|
||||
: aNode;
|
||||
});
|
||||
|
||||
this.__defineGetter__("areaType", function() {
|
||||
return aNode.getAttribute("customizableui-areatype") || "";
|
||||
});
|
||||
|
||||
this.__defineGetter__("overflowed", function() {
|
||||
return aNode.classList.contains("overflowedItem");
|
||||
});
|
||||
|
@ -528,8 +528,7 @@ const DownloadsIndicatorView = {
|
||||
} else {
|
||||
// If the downloads button is in the menu panel, open the Library
|
||||
let widgetGroup = CustomizableUI.getWidget("downloads-button");
|
||||
let widget = widgetGroup.forWindow(window);
|
||||
if (widget.areaType == CustomizableUI.TYPE_MENU_PANEL) {
|
||||
if (widgetGroup.areaType == CustomizableUI.TYPE_MENU_PANEL) {
|
||||
DownloadsPanel.showDownloadsHistory();
|
||||
} else {
|
||||
DownloadsPanel.showPanel();
|
||||
|
Loading…
Reference in New Issue
Block a user