Bug 384763 - left click broken in bookmarks menu. r=ssptizer.

This commit is contained in:
mozilla.mano@sent.com 2007-06-18 17:16:09 -07:00
parent 98a8321d77
commit d07fb7189a

View File

@ -845,35 +845,6 @@
} }
})]]></field> })]]></field>
<!-- Checks whether and event should be acted on by this menu
(It should be if the event affects one of this menu's child
nodes) -->
<method name="eventValid">
<parameter name="event"/>
<body><![CDATA[
if ((event.target.localName != "menuitem" &&
event.target.localName != "menuseparator" &&
event.target.localName != "menu") ||
event.target.parentNode != this)
return false;
return true;
]]></body>
</method>
<!-- Sets the active view to this view, and sets the selection
to the node from this event. -->
<method name="setSelectionForEvent">
<parameter name="event"/>
<body><![CDATA[
// Set the selection to the node that was clicked on. If that
// node has a command but no data associated with it, it should
// act on the entire menu.
this._selection = event.target.node;
if (event.target.node == null)
this._selection = this._resultNode;
]]></body>
</method>
<property name="selType" readonly="true" onget="return 'single';"/> <property name="selType" readonly="true" onget="return 'single';"/>
<method name="buildContextMenu"> <method name="buildContextMenu">
@ -899,6 +870,7 @@
if (event.target == this) if (event.target == this)
this.onPopupShowing(); this.onPopupShowing();
</handler> </handler>
<handler event="popuphidden"> <handler event="popuphidden">
if (event.target != this) if (event.target != this)
return; return;
@ -912,26 +884,26 @@
this.removeAttribute("autoopened"); this.removeAttribute("autoopened");
</handler> </handler>
<!-- Set selected node/active view on mousedown/DOMMenuItemActive events <!-- Set selected node on DOMMenuItemActive/contextmenu events
so that they're set up when command and click events fire. --> so that they're set up when command and click events fire. -->
<handler event="mousedown"><![CDATA[ <handler event="DOMMenuItemActive"><![CDATA[
if (this.eventValid(event)) { if (event.target.parentNode == this) {
this.setSelectionForEvent(event); // Set the selection to the node that was activated. If that
// Don't let the event bubble up to a parent toolbar. // node has a command but no data associated with it, it should
event.stopPropagation(); // act on the entire menu.
this._selection = event.target.node || this._resultNode;
} }
]]></handler> ]]></handler>
<handler event="DOMMenuItemActive"><![CDATA[ <handler event="contextmenu"><![CDATA[
if (this.eventValid(event)) // DOMMenuItemActive is not dispatched for disabled menuitems and
this.setSelectionForEvent(event); // menuseparators. Set the selection here manually.
]]></handler> var popupNode = document.popupNode;
<handler event="DOMMenuItemInactive"><![CDATA[ // |popupNode == this| happens when the area between menuseparators
this._selection = null; // is clicked.
]]></handler> if (popupNode == this || popupNode.parentNode == this)
<handler event="command"><![CDATA[ this._selection = popupNode.node || this._resultNode;
if (this.eventValid(event))
this.setSelectionForEvent(event);
]]></handler> ]]></handler>
<handler event="draggesture"><![CDATA[ <handler event="draggesture"><![CDATA[
if (event.target.localName == "menuitem") if (event.target.localName == "menuitem")
// TODO--allow menu drag if shift (or alt??) key is down // TODO--allow menu drag if shift (or alt??) key is down