diff --git a/content/events/src/nsDOMEvent.cpp b/content/events/src/nsDOMEvent.cpp index de6cbfb87825..06b788c659b5 100644 --- a/content/events/src/nsDOMEvent.cpp +++ b/content/events/src/nsDOMEvent.cpp @@ -1557,14 +1557,6 @@ nsDOMEvent::ReportWrongPropertyAccessWarning(const char* aPropertyName) "DOM Events"); } -NS_IMETHODIMP -nsDOMEvent::GetPreventDefault(PRBool* aReturn) -{ - NS_ENSURE_ARG_POINTER(aReturn); - *aReturn = mEvent && (mEvent->flags & NS_EVENT_FLAG_NO_DEFAULT); - return NS_OK; -} - nsresult NS_NewDOMEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, nsEvent *aEvent) diff --git a/content/events/src/nsDOMUIEvent.cpp b/content/events/src/nsDOMUIEvent.cpp index 663af34b5ff5..bc471fbb7ed5 100644 --- a/content/events/src/nsDOMUIEvent.cpp +++ b/content/events/src/nsDOMUIEvent.cpp @@ -368,6 +368,15 @@ nsDOMUIEvent::GetIsChar(PRBool* aIsChar) } } +NS_IMETHODIMP +nsDOMUIEvent::GetPreventDefault(PRBool* aReturn) +{ + NS_ENSURE_ARG_POINTER(aReturn); + *aReturn = mEvent && (mEvent->flags & NS_EVENT_FLAG_NO_DEFAULT); + + return NS_OK; +} + NS_METHOD nsDOMUIEvent::GetCompositionReply(nsTextEventReply** aReply) { if((mEvent->message == NS_COMPOSITION_START) || diff --git a/content/events/src/nsDOMUIEvent.h b/content/events/src/nsDOMUIEvent.h index 5f6514da1150..0ad95145102a 100644 --- a/content/events/src/nsDOMUIEvent.h +++ b/content/events/src/nsDOMUIEvent.h @@ -71,7 +71,6 @@ public: // Forward to nsDOMEvent NS_FORWARD_TO_NSDOMEVENT - NS_FORWARD_NSIDOMNSEVENT(nsDOMEvent::) protected: // Internal helper functions diff --git a/content/events/src/nsEventDispatcher.cpp b/content/events/src/nsEventDispatcher.cpp index 76f22e1922b8..813865320fe3 100644 --- a/content/events/src/nsEventDispatcher.cpp +++ b/content/events/src/nsEventDispatcher.cpp @@ -325,6 +325,8 @@ nsEventTargetChainItem::HandleEventTargetChain(nsEventChainPostVisitor& aVisitor if (!(aVisitor.mEvent->flags & NS_EVENT_FLAG_CANT_BUBBLE) || newTarget) { if ((!(aVisitor.mEvent->flags & NS_EVENT_FLAG_NO_CONTENT_DISPATCH) || item->ForceContentDispatch()) && + (!(aFlags & NS_EVENT_FLAG_SYSTEM_EVENT) || + aVisitor.mEventStatus != nsEventStatus_eConsumeNoDefault) && !(aVisitor.mEvent->flags & NS_EVENT_FLAG_STOP_DISPATCH)) { item->HandleEvent(aVisitor, aFlags & NS_EVENT_BUBBLE_MASK, createdELMs != nsEventListenerManager::sCreatedCount); diff --git a/content/xbl/src/nsXBLBinding.cpp b/content/xbl/src/nsXBLBinding.cpp index 0b84dbd556e0..0aaf01597ac2 100644 --- a/content/xbl/src/nsXBLBinding.cpp +++ b/content/xbl/src/nsXBLBinding.cpp @@ -863,8 +863,7 @@ nsXBLBinding::InstallEventHandlers() // This is a weak ref. systemEventGroup above is already a // strong ref, so we are guaranteed it will not go away. nsIDOMEventGroup* eventGroup = nsnull; - if ((isChromeDoc || mBoundElement->IsInNativeAnonymousSubtree()) && - (curr->GetType() & (NS_HANDLER_TYPE_XBL_COMMAND | NS_HANDLER_TYPE_SYSTEM))) { + if (curr->GetType() & (NS_HANDLER_TYPE_XBL_COMMAND | NS_HANDLER_TYPE_SYSTEM)) { if (!systemEventGroup) manager->GetSystemEventGroupLM(getter_AddRefs(systemEventGroup)); eventGroup = systemEventGroup; @@ -902,8 +901,7 @@ nsXBLBinding::InstallEventHandlers() // This is a weak ref. systemEventGroup above is already a // strong ref, so we are guaranteed it will not go away. nsIDOMEventGroup* eventGroup = nsnull; - if ((isChromeDoc || mBoundElement->IsInNativeAnonymousSubtree()) && - (handler->GetType() & (NS_HANDLER_TYPE_XBL_COMMAND | NS_HANDLER_TYPE_SYSTEM))) { + if (handler->GetType() & (NS_HANDLER_TYPE_XBL_COMMAND | NS_HANDLER_TYPE_SYSTEM)) { if (!systemEventGroup) manager->GetSystemEventGroupLM(getter_AddRefs(systemEventGroup)); eventGroup = systemEventGroup; @@ -1001,9 +999,7 @@ nsXBLBinding::UnhookEventHandlers() if (!manager) { return; } - - PRBool isChromeDoc = - nsContentUtils::IsChromeDoc(mBoundElement->GetOwnerDoc()); + nsCOMPtr systemEventGroup; nsXBLPrototypeHandler* curr; for (curr = handlerChain; curr; curr = curr->GetNextHandler()) { @@ -1032,8 +1028,7 @@ nsXBLBinding::UnhookEventHandlers() // This is a weak ref. systemEventGroup above is already a // strong ref, so we are guaranteed it will not go away. nsIDOMEventGroup* eventGroup = nsnull; - if ((isChromeDoc || mBoundElement->IsInNativeAnonymousSubtree()) && - (curr->GetType() & (NS_HANDLER_TYPE_XBL_COMMAND | NS_HANDLER_TYPE_SYSTEM))) { + if (curr->GetType() & (NS_HANDLER_TYPE_XBL_COMMAND | NS_HANDLER_TYPE_SYSTEM)) { if (!systemEventGroup) manager->GetSystemEventGroupLM(getter_AddRefs(systemEventGroup)); eventGroup = systemEventGroup; @@ -1061,8 +1056,7 @@ nsXBLBinding::UnhookEventHandlers() // This is a weak ref. systemEventGroup above is already a // strong ref, so we are guaranteed it will not go away. nsIDOMEventGroup* eventGroup = nsnull; - if ((isChromeDoc || mBoundElement->IsInNativeAnonymousSubtree()) && - (handler->GetType() & (NS_HANDLER_TYPE_XBL_COMMAND | NS_HANDLER_TYPE_SYSTEM))) { + if (handler->GetType() & (NS_HANDLER_TYPE_XBL_COMMAND | NS_HANDLER_TYPE_SYSTEM)) { if (!systemEventGroup) manager->GetSystemEventGroupLM(getter_AddRefs(systemEventGroup)); eventGroup = systemEventGroup; diff --git a/content/xul/content/src/nsXULElement.cpp b/content/xul/content/src/nsXULElement.cpp index 65b4b127e77f..e2b21508acdf 100644 --- a/content/xul/content/src/nsXULElement.cpp +++ b/content/xul/content/src/nsXULElement.cpp @@ -140,8 +140,7 @@ #include "nsFrameLoader.h" #include "prlog.h" #include "rdf.h" -#include "nsIDOM3EventTarget.h" -#include "nsIDOMEventGroup.h" + #include "nsIControllers.h" // The XUL doc interface @@ -1565,17 +1564,6 @@ nsXULElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor) { aVisitor.mForceContentDispatch = PR_TRUE; //FIXME! Bug 329119 nsIAtom* tag = Tag(); - if (IsRootOfNativeAnonymousSubtree() && - (tag == nsGkAtoms::scrollbar || tag == nsGkAtoms::scrollcorner) && - (aVisitor.mEvent->message == NS_MOUSE_CLICK || - aVisitor.mEvent->message == NS_MOUSE_DOUBLECLICK || - aVisitor.mEvent->message == NS_XUL_COMMAND || - aVisitor.mEvent->message == NS_CONTEXTMENU)) { - // Don't propagate these events from native anonymous scrollbar. - aVisitor.mCanHandle = PR_TRUE; - aVisitor.mParentTarget = nsnull; - return NS_OK; - } if (aVisitor.mEvent->message == NS_XUL_COMMAND && aVisitor.mEvent->originalTarget == static_cast(this) && tag != nsGkAtoms::command) { @@ -2168,19 +2156,13 @@ PopupListenerPropertyDtor(void* aObject, nsIAtom* aPropertyName, if (!listener) { return; } - nsCOMPtr target = + nsCOMPtr target = do_QueryInterface(static_cast(aObject)); if (target) { - nsCOMPtr systemGroup; - static_cast(aObject)-> - GetSystemEventGroup(getter_AddRefs(systemGroup)); - if (systemGroup) { - target->RemoveGroupedEventListener(NS_LITERAL_STRING("mousedown"), - listener, PR_FALSE, systemGroup); - - target->RemoveGroupedEventListener(NS_LITERAL_STRING("contextmenu"), - listener, PR_FALSE, systemGroup); - } + target->RemoveEventListener(NS_LITERAL_STRING("mousedown"), listener, + PR_FALSE); + target->RemoveEventListener(NS_LITERAL_STRING("contextmenu"), listener, + PR_FALSE); } NS_RELEASE(listener); } @@ -2202,17 +2184,13 @@ nsXULElement::AddPopupListener(nsIAtom* aName) return NS_OK; } - nsCOMPtr systemGroup; - GetSystemEventGroup(getter_AddRefs(systemGroup)); - NS_ENSURE_STATE(systemGroup); - nsresult rv = NS_NewXULPopupListener(this, isContext, getter_AddRefs(popupListener)); if (NS_FAILED(rv)) return rv; // Add the popup as a listener on this element. - nsCOMPtr target(do_QueryInterface(static_cast(this))); + nsCOMPtr target(do_QueryInterface(static_cast(this))); NS_ENSURE_TRUE(target, NS_ERROR_FAILURE); rv = SetProperty(listenerAtom, popupListener, PopupListenerPropertyDtor, PR_TRUE); @@ -2220,14 +2198,10 @@ nsXULElement::AddPopupListener(nsIAtom* aName) // Want the property to have a reference to the listener. nsIDOMEventListener* listener = nsnull; popupListener.swap(listener); - - if (isContext) { - target->AddGroupedEventListener(NS_LITERAL_STRING("contextmenu"), - listener, PR_FALSE, systemGroup); - } else { - target->AddGroupedEventListener(NS_LITERAL_STRING("mousedown"), - listener, PR_FALSE, systemGroup); - } + if (isContext) + target->AddEventListener(NS_LITERAL_STRING("contextmenu"), listener, PR_FALSE); + else + target->AddEventListener(NS_LITERAL_STRING("mousedown"), listener, PR_FALSE); return NS_OK; } diff --git a/content/xul/content/test/Makefile.in b/content/xul/content/test/Makefile.in index 411032315310..c42b4f7abeaf 100644 --- a/content/xul/content/test/Makefile.in +++ b/content/xul/content/test/Makefile.in @@ -46,7 +46,6 @@ include $(topsrcdir)/config/rules.mk _TEST_FILES = test_bug330705-2.xul \ test_bug233643.xul \ - test_bug486990.xul \ $(NULL) _CHROME_FILES = \ diff --git a/content/xul/content/test/test_bug486990.xul b/content/xul/content/test/test_bug486990.xul deleted file mode 100644 index 309eeee75fc6..000000000000 --- a/content/xul/content/test/test_bug486990.xul +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - diff --git a/dom/interfaces/events/nsIDOMNSEvent.idl b/dom/interfaces/events/nsIDOMNSEvent.idl index d01fe33a4c46..4abdfb4d0388 100644 --- a/dom/interfaces/events/nsIDOMNSEvent.idl +++ b/dom/interfaces/events/nsIDOMNSEvent.idl @@ -44,7 +44,7 @@ #endif %} -[scriptable, uuid(9be8096b-f795-4045-9664-0c275f36fe5b)] +[scriptable, uuid(e565d518-4510-407f-a3d9-3b4107549c6d)] interface nsIDOMNSEvent : nsISupports { const long MOUSEDOWN = 0x00000001; @@ -114,7 +114,5 @@ interface nsIDOMNSEvent : nsISupports */ void preventCapture(); - boolean getPreventDefault(); - readonly attribute boolean isTrusted; }; diff --git a/dom/interfaces/events/nsIDOMNSUIEvent.idl b/dom/interfaces/events/nsIDOMNSUIEvent.idl index fdabbdcaf46e..5592478dc07b 100644 --- a/dom/interfaces/events/nsIDOMNSUIEvent.idl +++ b/dom/interfaces/events/nsIDOMNSUIEvent.idl @@ -37,14 +37,16 @@ * * ***** END LICENSE BLOCK ***** */ -#include "nsIDOMNSEvent.idl" +#include "domstubs.idl" -[scriptable, uuid(72c9f79c-98cd-4224-a467-86b59c0a38f7)] -interface nsIDOMNSUIEvent : nsIDOMNSEvent +[scriptable, uuid(a6cf90c4-15b3-11d2-932e-00805f8add32)] +interface nsIDOMNSUIEvent : nsISupports { const long SCROLL_PAGE_UP = -32768; const long SCROLL_PAGE_DOWN = 32768; + boolean getPreventDefault(); + readonly attribute long layerX; readonly attribute long layerY; readonly attribute long pageX; diff --git a/js/src/xpconnect/src/dom_quickstubs.qsconf b/js/src/xpconnect/src/dom_quickstubs.qsconf index 596063eb45ab..f5c2a3476c33 100644 --- a/js/src/xpconnect/src/dom_quickstubs.qsconf +++ b/js/src/xpconnect/src/dom_quickstubs.qsconf @@ -283,7 +283,6 @@ members = [ 'nsIDOMMouseEvent.screenX', 'nsIDOMNSEvent.originalTarget', 'nsIDOMNSEvent.preventCapture', - 'nsIDOMNSEvent.getPreventDefault', 'nsIDOMKeyEvent.ctrlKey', 'nsIDOMKeyEvent.shiftKey', 'nsIDOMKeyEvent.keyCode', @@ -295,6 +294,7 @@ members = [ 'nsIDOMMutationEvent.attrChange', 'nsIDOMMutationEvent.newValue', 'nsIDOMMutationEvent.prevValue', + 'nsIDOMNSUIEvent.getPreventDefault', 'nsIDOMNSUIEvent.which', 'nsIDOMNSUIEvent.rangeParent', 'nsIDOMNSUIEvent.rangeOffset', diff --git a/security/manager/ssl/src/nsSmartCardEvent.cpp b/security/manager/ssl/src/nsSmartCardEvent.cpp index d312d43d26c7..2b5df868508c 100644 --- a/security/manager/ssl/src/nsSmartCardEvent.cpp +++ b/security/manager/ssl/src/nsSmartCardEvent.cpp @@ -186,12 +186,6 @@ NS_IMETHODIMP nsSmartCardEvent::GetIsTrusted(PRBool *aIsTrusted) return mNSEvent->GetIsTrusted(aIsTrusted); } -NS_IMETHODIMP -nsSmartCardEvent::GetPreventDefault(PRBool* aReturn) -{ - NS_ASSERTION(mNSEvent, "SmartCardEvent called without Init"); - return mNSEvent->GetPreventDefault(aReturn); -} // IDOMEvent maps NS_IMETHODIMP nsSmartCardEvent::GetType(nsAString & aType) diff --git a/toolkit/content/widgets/popup.xml b/toolkit/content/widgets/popup.xml index 753778c2a9cd..105c3f6e19b5 100644 --- a/toolkit/content/widgets/popup.xml +++ b/toolkit/content/widgets/popup.xml @@ -174,6 +174,8 @@ + +