Bug 1446711 part 8. Get rid of nsIDOMMouseEvent. r=qdot

MozReview-Commit-ID: 2FK1MA4LGZj
This commit is contained in:
Boris Zbarsky 2018-03-20 00:16:07 -04:00
Родитель 89ea512161
Коммит 837dc7eaaa
29 изменённых файлов: 28 добавлений и 86 удалений

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

@ -550,8 +550,10 @@ let BrowserUsageTelemetry = {
_recordUrlOrSearchbarSelectedResultMethod(event, highlightedIndex, histogramID, userSelectionBehavior) {
let histogram = Services.telemetry.getHistogramById(histogramID);
// command events are from the one-off context menu. Treat them as clicks.
let isClick = event instanceof Ci.nsIDOMMouseEvent ||
(event && event.type == "command");
// Note that we don't care about MouseEvent subclasses here, since
// those are not clicks.
let isClick = event && (ChromeUtils.getClassName(event) == "MouseEvent" ||
event.type == "command");
let category;
if (isClick) {
category = "click";

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

@ -1694,7 +1694,7 @@ module.exports = {
"!type": "fn()",
"prototype": "Event.prototype",
"!url": "https://developer.mozilla.org/en/docs/DOM/MouseEvent",
"!doc": "The DOM MouseEvent represents events that occur due to the user interacting with a pointing device (such as a mouse). It's represented by the nsINSDOMMouseEvent interface, which extends the nsIDOMMouseEvent interface."
"!doc": "The DOM MouseEvent represents events that occur due to the user interacting with a pointing device (such as a mouse)."
},
"KeyboardEvent": {
"!type": "fn()",

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

@ -1895,7 +1895,11 @@ DebuggerServer.ObjectActorPreviewers.Object = [
}
let props = [];
if (rawObj instanceof Ci.nsIDOMMouseEvent) {
if (obj.class == "MouseEvent" ||
obj.class == "DragEvent" ||
obj.class == "PointerEvent" ||
obj.class == "SimpleGestureEvent" ||
obj.class == "WheelEvent") {
props.push("buttons", "clientX", "clientY", "layerX", "layerY");
} else if (obj.class == "KeyboardEvent") {
let modifiers = [];

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

@ -43,13 +43,6 @@ MouseEvent::MouseEvent(EventTarget* aOwner,
}
}
NS_IMPL_ADDREF_INHERITED(MouseEvent, UIEvent)
NS_IMPL_RELEASE_INHERITED(MouseEvent, UIEvent)
NS_INTERFACE_MAP_BEGIN(MouseEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseEvent)
NS_INTERFACE_MAP_END_INHERITING(UIEvent)
void
MouseEvent::InitMouseEvent(const nsAString& aType,
bool aCanBubble,

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

@ -11,26 +11,18 @@
#include "mozilla/dom/UIEvent.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/EventForwards.h"
#include "nsIDOMMouseEvent.h"
namespace mozilla {
namespace dom {
class MouseEvent : public UIEvent,
public nsIDOMMouseEvent
class MouseEvent : public UIEvent
{
public:
MouseEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetMouseEventBase* aEvent);
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMMouseEvent Interface
NS_DECL_NSIDOMMOUSEEVENT
// Forward to base class
NS_FORWARD_TO_UIEVENT
NS_INLINE_DECL_REFCOUNTING_INHERITED(MouseEvent, UIEvent)
virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
{
@ -120,10 +112,6 @@ protected:
} // namespace dom
} // namespace mozilla
#define NS_FORWARD_TO_MOUSEEVENT \
NS_FORWARD_NSIDOMMOUSEEVENT(MouseEvent::) \
NS_FORWARD_TO_UIEVENT
already_AddRefed<mozilla::dom::MouseEvent>
NS_NewDOMMouseEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,

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

@ -22,9 +22,6 @@ public:
NS_INLINE_DECL_REFCOUNTING_INHERITED(MouseScrollEvent, MouseEvent)
// Forward to base class
NS_FORWARD_TO_MOUSEEVENT
virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
{
return MouseScrollEventBinding::Wrap(aCx, this, aGivenProto);

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

@ -23,9 +23,6 @@ public:
NS_INLINE_DECL_REFCOUNTING_INHERITED(WheelEvent, MouseEvent)
// Forward to base class
NS_FORWARD_TO_MOUSEEVENT
static
already_AddRefed<WheelEvent> Constructor(const GlobalObject& aGlobal,
const nsAString& aType,

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

@ -314,7 +314,7 @@ interface nsIDOMWindowUtils : nsISupports {
* @param aIgnoreRootScrollFrame whether the event should ignore viewport bounds
* during dispatch
* @param aPressure touch input pressure: 0.0 -> 1.0
* @param aInputSourceArg input source, see nsIDOMMouseEvent for values,
* @param aInputSourceArg input source, see MouseEvent for values,
* defaults to mouse input.
* @param aIsDOMEventSynthesized controls nsIDOMEvent.isSynthesized value
* that helps identifying test related events,

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

@ -12,7 +12,6 @@ XPIDL_SOURCES += [
'nsIDOMEvent.idl',
'nsIDOMEventListener.idl',
'nsIDOMEventTarget.idl',
'nsIDOMMouseEvent.idl',
'nsIDOMNotifyPaintEvent.idl',
'nsIDOMNSEvent.idl',
'nsIDOMUIEvent.idl',

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

@ -1,19 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIDOMUIEvent.idl"
/**
* The nsIDOMMouseEvent interface is the datatype for all mouse events
* in the Document Object Model.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-2-Events/
*/
[builtinclass, uuid(5bdab8d8-7933-4c5c-b6d1-ab34481237f7)]
interface nsIDOMMouseEvent : nsIDOMUIEvent
{
};

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

@ -741,8 +741,7 @@ nsXBLPrototypeHandler::MouseEventMatched(MouseEvent* aMouseEvent)
return false;
}
return ModifiersMatchMask(static_cast<nsIDOMMouseEvent*>(aMouseEvent),
IgnoreModifierState());
return ModifiersMatchMask(aMouseEvent, IgnoreModifierState());
}
struct keyCodeData {

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

@ -14,7 +14,6 @@
#include "mozilla/dom/Element.h"
#include "nsIDOMElement.h"
#include "nsIDOMMouseEvent.h"
#include "nsIDOMEventListener.h"
#include "nsCycleCollectionParticipant.h"

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

@ -75,7 +75,6 @@
#include "nsIDOMEvent.h" // for nsIDOMEvent
#include "nsIDOMEventListener.h" // for nsIDOMEventListener
#include "nsIDOMEventTarget.h" // for nsIDOMEventTarget
#include "nsIDOMMouseEvent.h" // for nsIDOMMouseEvent
#include "nsIDOMNode.h" // for nsIDOMNode, etc.
#include "nsIDOMNodeList.h" // for nsIDOMNodeList
#include "nsIDocumentStateListener.h" // for nsIDocumentStateListener

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

@ -34,7 +34,6 @@
#include "nsIDOMDocument.h" // for nsIDOMDocument
#include "nsIDOMEvent.h" // for nsIDOMEvent
#include "nsIDOMEventTarget.h" // for nsIDOMEventTarget
#include "nsIDOMMouseEvent.h" // for nsIDOMMouseEvent
#include "nsIDOMNode.h" // for nsIDOMNode
#include "nsIDocument.h" // for nsIDocument
#include "nsIFocusManager.h" // for nsIFocusManager
@ -450,7 +449,7 @@ EditorEventListener::HandleEvent(nsIDOMEvent* aEvent)
}
// click
case eMouseClick: {
nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aEvent);
MouseEvent* mouseEvent = aEvent->InternalDOMEvent()->AsMouseEvent();
NS_ENSURE_TRUE(mouseEvent, NS_OK);
// If the preceding mousedown event or mouseup event was consumed,
// editor shouldn't handle this click event.
@ -636,7 +635,7 @@ EditorEventListener::KeyPress(WidgetKeyboardEvent* aKeyboardEvent)
}
nsresult
EditorEventListener::MouseClick(nsIDOMMouseEvent* aMouseEvent)
EditorEventListener::MouseClick(MouseEvent* aMouseEvent)
{
if (NS_WARN_IF(!aMouseEvent) || DetachedFromEditor()) {
return NS_OK;
@ -644,7 +643,7 @@ EditorEventListener::MouseClick(nsIDOMMouseEvent* aMouseEvent)
// nothing to do if editor isn't editable or clicked on out of the editor.
RefPtr<EditorBase> editorBase(mEditorBase);
WidgetMouseEvent* clickEvent =
aMouseEvent->AsEvent()->WidgetEventPtr()->AsMouseEvent();
aMouseEvent->WidgetEventPtr()->AsMouseEvent();
if (editorBase->IsReadonly() || editorBase->IsDisabled() ||
!editorBase->IsAcceptableInputEvent(clickEvent)) {
return NS_OK;
@ -681,12 +680,12 @@ EditorEventListener::MouseClick(nsIDOMMouseEvent* aMouseEvent)
}
nsresult
EditorEventListener::HandleMiddleClickPaste(nsIDOMMouseEvent* aMouseEvent)
EditorEventListener::HandleMiddleClickPaste(MouseEvent* aMouseEvent)
{
MOZ_ASSERT(aMouseEvent);
WidgetMouseEvent* clickEvent =
aMouseEvent->AsEvent()->WidgetEventPtr()->AsMouseEvent();
aMouseEvent->WidgetEventPtr()->AsMouseEvent();
MOZ_ASSERT(!DetachedFromEditorOrDefaultPrevented(clickEvent));
if (!Preferences::GetBool("middlemouse.paste", false)) {

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

@ -17,7 +17,6 @@
class nsCaret;
class nsIContent;
class nsIDOMEvent;
class nsIDOMMouseEvent;
class nsIPresShell;
class nsPresContext;
@ -70,7 +69,7 @@ protected:
void HandleEndComposition(WidgetCompositionEvent* aCompositionEvent);
virtual nsresult MouseDown(dom::MouseEvent* aMouseEvent);
virtual nsresult MouseUp(dom::MouseEvent* aMouseEvent) { return NS_OK; }
virtual nsresult MouseClick(nsIDOMMouseEvent* aMouseEvent);
virtual nsresult MouseClick(dom::MouseEvent* aMouseEvent);
nsresult Focus(InternalFocusEvent* aFocusEvent);
nsresult Blur(InternalFocusEvent* aBlurEvent);
nsresult DragEnter(dom::DragEvent* aDragEvent);
@ -88,7 +87,7 @@ protected:
bool EditorHasFocus();
bool IsFileControlTextBox();
bool ShouldHandleNativeKeyBindings(WidgetKeyboardEvent* aKeyboardEvent);
nsresult HandleMiddleClickPaste(nsIDOMMouseEvent* aMouseEvent);
nsresult HandleMiddleClickPaste(dom::MouseEvent* aMouseEvent);
/**
* DetachedFromEditor() returns true if editor was detached.

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

@ -28,7 +28,6 @@
#include "nsIDOMDocument.h"
#include "nsIDocumentInlines.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMMouseEvent.h"
#include "nsISelectionController.h"
#include "nsILinkHandler.h"
#include "nsIInlineSpellChecker.h"

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

@ -39,7 +39,6 @@ class nsITransferable;
class nsIClipboard;
class nsIDOMDocument;
class nsIDOMElement;
class nsIDOMMouseEvent;
class nsILinkHandler;
class nsTableWrapperFrame;
class nsIDOMRange;

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

@ -193,15 +193,13 @@ HTMLEditorEventListener::MouseDown(MouseEvent* aMouseEvent)
}
nsresult
HTMLEditorEventListener::MouseClick(nsIDOMMouseEvent* aMouseEvent)
HTMLEditorEventListener::MouseClick(MouseEvent* aMouseEvent)
{
if (NS_WARN_IF(DetachedFromEditor())) {
return NS_OK;
}
nsCOMPtr<nsIDOMEventTarget> target;
nsresult rv = aMouseEvent->AsEvent()->GetTarget(getter_AddRefs(target));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMEventTarget> target = aMouseEvent->GetTarget();
NS_ENSURE_TRUE(target, NS_ERROR_NULL_POINTER);
nsCOMPtr<Element> element = do_QueryInterface(target);
if (NS_WARN_IF(!element)) {

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

@ -32,7 +32,7 @@ public:
protected:
virtual nsresult MouseDown(dom::MouseEvent* aMouseEvent) override;
virtual nsresult MouseUp(dom::MouseEvent* aMouseEvent) override;
virtual nsresult MouseClick(nsIDOMMouseEvent* aMouseEvent) override;
virtual nsresult MouseClick(dom::MouseEvent* aMouseEvent) override;
};
} // namespace mozilla

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

@ -12,7 +12,6 @@
#include "nsGkAtoms.h"
#include "nsComboboxControlFrame.h"
#include "nsIPresShell.h"
#include "nsIDOMMouseEvent.h"
#include "nsIXULRuntime.h"
#include "nsFontMetrics.h"
#include "nsIScrollableFrame.h"
@ -1607,7 +1606,7 @@ nsListControlFrame::MouseUp(nsIDOMEvent* aMouseEvent)
{
NS_ASSERTION(aMouseEvent != nullptr, "aMouseEvent is null.");
nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aMouseEvent);
MouseEvent* mouseEvent = aMouseEvent->InternalDOMEvent()->AsMouseEvent();
NS_ENSURE_TRUE(mouseEvent, NS_ERROR_FAILURE);
UpdateInListState(aMouseEvent);
@ -1891,7 +1890,7 @@ nsresult
nsListControlFrame::MouseMove(nsIDOMEvent* aMouseEvent)
{
NS_ASSERTION(aMouseEvent, "aMouseEvent is null.");
nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aMouseEvent);
MouseEvent* mouseEvent = aMouseEvent->InternalDOMEvent()->AsMouseEvent();
NS_ENSURE_TRUE(mouseEvent, NS_ERROR_FAILURE);
UpdateInListState(aMouseEvent);

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

@ -16,7 +16,6 @@
#include "nsIContent.h"
#include "nsNameSpaceManager.h"
#include "nsIDocument.h"
#include "nsIDOMMouseEvent.h"
#include "nsIDOMElement.h"
#include "nsIDOMNodeList.h"
#include "nsCSSFrameConstructor.h"

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

@ -24,7 +24,6 @@
#include "nsIPresShell.h"
#include "nsCSSRendering.h"
#include "nsIDOMEvent.h"
#include "nsIDOMMouseEvent.h"
#include "nsScrollbarButtonFrame.h"
#include "nsISliderListener.h"
#include "nsIScrollableFrame.h"

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

@ -35,7 +35,6 @@
#include "nsStyleContext.h"
#include "nsIBoxObject.h"
#include "nsIDOMCustomEvent.h"
#include "nsIDOMMouseEvent.h"
#include "nsIDOMElement.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMXULElement.h"

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

@ -85,7 +85,7 @@ event.DoubleClickTracker = {
/**
* Sends a mouse event to given target.
*
* @param {nsIDOMMouseEvent} mouseEvent
* @param {MouseEvent} mouseEvent
* Event to send.
* @param {(DOMElement|string)} target
* Target of event. Can either be an element or the ID of an element.

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

@ -191,7 +191,7 @@ protected:
uint32_t mSuppressLevel;
// The input source of the drag event. Possible values are from nsIDOMMouseEvent.
// The input source of the drag event. Possible values are from MouseEvent.
uint16_t mInputSource;
nsTArray<RefPtr<mozilla::dom::ContentParent>> mChildProcesses;

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

@ -14,7 +14,6 @@
#include "nsWindow.h"
#include "nsWindowDefs.h"
#include "KeyboardLayout.h"
#include "nsIDOMMouseEvent.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/gfx/2D.h"

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

@ -85,7 +85,6 @@
#include "mozilla/WidgetTraceEvent.h"
#include "nsIAppShell.h"
#include "nsISupportsPrimitives.h"
#include "nsIDOMMouseEvent.h"
#include "nsIKeyEventInPluginCallback.h"
#include "nsITheme.h"
#include "nsIObserverService.h"

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

@ -46,7 +46,6 @@
#endif
#include "nsUXThemeData.h"
#include "nsIDOMMouseEvent.h"
#include "nsIIdleServiceInternal.h"
#include "IMMHandler.h"

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

@ -21,7 +21,6 @@
#include "nsIDOMEventTarget.h"
#include "nsIDOMGeoPositionError.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMMouseEvent.h"
#include "nsIDOMNode.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMNotifyPaintEvent.h"
@ -65,7 +64,6 @@
#include "mozilla/dom/ListBoxObjectBinding.h"
#include "mozilla/dom/MediaListBinding.h"
#include "mozilla/dom/MessageEventBinding.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/dom/NodeListBinding.h"
#include "mozilla/dom/NodeBinding.h"
#include "mozilla/dom/NotifyPaintEventBinding.h"
@ -158,7 +156,6 @@ const ComponentsInterfaceShimEntry kComponentsInterfaceShimMap[] =
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMGeoPositionError, PositionError),
DEFINE_SHIM(HTMLInputElement),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIListBoxObject, ListBoxObject),
DEFINE_SHIM(MouseEvent),
DEFINE_SHIM(NodeList),
DEFINE_SHIM(Node),
DEFINE_SHIM(NotifyPaintEvent),