Bug 1539827 - Use cmd_selectAll instead of nsISelectionController.selectAll on action bar r=geckoview-reviewers,esawin

After bug 676268 is landed, Gecko/Android supports `text/html` mime type on
clipboard. But copy command is sometimes failed after select all is executed.

`nsISelectionContoller.selectAll` is different of `cmd_selectAll`.
Since `cmd_selectAll` that is used on Firefox desktop doesn't select root
element, copy command always works well. So we should use it like desktop
browser on Fennec.

Also, GV already uses cmd_selectAll on action bar, so this is Fennec only.

Differential Revision: https://phabricator.services.mozilla.com/D25924

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Makoto Kato 2019-04-03 15:15:03 +00:00
Родитель 742034f638
Коммит 20f0f47eda
1 изменённых файлов: 1 добавлений и 23 удалений

Просмотреть файл

@ -409,7 +409,7 @@ var ActionBarHandler = {
}
// Close ActionBarHandler, then selectAll, and display handles.
ActionBarHandler._getSelectAllController(element, win).selectAll();
ActionBarHandler._getDocShell(win).doCommand("cmd_selectAll");
UITelemetry.addEvent("action.1", "actionbar", null, "select_all");
},
},
@ -797,28 +797,6 @@ var ActionBarHandler = {
return win.docShell.editingSession.getEditorForWindow(win);
},
/**
* Returns a selection controller.
*/
_getSelectionController: function(element = this._targetElement, win = this._contentWindow) {
if (this._isElementEditable(element)) {
return this._getEditor(element, win).selectionController;
}
return win.docShell.
QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsISelectionDisplay).
QueryInterface(Ci.nsISelectionController);
},
/**
* For selectAll(), provides the editor, or the default window selection Controller.
*/
_getSelectAllController: function(element = this._targetElement, win = this._contentWindow) {
let editor = this._getEditor(element, win);
return (editor) ?
editor : this._getSelectionController(element, win);
},
/**
* Call / Phone Helper methods.
*/