mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1011059 - Use editor rather than selection controller to select all; r=margaret
This commit is contained in:
parent
418c4d6dfa
commit
c8b355cd23
@ -401,7 +401,12 @@ var SelectionHandler = {
|
||||
}
|
||||
|
||||
// Else default to selectALL Document
|
||||
this._getSelectionController().selectAll();
|
||||
let editor = this._getEditor();
|
||||
if (editor) {
|
||||
editor.selectAll();
|
||||
} else {
|
||||
this._getSelectionController().selectAll();
|
||||
}
|
||||
|
||||
// Selection is entire HTMLHtmlElement, remove any trailing document whitespace
|
||||
let selection = this._getSelection();
|
||||
@ -712,6 +717,17 @@ var SelectionHandler = {
|
||||
return selection.toString().trim();
|
||||
},
|
||||
|
||||
_getEditor: function sh_getEditor() {
|
||||
if (this._targetElement instanceof Ci.nsIDOMNSEditableElement) {
|
||||
return this._targetElement.QueryInterface(Ci.nsIDOMNSEditableElement).editor;
|
||||
}
|
||||
return this._contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIEditingSession)
|
||||
.getEditorForWindow(this._contentWindow);
|
||||
},
|
||||
|
||||
_getSelectionController: function sh_getSelectionController() {
|
||||
if (this._targetElement instanceof Ci.nsIDOMNSEditableElement)
|
||||
return this._targetElement.QueryInterface(Ci.nsIDOMNSEditableElement).editor.selectionController;
|
||||
|
Loading…
Reference in New Issue
Block a user