Title: [185236] trunk/Source/WebInspectorUI
- Revision
- 185236
- Author
- nvasil...@apple.com
- Date
- 2015-06-04 21:31:18 -0700 (Thu, 04 Jun 2015)
Log Message
Web Inspector: Close and open tabs on mouseup, not mousedown
https://bugs.webkit.org/show_bug.cgi?id=145656
Match Safari's behaviour.
Reviewed by Timothy Hatcher.
* UserInterface/Views/TabBar.js:
(WebInspector.TabBar):
(WebInspector.TabBar.prototype.set newTabItem):
(WebInspector.TabBar.prototype._handleMouseDown):
(WebInspector.TabBar.prototype._handleClick): Added.
(WebInspector.TabBar.prototype._handleMouseUp):
(WebInspector.TabBar.prototype._handleNewTabClick): Added.
(WebInspector.TabBar.prototype._handleMouseMoved):
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (185235 => 185236)
--- trunk/Source/WebInspectorUI/ChangeLog 2015-06-05 03:37:35 UTC (rev 185235)
+++ trunk/Source/WebInspectorUI/ChangeLog 2015-06-05 04:31:18 UTC (rev 185236)
@@ -1,5 +1,23 @@
2015-06-04 Nikita Vasilyev <nvasil...@apple.com>
+ Web Inspector: Close and open tabs on mouseup, not mousedown
+ https://bugs.webkit.org/show_bug.cgi?id=145656
+
+ Match Safari's behaviour.
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Views/TabBar.js:
+ (WebInspector.TabBar):
+ (WebInspector.TabBar.prototype.set newTabItem):
+ (WebInspector.TabBar.prototype._handleMouseDown):
+ (WebInspector.TabBar.prototype._handleClick): Added.
+ (WebInspector.TabBar.prototype._handleMouseUp):
+ (WebInspector.TabBar.prototype._handleNewTabClick): Added.
+ (WebInspector.TabBar.prototype._handleMouseMoved):
+
+2015-06-04 Nikita Vasilyev <nvasil...@apple.com>
+
Web Inspector: Decrease tabs height to match Safari's tabs height
https://bugs.webkit.org/show_bug.cgi?id=145647
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js (185235 => 185236)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js 2015-06-05 03:37:35 UTC (rev 185235)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js 2015-06-05 04:31:18 UTC (rev 185236)
@@ -38,6 +38,7 @@
this._element.appendChild(topBorderElement);
this._element.addEventListener("mousedown", this._handleMouseDown.bind(this));
+ this._element.addEventListener("click", this._handleClick.bind(this));
this._element.addEventListener("mouseleave", this._handleMouseLeave.bind(this));
this._tabBarItems = [];
@@ -57,17 +58,22 @@
set newTabItem(newTabItem)
{
+ if (!this._handleNewTabClickListener)
+ this._handleNewTabClickListener = this._handleNewTabClick.bind(this);
+
if (!this._handleNewTabMouseEnterListener)
this._handleNewTabMouseEnterListener = this._handleNewTabMouseEnter.bind(this);
if (this._newTabItem) {
this._newTabItem.element.classList.remove("new-tab-button");
+ this._newTabItem.element.removeEventListener("click", this._handleNewTabClickListener);
this._newTabItem.element.removeEventListener("mouseenter", this._handleNewTabMouseEnterListener);
this.removeTabBarItem(this._newTabItem, true);
}
if (newTabItem) {
newTabItem.element.classList.add("new-tab-button");
+ newTabItem.element.addEventListener("click", this._handleNewTabClickListener);
newTabItem.element.addEventListener("mouseenter", this._handleNewTabMouseEnterListener);
this.addTabBarItem(newTabItem, true);
}
@@ -552,16 +558,12 @@
if (tabBarItem.disabled)
return;
- if (tabBarItem === this._newTabItem) {
- this.dispatchEventToListeners(WebInspector.TabBar.Event.NewTabItemClicked);
+ if (tabBarItem === this._newTabItem)
return;
- }
var closeButtonElement = event.target.enclosingNodeOrSelfWithClass(WebInspector.TabBarItem.CloseButtonStyleClassName);
- if (closeButtonElement) {
- this.removeTabBarItem(tabBarItem, false, true);
+ if (closeButtonElement)
return;
- }
this.selectedTabBarItem = tabBarItem;
@@ -589,6 +591,24 @@
event.stopPropagation();
}
+ _handleClick(event)
+ {
+ var itemElement = event.target.enclosingNodeOrSelfWithClass(WebInspector.TabBarItem.StyleClassName);
+ if (!itemElement)
+ return;
+
+ var tabBarItem = itemElement[WebInspector.TabBarItem.ElementReferenceSymbol];
+ if (!tabBarItem)
+ return;
+
+ if (tabBarItem.disabled)
+ return;
+
+ var closeButtonElement = event.target.enclosingNodeOrSelfWithClass(WebInspector.TabBarItem.CloseButtonStyleClassName);
+ if (closeButtonElement)
+ this.removeTabBarItem(tabBarItem, false, true);
+ }
+
_handleMouseMoved(event)
{
console.assert(event.button === 0);
@@ -669,7 +689,7 @@
this._element.classList.remove("dragging-tab");
if (!this._tabAnimatedClosedSinceMouseEnter) {
- this._element.classList.remove("static-layout")
+ this._element.classList.remove("static-layout");
this._clearTabBarItemSizesAndPositions();
} else {
var left = 0;
@@ -711,6 +731,10 @@
this._finishExpandingTabsAfterClose();
}
+ _handleNewTabClick(event) {
+ this.dispatchEventToListeners(WebInspector.TabBar.Event.NewTabItemClicked);
+ }
+
_handleNewTabMouseEnter(event)
{
if (!this._tabAnimatedClosedSinceMouseEnter || !this._element.classList.contains("static-layout") || this._element.classList.contains("animating"))
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes