Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: chrome/content/ui/filters-filterview.js

Issue 29357368: Issue 4525 - Filter Preferences: Move findbar to the top of the filters list (Closed) Base URL: https://hg.adblockplus.org/adblockplus
Patch Set: Created Oct. 14, 2016, 8:09 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/content/ui/filters-filterview.js
===================================================================
--- a/chrome/content/ui/filters-filterview.js
+++ b/chrome/content/ui/filters-filterview.js
@@ -457,24 +457,32 @@ var FilterView =
FilterView.addDummyRow();
this.selectRow(position);
}
},
/**
* 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);
}
},
/**
* Finds a particular filter in the list and selects it.
*/
selectFilter: function(/**Filter*/ filter)
{
@@ -484,17 +492,17 @@ var FilterView =
if (this.data[i].filter == filter)
{
index = i;
break;
}
}
if (index >= 0)
{
- this.selectRow(index);
+ this.selectRow(index, true);
Wladimir Palant 2016/10/14 08:12:12 Selecting a filter (typically when coming from blo
this.treeElement.focus();
}
},
/**
* Updates value of data property on sorting or filter subscription changes.
*/
updateData: function()

Powered by Google App Engine
This is Rietveld