зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1011059 - Use editor rather than selection controller to select all; r=margaret
This commit is contained in:
Родитель
184d9af88b
Коммит
6b423efa48
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче