diff options
author | Pale Moon <git-repo@palemoon.org> | 2016-02-27 23:49:02 +0100 |
---|---|---|
committer | Pale Moon <git-repo@palemoon.org> | 2016-02-27 23:49:02 +0100 |
commit | 4ef0ccbd25f709bb3853182c2871a3a36076812c (patch) | |
tree | 6089dac7a964859a66cf8e7eedfaaf12c1f289c4 | |
parent | 212c7cb934bd4dbe1779cab7b8f1d299c3799b89 (diff) | |
download | palemoon-gre-4ef0ccbd25f709bb3853182c2871a3a36076812c.tar.gz |
Handle command keys with keydown instead of keypress in tables/cells (including session restore, etc.)
-rw-r--r-- | toolkit/content/widgets/tree.xml | 148 |
1 files changed, 107 insertions, 41 deletions
diff --git a/toolkit/content/widgets/tree.xml b/toolkit/content/widgets/tree.xml index 2d407e9f7..a4f192703 100644 --- a/toolkit/content/widgets/tree.xml +++ b/toolkit/content/widgets/tree.xml @@ -440,7 +440,7 @@ <parameter name="event"/> <body> <![CDATA[ - if (this._editingColumn || this.view.rowCount == 0) + if (this.view.rowCount == 0) return; if (this._isAccelPressed(event) && this.view.selection.single) { @@ -482,7 +482,7 @@ <parameter name="event"/> <body> <![CDATA[ - if (this._editingColumn || this.view.rowCount == 0) + if (this.view.rowCount == 0) return; if (this.view.selection.single) { @@ -519,7 +519,7 @@ <parameter name="event"/> <body> <![CDATA[ - if (this._editingColumn || this.view.rowCount == 0) + if (this.view.rowCount == 0) return; if (this.pageUpOrDownMovesSelection == this._isAccelPressed(event)) { @@ -568,7 +568,7 @@ <parameter name="event"/> <body> <![CDATA[ - if (this._editingColumn || this.view.rowCount == 0) + if (this.view.rowCount == 0) return; if (this.view.rowCount == 1 && !this.view.selection.isSelected(0) && @@ -618,7 +618,7 @@ <parameter name="event"/> <body> <![CDATA[ - if (this._editingColumn || this.view.rowCount == 0) + if (this.view.rowCount == 0) return; if (this.view.selection.isSelected(edge) && this.view.selection.count == 1) { @@ -644,7 +644,7 @@ <parameter name="event"/> <body> <![CDATA[ - if (this._editingColumn || this.view.rowCount == 0) + if (this.view.rowCount == 0) return; if (this.view.rowCount == 1 && !this.view.selection.isSelected(0)) { @@ -739,13 +739,7 @@ <handler event="blur" action="this.treeBoxObject.focused = false;"/> <handler event="blur" phase="capturing" action="if (event.originalTarget == this.inputField.inputField) this.stopEditing(true);"/> - <handler event="keypress" keycode="VK_ENTER"> - if (this._handleEnter(event)) { - event.stopPropagation(); - event.preventDefault(); - } - </handler> - <handler event="keypress" keycode="VK_RETURN"> + <handler event="keydown" keycode="VK_RETURN"> if (this._handleEnter(event)) { event.stopPropagation(); event.preventDefault(); @@ -753,7 +747,7 @@ </handler> #ifndef XP_MACOSX <!-- Use F2 key to enter text editing. --> - <handler event="keypress" keycode="VK_F2"> + <handler event="keydown" keycode="VK_F2"> <![CDATA[ if (!this._cellSelType) return; @@ -765,7 +759,7 @@ </handler> #endif // XP_MACOSX - <handler event="keypress" keycode="VK_ESCAPE"> + <handler event="keydown" keycode="VK_ESCAPE"> <![CDATA[ if (this._editingColumn) { this.stopEditing(false); @@ -775,7 +769,7 @@ } ]]> </handler> - <handler event="keypress" keycode="VK_LEFT"> + <handler event="keydown" keycode="VK_LEFT"> <![CDATA[ if (this._editingColumn) return; @@ -823,7 +817,7 @@ } ]]> </handler> - <handler event="keypress" keycode="VK_RIGHT"> + <handler event="keydown" keycode="VK_RIGHT"> <![CDATA[ if (this._editingColumn) return; @@ -879,30 +873,102 @@ } ]]> </handler> - <handler event="keypress" keycode="VK_UP" preventdefault="true" - modifiers="accel any" action="_moveByOffset(-1, 0, event);"/> - <handler event="keypress" keycode="VK_DOWN" preventdefault="true" - modifiers="accel any" action="_moveByOffset(1, this.view.rowCount - 1, event);"/> - <handler event="keypress" keycode="VK_UP" preventdefault="true" - modifiers="accel any, shift" action="_moveByOffsetShift(-1, 0, event);"/> - <handler event="keypress" keycode="VK_DOWN" preventdefault="true" - modifiers="accel any, shift" action="_moveByOffsetShift(1, this.view.rowCount - 1, event);"/> - <handler event="keypress" keycode="VK_PAGE_UP" preventdefault="true" - modifiers="accel any" action="_moveByPage(-1, 0, event);"/> - <handler event="keypress" keycode="VK_PAGE_DOWN" preventdefault="true" - modifiers="accel any" action="_moveByPage(1, this.view.rowCount - 1, event);"/> - <handler event="keypress" keycode="VK_PAGE_UP" preventdefault="true" - modifiers="accel any, shift" action="_moveByPageShift(-1, 0, event);"/> - <handler event="keypress" keycode="VK_PAGE_DOWN" preventdefault="true" - modifiers="accel any, shift" action="_moveByPageShift(1, this.view.rowCount - 1, event);"/> - <handler event="keypress" keycode="VK_HOME" preventdefault="true" - modifiers="accel any" action="_moveToEdge(0, event);"/> - <handler event="keypress" keycode="VK_END" preventdefault="true" - modifiers="accel any" action="_moveToEdge(this.view.rowCount - 1, event);"/> - <handler event="keypress" keycode="VK_HOME" preventdefault="true" - modifiers="accel any, shift" action="_moveToEdgeShift(0, event);"/> - <handler event="keypress" keycode="VK_END" preventdefault="true" - modifiers="accel any, shift" action="_moveToEdgeShift(this.view.rowCount - 1, event);"/> + <handler event="keydown" keycode="VK_UP" modifiers="accel any"> + <![CDATA[ + if (this._editingColumn) + return; + _moveByOffset(-1, 0, event); + event.preventDefault(); + ]]> + </handler> + <handler event="keydown" keycode="VK_DOWN" modifiers="accel any"> + <![CDATA[ + if (this._editingColumn) + return; + _moveByOffset(1, this.view.rowCount - 1, event); + event.preventDefault(); + ]]> + </handler> + <handler event="keydown" keycode="VK_UP" modifiers="accel any, shift"> + <![CDATA[ + if (this._editingColumn) + return; + _moveByOffsetShift(-1, 0, event); + event.preventDefault(); + ]]> + </handler> + <handler event="keydown" keycode="VK_DOWN" modifiers="accel any, shift"> + <![CDATA[ + if (this._editingColumn) + return; + _moveByOffsetShift(1, this.view.rowCount - 1, event); + event.preventDefault(); + ]]> + </handler> + <handler event="keydown" keycode="VK_PAGE_UP" modifiers="accel any"> + <![CDATA[ + if (this._editingColumn) + return; + _moveByPage(-1, 0, event); + event.preventDefault(); + ]]> + </handler> + <handler event="keydown" keycode="VK_PAGE_DOWN" modifiers="accel any"> + <![CDATA[ + if (this._editingColumn) + return; + _moveByPage(1, this.view.rowCount - 1, event); + event.preventDefault(); + ]]> + </handler> + <handler event="keydown" keycode="VK_PAGE_UP" modifiers="accel any, shift"> + <![CDATA[ + if (this._editingColumn) + return; + _moveByPageShift(-1, 0, event); + event.preventDefault(); + ]]> + </handler> + <handler event="keydown" keycode="VK_PAGE_DOWN" modifiers="accel any, shift"> + <![CDATA[ + if (this._editingColumn) + return; + _moveByPageShift(1, this.view.rowCount - 1, event); + event.preventDefault(); + ]]> + </handler> + <handler event="keydown" keycode="VK_HOME" modifiers="accel any"> + <![CDATA[ + if (this._editingColumn) + return; + _moveToEdge(0, event); + event.preventDefault(); + ]]> + </handler> + <handler event="keydown" keycode="VK_END" modifiers="accel any"> + <![CDATA[ + if (this._editingColumn) + return; + _moveToEdge(this.view.rowCount - 1, event); + event.preventDefault(); + ]]> + </handler> + <handler event="keydown" keycode="VK_HOME" modifiers="accel any, shift"> + <![CDATA[ + if (this._editingColumn) + return; + _moveToEdgeShift(0, event); + event.preventDefault(); + ]]> + </handler> + <handler event="keydown" keycode="VK_END" modifiers="accel any, shift"> + <![CDATA[ + if (this._editingColumn) + return; + _moveToEdgeShift(this.view.rowCount - 1, event); + event.preventDefault(); + ]]> + </handler> <handler event="keypress"> <![CDATA[ if (this._editingColumn) |