mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 980130 - bookmarks button breaks after reset in Australis customize mode, r=jaws
--HG-- extra : rebase_source : 9bc03af491b69d3e31191d69cb3007ce5132bcf2
This commit is contained in:
parent
b7283dd6a1
commit
bd963982c2
@ -970,9 +970,10 @@ let PlacesToolbarHelper = {
|
||||
*/
|
||||
|
||||
let BookmarkingUI = {
|
||||
BOOKMARK_BUTTON_ID: "bookmarks-menu-button",
|
||||
get button() {
|
||||
delete this.button;
|
||||
let widgetGroup = CustomizableUI.getWidget("bookmarks-menu-button");
|
||||
let widgetGroup = CustomizableUI.getWidget(this.BOOKMARK_BUTTON_ID);
|
||||
return this.button = widgetGroup.forWindow(window).node;
|
||||
},
|
||||
|
||||
@ -987,7 +988,7 @@ let BookmarkingUI = {
|
||||
if (!this._shouldUpdateStarState()) {
|
||||
return null;
|
||||
}
|
||||
let widget = CustomizableUI.getWidget("bookmarks-menu-button")
|
||||
let widget = CustomizableUI.getWidget(this.BOOKMARK_BUTTON_ID)
|
||||
.forWindow(window);
|
||||
if (widget.overflowed)
|
||||
return widget.anchor;
|
||||
@ -1071,7 +1072,7 @@ let BookmarkingUI = {
|
||||
return;
|
||||
}
|
||||
|
||||
let widget = CustomizableUI.getWidget("bookmarks-menu-button")
|
||||
let widget = CustomizableUI.getWidget(this.BOOKMARK_BUTTON_ID)
|
||||
.forWindow(window);
|
||||
if (widget.overflowed) {
|
||||
// Don't open a popup in the overflow popup, rather just open the Library.
|
||||
@ -1133,7 +1134,7 @@ let BookmarkingUI = {
|
||||
},
|
||||
|
||||
_updateCustomizationState: function BUI__updateCustomizationState() {
|
||||
let placement = CustomizableUI.getPlacementOfWidget("bookmarks-menu-button");
|
||||
let placement = CustomizableUI.getPlacementOfWidget(this.BOOKMARK_BUTTON_ID);
|
||||
this._currentAreaType = placement && CustomizableUI.getAreaType(placement.area);
|
||||
},
|
||||
|
||||
@ -1167,10 +1168,30 @@ let BookmarkingUI = {
|
||||
},
|
||||
|
||||
onWidgetAdded: function BUI_widgetAdded(aWidgetId) {
|
||||
if (aWidgetId != "bookmarks-menu-button") {
|
||||
return;
|
||||
if (aWidgetId == this.BOOKMARK_BUTTON_ID) {
|
||||
this._onWidgetWasMoved();
|
||||
}
|
||||
},
|
||||
|
||||
onWidgetRemoved: function BUI_widgetRemoved(aWidgetId) {
|
||||
if (aWidgetId == this.BOOKMARK_BUTTON_ID) {
|
||||
this._onWidgetWasMoved();
|
||||
}
|
||||
},
|
||||
|
||||
onWidgetReset: function BUI_widgetReset(aNode, aContainer) {
|
||||
if (aNode == this.button) {
|
||||
this._onWidgetWasMoved();
|
||||
}
|
||||
},
|
||||
|
||||
onWidgetUndoMove: function BUI_undoWidgetUndoMove(aNode, aContainer) {
|
||||
if (aNode == this.button) {
|
||||
this._onWidgetWasMoved();
|
||||
}
|
||||
},
|
||||
|
||||
_onWidgetWasMoved: function BUI_widgetWasMoved() {
|
||||
let usedToUpdateStarState = this._shouldUpdateStarState();
|
||||
this._updateCustomizationState();
|
||||
if (!usedToUpdateStarState && this._shouldUpdateStarState()) {
|
||||
@ -1186,19 +1207,6 @@ let BookmarkingUI = {
|
||||
this._updateToolbarStyle();
|
||||
},
|
||||
|
||||
onWidgetRemoved: function BUI_widgetRemoved(aWidgetId) {
|
||||
if (aWidgetId != "bookmarks-menu-button") {
|
||||
return;
|
||||
}
|
||||
// If we're moved outside of customize mode, we need to uninit
|
||||
// our view so it gets reconstructed.
|
||||
if (!this._isCustomizing) {
|
||||
this._uninitView();
|
||||
}
|
||||
this._updateCustomizationState();
|
||||
this._updateToolbarStyle();
|
||||
},
|
||||
|
||||
onCustomizeEnd: function BUI_customizeEnd(aWindow) {
|
||||
if (aWindow == window) {
|
||||
this._isCustomizing = false;
|
||||
@ -1361,7 +1369,7 @@ let BookmarkingUI = {
|
||||
let view = document.getElementById("PanelUI-bookmarks");
|
||||
view.addEventListener("ViewShowing", this);
|
||||
view.addEventListener("ViewHiding", this);
|
||||
let anchor = document.getElementById("bookmarks-menu-button");
|
||||
let anchor = document.getElementById(this.BOOKMARK_BUTTON_ID);
|
||||
anchor.setAttribute("closemenu", "none");
|
||||
PanelUI.showSubView("PanelUI-bookmarks", anchor,
|
||||
CustomizableUI.AREA_PANEL);
|
||||
@ -1379,7 +1387,7 @@ let BookmarkingUI = {
|
||||
this._showSubview();
|
||||
return;
|
||||
}
|
||||
let widget = CustomizableUI.getWidget("bookmarks-menu-button")
|
||||
let widget = CustomizableUI.getWidget(this.BOOKMARK_BUTTON_ID)
|
||||
.forWindow(window);
|
||||
if (widget.overflowed) {
|
||||
// Allow to close the panel if the page is already bookmarked, cause
|
||||
@ -1517,7 +1525,7 @@ let BookmarkingUI = {
|
||||
},
|
||||
onWidgetOverflow: function(aNode, aContainer) {
|
||||
let win = aNode.ownerDocument.defaultView;
|
||||
if (aNode.id != "bookmarks-menu-button" || win != window)
|
||||
if (aNode.id != this.BOOKMARK_BUTTON_ID || win != window)
|
||||
return;
|
||||
|
||||
let currentLabel = aNode.getAttribute("label");
|
||||
@ -1533,7 +1541,7 @@ let BookmarkingUI = {
|
||||
|
||||
onWidgetUnderflow: function(aNode, aContainer) {
|
||||
let win = aNode.ownerDocument.defaultView;
|
||||
if (aNode.id != "bookmarks-menu-button" || win != window)
|
||||
if (aNode.id != this.BOOKMARK_BUTTON_ID || win != window)
|
||||
return;
|
||||
|
||||
// The view gets broken by being removed and reinserted. Uninit
|
||||
|
@ -112,6 +112,7 @@ let gRestoring = false;
|
||||
let gDirty = false;
|
||||
let gInBatchStack = 0;
|
||||
let gResetting = false;
|
||||
let gUndoResetting = false;
|
||||
|
||||
/**
|
||||
* gBuildAreas maps area IDs to actual area nodes within browser windows.
|
||||
@ -522,6 +523,8 @@ let CustomizableUIInternal = {
|
||||
this.insertWidgetBefore(node, currentNode, container, aArea);
|
||||
if (gResetting) {
|
||||
this.notifyListeners("onWidgetReset", node, container);
|
||||
} else if (gUndoResetting) {
|
||||
this.notifyListeners("onWidgetUndoMove", node, container);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2172,6 +2175,8 @@ let CustomizableUIInternal = {
|
||||
gUIStateBeforeReset.drawInTitlebar == null) {
|
||||
return;
|
||||
}
|
||||
gUndoResetting = true;
|
||||
|
||||
let uiCustomizationState = gUIStateBeforeReset.uiCustomizationState;
|
||||
let drawInTitlebar = gUIStateBeforeReset.drawInTitlebar;
|
||||
|
||||
@ -2191,6 +2196,8 @@ let CustomizableUIInternal = {
|
||||
}
|
||||
this._rebuildRegisteredAreas();
|
||||
}
|
||||
|
||||
gUndoResetting = false;
|
||||
},
|
||||
|
||||
_clearPreviousUIState: function() {
|
||||
@ -2464,6 +2471,11 @@ this.CustomizableUI = {
|
||||
* different location. aNode is the widget's node, aContainer is the
|
||||
* area it was moved into (NB: it might already have been there and been
|
||||
* moved to a different position!)
|
||||
* - onWidgetUndoMove(aNode, aContainer)
|
||||
* Fired after undoing a reset to default placements moves a widget's
|
||||
* node to a different location. aNode is the widget's node, aContainer
|
||||
* is the area it was moved into (NB: it might already have been there
|
||||
* and been moved to a different position!)
|
||||
* - onAreaReset(aArea, aContainer)
|
||||
* Fired after a reset to default placements is complete on an area's
|
||||
* DOM node. Note that this is fired for each DOM node. aArea is the area
|
||||
|
Loading…
Reference in New Issue
Block a user