Web Inspector: Table selection should not require that rows be in the cache
authormattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Nov 2018 19:01:30 +0000 (19:01 +0000)
committermattbaker@apple.com <mattbaker@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Nov 2018 19:01:30 +0000 (19:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=190993
<rdar://problem/45613812>

Reviewed by Devin Rousso.

Source/WebInspectorUI:

Deselecting a table row shouldn't depend on it being in the cache. This
allows us to implement select all, and other kinds of bulk selection
actions that affect rows that haven't been revealed.

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

LayoutTests:

Add a test that a table row that is not in the cache can be selected/deselected.

* inspector/table/table-selection-expected.txt:
* inspector/table/table-selection.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237817 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/inspector/table/table-selection-expected.txt
LayoutTests/inspector/table/table-selection.html
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/Table.js

index 26c17ac..d9521ce 100644 (file)
@@ -1,3 +1,16 @@
+2018-11-05  Matt Baker  <mattbaker@apple.com>
+
+        Web Inspector: Table selection should not require that rows be in the cache
+        https://bugs.webkit.org/show_bug.cgi?id=190993
+        <rdar://problem/45613812>
+
+        Reviewed by Devin Rousso.
+
+        Add a test that a table row that is not in the cache can be selected/deselected.
+
+        * inspector/table/table-selection-expected.txt:
+        * inspector/table/table-selection.html:
+
 2018-11-05  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: show save/restore stack for recorded 2D Canvases
index 717fce8..fd905af 100644 (file)
@@ -1,4 +1,4 @@
-Tests for WI.Table.
+Tests for WI.Table selection.
 
 
 == Running test suite: Table.RowSelection
@@ -66,3 +66,11 @@ PASS: Table selection changed.
 PASS: selectedRow should be 1.
 PASS: selectedRows should be [1].
 
+-- Running test case: Table.SelectAndDeselectRow.NotCached
+Selecting row 999.
+PASS: Table selection changed.
+PASS: selectedRow should be 999.
+Deselecting row 999.
+PASS: Table selection changed.
+PASS: selectedRows should not include 999.
+
index f61b544..d28fa87 100644 (file)
@@ -133,11 +133,24 @@ function test()
         }
     });
 
+    suite.addTestCase({
+        name: "Table.SelectAndDeselectRow.NotCached",
+        description: "Select and deselect a row that is not in the table cache.",
+        test() {
+            let table = InspectorTest.createTable(1000);
+
+            triggerSelectRow(table, 999);
+            triggerDeselectRow(table, 999);
+
+            return true;
+        }
+    });
+
     suite.runTestCasesAndFinish();
 }
 </script>
 </head>
 <body onLoad="runTest()">
-    <p>Tests for WI.Table.</p>
+    <p>Tests for WI.Table selection.</p>
 </body>
 </html>
index c175028..485082d 100644 (file)
@@ -1,3 +1,18 @@
+2018-11-05  Matt Baker  <mattbaker@apple.com>
+
+        Web Inspector: Table selection should not require that rows be in the cache
+        https://bugs.webkit.org/show_bug.cgi?id=190993
+        <rdar://problem/45613812>
+
+        Reviewed by Devin Rousso.
+
+        Deselecting a table row shouldn't depend on it being in the cache. This
+        allows us to implement select all, and other kinds of bulk selection
+        actions that affect rows that haven't been revealed.
+
+        * UserInterface/Views/Table.js:
+        (WI.Table.prototype.deselectRow):
+
 2018-11-05  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: show save/restore stack for recorded 2D Canvases
index cdca16e..f753d9f 100644 (file)
@@ -355,10 +355,8 @@ WI.Table = class Table extends WI.View
             return;
 
         let oldSelectedRow = this._cachedRows.get(rowIndex);
-        if (!oldSelectedRow)
-            return;
-
-        oldSelectedRow.classList.remove("selected");
+        if (oldSelectedRow)
+            oldSelectedRow.classList.remove("selected");
 
         this._selectedRows.delete(rowIndex);