summaryrefslogtreecommitdiffstats
path: root/devtools/client/shared
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-02 17:52:34 +0100
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-03-02 17:52:34 +0100
commit166fb9f2893dcfb3375aa3227d116fb0ce2c6d42 (patch)
tree9bfd8bb159a20f00ff507ab9c27c22434155df23 /devtools/client/shared
parent26e53627d6922b3b965afd76fc5d72e3cc1d9ba5 (diff)
downloadUXP-166fb9f2893dcfb3375aa3227d116fb0ce2c6d42.tar
UXP-166fb9f2893dcfb3375aa3227d116fb0ce2c6d42.tar.gz
UXP-166fb9f2893dcfb3375aa3227d116fb0ce2c6d42.tar.lz
UXP-166fb9f2893dcfb3375aa3227d116fb0ce2c6d42.tar.xz
UXP-166fb9f2893dcfb3375aa3227d116fb0ce2c6d42.zip
moebius#339: Make it possible to add cookies, local and session storage entries
Issue #31 https://github.com/MoonchildProductions/moebius/pull/339
Diffstat (limited to 'devtools/client/shared')
-rw-r--r--devtools/client/shared/widgets/TableWidget.js27
1 files changed, 26 insertions, 1 deletions
diff --git a/devtools/client/shared/widgets/TableWidget.js b/devtools/client/shared/widgets/TableWidget.js
index 84645b5b1..c9fa55d77 100644
--- a/devtools/client/shared/widgets/TableWidget.js
+++ b/devtools/client/shared/widgets/TableWidget.js
@@ -123,6 +123,8 @@ function TableWidget(node, options = {}) {
TableWidget.prototype = {
items: null,
+ editBookmark: null,
+ scrollIntoViewOnUpdate: null,
/**
* Getter for the headers context menu popup id.
@@ -1159,7 +1161,9 @@ Column.prototype = {
},
/**
- * Called when a row is updated.
+ * Called when a row is updated e.g. a cell is changed. This means that
+ * for a new row this method will be called once for each column. If a single
+ * cell is changed this method will be called just once.
*
* @param {string} event
* The event name of the event. i.e. EVENTS.ROW_UPDATED
@@ -1168,7 +1172,23 @@ Column.prototype = {
*/
onRowUpdated: function (event, id) {
this._updateItems();
+
if (this.highlightUpdated && this.items[id] != null) {
+ if (this.table.scrollIntoViewOnUpdate) {
+ let cell = this.cells[this.items[id]];
+
+ // When a new row is created this method is called once for each column
+ // as each cell is updated. We can only scroll to cells if they are
+ // visible. We check for visibility and once we find the first visible
+ // cell in a row we scroll it into view and reset the
+ // scrollIntoViewOnUpdate flag.
+ if (cell.label.clientHeight > 0) {
+ cell.scrollIntoView();
+
+ this.table.scrollIntoViewOnUpdate = null;
+ }
+ }
+
if (this.table.editBookmark) {
// A rows position in the table can change as the result of an edit. In
// order to ensure that the correct row is highlighted after an edit we
@@ -1180,6 +1200,7 @@ Column.prototype = {
this.cells[this.items[id]].flash();
}
+
this.updateZebra();
},
@@ -1594,6 +1615,10 @@ Cell.prototype = {
this.label.focus();
},
+ scrollIntoView: function () {
+ this.label.scrollIntoView(false);
+ },
+
destroy: function () {
this.label.remove();
this.label = null;