Title: [234822] trunk/Source/WebInspectorUI
Revision
234822
Author
[email protected]
Date
2018-08-13 15:44:18 -0700 (Mon, 13 Aug 2018)

Log Message

Web Inspector: Table should handle row selection instead of the table delegate
https://bugs.webkit.org/show_bug.cgi?id=188534
<rdar://problem/43253335>

Reviewed by Joseph Pecoraro.

Row selection should be implemented by Table, rather than its delegate.

* UserInterface/Views/NetworkTableContentView.js:
(WI.NetworkTableContentView.prototype.tableShouldSelectRow):
(WI.NetworkTableContentView.prototype.tableCellMouseDown): Deleted.
Prevent selection unless the clicked cell belongs to the name column.

* UserInterface/Views/ResourceCookiesContentView.js:
(WI.ResourceCookiesContentView.prototype.tableShouldSelectRow):
Always prevent selection.

* UserInterface/Views/Table.js:
(WI.Table):
(WI.Table.prototype._handleMouseDown):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (234821 => 234822)


--- trunk/Source/WebInspectorUI/ChangeLog	2018-08-13 22:29:37 UTC (rev 234821)
+++ trunk/Source/WebInspectorUI/ChangeLog	2018-08-13 22:44:18 UTC (rev 234822)
@@ -1,3 +1,26 @@
+2018-08-13  Matt Baker  <[email protected]>
+
+        Web Inspector: Table should handle row selection instead of the table delegate
+        https://bugs.webkit.org/show_bug.cgi?id=188534
+        <rdar://problem/43253335>
+
+        Reviewed by Joseph Pecoraro.
+
+        Row selection should be implemented by Table, rather than its delegate.
+
+        * UserInterface/Views/NetworkTableContentView.js:
+        (WI.NetworkTableContentView.prototype.tableShouldSelectRow):
+        (WI.NetworkTableContentView.prototype.tableCellMouseDown): Deleted.
+        Prevent selection unless the clicked cell belongs to the name column.
+
+        * UserInterface/Views/ResourceCookiesContentView.js:
+        (WI.ResourceCookiesContentView.prototype.tableShouldSelectRow):
+        Always prevent selection.
+
+        * UserInterface/Views/Table.js:
+        (WI.Table):
+        (WI.Table.prototype._handleMouseDown):
+
 2018-08-12  Aditya Keerthi  <[email protected]>
 
         [macOS] Color wells should appear pressed when presenting a color picker

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js (234821 => 234822)


--- trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js	2018-08-13 22:29:37 UTC (rev 234821)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js	2018-08-13 22:44:18 UTC (rev 234822)
@@ -324,14 +324,6 @@
 
     // Table delegate
 
-    tableCellMouseDown(table, cell, column, rowIndex, event)
-    {
-        if (column !== this._nameColumn)
-            return;
-
-        this._table.selectRow(rowIndex);
-    }
-
     tableCellContextMenuClicked(table, cell, column, rowIndex, event)
     {
         if (column !== this._nameColumn)
@@ -347,6 +339,11 @@
         contextMenu.appendItem(WI.UIString("Export HAR"), () => { this._exportHAR(); });
     }
 
+    tableShouldSelectRow(table, cell, column, rowIndex)
+    {
+        return column === this._nameColumn;
+    }
+
     tableSelectedRowChanged(table, rowIndex)
     {
         if (isNaN(rowIndex)) {

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceCookiesContentView.js (234821 => 234822)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceCookiesContentView.js	2018-08-13 22:29:37 UTC (rev 234821)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceCookiesContentView.js	2018-08-13 22:44:18 UTC (rev 234822)
@@ -58,6 +58,11 @@
 
     // Table delegate
 
+    tableShouldSelectRow(table, cell, column, rowIndex)
+    {
+        return false;
+    }
+
     tablePopulateCell(table, cell, column, rowIndex)
     {
         let cookie = this._dataSourceForTable(table)[rowIndex];

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/Table.js (234821 => 234822)


--- trunk/Source/WebInspectorUI/UserInterface/Views/Table.js	2018-08-13 22:29:37 UTC (rev 234821)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/Table.js	2018-08-13 22:44:18 UTC (rev 234822)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2017 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008-2018 Apple Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -56,8 +56,7 @@
         this._scrollContainerElement.className = "data-container";
         this._scrollContainerElement.addEventListener("scroll", scrollHandler);
         this._scrollContainerElement.addEventListener("mousewheel", scrollHandler);
-        if (this._delegate.tableCellMouseDown)
-            this._scrollContainerElement.addEventListener("mousedown", this._handleMouseDown.bind(this));
+        this._scrollContainerElement.addEventListener("mousedown", this._handleMouseDown.bind(this));
         if (this._delegate.tableCellContextMenuClicked)
             this._scrollContainerElement.addEventListener("contextmenu", this._handleContextMenu.bind(this));
 
@@ -1202,7 +1201,10 @@
         let column = this._visibleColumns[columnIndex];
         let rowIndex = row.__index;
 
-        this._delegate.tableCellMouseDown(this, cell, column, rowIndex, event);
+        if (this._delegate.tableShouldSelectRow && !this._delegate.tableShouldSelectRow(this, cell, column, rowIndex))
+            return;
+
+        this.selectRow(rowIndex);
     }
 
     _handleContextMenu(event)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to