Bug 934470 - Cursor pin disappears on drag in textarea input, r=margaret

This commit is contained in:
Mark Capella 2013-11-18 23:48:49 -05:00
parent 49274d490a
commit 0c05ef6452

View File

@ -17,6 +17,7 @@ var SelectionHandler = {
_cache: null,
_activeType: 0, // TYPE_NONE
_ignoreSelectionChanges: false, // True while user drags text selection handles
_ignoreCompositionChanges: false, // Persist caret during IME composition updates
// The window that holds the selection (can be a sub-frame)
get _contentWindow() {
@ -108,6 +109,9 @@ var SelectionHandler = {
this._ignoreSelectionChanges = true;
this._moveSelection(data.handleType == this.HANDLE_TYPE_START, data.x, data.y);
} else if (this._activeType == this.TYPE_CURSOR) {
// Ignore IMM composition notifications when caret movement starts
this._ignoreCompositionChanges = true;
// Send a click event to the text box, which positions the caret
this._sendMouseEvents(data.x, data.y);
@ -133,6 +137,10 @@ var SelectionHandler = {
}
// Act on selectionChange notifications after handle movement ends
this._ignoreSelectionChanges = false;
} else if (this._activeType == this.TYPE_CURSOR) {
// Act on IMM composition notifications after caret movement ends
this._ignoreCompositionChanges = false;
}
this._positionHandles();
break;
@ -158,7 +166,8 @@ var SelectionHandler = {
break;
case "compositionend":
if (this._activeType == this.TYPE_CURSOR) {
// compositionend messages normally terminate caret display
if (this._activeType == this.TYPE_CURSOR && !this._ignoreCompositionChanges) {
this._deactivate();
}
break;
@ -530,6 +539,7 @@ var SelectionHandler = {
this._isRTL = false;
this._cache = null;
this._ignoreSelectionChanges = false;
this._ignoreCompositionChanges = false;
},
_getViewOffset: function sh_getViewOffset() {