зеркало из https://github.com/mozilla/pjs.git
Bug 404536 - "Right click on Web page button should be ignored (don't show context menu on web form controls except textboxes)" [p=ehsan.akhgari@gmail.com (Ehsan Akhgari [ehsan]) r=Mano ui-r+a1.9=beltzner]
This commit is contained in:
Родитель
a2b83c8e26
Коммит
c9c3e3c025
|
@ -362,7 +362,8 @@ nsContextMenu.prototype = {
|
|||
// Set various context menu attributes based on the state of the world.
|
||||
setTarget: function (aNode, aRangeParent, aRangeOffset) {
|
||||
const xulNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
if (aNode.namespaceURI == xulNS) {
|
||||
if (aNode.namespaceURI == xulNS ||
|
||||
this.isTargetAFormControl(aNode)) {
|
||||
this.shouldDisplay = false;
|
||||
return;
|
||||
}
|
||||
|
@ -1093,6 +1094,18 @@ nsContextMenu.prototype = {
|
|||
"contextMenu.hasBGImage = " + this.hasBGImage + "\n";
|
||||
},
|
||||
|
||||
// Returns true if aNode is a from control (except text boxes).
|
||||
// This is used to disable the context menu for form controls.
|
||||
isTargetAFormControl: function(aNode) {
|
||||
if (aNode instanceof HTMLInputElement)
|
||||
return (aNode.type != "text" && aNode.type != "password");
|
||||
|
||||
return (aNode instanceof HTMLButtonElement) ||
|
||||
(aNode instanceof HTMLSelectElement) ||
|
||||
(aNode instanceof HTMLOptionElement) ||
|
||||
(aNode instanceof HTMLOptGroupElement);
|
||||
},
|
||||
|
||||
isTargetATextBox: function(node) {
|
||||
if (node instanceof HTMLInputElement)
|
||||
return (node.type == "text" || node.type == "password")
|
||||
|
|
Загрузка…
Ссылка в новой задаче