Changing broadcaster to use onbroadcast instead of oncommand. Adding the "braodcast" "commandupdate" and "input" events. Changed all xul observes nodes to use onbroadcast instead of onchange.

This commit is contained in:
saari%netscape.com 1999-09-21 23:02:35 +00:00
Родитель c51b1b4d09
Коммит 6df67e6af3
36 изменённых файлов: 226 добавлений и 688 удалений

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

@ -44,8 +44,8 @@ static char* mEventNames[] = {
"mousedown", "mouseup", "click", "dblclick", "mouseover",
"mouseout", "mousemove", "keydown", "keyup", "keypress",
"focus", "blur", "load", "unload", "abort", "error",
"submit", "reset", "change", "select", "paint" ,"text",
"create", "destroy", "command", "dragenter", "dragover", "dragexit",
"submit", "reset", "change", "select", "input", "paint" ,"text",
"create", "destroy", "command", "broadcast", "commandupdate", "dragenter", "dragover", "dragexit",
"dragdrop", "draggesture"
};
@ -695,6 +695,8 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType)
return mEventNames[eDOMEvents_change];
case NS_FORM_SELECTED:
return mEventNames[eDOMEvents_select];
case NS_FORM_INPUT:
return mEventNames[eDOMEvents_input];
case NS_PAINT:
return mEventNames[eDOMEvents_paint];
case NS_TEXT_EVENT:
@ -704,7 +706,11 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType)
case NS_MENU_DESTROY:
return mEventNames[eDOMEvents_destroy];
case NS_MENU_ACTION:
return mEventNames[eDOMEvents_action];
return mEventNames[eDOMEvents_command];
case NS_XUL_BROADCAST:
return mEventNames[eDOMEvents_broadcast];
case NS_XUL_COMMAND_UPDATE:
return mEventNames[eDOMEvents_commandupdate];
case NS_DRAGDROP_ENTER:
return mEventNames[eDOMEvents_dragenter];
case NS_DRAGDROP_OVER:

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

@ -57,11 +57,14 @@ public:
eDOMEvents_reset,
eDOMEvents_change,
eDOMEvents_select,
eDOMEvents_input,
eDOMEvents_paint,
eDOMEvents_text,
eDOMEvents_create,
eDOMEvents_destroy,
eDOMEvents_action,
eDOMEvents_command,
eDOMEvents_broadcast,
eDOMEvents_commandupdate,
eDOMEvents_dragenter,
eDOMEvents_dragover,
eDOMEvents_dragexit,

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

@ -335,6 +335,10 @@ nsresult nsEventListenerManager::GetIdentifiersForType(const nsString& aType, ns
aIID = kIDOMFormListenerIID;
*aFlags = NS_EVENT_BITS_FORM_SELECT;
}
else if (aType == "input") {
aIID = kIDOMFormListenerIID;
*aFlags = NS_EVENT_BITS_FORM_INPUT;
}
else if (aType == "load") {
aIID = kIDOMLoadListenerIID;
*aFlags = NS_EVENT_BITS_LOAD_LOAD;
@ -367,6 +371,14 @@ nsresult nsEventListenerManager::GetIdentifiersForType(const nsString& aType, ns
aIID = kIDOMMenuListenerIID;
*aFlags = NS_EVENT_BITS_MENU_ACTION;
}
else if (aType == "broadcast") {
aIID = kIDOMMenuListenerIID;
*aFlags = NS_EVENT_BITS_XUL_BROADCAST;
}
else if (aType == "commandupdate") {
aIID = kIDOMMenuListenerIID;
*aFlags = NS_EVENT_BITS_XUL_COMMAND_UPDATE;
}
else if (aType == "dragenter") {
aIID = NS_GET_IID(nsIDOMDragListener);
*aFlags = NS_EVENT_BITS_DRAG_ENTER;
@ -876,6 +888,7 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext& aPresContext,
case NS_FORM_RESET:
case NS_FORM_CHANGE:
case NS_FORM_SELECTED:
case NS_FORM_INPUT:
if (nsnull != mFormListeners) {
if (nsnull == *aDOMEvent) {
ret = NS_NewDOMUIEvent(aDOMEvent, aPresContext, aEvent);
@ -902,6 +915,9 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext& aPresContext,
case NS_FORM_SELECTED:
ret = mFormListener->Select(*aDOMEvent);
break;
case NS_FORM_INPUT:
ret = mFormListener->Input(*aDOMEvent);
break;
default:
break;
}
@ -930,6 +946,11 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext& aPresContext,
correctSubType = PR_TRUE;
}
break;
case NS_FORM_INPUT:
if (ls->mSubType & NS_EVENT_BITS_FORM_INPUT) {
correctSubType = PR_TRUE;
}
break;
default:
break;
}
@ -1105,6 +1126,8 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext& aPresContext,
case NS_MENU_CREATE:
case NS_MENU_DESTROY:
case NS_MENU_ACTION:
case NS_XUL_BROADCAST:
case NS_XUL_COMMAND_UPDATE:
if (nsnull != mMenuListeners) {
if (nsnull == *aDOMEvent) {
ret = NS_NewDOMUIEvent(aDOMEvent, aPresContext, aEvent);
@ -1128,6 +1151,12 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext& aPresContext,
case NS_MENU_ACTION:
ret = mMenuListener->Action(*aDOMEvent);
break;
case NS_XUL_BROADCAST:
ret = mMenuListener->Broadcast(*aDOMEvent);
break;
case NS_XUL_COMMAND_UPDATE:
ret = mMenuListener->CommandUpdate(*aDOMEvent);
break;
default:
break;
}
@ -1151,6 +1180,16 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext& aPresContext,
correctSubType = PR_TRUE;
}
break;
case NS_XUL_BROADCAST:
if (ls->mSubType & NS_EVENT_BITS_XUL_BROADCAST) {
correctSubType = PR_TRUE;
}
break;
case NS_XUL_COMMAND_UPDATE:
if (ls->mSubType & NS_EVENT_BITS_XUL_COMMAND_UPDATE) {
correctSubType = PR_TRUE;
}
break;
default:
break;
}

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

@ -157,6 +157,7 @@ protected:
#define NS_EVENT_BITS_FORM_RESET 0x02
#define NS_EVENT_BITS_FORM_CHANGE 0x04
#define NS_EVENT_BITS_FORM_SELECT 0x08
#define NS_EVENT_BITS_FORM_INPUT 0x10
//nsIDOMLoadListener
#define NS_EVENT_BITS_LOAD_NONE 0x00
@ -166,9 +167,11 @@ protected:
#define NS_EVENT_BITS_LOAD_ERROR 0x08
//nsIDOMMenuListener
#define NS_EVENT_BITS_MENU_CREATE 0x00
#define NS_EVENT_BITS_MENU_DESTROY 0x01
#define NS_EVENT_BITS_MENU_ACTION 0x02
#define NS_EVENT_BITS_MENU_CREATE 0x00
#define NS_EVENT_BITS_MENU_DESTROY 0x01
#define NS_EVENT_BITS_MENU_ACTION 0x02
#define NS_EVENT_BITS_XUL_BROADCAST 0x04
#define NS_EVENT_BITS_XUL_COMMAND_UPDATE 0x08
//nsIDOMDragListener
#define NS_EVENT_BITS_DRAG_NONE 0x00

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

@ -380,12 +380,12 @@ public:
nsresult AddScriptEventListener(nsIAtom* aName, const nsString& aValue, REFNSIID aIID);
nsresult ExecuteOnChangeHandler(nsIDOMElement* anElement, const nsString& attrName);
nsresult ExecuteOnBroadcastHandler(nsIDOMElement* anElement, const nsString& attrName);
PRBool ElementIsInDocument();
static nsresult
ExecuteJSCode(nsIDOMElement* anElement);
ExecuteJSCode(nsIDOMElement* anElement, nsEvent* aEvent);
// Used with treecol width attributes
static PRBool ParseNumericValue(const nsString& aString,
@ -516,9 +516,11 @@ static EventHandlerMapEntry kEventHandlerMap[] = {
{ "onabort", nsnull, &kIDOMLoadListenerIID },
{ "onerror", nsnull, &kIDOMLoadListenerIID },
{ "oncreate", nsnull, &kIDOMMenuListenerIID },
{ "ondestroy", nsnull, &kIDOMMenuListenerIID },
{ "oncommand", nsnull, &kIDOMMenuListenerIID },
{ "oncreate", nsnull, &kIDOMMenuListenerIID },
{ "ondestroy", nsnull, &kIDOMMenuListenerIID },
{ "oncommand", nsnull, &kIDOMMenuListenerIID },
{ "onbroadcast", nsnull, &kIDOMMenuListenerIID },
{ "oncommandupdate", nsnull, &kIDOMMenuListenerIID },
{ "onfocus", nsnull, &kIDOMFocusListenerIID },
{ "onblur", nsnull, &kIDOMFocusListenerIID },
@ -527,6 +529,7 @@ static EventHandlerMapEntry kEventHandlerMap[] = {
{ "onreset", nsnull, &kIDOMFormListenerIID },
{ "onchange", nsnull, &kIDOMFormListenerIID },
{ "onselect", nsnull, &kIDOMFormListenerIID },
{ "oninput", nsnull, &kIDOMFormListenerIID },
{ "onpaint", nsnull, &kIDOMPaintListenerIID },
@ -2415,7 +2418,7 @@ RDFElementImpl::SetAttribute(PRInt32 aNameSpaceID,
// XXX Should have a function that knows which attributes are special.
// First we set the attribute in the observer.
xulListener->mListener->SetAttribute(attribute, aValue);
ExecuteOnChangeHandler(xulListener->mListener, attribute);
ExecuteOnBroadcastHandler(xulListener->mListener, attribute);
}
}
}
@ -2825,8 +2828,8 @@ RDFElementImpl::HandleDOMEvent(nsIPresContext& aPresContext,
GetTagName(tagName);
if (aEvent->message == NS_MENU_ACTION || aEvent->message == NS_MENU_CREATE ||
aEvent->message == NS_MENU_DESTROY || aEvent->message == NS_FORM_SELECTED ||
aEvent->message == NS_FORM_CHANGE || aEvent->message == NS_DRAGDROP_ENTER ||
aEvent->message == NS_DRAGDROP_EXIT ||
aEvent->message == NS_XUL_BROADCAST || aEvent->message == NS_XUL_COMMAND_UPDATE ||
aEvent->message == NS_DRAGDROP_ENTER || aEvent->message == NS_DRAGDROP_EXIT ||
tagName == "menu" || tagName == "menuitem" ||
tagName == "menubar" || tagName == "key" || tagName == "keyset") {
nsCOMPtr<nsIEventListenerManager> listenerManager;
@ -3163,7 +3166,7 @@ RDFElementImpl::EnsureContentsGenerated(void) const
nsresult
RDFElementImpl::ExecuteOnChangeHandler(nsIDOMElement* anElement, const nsString& attrName)
RDFElementImpl::ExecuteOnBroadcastHandler(nsIDOMElement* anElement, const nsString& attrName)
{
// Now we execute the onchange handler in the context of the
// observer. We need to find the observer in order to
@ -3193,7 +3196,10 @@ RDFElementImpl::ExecuteOnChangeHandler(nsIDOMElement* anElement, const nsString&
if (listeningToAttribute == attrName) {
// This is the right observes node.
// Execute the onchange event handler
ExecuteJSCode(domElement);
nsEvent event;
event.eventStructType = NS_EVENT;
event.message = NS_XUL_BROADCAST;
ExecuteJSCode(domElement, &event);
}
}
}
@ -3237,7 +3243,7 @@ RDFElementImpl::ElementIsInDocument()
}
nsresult
RDFElementImpl::ExecuteJSCode(nsIDOMElement* anElement)
RDFElementImpl::ExecuteJSCode(nsIDOMElement* anElement, nsEvent* aEvent)
{
// This code executes in every presentation context in which this
// document is appearing.
@ -3266,10 +3272,7 @@ RDFElementImpl::ExecuteJSCode(nsIDOMElement* anElement)
// Handle the DOM event
nsEventStatus status = nsEventStatus_eIgnore;
nsEvent event;
event.eventStructType = NS_EVENT;
event.message = NS_FORM_CHANGE; // XXX: I feel dirty and evil for subverting this.
content->HandleDOMEvent(*aPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, status);
content->HandleDOMEvent(*aPresContext, aEvent, nsnull, NS_EVENT_FLAG_INIT, status);
}
return NS_OK;

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

@ -322,7 +322,7 @@ XULCommandDispatcherImpl::UpdateCommands(const nsString& aEventName)
nsEventStatus status = nsEventStatus_eIgnore;
nsEvent event;
event.eventStructType = NS_EVENT;
event.message = NS_FORM_CHANGE; // XXX: I feel dirty and evil for subverting this.
event.message = NS_XUL_COMMAND_UPDATE;
content->HandleDOMEvent(*context, &event, nsnull, NS_EVENT_FLAG_INIT, status);
}
}

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

@ -63,6 +63,13 @@ public:
* @returns whether the event was consumed or ignored. @see nsresult
*/
virtual nsresult Select(nsIDOMEvent* aEvent) = 0;
/**
* Processes a form input event
* @param aEvent @see nsIDOMEvent.h
* @returns whether the event was consumed or ignored. @see nsresult
*/
virtual nsresult Input(nsIDOMEvent* aEvent) = 0;
};

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

@ -35,6 +35,8 @@ public:
NS_IMETHOD Create(nsIDOMEvent* aEvent) = 0;
NS_IMETHOD Destroy(nsIDOMEvent* aEvent) = 0;
NS_IMETHOD Action(nsIDOMEvent* aEvent) = 0;
NS_IMETHOD Broadcast(nsIDOMEvent* aEvent) = 0;
NS_IMETHOD CommandUpdate(nsIDOMEvent* aEvent) = 0;
};
#endif // nsIDOMMenuListener_h__

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

@ -48,7 +48,7 @@
<!-- Interim hack to transition from nsIXULWindowCallbacks/ShowWindowWithArgs -->
<broadcaster id="dialog.start" ready="false"/>
<observes element="dialog.start" attribute="ready" onchange="EditorStartup('html')"/>
<observes element="dialog.start" attribute="ready" onbroadcast="EditorStartup('html')"/>
<!-- broadcaster nodes are appended here from the overlays -->
<broadcasterset id="broadcasterset">

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

@ -47,7 +47,7 @@
<!-- Interim hack to transition from nsIXULWindowCallbacks/ShowWindowWithArgs -->
<broadcaster id="dialog.start" ready="false"/>
<observes element="dialog.start" attribute="ready" onchange="EditorStartup('text')"/>
<observes element="dialog.start" attribute="ready" onbroadcast="EditorStartup('text')"/>
<!-- broadcaster nodes are appended here from the overlays -->
<broadcasterset id="broadcasterset">

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

@ -621,7 +621,7 @@
<!-- Formatting toolbar items -->
<titledbutton style="width:68pt" id="ParagraphPopupButton" value="&paragraphToolbarMenu.label;" class="popup" align="left" popupanchor="bottomleft">
<observes element="Editor:Paragraph:Format" attribute="format" onchange="onParagraphFormatChange()"/>
<observes element="Editor:Paragraph:Format" attribute="format" onbroadcast="onParagraphFormatChange()"/>
</titledbutton>
<titledbutton id="FontFacePopupButton" value="&fontToolbarMenu.label;" class="popup" align="right" popupanchor="bottomleft"/>
<titledbutton id="FontSizePopupButton" value="&sizeToolbarMenu.label;" class="popup" align="right" popupanchor="bottomleft"/>
@ -630,21 +630,21 @@
<!-- can't just use observes here because we don't want the value from the broadcaster -->
<titledbutton id="boldButton" value="&formatToolbar.boldChar;" onclick="EditorToggleStyle('bold')">
<observes element="Editor:Bold" attribute="bold" onchange="onStyleChange('bold')"/>
<observes element="Editor:Bold" attribute="bold" onbroadcast="onStyleChange('bold')"/>
</titledbutton>
<titledbutton id="italicButton" value="&formatToolbar.italicChar;" onclick="EditorToggleStyle('italic')">
<observes element="Editor:Italic" attribute="italic" onchange="onStyleChange('italic')"/>
<observes element="Editor:Italic" attribute="italic" onbroadcast="onStyleChange('italic')"/>
</titledbutton>
<titledbutton id="underlineButton" value="&formatToolbar.underlineChar;" onclick="EditorToggleStyle('underline')">
<observes element="Editor:Underline" attribute="underline" onchange="onStyleChange('underline')"/>
<observes element="Editor:Underline" attribute="underline" onbroadcast="onStyleChange('underline')"/>
</titledbutton>
<titledbutton id="ulButton" src="&bulletListIcon.url;" align="bottom" onclick="EditorInsertList('ul')">
<observes element="Editor:Paragraph:ListType" attribute="format" onchange="onListFormatChange('ul')"/>
<observes element="Editor:Paragraph:ListType" attribute="format" onbroadcast="onListFormatChange('ul')"/>
</titledbutton>
<titledbutton id="olButton" src="&numberListIcon.url;" align="bottom" onclick="EditorInsertList('ol')">
<observes element="Editor:Paragraph:ListType" attribute="format" onchange="onListFormatChange('ol')"/>
<observes element="Editor:Paragraph:ListType" attribute="format" onbroadcast="onListFormatChange('ol')"/>
</titledbutton>
<titledbutton id="outdentButton" src="&outdentIcon.url;" align="bottom" onclick="EditorIndent('outdent')"/>

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

@ -208,13 +208,13 @@
<spring flex="100%"/>
<progressmeter id="statusbar-icon" mode="normal" value="0" onclick="dumpProgress()">
<observes element="Browser:LoadingProgress" attribute="mode"/>
<observes element="Browser:Throbber" attribute="busy" onchange="onProgress()"/>
<observes element="Browser:Throbber" attribute="busy" onbroadcast="onProgress()"/>
</progressmeter>
<spring flex="100%"/>
</box>
<titledbutton id="statusText" align="right" flex="100%" value="Document: Done" style="font-family:sans-serif;font-size:2.5mm">
<observes element="Browser:Status" attribute="value" onchange="onStatus()"/>
<observes element="Browser:Status" attribute="value" onbroadcast="onStatus()"/>
</titledbutton>
<spring flex="100%"/>

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

@ -44,8 +44,8 @@ static char* mEventNames[] = {
"mousedown", "mouseup", "click", "dblclick", "mouseover",
"mouseout", "mousemove", "keydown", "keyup", "keypress",
"focus", "blur", "load", "unload", "abort", "error",
"submit", "reset", "change", "select", "paint" ,"text",
"create", "destroy", "command", "dragenter", "dragover", "dragexit",
"submit", "reset", "change", "select", "input", "paint" ,"text",
"create", "destroy", "command", "broadcast", "commandupdate", "dragenter", "dragover", "dragexit",
"dragdrop", "draggesture"
};
@ -695,6 +695,8 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType)
return mEventNames[eDOMEvents_change];
case NS_FORM_SELECTED:
return mEventNames[eDOMEvents_select];
case NS_FORM_INPUT:
return mEventNames[eDOMEvents_input];
case NS_PAINT:
return mEventNames[eDOMEvents_paint];
case NS_TEXT_EVENT:
@ -704,7 +706,11 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType)
case NS_MENU_DESTROY:
return mEventNames[eDOMEvents_destroy];
case NS_MENU_ACTION:
return mEventNames[eDOMEvents_action];
return mEventNames[eDOMEvents_command];
case NS_XUL_BROADCAST:
return mEventNames[eDOMEvents_broadcast];
case NS_XUL_COMMAND_UPDATE:
return mEventNames[eDOMEvents_commandupdate];
case NS_DRAGDROP_ENTER:
return mEventNames[eDOMEvents_dragenter];
case NS_DRAGDROP_OVER:

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

@ -57,11 +57,14 @@ public:
eDOMEvents_reset,
eDOMEvents_change,
eDOMEvents_select,
eDOMEvents_input,
eDOMEvents_paint,
eDOMEvents_text,
eDOMEvents_create,
eDOMEvents_destroy,
eDOMEvents_action,
eDOMEvents_command,
eDOMEvents_broadcast,
eDOMEvents_commandupdate,
eDOMEvents_dragenter,
eDOMEvents_dragover,
eDOMEvents_dragexit,

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

@ -335,6 +335,10 @@ nsresult nsEventListenerManager::GetIdentifiersForType(const nsString& aType, ns
aIID = kIDOMFormListenerIID;
*aFlags = NS_EVENT_BITS_FORM_SELECT;
}
else if (aType == "input") {
aIID = kIDOMFormListenerIID;
*aFlags = NS_EVENT_BITS_FORM_INPUT;
}
else if (aType == "load") {
aIID = kIDOMLoadListenerIID;
*aFlags = NS_EVENT_BITS_LOAD_LOAD;
@ -367,6 +371,14 @@ nsresult nsEventListenerManager::GetIdentifiersForType(const nsString& aType, ns
aIID = kIDOMMenuListenerIID;
*aFlags = NS_EVENT_BITS_MENU_ACTION;
}
else if (aType == "broadcast") {
aIID = kIDOMMenuListenerIID;
*aFlags = NS_EVENT_BITS_XUL_BROADCAST;
}
else if (aType == "commandupdate") {
aIID = kIDOMMenuListenerIID;
*aFlags = NS_EVENT_BITS_XUL_COMMAND_UPDATE;
}
else if (aType == "dragenter") {
aIID = NS_GET_IID(nsIDOMDragListener);
*aFlags = NS_EVENT_BITS_DRAG_ENTER;
@ -876,6 +888,7 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext& aPresContext,
case NS_FORM_RESET:
case NS_FORM_CHANGE:
case NS_FORM_SELECTED:
case NS_FORM_INPUT:
if (nsnull != mFormListeners) {
if (nsnull == *aDOMEvent) {
ret = NS_NewDOMUIEvent(aDOMEvent, aPresContext, aEvent);
@ -902,6 +915,9 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext& aPresContext,
case NS_FORM_SELECTED:
ret = mFormListener->Select(*aDOMEvent);
break;
case NS_FORM_INPUT:
ret = mFormListener->Input(*aDOMEvent);
break;
default:
break;
}
@ -930,6 +946,11 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext& aPresContext,
correctSubType = PR_TRUE;
}
break;
case NS_FORM_INPUT:
if (ls->mSubType & NS_EVENT_BITS_FORM_INPUT) {
correctSubType = PR_TRUE;
}
break;
default:
break;
}
@ -1105,6 +1126,8 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext& aPresContext,
case NS_MENU_CREATE:
case NS_MENU_DESTROY:
case NS_MENU_ACTION:
case NS_XUL_BROADCAST:
case NS_XUL_COMMAND_UPDATE:
if (nsnull != mMenuListeners) {
if (nsnull == *aDOMEvent) {
ret = NS_NewDOMUIEvent(aDOMEvent, aPresContext, aEvent);
@ -1128,6 +1151,12 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext& aPresContext,
case NS_MENU_ACTION:
ret = mMenuListener->Action(*aDOMEvent);
break;
case NS_XUL_BROADCAST:
ret = mMenuListener->Broadcast(*aDOMEvent);
break;
case NS_XUL_COMMAND_UPDATE:
ret = mMenuListener->CommandUpdate(*aDOMEvent);
break;
default:
break;
}
@ -1151,6 +1180,16 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext& aPresContext,
correctSubType = PR_TRUE;
}
break;
case NS_XUL_BROADCAST:
if (ls->mSubType & NS_EVENT_BITS_XUL_BROADCAST) {
correctSubType = PR_TRUE;
}
break;
case NS_XUL_COMMAND_UPDATE:
if (ls->mSubType & NS_EVENT_BITS_XUL_COMMAND_UPDATE) {
correctSubType = PR_TRUE;
}
break;
default:
break;
}

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

@ -157,6 +157,7 @@ protected:
#define NS_EVENT_BITS_FORM_RESET 0x02
#define NS_EVENT_BITS_FORM_CHANGE 0x04
#define NS_EVENT_BITS_FORM_SELECT 0x08
#define NS_EVENT_BITS_FORM_INPUT 0x10
//nsIDOMLoadListener
#define NS_EVENT_BITS_LOAD_NONE 0x00
@ -166,9 +167,11 @@ protected:
#define NS_EVENT_BITS_LOAD_ERROR 0x08
//nsIDOMMenuListener
#define NS_EVENT_BITS_MENU_CREATE 0x00
#define NS_EVENT_BITS_MENU_DESTROY 0x01
#define NS_EVENT_BITS_MENU_ACTION 0x02
#define NS_EVENT_BITS_MENU_CREATE 0x00
#define NS_EVENT_BITS_MENU_DESTROY 0x01
#define NS_EVENT_BITS_MENU_ACTION 0x02
#define NS_EVENT_BITS_XUL_BROADCAST 0x04
#define NS_EVENT_BITS_XUL_COMMAND_UPDATE 0x08
//nsIDOMDragListener
#define NS_EVENT_BITS_DRAG_NONE 0x00

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

@ -476,13 +476,13 @@ Rights Reserved.
<progressmeter id="statusbar-icon" mode="normal" value="0" onclick="dumpProgress()">
<observes element="Messenger:LoadingProgress" attribute="mode"/>
<observes element="Messenger:LoadingProgress" attribute="value"/>
<observes element="Messenger:Throbber" attribute="busy" onchange="onProgress()"/>
<observes element="Messenger:Throbber" attribute="busy" onbroadcast="onProgress()"/>
</progressmeter>
<spring flex="100%"/>
</box>
<titledbutton id="statusText" align="left" flex="100%" value="&statusText.label;" style="font-family:sans-serif;font-size:2.5mm">
<observes element="Messenger:Status" attribute="value" onchange="onStatus()"/>
<observes element="Messenger:Status" attribute="value" onbroadcast="onStatus()"/>
</titledbutton>
</box>

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

@ -97,7 +97,7 @@ ACTUALLY, EVERY TIME YOU TYPE ANY OF THE KEY DEFINED HERE AFTER WITHOUT ANY OF T
<!-- Interim hack to transition from nsIXULWindowCallbacks/ShowWindowWithArgs -->
<broadcaster id="dialog.start" ready="false"/>
<observes element="dialog.start" attribute="ready" onchange="ComposeStartup()"/>
<observes element="dialog.start" attribute="ready" onbroadcast="ComposeStartup()"/>
<!-- box id="toolbar" align="vertical" style="width:100%;height:100%" -->
<toolbox>

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

@ -1,194 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="xul.css" type="text/css"?>
<?xml-stylesheet href="prefmProgress.css" type="text/css"?>
<!DOCTYPE window
[
<!ENTITY downloadWindow.title "Updating profile">
<!ENTITY location "Location">
<!ENTITY saving "Saving">
<!ENTITY status "Status:">
<!ENTITY dialogStatus.label "( nn.nK of mm.mK bytes )">
<!ENTITY timeLeft "Time Left:">
<!ENTITY dialogTimeLeft.label "?">
<!ENTITY dialogCancel.label "Cancel">
]
>
<window xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Updating profile"
width="425"
height="225"
onload="onLoad()">
<data>
<broadcaster id="data.progress" type="progress" value="0" max="0" completed="false"/>
<broadcaster id="data.status" type="string" value=""/>
<broadcaster id="data.execute" command=""/>
</data>
<dialog>
<observes element="data.progress" attribute="value" onchange="onProgress()"/>
<observes element="data.progress" attribute="completed" onchange="onCompletion()"/>
<observes element="data.status" attribute="value" onchange="onStatus()"/>
</dialog>
<html:script>
var data;
var dialog;
function loadDialog() {
dialog.location.setAttribute( "value", data.location.getAttribute( "value" ) );
dialog.fileName.setAttribute( "value", data.fileName.getAttribute( "value" ) );
}
function onLoad() {
// Set global variables.
data = new Object;
data.progress = document.getElementById("data.progress");
data.status = document.getElementById("data.status");
data.execute = document.getElementById("data.execute");
dialog = new Object;
dialog.status = document.getElementById("dialog.status");
dialog.progress = document.getElementById("dialog.progress");
dialog.progressPercent = document.getElementById("dialog.progressPercent");
dialog.cancel = document.getElementById("dialog.cancel");
// Fill dialog.
loadDialog();
// Commence.
data.execute.setAttribute("command","start");
}
var started = false;
var completed = false;
var interval = 1000; // Update every 1000 milliseconds.
var lastUpdate = -interval; // Update initially.
function stop() {
if ( started &amp;&amp; !completed ) {
// Stop the download.
data.execute.setAttribute( "command", "stop" );
} else {
// Close the window.
data.execute.setAttribute( "command", "close" );
}
}
function onProgress() {
// Check for first time.
if ( !started ) {
// Initialize download start time.
started = true;
dialog.cancel.removeAttribute( "disabled" );
}
// Get stats.
var currentStatus = data.progress.getAttribute("value");
var max = data.progress.getAttribute("max");
// Determine if progress bar should update
// If a file isn't done copying, don't increment progress bar.
if ( currentStatus == lastUpdate ) {
return;
}
// Update with the current progress value.
lastUpdate = currentStatus;
// Update download rate.
var elapsed = now - startTime;
var rate; // bytes/sec
if ( elapsed ) {
rate = ( bytes * 1000 ) / elapsed;
} else {
rate = 0;
}
// Calculate percentage.
var percent = Math.round( (currentStatus*100)/max );
// Advance progress meter.
dialog.progress.setAttribute( "value", percent );
// Update percentage label on progress meter.
dialog.progressPercent.childNodes[0].nodeValue = percent + "%";
}
function onCompletion() {
if ( !completed ) {
completed = true;
data.execute.setAttribute( "command", "close" );
}
}
function onStatus() {
var txt = data.status.getAttribute( "value" );
dialog.status.childNodes[0].nodeValue = txt;
}
</html:script>
<html:table style="width:100%;">
<html:tr>
<html:td align="right">
&location;
</html:td>
<html:td align="left">
<html:input id="dialog.location" readonly="" style="background-color:lightgray;width:300px;"/>
</html:td>
</html:tr>
<html:tr>
<html:td align="right">
&saving;
</html:td>
<html:td align="left">
<html:input id="dialog.fileName" readonly="" value="" style="background-color:lightgray;width:300px;"/>
</html:td>
</html:tr>
<html:tr>
<html:td align="right">
&status;
</html:td>
<html:td align="left">
<html:span id="dialog.status">
&dialogStatus.label;
</html:span>
</html:td>
</html:tr>
<html:tr>
<html:td align="right">
&timeLeft;
</html:td>
<html:td align="left">
<html:span id="dialog.timeLeft">
&dialogTimeLeft.label;
</html:span>
</html:td>
</html:tr>
<html:tr>
<html:td align="center" height="40px" colspan="2">
<progressmeter id="dialog.progress" mode="normal" value="0"
style="width:300px;height:16px;"/>
<html:span id="dialog.progressPercent" style="border-left:5px solid lightgray;">
0%
</html:span>
</html:td>
</html:tr>
<html:tr>
<html:td align="center" colspan="2">
<html:button id="dialog.cancel" onclick="stop()">&dialogCancel.label;</html:button>
</html:td>
</html:tr>
</html:table>
</window>

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

@ -1,194 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="xul.css" type="text/css"?>
<?xml-stylesheet href="prefmProgress.css" type="text/css"?>
<!DOCTYPE window
[
<!ENTITY downloadWindow.title "Updating profile">
<!ENTITY location "Location">
<!ENTITY saving "Saving">
<!ENTITY status "Status:">
<!ENTITY dialogStatus.label "( nn.nK of mm.mK bytes )">
<!ENTITY timeLeft "Time Left:">
<!ENTITY dialogTimeLeft.label "?">
<!ENTITY dialogCancel.label "Cancel">
]
>
<window xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Updating profile"
width="425"
height="225"
onload="onLoad()">
<data>
<broadcaster id="data.progress" type="progress" value="0" max="0" completed="false"/>
<broadcaster id="data.status" type="string" value=""/>
<broadcaster id="data.execute" command=""/>
</data>
<dialog>
<observes element="data.progress" attribute="value" onchange="onProgress()"/>
<observes element="data.progress" attribute="completed" onchange="onCompletion()"/>
<observes element="data.status" attribute="value" onchange="onStatus()"/>
</dialog>
<html:script>
var data;
var dialog;
function loadDialog() {
dialog.location.setAttribute( "value", data.location.getAttribute( "value" ) );
dialog.fileName.setAttribute( "value", data.fileName.getAttribute( "value" ) );
}
function onLoad() {
// Set global variables.
data = new Object;
data.progress = document.getElementById("data.progress");
data.status = document.getElementById("data.status");
data.execute = document.getElementById("data.execute");
dialog = new Object;
dialog.status = document.getElementById("dialog.status");
dialog.progress = document.getElementById("dialog.progress");
dialog.progressPercent = document.getElementById("dialog.progressPercent");
dialog.cancel = document.getElementById("dialog.cancel");
// Fill dialog.
loadDialog();
// Commence.
data.execute.setAttribute("command","start");
}
var started = false;
var completed = false;
var interval = 1000; // Update every 1000 milliseconds.
var lastUpdate = -interval; // Update initially.
function stop() {
if ( started &amp;&amp; !completed ) {
// Stop the download.
data.execute.setAttribute( "command", "stop" );
} else {
// Close the window.
data.execute.setAttribute( "command", "close" );
}
}
function onProgress() {
// Check for first time.
if ( !started ) {
// Initialize download start time.
started = true;
dialog.cancel.removeAttribute( "disabled" );
}
// Get stats.
var currentStatus = data.progress.getAttribute("value");
var max = data.progress.getAttribute("max");
// Determine if progress bar should update
// If a file isn't done copying, don't increment progress bar.
if ( currentStatus == lastUpdate ) {
return;
}
// Update with the current progress value.
lastUpdate = currentStatus;
// Update download rate.
var elapsed = now - startTime;
var rate; // bytes/sec
if ( elapsed ) {
rate = ( bytes * 1000 ) / elapsed;
} else {
rate = 0;
}
// Calculate percentage.
var percent = Math.round( (currentStatus*100)/max );
// Advance progress meter.
dialog.progress.setAttribute( "value", percent );
// Update percentage label on progress meter.
dialog.progressPercent.childNodes[0].nodeValue = percent + "%";
}
function onCompletion() {
if ( !completed ) {
completed = true;
data.execute.setAttribute( "command", "close" );
}
}
function onStatus() {
var txt = data.status.getAttribute( "value" );
dialog.status.childNodes[0].nodeValue = txt;
}
</html:script>
<html:table style="width:100%;">
<html:tr>
<html:td align="right">
&location;
</html:td>
<html:td align="left">
<html:input id="dialog.location" readonly="" style="background-color:lightgray;width:300px;"/>
</html:td>
</html:tr>
<html:tr>
<html:td align="right">
&saving;
</html:td>
<html:td align="left">
<html:input id="dialog.fileName" readonly="" value="" style="background-color:lightgray;width:300px;"/>
</html:td>
</html:tr>
<html:tr>
<html:td align="right">
&status;
</html:td>
<html:td align="left">
<html:span id="dialog.status">
&dialogStatus.label;
</html:span>
</html:td>
</html:tr>
<html:tr>
<html:td align="right">
&timeLeft;
</html:td>
<html:td align="left">
<html:span id="dialog.timeLeft">
&dialogTimeLeft.label;
</html:span>
</html:td>
</html:tr>
<html:tr>
<html:td align="center" height="40px" colspan="2">
<progressmeter id="dialog.progress" mode="normal" value="0"
style="width:300px;height:16px;"/>
<html:span id="dialog.progressPercent" style="border-left:5px solid lightgray;">
0%
</html:span>
</html:td>
</html:tr>
<html:tr>
<html:td align="center" colspan="2">
<html:button id="dialog.cancel" onclick="stop()">&dialogCancel.label;</html:button>
</html:td>
</html:tr>
</html:table>
</window>

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

@ -1,194 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="xul.css" type="text/css"?>
<?xml-stylesheet href="prefmProgress.css" type="text/css"?>
<!DOCTYPE window
[
<!ENTITY downloadWindow.title "Updating profile">
<!ENTITY location "Location">
<!ENTITY saving "Saving">
<!ENTITY status "Status:">
<!ENTITY dialogStatus.label "( nn.nK of mm.mK bytes )">
<!ENTITY timeLeft "Time Left:">
<!ENTITY dialogTimeLeft.label "?">
<!ENTITY dialogCancel.label "Cancel">
]
>
<window xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Updating profile"
width="425"
height="225"
onload="onLoad()">
<data>
<broadcaster id="data.progress" type="progress" value="0" max="0" completed="false"/>
<broadcaster id="data.status" type="string" value=""/>
<broadcaster id="data.execute" command=""/>
</data>
<dialog>
<observes element="data.progress" attribute="value" onchange="onProgress()"/>
<observes element="data.progress" attribute="completed" onchange="onCompletion()"/>
<observes element="data.status" attribute="value" onchange="onStatus()"/>
</dialog>
<html:script>
var data;
var dialog;
function loadDialog() {
dialog.location.setAttribute( "value", data.location.getAttribute( "value" ) );
dialog.fileName.setAttribute( "value", data.fileName.getAttribute( "value" ) );
}
function onLoad() {
// Set global variables.
data = new Object;
data.progress = document.getElementById("data.progress");
data.status = document.getElementById("data.status");
data.execute = document.getElementById("data.execute");
dialog = new Object;
dialog.status = document.getElementById("dialog.status");
dialog.progress = document.getElementById("dialog.progress");
dialog.progressPercent = document.getElementById("dialog.progressPercent");
dialog.cancel = document.getElementById("dialog.cancel");
// Fill dialog.
loadDialog();
// Commence.
data.execute.setAttribute("command","start");
}
var started = false;
var completed = false;
var interval = 1000; // Update every 1000 milliseconds.
var lastUpdate = -interval; // Update initially.
function stop() {
if ( started &amp;&amp; !completed ) {
// Stop the download.
data.execute.setAttribute( "command", "stop" );
} else {
// Close the window.
data.execute.setAttribute( "command", "close" );
}
}
function onProgress() {
// Check for first time.
if ( !started ) {
// Initialize download start time.
started = true;
dialog.cancel.removeAttribute( "disabled" );
}
// Get stats.
var currentStatus = data.progress.getAttribute("value");
var max = data.progress.getAttribute("max");
// Determine if progress bar should update
// If a file isn't done copying, don't increment progress bar.
if ( currentStatus == lastUpdate ) {
return;
}
// Update with the current progress value.
lastUpdate = currentStatus;
// Update download rate.
var elapsed = now - startTime;
var rate; // bytes/sec
if ( elapsed ) {
rate = ( bytes * 1000 ) / elapsed;
} else {
rate = 0;
}
// Calculate percentage.
var percent = Math.round( (currentStatus*100)/max );
// Advance progress meter.
dialog.progress.setAttribute( "value", percent );
// Update percentage label on progress meter.
dialog.progressPercent.childNodes[0].nodeValue = percent + "%";
}
function onCompletion() {
if ( !completed ) {
completed = true;
data.execute.setAttribute( "command", "close" );
}
}
function onStatus() {
var txt = data.status.getAttribute( "value" );
dialog.status.childNodes[0].nodeValue = txt;
}
</html:script>
<html:table style="width:100%;">
<html:tr>
<html:td align="right">
&location;
</html:td>
<html:td align="left">
<html:input id="dialog.location" readonly="" style="background-color:lightgray;width:300px;"/>
</html:td>
</html:tr>
<html:tr>
<html:td align="right">
&saving;
</html:td>
<html:td align="left">
<html:input id="dialog.fileName" readonly="" value="" style="background-color:lightgray;width:300px;"/>
</html:td>
</html:tr>
<html:tr>
<html:td align="right">
&status;
</html:td>
<html:td align="left">
<html:span id="dialog.status">
&dialogStatus.label;
</html:span>
</html:td>
</html:tr>
<html:tr>
<html:td align="right">
&timeLeft;
</html:td>
<html:td align="left">
<html:span id="dialog.timeLeft">
&dialogTimeLeft.label;
</html:span>
</html:td>
</html:tr>
<html:tr>
<html:td align="center" height="40px" colspan="2">
<progressmeter id="dialog.progress" mode="normal" value="0"
style="width:300px;height:16px;"/>
<html:span id="dialog.progressPercent" style="border-left:5px solid lightgray;">
0%
</html:span>
</html:td>
</html:tr>
<html:tr>
<html:td align="center" colspan="2">
<html:button id="dialog.cancel" onclick="stop()">&dialogCancel.label;</html:button>
</html:td>
</html:tr>
</html:table>
</window>

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

@ -380,12 +380,12 @@ public:
nsresult AddScriptEventListener(nsIAtom* aName, const nsString& aValue, REFNSIID aIID);
nsresult ExecuteOnChangeHandler(nsIDOMElement* anElement, const nsString& attrName);
nsresult ExecuteOnBroadcastHandler(nsIDOMElement* anElement, const nsString& attrName);
PRBool ElementIsInDocument();
static nsresult
ExecuteJSCode(nsIDOMElement* anElement);
ExecuteJSCode(nsIDOMElement* anElement, nsEvent* aEvent);
// Used with treecol width attributes
static PRBool ParseNumericValue(const nsString& aString,
@ -516,9 +516,11 @@ static EventHandlerMapEntry kEventHandlerMap[] = {
{ "onabort", nsnull, &kIDOMLoadListenerIID },
{ "onerror", nsnull, &kIDOMLoadListenerIID },
{ "oncreate", nsnull, &kIDOMMenuListenerIID },
{ "ondestroy", nsnull, &kIDOMMenuListenerIID },
{ "oncommand", nsnull, &kIDOMMenuListenerIID },
{ "oncreate", nsnull, &kIDOMMenuListenerIID },
{ "ondestroy", nsnull, &kIDOMMenuListenerIID },
{ "oncommand", nsnull, &kIDOMMenuListenerIID },
{ "onbroadcast", nsnull, &kIDOMMenuListenerIID },
{ "oncommandupdate", nsnull, &kIDOMMenuListenerIID },
{ "onfocus", nsnull, &kIDOMFocusListenerIID },
{ "onblur", nsnull, &kIDOMFocusListenerIID },
@ -527,6 +529,7 @@ static EventHandlerMapEntry kEventHandlerMap[] = {
{ "onreset", nsnull, &kIDOMFormListenerIID },
{ "onchange", nsnull, &kIDOMFormListenerIID },
{ "onselect", nsnull, &kIDOMFormListenerIID },
{ "oninput", nsnull, &kIDOMFormListenerIID },
{ "onpaint", nsnull, &kIDOMPaintListenerIID },
@ -2415,7 +2418,7 @@ RDFElementImpl::SetAttribute(PRInt32 aNameSpaceID,
// XXX Should have a function that knows which attributes are special.
// First we set the attribute in the observer.
xulListener->mListener->SetAttribute(attribute, aValue);
ExecuteOnChangeHandler(xulListener->mListener, attribute);
ExecuteOnBroadcastHandler(xulListener->mListener, attribute);
}
}
}
@ -2825,8 +2828,8 @@ RDFElementImpl::HandleDOMEvent(nsIPresContext& aPresContext,
GetTagName(tagName);
if (aEvent->message == NS_MENU_ACTION || aEvent->message == NS_MENU_CREATE ||
aEvent->message == NS_MENU_DESTROY || aEvent->message == NS_FORM_SELECTED ||
aEvent->message == NS_FORM_CHANGE || aEvent->message == NS_DRAGDROP_ENTER ||
aEvent->message == NS_DRAGDROP_EXIT ||
aEvent->message == NS_XUL_BROADCAST || aEvent->message == NS_XUL_COMMAND_UPDATE ||
aEvent->message == NS_DRAGDROP_ENTER || aEvent->message == NS_DRAGDROP_EXIT ||
tagName == "menu" || tagName == "menuitem" ||
tagName == "menubar" || tagName == "key" || tagName == "keyset") {
nsCOMPtr<nsIEventListenerManager> listenerManager;
@ -3163,7 +3166,7 @@ RDFElementImpl::EnsureContentsGenerated(void) const
nsresult
RDFElementImpl::ExecuteOnChangeHandler(nsIDOMElement* anElement, const nsString& attrName)
RDFElementImpl::ExecuteOnBroadcastHandler(nsIDOMElement* anElement, const nsString& attrName)
{
// Now we execute the onchange handler in the context of the
// observer. We need to find the observer in order to
@ -3193,7 +3196,10 @@ RDFElementImpl::ExecuteOnChangeHandler(nsIDOMElement* anElement, const nsString&
if (listeningToAttribute == attrName) {
// This is the right observes node.
// Execute the onchange event handler
ExecuteJSCode(domElement);
nsEvent event;
event.eventStructType = NS_EVENT;
event.message = NS_XUL_BROADCAST;
ExecuteJSCode(domElement, &event);
}
}
}
@ -3237,7 +3243,7 @@ RDFElementImpl::ElementIsInDocument()
}
nsresult
RDFElementImpl::ExecuteJSCode(nsIDOMElement* anElement)
RDFElementImpl::ExecuteJSCode(nsIDOMElement* anElement, nsEvent* aEvent)
{
// This code executes in every presentation context in which this
// document is appearing.
@ -3266,10 +3272,7 @@ RDFElementImpl::ExecuteJSCode(nsIDOMElement* anElement)
// Handle the DOM event
nsEventStatus status = nsEventStatus_eIgnore;
nsEvent event;
event.eventStructType = NS_EVENT;
event.message = NS_FORM_CHANGE; // XXX: I feel dirty and evil for subverting this.
content->HandleDOMEvent(*aPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, status);
content->HandleDOMEvent(*aPresContext, aEvent, nsnull, NS_EVENT_FLAG_INIT, status);
}
return NS_OK;

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

@ -322,7 +322,7 @@ XULCommandDispatcherImpl::UpdateCommands(const nsString& aEventName)
nsEventStatus status = nsEventStatus_eIgnore;
nsEvent event;
event.eventStructType = NS_EVENT;
event.message = NS_FORM_CHANGE; // XXX: I feel dirty and evil for subverting this.
event.message = NS_XUL_COMMAND_UPDATE;
content->HandleDOMEvent(*context, &event, nsnull, NS_EVENT_FLAG_INIT, status);
}
}

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

@ -380,12 +380,12 @@ public:
nsresult AddScriptEventListener(nsIAtom* aName, const nsString& aValue, REFNSIID aIID);
nsresult ExecuteOnChangeHandler(nsIDOMElement* anElement, const nsString& attrName);
nsresult ExecuteOnBroadcastHandler(nsIDOMElement* anElement, const nsString& attrName);
PRBool ElementIsInDocument();
static nsresult
ExecuteJSCode(nsIDOMElement* anElement);
ExecuteJSCode(nsIDOMElement* anElement, nsEvent* aEvent);
// Used with treecol width attributes
static PRBool ParseNumericValue(const nsString& aString,
@ -516,9 +516,11 @@ static EventHandlerMapEntry kEventHandlerMap[] = {
{ "onabort", nsnull, &kIDOMLoadListenerIID },
{ "onerror", nsnull, &kIDOMLoadListenerIID },
{ "oncreate", nsnull, &kIDOMMenuListenerIID },
{ "ondestroy", nsnull, &kIDOMMenuListenerIID },
{ "oncommand", nsnull, &kIDOMMenuListenerIID },
{ "oncreate", nsnull, &kIDOMMenuListenerIID },
{ "ondestroy", nsnull, &kIDOMMenuListenerIID },
{ "oncommand", nsnull, &kIDOMMenuListenerIID },
{ "onbroadcast", nsnull, &kIDOMMenuListenerIID },
{ "oncommandupdate", nsnull, &kIDOMMenuListenerIID },
{ "onfocus", nsnull, &kIDOMFocusListenerIID },
{ "onblur", nsnull, &kIDOMFocusListenerIID },
@ -527,6 +529,7 @@ static EventHandlerMapEntry kEventHandlerMap[] = {
{ "onreset", nsnull, &kIDOMFormListenerIID },
{ "onchange", nsnull, &kIDOMFormListenerIID },
{ "onselect", nsnull, &kIDOMFormListenerIID },
{ "oninput", nsnull, &kIDOMFormListenerIID },
{ "onpaint", nsnull, &kIDOMPaintListenerIID },
@ -2415,7 +2418,7 @@ RDFElementImpl::SetAttribute(PRInt32 aNameSpaceID,
// XXX Should have a function that knows which attributes are special.
// First we set the attribute in the observer.
xulListener->mListener->SetAttribute(attribute, aValue);
ExecuteOnChangeHandler(xulListener->mListener, attribute);
ExecuteOnBroadcastHandler(xulListener->mListener, attribute);
}
}
}
@ -2825,8 +2828,8 @@ RDFElementImpl::HandleDOMEvent(nsIPresContext& aPresContext,
GetTagName(tagName);
if (aEvent->message == NS_MENU_ACTION || aEvent->message == NS_MENU_CREATE ||
aEvent->message == NS_MENU_DESTROY || aEvent->message == NS_FORM_SELECTED ||
aEvent->message == NS_FORM_CHANGE || aEvent->message == NS_DRAGDROP_ENTER ||
aEvent->message == NS_DRAGDROP_EXIT ||
aEvent->message == NS_XUL_BROADCAST || aEvent->message == NS_XUL_COMMAND_UPDATE ||
aEvent->message == NS_DRAGDROP_ENTER || aEvent->message == NS_DRAGDROP_EXIT ||
tagName == "menu" || tagName == "menuitem" ||
tagName == "menubar" || tagName == "key" || tagName == "keyset") {
nsCOMPtr<nsIEventListenerManager> listenerManager;
@ -3163,7 +3166,7 @@ RDFElementImpl::EnsureContentsGenerated(void) const
nsresult
RDFElementImpl::ExecuteOnChangeHandler(nsIDOMElement* anElement, const nsString& attrName)
RDFElementImpl::ExecuteOnBroadcastHandler(nsIDOMElement* anElement, const nsString& attrName)
{
// Now we execute the onchange handler in the context of the
// observer. We need to find the observer in order to
@ -3193,7 +3196,10 @@ RDFElementImpl::ExecuteOnChangeHandler(nsIDOMElement* anElement, const nsString&
if (listeningToAttribute == attrName) {
// This is the right observes node.
// Execute the onchange event handler
ExecuteJSCode(domElement);
nsEvent event;
event.eventStructType = NS_EVENT;
event.message = NS_XUL_BROADCAST;
ExecuteJSCode(domElement, &event);
}
}
}
@ -3237,7 +3243,7 @@ RDFElementImpl::ElementIsInDocument()
}
nsresult
RDFElementImpl::ExecuteJSCode(nsIDOMElement* anElement)
RDFElementImpl::ExecuteJSCode(nsIDOMElement* anElement, nsEvent* aEvent)
{
// This code executes in every presentation context in which this
// document is appearing.
@ -3266,10 +3272,7 @@ RDFElementImpl::ExecuteJSCode(nsIDOMElement* anElement)
// Handle the DOM event
nsEventStatus status = nsEventStatus_eIgnore;
nsEvent event;
event.eventStructType = NS_EVENT;
event.message = NS_FORM_CHANGE; // XXX: I feel dirty and evil for subverting this.
content->HandleDOMEvent(*aPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, status);
content->HandleDOMEvent(*aPresContext, aEvent, nsnull, NS_EVENT_FLAG_INIT, status);
}
return NS_OK;

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

@ -226,7 +226,7 @@ var contextTarget = null; // Content element to which context menu applies.
<!-- Interim hack to transition from nsIXULWindowCallbacks/ShowWindowWithArgs -->
<broadcaster id="dialog.start" ready="false"/>
<observes element="dialog.start" attribute="ready" onchange="onLoadWithArgs()"/>
<observes element="dialog.start" attribute="ready" onbroadcast="onLoadWithArgs()"/>
<!-- keys are appended from the overlay -->
@ -654,7 +654,7 @@ var contextTarget = null; // Content element to which context menu applies.
<titledbutton id="stop-button" align="top"
value="&stopButton.label;" onclick="BrowserStop()">
<observes element="canStop" attribute="disabled"
onchange="BrowserCanStop()"/>
onbroadcast="BrowserCanStop()"/>
</titledbutton>
<box align="vertical" flex="100%">
@ -740,7 +740,7 @@ var contextTarget = null; // Content element to which context menu applies.
align="horizontal" value="0" onclick="dumpProgress()">
<observes element="Browser:LoadingProgress" attribute="mode"/>
<observes element="Browser:Throbber" attribute="busy"
onchange="onProgress()"/>
onbroadcast="onProgress()"/>
</progressmeter>
<spring flex="100%"/>
</box>
@ -748,7 +748,7 @@ var contextTarget = null; // Content element to which context menu applies.
value="&statusText.label;"
style="font-family:sans-serif;font-size:2.5mm">
<observes element="Browser:Status" attribute="value"
onchange="onStatus()"/>
onbroadcast="onStatus()"/>
</titledbutton>
<spring flex="100%"/>
@ -758,7 +758,7 @@ var contextTarget = null; // Content element to which context menu applies.
<titledbutton id="protocol-icon" class="borderless" uri="..."
src="" align="left" onclick="onProtocolClick()">
<observes element="Browser:ProtocolIcon" attribute="uri"
onchange="onProtocolChange()"/>
onbroadcast="onProtocolChange()"/>
</titledbutton>
</box>
</box><!-- status -->

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

@ -26,7 +26,7 @@
<!-- Interim hack to transition from nsIXULWindowCallbacks/ShowWindowWithArgs -->
<broadcaster id="dialog.start" ready="false"/>
<observes element="dialog.start" attribute="ready" onchange="StartupViewSource()"/>
<observes element="dialog.start" attribute="ready" onbroadcast="StartupViewSource()"/>
<menubar>
<menu value="&fileMenu.label;">
@ -191,13 +191,13 @@
<spring flex="100%"/>
<progressmeter id="statusbar-icon" mode="normal" value="0" onclick="dumpProgress()">
<observes element="Browser:LoadingProgress" attribute="mode"/>
<observes element="Browser:Throbber" attribute="busy" onchange="onProgress()"/>
<observes element="Browser:Throbber" attribute="busy" onbroadcast="onProgress()"/>
</progressmeter>
<spring flex="100%"/>
</box>
<titledbutton id="statusText" align="right" flex="100%" value="Document: Done" style="font-family:sans-serif;font-size:2.5mm">
<observes element="Browser:Status" attribute="value" onchange="onStatus()"/>
<observes element="Browser:Status" attribute="value" onbroadcast="onStatus()"/>
</titledbutton>
<spring flex="100%"/>

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

@ -47,7 +47,7 @@
<!-- Interim hack to transition from nsIXULWindowCallbacks/ShowWindowWithArgs -->
<broadcaster id="dialog.start" ready="false"/>
<observes element="dialog.start" attribute="ready" onchange="EditorStartup('text')"/>
<observes element="dialog.start" attribute="ready" onbroadcast="EditorStartup('text')"/>
<!-- broadcaster nodes are appended here from the overlays -->
<broadcasterset id="broadcasterset">

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

@ -300,6 +300,7 @@ enum nsDragDropEventStatus {
#define NS_FORM_RESET (NS_FORM_EVENT_START + 1)
#define NS_FORM_CHANGE (NS_FORM_EVENT_START + 2)
#define NS_FORM_SELECTED (NS_FORM_EVENT_START + 3)
#define NS_FORM_INPUT (NS_FORM_EVENT_START + 4)
//Need separate focus/blur notifications for non-native widgets
#define NS_FOCUS_EVENT_START 1300
@ -319,7 +320,8 @@ enum nsDragDropEventStatus {
#define NS_MENU_CREATE (NS_MENU_EVENT_START)
#define NS_MENU_DESTROY (NS_MENU_EVENT_START+1)
#define NS_MENU_ACTION (NS_MENU_EVENT_START+2)
#define NS_XUL_BROADCAST (NS_MENU_EVENT_START+3)
#define NS_XUL_COMMAND_UPDATE (NS_MENU_EVENT_START+4)
//@}

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

@ -774,6 +774,7 @@ case _value: eventName = _name ; break
_ASSIGN_eventName(NS_FOCUS_CONTENT,"NS_FOCUS_CONTENT");
_ASSIGN_eventName(NS_FORM_SELECTED,"NS_FORM_SELECTED");
_ASSIGN_eventName(NS_FORM_CHANGE,"NS_FORM_CHANGE");
_ASSIGN_eventName(NS_FORM_INPUT,"NS_FORM_INPUT");
_ASSIGN_eventName(NS_FORM_RESET,"NS_FORM_RESET");
_ASSIGN_eventName(NS_FORM_SUBMIT,"NS_FORM_SUBMIT");
_ASSIGN_eventName(NS_GOTFOCUS,"NS_GOTFOCUS");
@ -807,6 +808,8 @@ case _value: eventName = _name ; break
_ASSIGN_eventName(NS_MENU_CREATE,"NS_MENU_CREATE");
_ASSIGN_eventName(NS_MENU_DESTROY,"NS_MENU_DESTROY");
_ASSIGN_eventName(NS_MENU_ACTION, "NS_MENU_ACTION");
_ASSIGN_eventName(NS_XUL_BROADCAST, "NS_XUL_BROADCAST");
_ASSIGN_eventName(NS_XUL_COMMAND_UPDATE, "NS_XUL_COMMAND_UPDATE");
_ASSIGN_eventName(NS_SCROLLBAR_LINE_NEXT,"NS_SB_LINE_NEXT");
_ASSIGN_eventName(NS_SCROLLBAR_LINE_PREV,"NS_SB_LINE_PREV");
_ASSIGN_eventName(NS_SCROLLBAR_PAGE_NEXT,"NS_SB_PAGE_NEXT");

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

@ -33,8 +33,8 @@ Contributor(s): ______________________________________. -->
<broadcaster id="NetDialog:CheckMessage"/>
</data>
<dialog>
<observes element="NetDialog:Message" attribute="text" onchange="onUpdate()"/>
<observes element="NetDialog:CheckMessage" attribute="text" onchange="onUpdate()"/>
<observes element="NetDialog:Message" attribute="text" onbroadcast="onUpdate()"/>
<observes element="NetDialog:CheckMessage" attribute="text" onbroadcast="onUpdate()"/>
</dialog>
<html:script>

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

@ -8,7 +8,7 @@
<broadcaster id="NetDialog:Message"/>
</data>
<dialog>
<observes element="NetDialog:Message" attribute="text" onchange="onUpdate()"/>
<observes element="NetDialog:Message" attribute="text" onbroadcast="onUpdate()"/>
</dialog>
<html:script>
function onUpdate()

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

@ -226,7 +226,7 @@ var contextTarget = null; // Content element to which context menu applies.
<!-- Interim hack to transition from nsIXULWindowCallbacks/ShowWindowWithArgs -->
<broadcaster id="dialog.start" ready="false"/>
<observes element="dialog.start" attribute="ready" onchange="onLoadWithArgs()"/>
<observes element="dialog.start" attribute="ready" onbroadcast="onLoadWithArgs()"/>
<!-- keys are appended from the overlay -->
@ -654,7 +654,7 @@ var contextTarget = null; // Content element to which context menu applies.
<titledbutton id="stop-button" align="top"
value="&stopButton.label;" onclick="BrowserStop()">
<observes element="canStop" attribute="disabled"
onchange="BrowserCanStop()"/>
onbroadcast="BrowserCanStop()"/>
</titledbutton>
<box align="vertical" flex="100%">
@ -740,7 +740,7 @@ var contextTarget = null; // Content element to which context menu applies.
align="horizontal" value="0" onclick="dumpProgress()">
<observes element="Browser:LoadingProgress" attribute="mode"/>
<observes element="Browser:Throbber" attribute="busy"
onchange="onProgress()"/>
onbroadcast="onProgress()"/>
</progressmeter>
<spring flex="100%"/>
</box>
@ -748,7 +748,7 @@ var contextTarget = null; // Content element to which context menu applies.
value="&statusText.label;"
style="font-family:sans-serif;font-size:2.5mm">
<observes element="Browser:Status" attribute="value"
onchange="onStatus()"/>
onbroadcast="onStatus()"/>
</titledbutton>
<spring flex="100%"/>
@ -758,7 +758,7 @@ var contextTarget = null; // Content element to which context menu applies.
<titledbutton id="protocol-icon" class="borderless" uri="..."
src="" align="left" onclick="onProtocolClick()">
<observes element="Browser:ProtocolIcon" attribute="uri"
onchange="onProtocolChange()"/>
onbroadcast="onProtocolChange()"/>
</titledbutton>
</box>
</box><!-- status -->

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

@ -26,7 +26,7 @@
<!-- Interim hack to transition from nsIXULWindowCallbacks/ShowWindowWithArgs -->
<broadcaster id="dialog.start" ready="false"/>
<observes element="dialog.start" attribute="ready" onchange="StartupViewSource()"/>
<observes element="dialog.start" attribute="ready" onbroadcast="StartupViewSource()"/>
<menubar>
<menu value="&fileMenu.label;">
@ -191,13 +191,13 @@
<spring flex="100%"/>
<progressmeter id="statusbar-icon" mode="normal" value="0" onclick="dumpProgress()">
<observes element="Browser:LoadingProgress" attribute="mode"/>
<observes element="Browser:Throbber" attribute="busy" onchange="onProgress()"/>
<observes element="Browser:Throbber" attribute="busy" onbroadcast="onProgress()"/>
</progressmeter>
<spring flex="100%"/>
</box>
<titledbutton id="statusText" align="right" flex="100%" value="Document: Done" style="font-family:sans-serif;font-size:2.5mm">
<observes element="Browser:Status" attribute="value" onchange="onStatus()"/>
<observes element="Browser:Status" attribute="value" onbroadcast="onStatus()"/>
</titledbutton>
<spring flex="100%"/>

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

@ -21,9 +21,9 @@
</data>
<dialog>
<observes element="data.progress" attribute="value" onchange="onProgress()"/>
<observes element="data.progress" attribute="completed" onchange="onCompletion()"/>
<observes element="data.status" attribute="value" onchange="onStatus()"/>
<observes element="data.progress" attribute="value" onbroadcast="onProgress()"/>
<observes element="data.progress" attribute="completed" onbroadcast="onCompletion()"/>
<observes element="data.status" attribute="value" onbroadcast="onStatus()"/>
</dialog>
<html:script>

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

@ -730,13 +730,13 @@
<spring flex="100%"/>
<progressmeter id="statusbar-icon" mode="normal" value="0" onclick="dumpProgress()">
<observes element="Browser:LoadingProgress" attribute="mode"/>
<observes element="Browser:Throbber" attribute="busy" onchange="onProgress()"/>
<observes element="Browser:Throbber" attribute="busy" onbroadcast="onProgress()"/>
</progressmeter>
<spring flex="100%"/>
</box>
<titledbutton id="statusText" align="right" flex="1%" value="Document: Done" style="font-family:sans-serif;font-size:2.5mm">
<observes element="Browser:Status" attribute="value" onchange="onStatus()"/>
<observes element="Browser:Status" attribute="value" onbroadcast="onStatus()"/>
</titledbutton>
<spring flex="100%"/>

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

@ -34,27 +34,22 @@
<commandset id="globalEditMenuItems"
commandupdater="true"
onchange="goUpdateGlobalEditMenuItems()"/>
oncommandupdate="goUpdateGlobalEditMenuItems()"/>
<broadcaster id="cmd_undo"
oncommand="goDoCommand('cmd_undo')"
onchange="goUpdateCommand('cmd_undo')"
disabled="true"/>
<broadcaster id="cmd_redo"
oncommand="goDoCommand('cmd_redo')"
onchange="goUpdateCommand('cmd_redo')"
disabled="true"/>
<broadcaster id="cmd_cut"
oncommand="goDoCommand('cmd_cut')"
onchange="goUpdateCommand('cmd_cut')"
disabled="true"/>
<broadcaster id="cmd_copy"
oncommand="goDoCommand('cmd_copy')"
onchange="goUpdateCommand('cmd_copy')"
disabled="true"/>
<broadcaster id="cmd_paste"
oncommand="goDoCommand('cmd_paste')"
onchange="goUpdateCommand('cmd_paste')"
disabled="true"/>
<broadcaster id="cmd_delete"
oncommand="goDoCommand('cmd_delete')"