зеркало из https://github.com/mozilla/gecko-dev.git
Bug 858359 - Remove Selectable context menu options on input and textareas when there is text and no selection. r=jimm
This commit is contained in:
Родитель
529c0f06b2
Коммит
09c491351e
|
@ -291,12 +291,13 @@ var ContextMenuHandler = {
|
||||||
|
|
||||||
// Don't include "copy" for password fields.
|
// Don't include "copy" for password fields.
|
||||||
if (!(elem instanceof Ci.nsIDOMHTMLInputElement) || elem.mozIsTextField(true)) {
|
if (!(elem instanceof Ci.nsIDOMHTMLInputElement) || elem.mozIsTextField(true)) {
|
||||||
|
// If there is a selection add cut and copy
|
||||||
if (selectionStart != selectionEnd) {
|
if (selectionStart != selectionEnd) {
|
||||||
state.types.push("cut");
|
state.types.push("cut");
|
||||||
state.types.push("copy");
|
state.types.push("copy");
|
||||||
state.string = elem.value.slice(selectionStart, selectionEnd);
|
state.string = elem.value.slice(selectionStart, selectionEnd);
|
||||||
}
|
} else if (elem.value && elem.textLength) {
|
||||||
if (elem.value && (selectionStart > 0 || selectionEnd < elem.textLength)) {
|
// There is text and it is not selected so add selectable items
|
||||||
state.types.push("selectable");
|
state.types.push("selectable");
|
||||||
state.string = elem.value;
|
state.string = elem.value;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче