Bug 1463576 - 2. Add test-only geckoview.selection_action.show_on_focus pref; r=jchen

Add the "geckoview.selection_action.show_on_focus" pref for testing
only. The pref makes us show selection actions when the selection is
initially collapsed in an editor, which makes it easier to test behavior
for collapsed selections.

MozReview-Commit-ID: 3U6UfzokHaI

--HG--
extra : rebase_source : fa99dc24e50e09a905664e70ebc34b0ad219dfff
This commit is contained in:
Jim Chen 2018-06-01 13:39:20 -04:00
Родитель 81118778f8
Коммит 3442eee048
1 изменённых файлов: 5 добавлений и 1 удалений

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

@ -146,7 +146,9 @@ class GeckoViewSelectionActionContent extends GeckoViewContentModule {
} else if (aEvent.selectionEditable &&
aEvent.collapsed &&
reason !== "longpressonemptycontent" &&
reason !== "taponcaret") {
reason !== "taponcaret" &&
!Services.prefs.getBoolPref(
"geckoview.selection_action.show_on_focus", false)) {
// Don't show selection actions when merely focusing on an editor or
// repositioning the cursor. Wait until long press or the caret is tapped
// in order to match Android behavior.
@ -205,10 +207,12 @@ class GeckoViewSelectionActionContent extends GeckoViewContentModule {
onSuccess: response => {
if (response.seqNo !== this._seqNo) {
// Stale action.
warn `Stale response ${response.id}`;
return;
}
let action = actions.find(action => action.id === response.id);
if (action) {
debug `Performing ${response.id}`;
action.perform.call(this, aEvent, response);
} else {
warn `Invalid action ${response.id}`;