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:
Brian R. Bondy 2013-04-08 14:42:54 -04:00
Родитель 529c0f06b2
Коммит 09c491351e
1 изменённых файлов: 3 добавлений и 2 удалений

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

@ -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;
} }