From ed6f59a4d7ffc281eaed99af52dbd72222ea209b Mon Sep 17 00:00:00 2001 From: "Olli.Pettay%helsinki.fi" Date: Sat, 25 Mar 2006 22:03:49 +0000 Subject: [PATCH] Bug 330710, Replace obsolete preventBubble/preventCapture with stopPropagation, r=neil, r=mconnor, sr=jst git-svn-id: svn://10.0.0.236/trunk@192998 18797224-902f-48f8-a5cc-f745e15eee43 --- .../browser/base/content/browser-menubar.inc | 10 ++-- mozilla/browser/base/content/browser.js | 12 ++--- mozilla/browser/base/content/browser.xul | 37 +++++++------- .../bookmarks/content/bookmarksManager.js | 6 +-- .../bookmarks/content/bookmarksManager.xul | 2 +- .../bookmarks/content/bookmarksMenu.js | 2 +- .../bookmarks/content/bookmarksTree.xml | 8 +-- .../components/places/content/menu.xml | 2 +- .../components/places/content/places.js | 2 +- .../components/places/content/places.xul | 6 +-- .../html/content/src/nsHTMLButtonElement.cpp | 8 +-- .../html/content/src/nsHTMLInputElement.cpp | 6 +-- .../xul/content/src/nsXULPopupListener.cpp | 26 ++++------ .../libeditor/text/nsEditorEventListeners.cpp | 22 +++----- .../text/nsPlaintextDataTransfer.cpp | 4 +- .../ui/dialogs/content/EdImageMapShapes.js | 4 +- .../resources/content/venkman-views.js | 4 +- mozilla/layout/forms/nsListControlFrame.cpp | 25 ++------- .../layout/forms/resources/content/select.xml | 4 +- mozilla/layout/generic/nsObjectFrame.cpp | 51 ++++--------------- .../layout/xul/base/src/nsMenuBarListener.cpp | 23 ++------- .../layout/xul/base/src/nsMenuListener.cpp | 8 +-- mozilla/mail/base/content/FilterListDialog.js | 2 +- .../mail/base/content/mailWindowOverlay.js | 2 +- .../mail/base/content/mailWindowOverlay.xul | 14 ++--- .../mail/base/content/msgMail3PaneWindow.js | 8 +-- .../components/addrbook/content/abCommon.js | 2 +- .../compose/content/MsgComposeCommands.js | 2 +- .../content/addressingWidgetOverlay.js | 6 ++- .../extensions/newsblog/content/edittree.xml | 4 +- .../addrbook/resources/content/abCommon.js | 2 +- .../resources/content/abMailListDialog.js | 8 +-- .../content/abSelectAddressesDialog.js | 2 +- .../resources/content/mailWindowOverlay.js | 2 +- .../resources/content/mailWindowOverlay.xul | 18 +++---- .../resources/content/msgMail3PaneWindow.js | 8 +-- .../base/resources/content/threadPane.js | 4 +- .../resources/content/FilterListDialog.js | 2 +- .../content/addressingWidgetOverlay.js | 6 ++- mozilla/toolkit/content/nsDragAndDrop.js | 6 +-- mozilla/toolkit/content/widgets/browser.xml | 2 +- mozilla/toolkit/content/widgets/general.xml | 2 +- mozilla/toolkit/content/widgets/radio.xml | 8 +-- mozilla/toolkit/content/widgets/scrollbar.xml | 8 +-- mozilla/toolkit/content/widgets/scrollbox.xml | 6 +-- mozilla/toolkit/content/widgets/tabbox.xml | 2 +- .../toolkit/content/widgets/tabbrowser.xml | 2 +- mozilla/toolkit/content/widgets/textbox.xml | 2 +- mozilla/toolkit/content/widgets/tree.xml | 6 +-- .../resources/content/linkToolbarOverlay.xul | 2 +- .../browser/resources/content/navigator.xul | 19 ++++--- .../resources/content/navigatorOverlay.xul | 12 ++--- .../resources/content/contentAreaClick.js | 10 ++-- .../bookmarks/resources/bookmarksManager.js | 4 +- .../bookmarks/resources/bookmarksManager.xul | 4 +- .../bookmarks/resources/bookmarksTree.xml | 8 +-- .../resources/content/bindings/general.xml | 2 +- .../resources/content/bindings/radio.xml | 8 +-- .../resources/content/bindings/scrollbar.xml | 8 +-- .../resources/content/bindings/scrollbox.xml | 8 +-- .../resources/content/bindings/tabbox.xml | 4 +- .../resources/content/bindings/tabbrowser.xml | 2 +- .../resources/content/bindings/textbox.xml | 2 +- .../resources/content/bindings/tree.xml | 6 +-- .../global/resources/content/nsDragAndDrop.js | 6 +-- 65 files changed, 207 insertions(+), 306 deletions(-) diff --git a/mozilla/browser/base/content/browser-menubar.inc b/mozilla/browser/base/content/browser-menubar.inc index acae0007ce6..30a09983b26 100644 --- a/mozilla/browser/base/content/browser-menubar.inc +++ b/mozilla/browser/base/content/browser-menubar.inc @@ -187,7 +187,7 @@ + oncommand="setStyleDisabled(true); event.stopPropagation();" type="radio"/> @@ -415,10 +415,10 @@ oncommand="BookmarksMenu.loadBookmark(event, event.target, this.database)" onclick="BookmarksMenu.loadBookmarkMiddleClick(event, this.database)" ondraggesture="nsDragAndDrop.startDrag(event, BookmarksMenuDNDObserver)" - ondragdrop="nsDragAndDrop.drop(event, BookmarksMenuDNDObserver); event.preventBubble()" - ondragenter="nsDragAndDrop.dragEnter(event, BookmarksMenuDNDObserver); event.preventBubble()" - ondragexit="nsDragAndDrop.dragExit(event, BookmarksMenuDNDObserver); event.preventBubble()" - ondragover="nsDragAndDrop.dragOver(event, BookmarksMenuDNDObserver); event.preventBubble()"> + ondragdrop="nsDragAndDrop.drop(event, BookmarksMenuDNDObserver); event.stopPropagation()" + ondragenter="nsDragAndDrop.dragEnter(event, BookmarksMenuDNDObserver); event.stopPropagation()" + ondragexit="nsDragAndDrop.dragExit(event, BookmarksMenuDNDObserver); event.stopPropagation()" + ondragover="nsDragAndDrop.dragOver(event, BookmarksMenuDNDObserver); event.stopPropagation()"> @@ -184,7 +184,7 @@ @@ -229,8 +229,7 @@ + onclick="event.stopPropagation();"> #endif - + @@ -315,10 +314,10 @@ oncommand="BookmarksMenu.loadBookmark(event, event.target, this.database)" onclick="BookmarksMenu.loadBookmarkMiddleClick(event, this.database)" ondraggesture="nsDragAndDrop.startDrag(event, BookmarksMenuDNDObserver)" - ondragdrop="nsDragAndDrop.drop(event, BookmarksMenuDNDObserver); event.preventBubble()" - ondragenter="nsDragAndDrop.dragEnter(event, BookmarksMenuDNDObserver); event.preventBubble()" - ondragexit="nsDragAndDrop.dragExit(event, BookmarksMenuDNDObserver); event.preventBubble()" - ondragover="nsDragAndDrop.dragOver(event, BookmarksMenuDNDObserver); event.preventBubble()"> + ondragdrop="nsDragAndDrop.drop(event, BookmarksMenuDNDObserver); event.stopPropagation()" + ondragenter="nsDragAndDrop.dragEnter(event, BookmarksMenuDNDObserver); event.stopPropagation()" + ondragexit="nsDragAndDrop.dragExit(event, BookmarksMenuDNDObserver); event.stopPropagation()" + ondragover="nsDragAndDrop.dragOver(event, BookmarksMenuDNDObserver); event.stopPropagation()"> @@ -332,10 +331,10 @@ oncommand="BookmarksMenu.loadBookmark(event, event.target, this.database)" onclick="BookmarksMenu.loadBookmarkMiddleClick(event, this.database)" ondraggesture="nsDragAndDrop.startDrag(event, BookmarksMenuDNDObserver)" - ondragdrop="nsDragAndDrop.drop(event, BookmarksMenuDNDObserver); event.preventBubble()" - ondragenter="nsDragAndDrop.dragEnter(event, BookmarksMenuDNDObserver); event.preventBubble()" - ondragexit="nsDragAndDrop.dragExit(event, BookmarksMenuDNDObserver); event.preventBubble()" - ondragover="nsDragAndDrop.dragOver(event, BookmarksMenuDNDObserver); event.preventBubble()"> + ondragdrop="nsDragAndDrop.drop(event, BookmarksMenuDNDObserver); event.stopPropagation()" + ondragenter="nsDragAndDrop.dragEnter(event, BookmarksMenuDNDObserver); event.stopPropagation()" + ondragexit="nsDragAndDrop.dragExit(event, BookmarksMenuDNDObserver); event.stopPropagation()" + ondragover="nsDragAndDrop.dragOver(event, BookmarksMenuDNDObserver); event.stopPropagation()"> @@ -502,7 +501,7 @@ diff --git a/mozilla/browser/components/bookmarks/content/bookmarksManager.js b/mozilla/browser/components/bookmarks/content/bookmarksManager.js index e1a2d81ae2e..b8aff93d588 100644 --- a/mozilla/browser/components/bookmarks/content/bookmarksManager.js +++ b/mozilla/browser/components/bookmarks/content/bookmarksManager.js @@ -185,7 +185,7 @@ function onViewMenuSortItemSelected(aEvent) break; } - aEvent.preventCapture(); + aEvent.stopPropagation(); } var gConstructedColumnsMenuItems = false; @@ -216,7 +216,7 @@ function fillColumnsMenu(aEvent) } } - aEvent.preventBubble(); + aEvent.stopPropagation(); } function onViewMenuColumnItemSelected(aEvent) @@ -227,7 +227,7 @@ function onViewMenuColumnItemSelected(aEvent) bookmarksView.toggleColumnVisibility(resource); } - aEvent.preventBubble(); + aEvent.stopPropagation(); } function onViewSelected(aEvent) diff --git a/mozilla/browser/components/bookmarks/content/bookmarksManager.xul b/mozilla/browser/components/bookmarks/content/bookmarksManager.xul index d86294852f0..3a8388aac47 100644 --- a/mozilla/browser/components/bookmarks/content/bookmarksManager.xul +++ b/mozilla/browser/components/bookmarks/content/bookmarksManager.xul @@ -172,7 +172,7 @@ diff --git a/mozilla/browser/components/bookmarks/content/bookmarksMenu.js b/mozilla/browser/components/bookmarks/content/bookmarksMenu.js index 70837ffb456..a44a05aba74 100644 --- a/mozilla/browser/components/bookmarks/content/bookmarksMenu.js +++ b/mozilla/browser/components/bookmarks/content/bookmarksMenu.js @@ -449,7 +449,7 @@ var BookmarksMenu = { var selection = BookmarksUtils.getSelectionFromResource(rSource); var browserTarget = whereToOpenLink(aEvent); BookmarksCommand.openBookmark(selection, browserTarget, aDS); - aEvent.preventBubble(); + aEvent.stopPropagation(); }, //////////////////////////////////////////////// diff --git a/mozilla/browser/components/bookmarks/content/bookmarksTree.xml b/mozilla/browser/components/bookmarks/content/bookmarksTree.xml index 476f70cf17f..22ab7f94cc4 100644 --- a/mozilla/browser/components/bookmarks/content/bookmarksTree.xml +++ b/mozilla/browser/components/bookmarks/content/bookmarksTree.xml @@ -845,8 +845,8 @@ + onclick="event.stopPropagation();" + onkeypress="event.stopPropagation();"/> + onclick="event.stopPropagation();" + onkeypress="event.stopPropagation();"/> diff --git a/mozilla/browser/components/places/content/menu.xml b/mozilla/browser/components/places/content/menu.xml index 9eaa94d270c..9ba79e7eba8 100755 --- a/mozilla/browser/components/places/content/menu.xml +++ b/mozilla/browser/components/places/content/menu.xml @@ -709,7 +709,7 @@ if (this.eventValid(event)) { this.setSelectionForEvent(event); // Don't let the event bubble up to a parent toolbar. - event.preventBubble(); + event.stopPropagation(); } ]]> + oncommand="ViewMenu.showHideColumn(event.target); event.stopPropagation();"/> + oncommand="ViewMenu.setSortColumn(null, 'ascending'); event.stopPropagation();"/> + oncommand="ViewMenu.setSortColumn(null, 'descending'); event.stopPropagation();"/> diff --git a/mozilla/content/html/content/src/nsHTMLButtonElement.cpp b/mozilla/content/html/content/src/nsHTMLButtonElement.cpp index 774a54624fc..ed1e0bf4211 100644 --- a/mozilla/content/html/content/src/nsHTMLButtonElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLButtonElement.cpp @@ -423,14 +423,8 @@ nsHTMLButtonElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor) case NS_MOUSE_RIGHT_BUTTON_DOWN: case NS_MOUSE_RIGHT_BUTTON_UP: { - nsCOMPtr nsevent; - if (aVisitor.mDOMEvent) { - nsevent = do_QueryInterface(aVisitor.mDOMEvent); - } - - if (nsevent) { - nsevent->PreventBubble(); + aVisitor.mDOMEvent->StopPropagation(); } else { rv = NS_ERROR_FAILURE; } diff --git a/mozilla/content/html/content/src/nsHTMLInputElement.cpp b/mozilla/content/html/content/src/nsHTMLInputElement.cpp index 3ea3e631799..9dc5c117f4f 100644 --- a/mozilla/content/html/content/src/nsHTMLInputElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLInputElement.cpp @@ -1630,10 +1630,8 @@ nsHTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor) if (mType == NS_FORM_INPUT_BUTTON || mType == NS_FORM_INPUT_RESET || mType == NS_FORM_INPUT_SUBMIT) { - nsCOMPtr nsevent = - do_QueryInterface(aVisitor.mDOMEvent); - if (nsevent) { - nsevent->PreventBubble(); + if (aVisitor.mDOMEvent) { + aVisitor.mDOMEvent->StopPropagation(); } else { rv = NS_ERROR_FAILURE; } diff --git a/mozilla/content/xul/content/src/nsXULPopupListener.cpp b/mozilla/content/xul/content/src/nsXULPopupListener.cpp index 637277259a1..09390d80e5a 100644 --- a/mozilla/content/xul/content/src/nsXULPopupListener.cpp +++ b/mozilla/content/xul/content/src/nsXULPopupListener.cpp @@ -297,30 +297,22 @@ XULPopupListenerImpl::PreLaunchPopup(nsIDOMEvent* aMouseEvent) if (button == 0) { // Time to launch a popup menu. LaunchPopup(aMouseEvent); - - if (nsevent) { - nsevent->PreventBubble(); - } - + aMouseEvent->StopPropagation(); aMouseEvent->PreventDefault(); } break; case eXULPopupType_context: - // Time to launch a context menu + // Time to launch a context menu #ifndef NS_CONTEXT_MENU_IS_MOUSEUP - // If the context menu launches on mousedown, - // we have to fire focus on the content we clicked on - FireFocusOnTargetContent(targetNode); + // If the context menu launches on mousedown, + // we have to fire focus on the content we clicked on + FireFocusOnTargetContent(targetNode); #endif - LaunchPopup(aMouseEvent); - - if (nsevent) { - nsevent->PreventBubble(); - } - - aMouseEvent->PreventDefault(); - break; + LaunchPopup(aMouseEvent); + aMouseEvent->StopPropagation(); + aMouseEvent->PreventDefault(); + break; } xulDocument->SetPopupEvent(nsnull); return NS_OK; diff --git a/mozilla/editor/libeditor/text/nsEditorEventListeners.cpp b/mozilla/editor/libeditor/text/nsEditorEventListeners.cpp index 17f08cfed9f..bbae808be4f 100644 --- a/mozilla/editor/libeditor/text/nsEditorEventListeners.cpp +++ b/mozilla/editor/libeditor/text/nsEditorEventListeners.cpp @@ -356,9 +356,9 @@ nsTextEditorMouseListener::MouseClick(nsIDOMEvent* aMouseEvent) else editor->Paste(clipboard); - // Prevent the event from bubbling up to be possibly handled + // Prevent the event from propagating up to be possibly handled // again by the containing window: - nsevent->PreventBubble(); + mouseEvent->StopPropagation(); mouseEvent->PreventDefault(); // We processed the event, whether drop/paste succeeded or not @@ -652,11 +652,7 @@ nsTextEditorDragListener::DragDrop(nsIDOMEvent* aMouseEvent) return NS_OK; } - //some day we want to use another way to stop this from bubbling. - nsCOMPtr nsevent(do_QueryInterface(aMouseEvent)); - if (nsevent) - nsevent->PreventBubble(); - + aMouseEvent->StopPropagation(); aMouseEvent->PreventDefault(); return mEditor->InsertFromDrop(aMouseEvent); } @@ -1012,6 +1008,7 @@ IsTargetFocused(nsIDOMEventTarget* aTarget) nsresult nsTextEditorFocusListener::Focus(nsIDOMEvent* aEvent) { + NS_ENSURE_ARG(aEvent); // It's possible for us to receive a focus when we're really not focused. // This happens, for example, when an onfocus handler that's hooked up // before this listener focuses something else. In that case, all of the @@ -1029,10 +1026,7 @@ nsTextEditorFocusListener::Focus(nsIDOMEvent* aEvent) // turn on selection and caret if (mEditor) { - nsCOMPtr nsevent(do_QueryInterface(aEvent)); - if (nsevent) { - nsevent->PreventBubble(); - } + aEvent->StopPropagation(); PRUint32 flags; mEditor->GetFlags(&flags); @@ -1077,13 +1071,11 @@ nsTextEditorFocusListener::Focus(nsIDOMEvent* aEvent) nsresult nsTextEditorFocusListener::Blur(nsIDOMEvent* aEvent) { + NS_ENSURE_ARG(aEvent); // turn off selection and caret if (mEditor) { - nsCOMPtr nsevent(do_QueryInterface(aEvent)); - if (nsevent) { - nsevent->PreventBubble(); - } + aEvent->StopPropagation(); // when imeEditor exists, call ForceCompositionEnd() to tell // the input focus is leaving first diff --git a/mozilla/editor/libeditor/text/nsPlaintextDataTransfer.cpp b/mozilla/editor/libeditor/text/nsPlaintextDataTransfer.cpp index ed7a4c930e6..55168e9b47d 100644 --- a/mozilla/editor/libeditor/text/nsPlaintextDataTransfer.cpp +++ b/mozilla/editor/libeditor/text/nsPlaintextDataTransfer.cpp @@ -408,9 +408,7 @@ NS_IMETHODIMP nsPlaintextEditor::DoDrag(nsIDOMEvent *aDragEvent) rv = dragService->InvokeDragSession(domnode, transferableArray, nsnull, flags); if (NS_FAILED(rv)) return rv; - nsCOMPtr nsevent(do_QueryInterface(aDragEvent)); - if (nsevent) - nsevent->PreventBubble(); + aDragEvent->StopPropagation(); return rv; } diff --git a/mozilla/editor/ui/dialogs/content/EdImageMapShapes.js b/mozilla/editor/ui/dialogs/content/EdImageMapShapes.js index bd3a71b83e5..e704c9e35e5 100644 --- a/mozilla/editor/ui/dialogs/content/EdImageMapShapes.js +++ b/mozilla/editor/ui/dialogs/content/EdImageMapShapes.js @@ -212,7 +212,7 @@ function addPoint(event, pointX, pointY, start){ dump('addPoint Called with event\n'); pointX = event.clientX+window.frames[0].pageXOffset; pointY = event.clientY+window.frames[0].pageYOffset; - event.preventBubble(); + event.stopPropagation(); if (event.detail == 2){ polyFinish(); return; @@ -281,7 +281,7 @@ function polyFinish(event, construct){ else deleteElement(currentPoly); if (event) - event.preventBubble(); + event.stopPropagation(); currentPoly = null; } diff --git a/mozilla/extensions/venkman/resources/content/venkman-views.js b/mozilla/extensions/venkman/resources/content/venkman-views.js index 1a646e25cc6..50883ce5c9e 100644 --- a/mozilla/extensions/venkman/resources/content/venkman-views.js +++ b/mozilla/extensions/venkman/resources/content/venkman-views.js @@ -3092,8 +3092,8 @@ console.views.source2.onCloseButton = function s2v_onclose(e) { var index = this.getIndexOfTab(e.target.parentNode); - this.removeSourceTabAtIndex(index); - e.preventBubble() + this.removeSourceTabAtIndex(index); + e.stopPropagation(); } console.views.source2.onTabClick = diff --git a/mozilla/layout/forms/nsListControlFrame.cpp b/mozilla/layout/forms/nsListControlFrame.cpp index 9099e39fc66..ff580941fba 100644 --- a/mozilla/layout/forms/nsListControlFrame.cpp +++ b/mozilla/layout/forms/nsListControlFrame.cpp @@ -2245,13 +2245,7 @@ nsListControlFrame::MouseUp(nsIDOMEvent* aMouseEvent) if (IsInDropDownMode()) { if (!IgnoreMouseEventForSelection(aMouseEvent)) { aMouseEvent->PreventDefault(); - - nsCOMPtr nsevent(do_QueryInterface(aMouseEvent)); - - if (nsevent) { - nsevent->PreventCapture(); - nsevent->PreventBubble(); - } + aMouseEvent->StopPropagation(); } else { CaptureMouseEvents(PR_FALSE); return NS_OK; @@ -2295,14 +2289,7 @@ nsListControlFrame::MouseUp(nsIDOMEvent* aMouseEvent) IsOptionDisabled(selectedIndex, isDisabled); if (isDisabled) { aMouseEvent->PreventDefault(); - - nsCOMPtr nsevent(do_QueryInterface(aMouseEvent)); - - if (nsevent) { - nsevent->PreventCapture(); - nsevent->PreventBubble(); - } - + aMouseEvent->StopPropagation(); CaptureMouseEvents(PR_FALSE); return NS_ERROR_FAILURE; } @@ -2520,13 +2507,7 @@ nsListControlFrame::MouseDown(nsIDOMEvent* aMouseEvent) if (IsInDropDownMode()) { if (!IgnoreMouseEventForSelection(aMouseEvent)) { aMouseEvent->PreventDefault(); - - nsCOMPtr nsevent(do_QueryInterface(aMouseEvent)); - - if (nsevent) { - nsevent->PreventCapture(); - nsevent->PreventBubble(); - } + aMouseEvent->StopPropagation(); } else { return NS_OK; } diff --git a/mozilla/layout/forms/resources/content/select.xml b/mozilla/layout/forms/resources/content/select.xml index 64a4b6982a1..16db120a6e5 100644 --- a/mozilla/layout/forms/resources/content/select.xml +++ b/mozilla/layout/forms/resources/content/select.xml @@ -729,13 +729,13 @@ diff --git a/mozilla/layout/generic/nsObjectFrame.cpp b/mozilla/layout/generic/nsObjectFrame.cpp index 7d750eab296..ce02bb85246 100644 --- a/mozilla/layout/generic/nsObjectFrame.cpp +++ b/mozilla/layout/generic/nsObjectFrame.cpp @@ -2620,12 +2620,7 @@ nsresult nsPluginInstanceOwner::DispatchFocusToPlugin(nsIDOMEvent* aFocusEvent) nsEventStatus rv = ProcessEvent(focusEvent); if (nsEventStatus_eConsumeNoDefault == rv) { aFocusEvent->PreventDefault(); - - nsCOMPtr nsevent(do_QueryInterface(aFocusEvent)); - - if (nsevent) { - nsevent->PreventBubble(); - } + aFocusEvent->StopPropagation(); } } else NS_ASSERTION(PR_FALSE, "nsPluginInstanceOwner::DispatchFocusToPlugin failed, focusEvent null"); @@ -2641,10 +2636,7 @@ nsresult nsPluginInstanceOwner::DragEnter(nsIDOMEvent* aMouseEvent) if (mInstance) { // Let the plugin handle drag events. aMouseEvent->PreventDefault(); - nsCOMPtr nsevent(do_QueryInterface(aMouseEvent)); - if (nsevent) { - nsevent->PreventBubble(); - } + aMouseEvent->StopPropagation(); } return NS_OK; @@ -2655,10 +2647,7 @@ nsresult nsPluginInstanceOwner::DragOver(nsIDOMEvent* aMouseEvent) if (mInstance) { // Let the plugin handle drag events. aMouseEvent->PreventDefault(); - nsCOMPtr nsevent(do_QueryInterface(aMouseEvent)); - if (nsevent) { - nsevent->PreventBubble(); - } + aMouseEvent->StopPropagation(); } return NS_OK; @@ -2669,10 +2658,7 @@ nsresult nsPluginInstanceOwner::DragExit(nsIDOMEvent* aMouseEvent) if (mInstance) { // Let the plugin handle drag events. aMouseEvent->PreventDefault(); - nsCOMPtr nsevent(do_QueryInterface(aMouseEvent)); - if (nsevent) { - nsevent->PreventBubble(); - } + aMouseEvent->StopPropagation(); } return NS_OK; @@ -2683,10 +2669,7 @@ nsresult nsPluginInstanceOwner::DragDrop(nsIDOMEvent* aMouseEvent) if (mInstance) { // Let the plugin handle drag events. aMouseEvent->PreventDefault(); - nsCOMPtr nsevent(do_QueryInterface(aMouseEvent)); - if (nsevent) { - nsevent->PreventBubble(); - } + aMouseEvent->StopPropagation(); } return NS_OK; @@ -2697,10 +2680,7 @@ nsresult nsPluginInstanceOwner::DragGesture(nsIDOMEvent* aMouseEvent) if (mInstance) { // Let the plugin handle drag events. aMouseEvent->PreventDefault(); - nsCOMPtr nsevent(do_QueryInterface(aMouseEvent)); - if (nsevent) { - nsevent->PreventBubble(); - } + aMouseEvent->StopPropagation(); } return NS_OK; @@ -2757,10 +2737,7 @@ nsresult nsPluginInstanceOwner::KeyPress(nsIDOMEvent* aKeyEvent) // If this event is going to the plugin, we want to kill it. // Not actually sending keypress to the plugin, since we didn't before. aKeyEvent->PreventDefault(); - nsCOMPtr nsevent(do_QueryInterface(aKeyEvent)); - if (nsevent) { - nsevent->PreventBubble(); - } + aKeyEvent->StopPropagation(); } return NS_OK; #endif @@ -2783,12 +2760,7 @@ nsresult nsPluginInstanceOwner::DispatchKeyToPlugin(nsIDOMEvent* aKeyEvent) nsEventStatus rv = ProcessEvent(*keyEvent); if (nsEventStatus_eConsumeNoDefault == rv) { aKeyEvent->PreventDefault(); - - nsCOMPtr nsevent(do_QueryInterface(aKeyEvent)); - - if (nsevent) { - nsevent->PreventBubble(); - } + aKeyEvent->StopPropagation(); } } else NS_ASSERTION(PR_FALSE, "nsPluginInstanceOwner::DispatchKeyToPlugin failed, keyEvent null"); @@ -2916,12 +2888,7 @@ nsresult nsPluginInstanceOwner::DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent) nsEventStatus rv = ProcessEvent(*mouseEvent); if (nsEventStatus_eConsumeNoDefault == rv) { aMouseEvent->PreventDefault(); - - nsCOMPtr nsevent(do_QueryInterface(aMouseEvent)); - - if (nsevent) { - nsevent->PreventBubble(); - } + aMouseEvent->StopPropagation(); } } else NS_ASSERTION(PR_FALSE, "nsPluginInstanceOwner::DispatchMouseToPlugin failed, mouseEvent null"); diff --git a/mozilla/layout/xul/base/src/nsMenuBarListener.cpp b/mozilla/layout/xul/base/src/nsMenuBarListener.cpp index 919c0cfd988..14ea7eb3943 100644 --- a/mozilla/layout/xul/base/src/nsMenuBarListener.cpp +++ b/mozilla/layout/xul/base/src/nsMenuBarListener.cpp @@ -170,13 +170,7 @@ nsMenuBarListener::KeyUp(nsIDOMEvent* aKeyEvent) PRBool active = mMenuBarFrame->IsActive(); if (active) { - nsCOMPtr nsevent(do_QueryInterface(aKeyEvent)); - - if (nsevent) { - nsevent->PreventBubble(); - nsevent->PreventCapture(); - } - + aKeyEvent->StopPropagation(); aKeyEvent->PreventDefault(); return NS_ERROR_BASE; // I am consuming event } @@ -217,7 +211,6 @@ nsMenuBarListener::KeyPress(nsIDOMEvent* aKeyEvent) if (mAccessKey) { nsCOMPtr nsUIEvent = do_QueryInterface(aKeyEvent); - nsCOMPtr nsevent(do_QueryInterface(aKeyEvent)); PRBool preventDefault; @@ -243,13 +236,9 @@ nsMenuBarListener::KeyPress(nsIDOMEvent* aKeyEvent) mMenuBarFrame->ShortcutNavigation(keyEvent, active); if (active) { - if (nsevent) { - nsevent->PreventBubble(); - nsevent->PreventCapture(); - } - + aKeyEvent->StopPropagation(); aKeyEvent->PreventDefault(); - + retVal = NS_ERROR_BASE; // I am consuming event } } @@ -261,11 +250,7 @@ nsMenuBarListener::KeyPress(nsIDOMEvent* aKeyEvent) // In Windows, both of these activate the menu bar. mMenuBarFrame->ToggleMenuActiveState(); - if (nsevent) { - nsevent->PreventBubble(); - nsevent->PreventCapture(); - } - + aKeyEvent->StopPropagation(); aKeyEvent->PreventDefault(); return NS_ERROR_BASE; // consume the event } diff --git a/mozilla/layout/xul/base/src/nsMenuListener.cpp b/mozilla/layout/xul/base/src/nsMenuListener.cpp index 94537edc784..b9814dc67ce 100644 --- a/mozilla/layout/xul/base/src/nsMenuListener.cpp +++ b/mozilla/layout/xul/base/src/nsMenuListener.cpp @@ -91,13 +91,7 @@ nsMenuListener::~nsMenuListener() nsresult nsMenuListener::KeyUp(nsIDOMEvent* aKeyEvent) { - nsCOMPtr nsevent(do_QueryInterface(aKeyEvent)); - - if (nsevent) { - nsevent->PreventBubble(); - nsevent->PreventCapture(); - } - + aKeyEvent->StopPropagation(); aKeyEvent->PreventDefault(); return NS_ERROR_BASE; // I am consuming event diff --git a/mozilla/mail/base/content/FilterListDialog.js b/mozilla/mail/base/content/FilterListDialog.js index 353fa85bb39..9e427acf9bb 100644 --- a/mozilla/mail/base/content/FilterListDialog.js +++ b/mozilla/mail/base/content/FilterListDialog.js @@ -612,7 +612,7 @@ function onFilterClick(event) if (row.value == -1 || row.value > filterTree.view.rowCount-1 || event.originalTarget.localName != "treechildren") { if (event.originalTarget.localName == "treecol") { // clicking on the name column in the filter list should not sort - event.preventBubble(); + event.stopPropagation(); } return; } diff --git a/mozilla/mail/base/content/mailWindowOverlay.js b/mozilla/mail/base/content/mailWindowOverlay.js index f18f3f1da6a..6df2bace27b 100644 --- a/mozilla/mail/base/content/mailWindowOverlay.js +++ b/mozilla/mail/base/content/mailWindowOverlay.js @@ -2052,7 +2052,7 @@ function GetMessagesForAccount(aEvent) var uri = aEvent.target.id; var server = GetServer(uri); GetMessagesForInboxOnServer(server); - aEvent.preventBubble(); + aEvent.stopPropagation(); } diff --git a/mozilla/mail/base/content/mailWindowOverlay.xul b/mozilla/mail/base/content/mailWindowOverlay.xul index ba26b4ff8c7..1d4622b8fbd 100644 --- a/mozilla/mail/base/content/mailWindowOverlay.xul +++ b/mozilla/mail/base/content/mailWindowOverlay.xul @@ -257,7 +257,7 @@ oncommandupdate="goUpdateMailMenuItems(this)"> @@ -266,13 +266,13 @@ events="create-menu-mark" oncommandupdate="goUpdateMailMenuItems(this)"> - - - + + + - - - + + + diff --git a/mozilla/mail/base/content/msgMail3PaneWindow.js b/mozilla/mail/base/content/msgMail3PaneWindow.js index 84d695bb7dc..42ed9af6d07 100644 --- a/mozilla/mail/base/content/msgMail3PaneWindow.js +++ b/mozilla/mail/base/content/msgMail3PaneWindow.js @@ -1358,7 +1358,7 @@ function ChangeSelectionWithoutContentLoad(event, tree) if(tree.id == "threadTree") gThreadPaneCurrentSelectedIndex = row; } - event.preventBubble(); + event.stopPropagation(); } function TreeOnMouseDown(event) @@ -1389,7 +1389,7 @@ function FolderPaneOnClick(event) if (row.value == -1) { if (event.originalTarget.localName == "treecol") { // clicking on the name column in the folder pane should not sort - event.preventBubble(); + event.stopPropagation(); CycleFolderView(); // needed to cycle the folder view for the old school tree col users } return; @@ -1420,7 +1420,7 @@ function FolderPaneOnClick(event) } else if ((event.originalTarget.localName == "slider") || (event.originalTarget.localName == "scrollbarbutton")) { - event.preventBubble(); + event.stopPropagation(); } else if (event.detail == 2) { FolderPaneDoubleClick(row.value, event); @@ -1452,7 +1452,7 @@ function FolderPaneDoubleClick(folderIndex, event) // double clicking should not toggle the open / close state of the // folder. this will happen if we don't prevent the event from // bubbling to the default handler in tree.xml - event.preventBubble(); + event.stopPropagation(); } } diff --git a/mozilla/mail/components/addrbook/content/abCommon.js b/mozilla/mail/components/addrbook/content/abCommon.js index 4d10fbd7a65..3219dc92d63 100644 --- a/mozilla/mail/components/addrbook/content/abCommon.js +++ b/mozilla/mail/components/addrbook/content/abCommon.js @@ -626,7 +626,7 @@ function DirPaneClick(event) // if the user clicks on the header / trecol, do nothing if (event.originalTarget.localName == "treecol") { - event.preventBubble(); + event.stopPropagation(); return; } } diff --git a/mozilla/mail/components/compose/content/MsgComposeCommands.js b/mozilla/mail/components/compose/content/MsgComposeCommands.js index 31cc4f2632a..b688e6745fc 100644 --- a/mozilla/mail/components/compose/content/MsgComposeCommands.js +++ b/mozilla/mail/components/compose/content/MsgComposeCommands.js @@ -2277,7 +2277,7 @@ function changeLanguage(event) InlineSpellChecker.checkDocument(window.content.document); } - event.preventBubble(); + event.stopPropagation(); } function ToggleReturnReceipt(target) diff --git a/mozilla/mail/components/compose/content/addressingWidgetOverlay.js b/mozilla/mail/components/compose/content/addressingWidgetOverlay.js index b0505c09c73..ddca8c8eae9 100644 --- a/mozilla/mail/components/compose/content/addressingWidgetOverlay.js +++ b/mozilla/mail/components/compose/content/addressingWidgetOverlay.js @@ -914,8 +914,10 @@ function awRecipientKeyDown(event, element) */ if (!element.value) awDeleteHit(element); - event.preventBubble(); //We need to stop the event else the listbox will receive it and the function - //awKeyDown will be executed! + + // We need to stop the event else the listbox will receive it and the + // function awKeyDown will be executed! + event.stopPropagation(); break; } } diff --git a/mozilla/mail/extensions/newsblog/content/edittree.xml b/mozilla/mail/extensions/newsblog/content/edittree.xml index c624ddcf775..259ca7f6a83 100755 --- a/mozilla/mail/extensions/newsblog/content/edittree.xml +++ b/mozilla/mail/extensions/newsblog/content/edittree.xml @@ -103,7 +103,7 @@ if (aEvent.keyCode == 27){ tree._assignValueToCell(tree._editOriginalValue,false); } - aEvent.preventBubble(); + aEvent.stopPropagation(); ]]> @@ -165,7 +165,7 @@ var col = {}; var obj = {}; if(row.value != -1) { - event.preventBubble(); + event.stopPropagation(); treeBox.getCellAt(event.clientX,event.clientY,row,col,obj); this.setEditMode(row.value,col.value,true); } diff --git a/mozilla/mailnews/addrbook/resources/content/abCommon.js b/mozilla/mailnews/addrbook/resources/content/abCommon.js index 2a873461454..1f6d165d361 100644 --- a/mozilla/mailnews/addrbook/resources/content/abCommon.js +++ b/mozilla/mailnews/addrbook/resources/content/abCommon.js @@ -622,7 +622,7 @@ function DirPaneClick(event) // if the user clicks on the header / trecol, do nothing if (event.originalTarget.localName == "treecol") { - event.preventBubble(); + event.stopPropagation(); return; } diff --git a/mozilla/mailnews/addrbook/resources/content/abMailListDialog.js b/mozilla/mailnews/addrbook/resources/content/abMailListDialog.js index 8b8632ca1ab..20eb372d51a 100644 --- a/mozilla/mailnews/addrbook/resources/content/abMailListDialog.js +++ b/mozilla/mailnews/addrbook/resources/content/abMailListDialog.js @@ -59,8 +59,10 @@ catch (e) function handleKeyPress(element, event) { // allow dialog to close on enter if focused textbox has no value - if (element.value != "" && event.keyCode == 13) - event.preventBubble(); + if (element.value != "" && event.keyCode == 13) { + event.stopPropagation(); + event.preventDefault(); + } } function mailingListExists(listname) @@ -365,7 +367,7 @@ function awNotAnEmptyArea(event) if ( lastInput && lastInput.value ) awAppendNewRow(false); - event.preventBubble(); + event.stopPropagation(); } function awClickEmptySpace(target, setFocus) diff --git a/mozilla/mailnews/addrbook/resources/content/abSelectAddressesDialog.js b/mozilla/mailnews/addrbook/resources/content/abSelectAddressesDialog.js index 38cd4eb092e..4e229bdb442 100644 --- a/mozilla/mailnews/addrbook/resources/content/abSelectAddressesDialog.js +++ b/mozilla/mailnews/addrbook/resources/content/abSelectAddressesDialog.js @@ -381,7 +381,7 @@ function OnReturnHit(event) var focusedElement = document.commandDispatcher.focusedElement; if (focusedElement && (focusedElement.id == "addressBucket")) return; - event.preventBubble(); + event.stopPropagation(); if (focusedElement && (focusedElement.id == "abResultsTree")) gActivatedButton.doCommand(); } diff --git a/mozilla/mailnews/base/resources/content/mailWindowOverlay.js b/mozilla/mailnews/base/resources/content/mailWindowOverlay.js index 08516a376dc..4ebc94b2210 100644 --- a/mozilla/mailnews/base/resources/content/mailWindowOverlay.js +++ b/mozilla/mailnews/base/resources/content/mailWindowOverlay.js @@ -2005,7 +2005,7 @@ function GetMessagesForAccount(aEvent) var uri = aEvent.target.id; var server = GetServer(uri); GetMessagesForInboxOnServer(server); - aEvent.preventBubble(); + aEvent.stopPropagation(); } diff --git a/mozilla/mailnews/base/resources/content/mailWindowOverlay.xul b/mozilla/mailnews/base/resources/content/mailWindowOverlay.xul index a791d150901..57a48e9c24b 100644 --- a/mozilla/mailnews/base/resources/content/mailWindowOverlay.xul +++ b/mozilla/mailnews/base/resources/content/mailWindowOverlay.xul @@ -268,7 +268,7 @@ oncommandupdate="goUpdateMailMenuItems(this)"> @@ -277,16 +277,16 @@ events="create-menu-mark" oncommandupdate="goUpdateMailMenuItems(this)"> - - - + + + - - - + + + - - + + filterTree.view.rowCount-1 || event.originalTarget.localName != "treechildren") { if (event.originalTarget.localName == "treecol") { // clicking on the name column in the filter list should not sort - event.preventBubble(); + event.stopPropagation(); } return; } diff --git a/mozilla/mailnews/compose/resources/content/addressingWidgetOverlay.js b/mozilla/mailnews/compose/resources/content/addressingWidgetOverlay.js index 6da7dd27c7d..0d063655c50 100644 --- a/mozilla/mailnews/compose/resources/content/addressingWidgetOverlay.js +++ b/mozilla/mailnews/compose/resources/content/addressingWidgetOverlay.js @@ -887,8 +887,10 @@ function awRecipientKeyDown(event, element) */ if (!element.value) awDeleteHit(element); - event.preventBubble(); //We need to stop the event else the listbox will receive it and the function - //awKeyDown will be executed! + + //We need to stop the event else the listbox will receive it and the function + //awKeyDown will be executed! + event.stopPropagation(); break; } } diff --git a/mozilla/toolkit/content/nsDragAndDrop.js b/mozilla/toolkit/content/nsDragAndDrop.js index 2be40f4c83c..1cf7f7abfbb 100644 --- a/mozilla/toolkit/content/nsDragAndDrop.js +++ b/mozilla/toolkit/content/nsDragAndDrop.js @@ -434,7 +434,7 @@ var nsDragAndDrop = { // cancel the drag. even if it's not, there's not much // we can do, so be silent. } - aEvent.preventBubble(); + aEvent.stopPropagation(); }, /** @@ -462,7 +462,7 @@ var nsDragAndDrop = { aDragDropObserver.onDragOver(aEvent, flavourSet.flavourTable[flavour], this.mDragSession); - aEvent.preventBubble(); + aEvent.stopPropagation(); break; } } @@ -495,7 +495,7 @@ var nsDragAndDrop = { var dropData = multiple ? transferData : transferData.first.first; aDragDropObserver.onDrop(aEvent, dropData, this.mDragSession); } - aEvent.preventBubble(); + aEvent.stopPropagation(); }, /** diff --git a/mozilla/toolkit/content/widgets/browser.xml b/mozilla/toolkit/content/widgets/browser.xml index c86ad034169..6f8ec56be71 100644 --- a/mozilla/toolkit/content/widgets/browser.xml +++ b/mozilla/toolkit/content/widgets/browser.xml @@ -930,7 +930,7 @@ diff --git a/mozilla/toolkit/content/widgets/general.xml b/mozilla/toolkit/content/widgets/general.xml index 871465dd5ed..da41de97e9c 100644 --- a/mozilla/toolkit/content/widgets/general.xml +++ b/mozilla/toolkit/content/widgets/general.xml @@ -160,7 +160,7 @@ } } } - aEvent.preventBubble(); + aEvent.stopPropagation(); ]]> diff --git a/mozilla/toolkit/content/widgets/radio.xml b/mozilla/toolkit/content/widgets/radio.xml index 40a95815cf0..553f245c9f5 100644 --- a/mozilla/toolkit/content/widgets/radio.xml +++ b/mozilla/toolkit/content/widgets/radio.xml @@ -297,19 +297,19 @@ this.checkAdjacentElement(false); - event.preventBubble(); + event.stopPropagation(); this.checkAdjacentElement(false); - event.preventBubble(); + event.stopPropagation(); this.checkAdjacentElement(true); - event.preventBubble(); + event.stopPropagation(); this.checkAdjacentElement(true); - event.preventBubble(); + event.stopPropagation(); + onclick="event.stopPropagation();" + onkeypress="event.stopPropagation();"/> + onclick="event.stopPropagation();" + onkeypress="event.stopPropagation();"/> diff --git a/mozilla/xpfe/global/resources/content/bindings/general.xml b/mozilla/xpfe/global/resources/content/bindings/general.xml index 9f9987408cc..35b67318dd8 100644 --- a/mozilla/xpfe/global/resources/content/bindings/general.xml +++ b/mozilla/xpfe/global/resources/content/bindings/general.xml @@ -160,7 +160,7 @@ } } } - aEvent.preventBubble(); + aEvent.stopPropagation(); ]]> diff --git a/mozilla/xpfe/global/resources/content/bindings/radio.xml b/mozilla/xpfe/global/resources/content/bindings/radio.xml index 40a95815cf0..553f245c9f5 100644 --- a/mozilla/xpfe/global/resources/content/bindings/radio.xml +++ b/mozilla/xpfe/global/resources/content/bindings/radio.xml @@ -297,19 +297,19 @@ this.checkAdjacentElement(false); - event.preventBubble(); + event.stopPropagation(); this.checkAdjacentElement(false); - event.preventBubble(); + event.stopPropagation(); this.checkAdjacentElement(true); - event.preventBubble(); + event.stopPropagation(); this.checkAdjacentElement(true); - event.preventBubble(); + event.stopPropagation();