author | Aleh Zasypkin <aleh.zasypkin@gmail.com> |
Thu, 06 Mar 2014 22:35:28 +0100 | |
changeset 173130 | 1b636faa318773541a796c0081f641cbd03ca8bf |
parent 173129 | 3c9c98992742be0349f65c340fdf53057b2c4fa1 |
child 173131 | b1b516d5c5e6c2d884e57107101b1e1f9b29193c |
push id | 26391 |
push user | cbook@mozilla.com |
push date | Wed, 12 Mar 2014 11:20:34 +0000 |
treeherder | mozilla-central@a56837cfc67c [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jimm |
bugs | 858206 |
milestone | 30.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
browser/metro/base/content/contenthandlers/SelectionHandler.js | file | annotate | diff | comparison | revisions |
--- a/browser/metro/base/content/contenthandlers/SelectionHandler.js +++ b/browser/metro/base/content/contenthandlers/SelectionHandler.js @@ -113,23 +113,34 @@ var SelectionHandler = { } // Sanity check to be sure we are initialized if (!this._targetElement) { this._onFail("not initialized"); return; } - // Similar to _onSelectionStart - we need to create initial selection - // but without the initialization bits. - let framePoint = this._clientPointToFramePoint({ xPos: aX, yPos: aY }); - if (!this._domWinUtils.selectAtPoint(framePoint.xPos, framePoint.yPos, - Ci.nsIDOMWindowUtils.SELECT_CHARACTER)) { - this._onFail("failed to set selection at point"); - return; + // Only use selectAtPoint for editable content and avoid that for inputs, + // as we can expand caret to selection manually more precisely. We can use + // selectAtPoint for inputs too though, but only once bug 881938 is fully + // resolved. + if(Util.isEditableContent(this._targetElement)) { + // Similar to _onSelectionStart - we need to create initial selection + // but without the initialization bits. + let framePoint = this._clientPointToFramePoint({ xPos: aX, yPos: aY }); + if (!this._domWinUtils.selectAtPoint(framePoint.xPos, framePoint.yPos, + Ci.nsIDOMWindowUtils.SELECT_CHARACTER)) { + this._onFail("failed to set selection at point"); + return; + } + } else if (this._targetElement.selectionStart == 0 || aMarker == "end") { + // Expand caret forward or backward depending on direction + this._targetElement.selectionEnd++; + } else { + this._targetElement.selectionStart--; } // We bail if things get out of sync here implying we missed a message. this._selectionMoveActive = true; // Update the position of the selection marker that is *not* // being dragged. this._updateSelectionUI("update", aMarker == "end", aMarker == "start");