Chromium Code Reviews| Index: Source/devtools/front_end/StatusBarButton.js |
| diff --git a/Source/devtools/front_end/StatusBarButton.js b/Source/devtools/front_end/StatusBarButton.js |
| index 1e6fd78c80ebba7d369c9b760227f055e3336c0b..9e104ebc87b8b9b997dcee78f5c1188db8a6049c 100644 |
| --- a/Source/devtools/front_end/StatusBarButton.js |
| +++ b/Source/devtools/front_end/StatusBarButton.js |
| @@ -101,7 +101,7 @@ WebInspector.StatusBarButton = function(title, className, states) |
| { |
| WebInspector.StatusBarItem.call(this, document.createElement("button")); |
| this.element.className = className + " status-bar-item"; |
| - this.element.addEventListener("click", this._clicked.bind(this), false); |
| + this.element.addEventListener("click", this._clicked.bind(this, false), false); |
| this.glyph = document.createElement("div"); |
| this.glyph.className = "glyph"; |
| @@ -126,9 +126,12 @@ WebInspector.StatusBarButton = function(title, className, states) |
| } |
| WebInspector.StatusBarButton.prototype = { |
| - _clicked: function() |
| + /** |
| + * @param {boolean} fromLongClick |
| + */ |
| + _clicked: function(fromLongClick) |
| { |
| - this.dispatchEventToListeners("click"); |
| + this.dispatchEventToListeners("click", fromLongClick); |
| if (this._longClickInterval) { |
| clearInterval(this._longClickInterval); |
| delete this._longClickInterval; |
| @@ -319,9 +322,9 @@ WebInspector.StatusBarButton.prototype = { |
| { |
| var buttons = this._longClickOptionsData.buttonsProvider(); |
| var mainButtonClone = new WebInspector.StatusBarButton(this.title, this.className, this.states); |
| - mainButtonClone.addEventListener("click", this._clicked, this); |
| + mainButtonClone.addEventListener("click", this._clicked.bind(this, true), this); |
| mainButtonClone.state = this.state; |
| - buttons.push(mainButtonClone); |
| + buttons.unshift(mainButtonClone); |
|
aandrey
2013/12/23 09:04:10
if it is a refactoring that has nothing to do with
eustas
2013/12/26 07:35:37
It is essential. Without this change order of "add
|
| var mouseUpListener = mouseUp.bind(this); |
| document.documentElement.addEventListener("mouseup", mouseUpListener, false); |
| @@ -334,7 +337,7 @@ WebInspector.StatusBarButton.prototype = { |
| var topNotBottom = hostButtonPosition.top + buttonHeight * buttons.length < document.documentElement.offsetHeight; |
| - if (topNotBottom) |
| + if (!topNotBottom) |
| buttons = buttons.reverse(); |
| optionsBarElement.style.height = (buttonHeight * buttons.length) + "px"; |
| @@ -380,7 +383,7 @@ WebInspector.StatusBarButton.prototype = { |
| for (var i = 0; i < buttons.length; ++i) { |
| if (buttons[i].element.classList.contains("emulate-active")) { |
| buttons[i].element.classList.remove("emulate-active"); |
| - buttons[i]._clicked(); |
| + buttons[i]._clicked(true); |
| break; |
| } |
| } |