Bug 374610 - xul:menuitem should have a way to get parent xul:menu, r=enndeaking, sr=neil, a=mtschrep

This commit is contained in:
surkov.alexander@gmail.com 2008-02-06 23:07:08 -08:00
parent d8aebfb510
commit abe6a728ae
2 changed files with 28 additions and 18 deletions

View File

@ -37,9 +37,19 @@
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#include "nsIDOMXULElement.idl" #include "nsIDOMXULElement.idl"
interface nsIDOMXULContainerElement;
[scriptable, uuid(edfeaf37-3b24-4466-af7a-b3851044f1c1)] [scriptable, uuid(4650e55f-4777-4271-8b62-9603a7dd4614)]
interface nsIDOMXULContainerElement : nsIDOMXULElement interface nsIDOMXULContainerItemElement : nsIDOMXULElement
{
/**
* Returns the parent container if any.
*/
readonly attribute nsIDOMXULContainerElement parentContainer;
};
[scriptable, uuid(bc07c626-4294-43ae-9b0a-e726de0adcad)]
interface nsIDOMXULContainerElement : nsIDOMXULContainerItemElement
{ {
/** /**
* Creates an item for the given label and value and appends it to the * Creates an item for the given label and value and appends it to the
@ -87,9 +97,5 @@ interface nsIDOMXULContainerElement : nsIDOMXULElement
* @param aIndex - the index of the item to return * @param aIndex - the index of the item to return
*/ */
nsIDOMXULElement getItemAtIndex(in long aIndex); nsIDOMXULElement getItemAtIndex(in long aIndex);
/**
* Returns the parent container if any.
*/
readonly attribute nsIDOMXULElement parentContainer;
}; };

View File

@ -15,7 +15,8 @@
<resources> <resources>
<stylesheet src="chrome://global/skin/menu.css"/> <stylesheet src="chrome://global/skin/menu.css"/>
</resources> </resources>
<implementation implements="nsIDOMXULSelectControlItemElement, nsIAccessibleProvider"> <implementation implements="nsIDOMXULSelectControlItemElement, nsIDOMXULContainerItemElement, nsIAccessibleProvider">
<!-- nsIAccessibleProvider -->
<property name="accessibleType" readonly="true"> <property name="accessibleType" readonly="true">
<getter> <getter>
<![CDATA[ <![CDATA[
@ -25,6 +26,8 @@
]]> ]]>
</getter> </getter>
</property> </property>
<!-- nsIDOMXULSelectControlItemElement -->
<property name="selected" readonly="true" <property name="selected" readonly="true"
onget="return this.getAttribute('selected') == 'true';"/> onget="return this.getAttribute('selected') == 'true';"/>
<property name="control" readonly="true"> <property name="control" readonly="true">
@ -38,6 +41,17 @@
]]> ]]>
</getter> </getter>
</property> </property>
<!-- nsIDOMXULContainerItemElement -->
<property name="parentContainer" readonly="true">
<getter>
for (var parent = this.parentNode; parent; parent = parent.parentNode) {
if (parent instanceof Components.interfaces.nsIDOMXULContainerElement)
return parent;
}
return null;
</getter>
</property>
</implementation> </implementation>
</binding> </binding>
@ -141,16 +155,6 @@
</body> </body>
</method> </method>
<property name="parentContainer" readonly="true">
<getter>
for (var parent = this.parentNode; parent; parent = parent.parentNode) {
if (parent instanceof Components.interfaces.nsIDOMXULContainerElement)
return parent;
}
return null;
</getter>
</property>
<property name="menupopup" readonly="true"> <property name="menupopup" readonly="true">
<getter> <getter>
<![CDATA[ <![CDATA[