mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 947284 - End text-selection handle is not visible when opting to select all text, r=margaret
This commit is contained in:
parent
b97fb99411
commit
9fbe40550b
@ -239,21 +239,14 @@ var SelectionHandler = {
|
||||
// Clear any existing selection from the document
|
||||
this._contentWindow.getSelection().removeAllRanges();
|
||||
|
||||
if (aOptions.mode == this.SELECT_ALL) {
|
||||
this._getSelectionController().selectAll();
|
||||
} else if (aOptions.mode == this.SELECT_AT_POINT) {
|
||||
if (!this._domWinUtils.selectAtPoint(aOptions.x, aOptions.y, Ci.nsIDOMWindowUtils.SELECT_WORDNOSPACE)) {
|
||||
this._deactivate();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
Services.console.logStringMessage("Invalid selection mode " + aOptions.mode);
|
||||
// Perform the appropriate selection method, if we can't determine method, or it fails, return
|
||||
if (!this._performSelection(aOptions)) {
|
||||
this._deactivate();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Double check results of successful selection operation
|
||||
let selection = this._getSelection();
|
||||
// If the range didn't have any text, let's bail
|
||||
if (!selection || selection.rangeCount == 0 || selection.getRangeAt(0).collapsed) {
|
||||
this._deactivate();
|
||||
return false;
|
||||
@ -283,6 +276,29 @@ var SelectionHandler = {
|
||||
return true;
|
||||
},
|
||||
|
||||
/*
|
||||
* Called to perform a selection operation, given a target element, selection method, starting point etc.
|
||||
*/
|
||||
_performSelection: function sh_performSelection(aOptions) {
|
||||
if (aOptions.mode == this.SELECT_ALL) {
|
||||
if (this._targetElement instanceof HTMLPreElement) {
|
||||
// Use SELECT_PARAGRAPH else we default to entire page including trailing whitespace
|
||||
return this._domWinUtils.selectAtPoint(1, 1, Ci.nsIDOMWindowUtils.SELECT_PARAGRAPH);
|
||||
} else {
|
||||
// Else default to selectALL Document
|
||||
this._getSelectionController().selectAll();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (aOptions.mode == this.SELECT_AT_POINT) {
|
||||
return this._domWinUtils.selectAtPoint(aOptions.x, aOptions.y, Ci.nsIDOMWindowUtils.SELECT_WORDNOSPACE);
|
||||
}
|
||||
|
||||
Services.console.logStringMessage("Invalid selection mode " + aOptions.mode);
|
||||
return false;
|
||||
},
|
||||
|
||||
/* Return true if the current selection (given by aPositions) is near to where the coordinates passed in */
|
||||
_selectionNearClick: function(aX, aY, aPositions) {
|
||||
let distance = 0;
|
||||
@ -517,14 +533,7 @@ var SelectionHandler = {
|
||||
},
|
||||
|
||||
selectAll: function sh_selectAll(aElement) {
|
||||
if (this._activeType != this.TYPE_SELECTION) {
|
||||
this.startSelection(aElement, { mode : this.SELECT_ALL });
|
||||
} else {
|
||||
let selectionController = this._getSelectionController();
|
||||
selectionController.selectAll();
|
||||
this._updateCacheForSelection();
|
||||
this._positionHandles();
|
||||
}
|
||||
this.startSelection(aElement, { mode : this.SELECT_ALL });
|
||||
},
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user