Bug 940292 - when using Australis' customize mode, the bookmarks toolbar chevron breaks, r=jaws

--HG--
extra : rebase_source : a2eae90f12ec780af4d0c646fe49ee4d8f5d35d2
This commit is contained in:
Gijs Kruitbosch 2013-12-05 23:11:24 +01:00
parent 578f6b2e57
commit 031cb1a0bf
2 changed files with 38 additions and 24 deletions

View File

@ -869,7 +869,7 @@ let PlacesToolbarHelper = {
return document.getElementById("PlacesToolbar");
},
init: function PTH_init() {
init: function PTH_init(forceToolbarOverflowCheck) {
let viewElt = this._viewElt;
if (!viewElt || viewElt._placesView)
return;
@ -886,6 +886,9 @@ let PlacesToolbarHelper = {
return;
new PlacesToolbar(this._place);
if (forceToolbarOverflowCheck) {
viewElt._placesView.updateOverflowStatus();
}
},
customizeStart: function PTH_customizeStart() {
@ -900,7 +903,7 @@ let PlacesToolbarHelper = {
customizeDone: function PTH_customizeDone() {
this._isCustomizing = false;
this.init();
this.init(true);
},
onPlaceholderCommand: function () {

View File

@ -1037,32 +1037,14 @@ PlacesToolbar.prototype = {
this.updateChevron();
break;
case "overflow":
if (aEvent.target != aEvent.currentTarget)
if (!this._isOverflowStateEventRelevant(aEvent))
return;
// Ignore purely vertical overflows.
if (aEvent.detail == 0)
return;
// Attach the popup binding to the chevron popup if it has not yet
// been initialized.
if (!this._chevronPopup.hasAttribute("type")) {
this._chevronPopup.setAttribute("place", this.place);
this._chevronPopup.setAttribute("type", "places");
}
this._chevron.collapsed = false;
this.updateChevron();
this._onOverflow();
break;
case "underflow":
if (aEvent.target != aEvent.currentTarget)
if (!this._isOverflowStateEventRelevant(aEvent))
return;
// Ignore purely vertical underflows.
if (aEvent.detail == 0)
return;
this.updateChevron();
this._chevron.collapsed = true;
this._onUnderflow();
break;
case "TabOpen":
case "TabClose":
@ -1103,6 +1085,35 @@ PlacesToolbar.prototype = {
}
},
updateOverflowStatus: function() {
if (this._rootElt.scrollLeftMax > 0) {
this._onOverflow();
} else {
this._onUnderflow();
}
},
_isOverflowStateEventRelevant: function PT_isOverflowStateEventRelevant(aEvent) {
// Ignore events not aimed at ourselves, as well as purely vertical ones:
return aEvent.target == aEvent.currentTarget && aEvent.detail > 0;
},
_onOverflow: function PT_onOverflow() {
// Attach the popup binding to the chevron popup if it has not yet
// been initialized.
if (!this._chevronPopup.hasAttribute("type")) {
this._chevronPopup.setAttribute("place", this.place);
this._chevronPopup.setAttribute("type", "places");
}
this._chevron.collapsed = false;
this.updateChevron();
},
_onUnderflow: function PT_onUnderflow() {
this.updateChevron();
this._chevron.collapsed = true;
},
updateChevron: function PT_updateChevron() {
// If the chevron is collapsed there's nothing to update.
if (this._chevron.collapsed)