[Pkg-mozext-commits] [adblock-plus] 45/98: Issue 4525 - Filter Preferences: Move findbar to the top of the filters list

David Prévot taffit at moszumanska.debian.org
Tue Oct 24 01:30:17 UTC 2017


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository adblock-plus.

commit 8dd73cc21c9ba0e446893da52284991a0cc96c2e
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Fri Oct 14 10:09:02 2016 +0200

    Issue 4525 - Filter Preferences: Move findbar to the top of the filters list
---
 chrome/content/ui/filters-filterview.js | 14 +++++++++++---
 chrome/content/ui/filters-search.js     |  9 ++++-----
 chrome/content/ui/filters.xul           | 24 ++++++++++++------------
 chrome/skin/filters.css                 |  5 +++++
 4 files changed, 32 insertions(+), 20 deletions(-)

diff --git a/chrome/content/ui/filters-filterview.js b/chrome/content/ui/filters-filterview.js
index 7475787..2a824bc 100644
--- a/chrome/content/ui/filters-filterview.js
+++ b/chrome/content/ui/filters-filterview.js
@@ -462,14 +462,22 @@ var FilterView =
 
   /**
    * Selects a row in the tree and makes sure it is visible.
+   * @param {number} row
+   *   row index
+   * @param {boolean} [scrollToTop]
+   *   if true, the selected row should become the top row of the list if
+   *   possible, otherwise the list is only scrolled if the row isn't visible.
    */
-  selectRow: function(row)
+  selectRow: function(row, scrollToTop)
   {
     if (this.selection)
     {
       row = Math.min(Math.max(row, 0), this.data.length - 1);
       this.selection.select(row);
-      this.boxObject.ensureRowIsVisible(row);
+      if (scrollToTop)
+        this.boxObject.scrollToRow(row);
+      else
+        this.boxObject.ensureRowIsVisible(row);
     }
   },
 
@@ -489,7 +497,7 @@ var FilterView =
     }
     if (index >= 0)
     {
-      this.selectRow(index);
+      this.selectRow(index, true);
       this.treeElement.focus();
     }
   },
diff --git a/chrome/content/ui/filters-search.js b/chrome/content/ui/filters-search.js
index a6983f6..2909377 100644
--- a/chrome/content/ui/filters-search.js
+++ b/chrome/content/ui/filters-search.js
@@ -94,10 +94,9 @@ var FilterSearch =
       direction = (text == this.lastSearchString ? 1 : 0);
     this.lastSearchString = text;
 
-    function normalizeString(string)
-    {
-      return caseSensitive ? string : string.toLowerCase();
-    }
+    let normalizeString = (caseSensitive ?
+                           string => string :
+                           string => string.toLowerCase());
 
     function findText(startIndex)
     {
@@ -109,7 +108,7 @@ var FilterSearch =
         let filter = normalizeString(list.view.getCellText(i, col));
         if (filter.indexOf(text) >= 0)
         {
-          FilterView.selectRow(i);
+          FilterView.selectRow(i, true);
           return true;
         }
       }
diff --git a/chrome/content/ui/filters.xul b/chrome/content/ui/filters.xul
index 9298b2f..1cf36f4 100644
--- a/chrome/content/ui/filters.xul
+++ b/chrome/content/ui/filters.xul
@@ -344,6 +344,18 @@
       <button id="addFilterButton" label="&addFilter.label;" command="filters-add-command"/>
     </hbox>
 
+    <hbox id="findbar" hidden="true" align="center" onkeypress="FilterSearch.keyPress(event);">
+      <toolbarbutton id="findbar-closebutton" tooltiptext="&findbar.close;" oncommand="FilterSearch.close();"/>
+      <textbox id="findbar-textbox" type="search" placeholder="&findbar.placeholder;" flex="1" oncommand="FilterSearch.search();"/>
+      <spinbuttons id="findbar-findAgain" onup="FilterSearch.search(-1);" ondown="FilterSearch.search(1);"/>
+      <button id="findbar-case-sensitive" type="checkbox" label="&findbar.caseSensitive;" oncommand="FilterSearch.search(0);"/>
+      <stack>
+        <label id="findbar-status-wrappedStart" class="findbar-status" value="&findbar.statusWrappedStart;"/>
+        <label id="findbar-status-wrappedEnd" class="findbar-status" value="&findbar.statusWrappedEnd;"/>
+        <label id="findbar-status-notFound" class="findbar-status" value="&findbar.statusNotFound;"/>
+      </stack>
+    </hbox>
+
     <tree id="filtersTree"
         flex="1"
         editable="true"
@@ -371,18 +383,6 @@
           ondragstart="FilterActions.startDrag(event);"
           ondragend="FilterActions.endDrag(event);"/>
     </tree>
-
-    <hbox id="findbar" hidden="true" align="center" onkeypress="FilterSearch.keyPress(event);">
-      <toolbarbutton id="findbar-closebutton" tooltiptext="&findbar.close;" oncommand="FilterSearch.close();"/>
-      <textbox id="findbar-textbox" type="search" placeholder="&findbar.placeholder;" flex="1" oncommand="FilterSearch.search();"/>
-      <spinbuttons id="findbar-findAgain" onup="FilterSearch.search(-1);" ondown="FilterSearch.search(1);"/>
-      <button id="findbar-case-sensitive" type="checkbox" label="&findbar.caseSensitive;" oncommand="FilterSearch.search(0);"/>
-      <stack>
-        <label id="findbar-status-wrappedStart" class="findbar-status" value="&findbar.statusWrappedStart;"/>
-        <label id="findbar-status-wrappedEnd" class="findbar-status" value="&findbar.statusWrappedEnd;"/>
-        <label id="findbar-status-notFound" class="findbar-status" value="&findbar.statusNotFound;"/>
-      </stack>
-    </hbox>
   </vbox>
 </hbox>
 
diff --git a/chrome/skin/filters.css b/chrome/skin/filters.css
index a89023e..344245d 100644
--- a/chrome/skin/filters.css
+++ b/chrome/skin/filters.css
@@ -219,6 +219,11 @@ treechildren::-moz-tree-image(col-slow, slow-true)
 
 /* Findbar */
 
+#findbar
+{
+  border-top: 1px solid #888;
+}
+
 #findbar-closebutton
 {
   list-style-image: url(close.png);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git



More information about the Pkg-mozext-commits mailing list