Bug 1446711 part 7. Switch the nsIDOMMouseEvent::MOZ_SOURCE_* constants over to MouseEventBinding. r=qdot

We can't include MouseEventBinding.h in MouseEvents.h because that produces
this include loop:

MouseEventBinding.h -> UIEventBinding.h ->
nsGlobalWindow.h -> nsGlobalWindowInner.h -> nsRefreshDriver.h ->
AnimationEventDispatcher.h -> AnimationComparator.h -> Animation.h ->
EffectCompositor.h -> PseudoElementHashEntry.h -> Element.h ->
PointerEventHandler.h -> MouseEvents.h -> MouseEventBinding.h

MozReview-Commit-ID: 6FNksGil7uD
This commit is contained in:
Boris Zbarsky 2018-03-20 00:16:06 -04:00
Родитель b69e080b56
Коммит 89ea512161
58 изменённых файлов: 173 добавлений и 125 удалений

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

@ -37,6 +37,7 @@
#include "nsITreeColumns.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/HTMLLabelElement.h"
#include "mozilla/dom/MouseEventBinding.h"
using namespace mozilla;
@ -143,7 +144,7 @@ nsCoreUtils::DispatchMouseEvent(EventMessage aMessage, int32_t aX, int32_t aY,
event.mClickCount = 1;
event.button = WidgetMouseEvent::eLeftButton;
event.mTime = PR_IntervalNow();
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
event.inputSource = dom::MouseEventBinding::MOZ_SOURCE_UNKNOWN;
nsEventStatus status = nsEventStatus_eIgnore;
aPresShell->HandleEventWithTarget(&event, aFrame, aContent, &status);

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

@ -89,7 +89,10 @@ var PointerRelay = { // jshint ignore:line
if (Utils.MozBuildApp === "browser" && aEvent.view.top.isChromeWindow) {
return;
}
if (aEvent.mozInputSource === Ci.nsIDOMMouseEvent.MOZ_SOURCE_UNKNOWN ||
// aEvent might not be a mouse event here at all; don't do the
// mozInputSource check unless it is.
if (("mozInputSource" in aEvent &&
aEvent.mozInputSource === aEvent.MOZ_SOURCE_UNKNOWN) ||
aEvent.isSynthesized) {
// Ignore events that are scripted or clicks from the a11y API.
return;

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

@ -116,7 +116,7 @@ TouchSimulator.prototype = {
// Ignore all but real mouse event coming from physical mouse
// (especially ignore mouse event being dispatched from a touch event)
if (evt.button ||
evt.mozInputSource != Ci.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE ||
evt.mozInputSource != evt.MOZ_SOURCE_MOUSE ||
evt.isSynthesized) {
return;
}
@ -223,7 +223,7 @@ TouchSimulator.prototype = {
let utils = content.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
utils.sendMouseEvent(type, evt.clientX, evt.clientY, 0, 1, 0, true, 0,
Ci.nsIDOMMouseEvent.MOZ_SOURCE_TOUCH);
evt.MOZ_SOURCE_TOUCH);
},
sendContextMenu({ target, clientX, clientY, screenX, screenY }) {

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

@ -142,10 +142,11 @@
#include "nsISupportsImpl.h"
#include "mozilla/dom/CSSPseudoElement.h"
#include "mozilla/dom/DocumentFragment.h"
#include "mozilla/dom/ElementBinding.h"
#include "mozilla/dom/KeyframeEffect.h"
#include "mozilla/dom/KeyframeEffectBinding.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/dom/WindowBinding.h"
#include "mozilla/dom/ElementBinding.h"
#include "mozilla/dom/VRDisplay.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/Preferences.h"
@ -2298,7 +2299,7 @@ Element::DispatchClickEvent(nsPresContext* aPresContext,
inputSource = sourceMouseEvent->inputSource;
} else if (aSourceEvent->mClass == eKeyboardEventClass) {
event.mFlags.mIsPositionless = true;
inputSource = nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD;
inputSource = MouseEventBinding::MOZ_SOURCE_KEYBOARD;
}
event.pressure = pressure;
event.mClickCount = clickCount;

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

@ -52,6 +52,7 @@
#include "mozilla/dom/HTMLSlotElement.h"
#include "mozilla/dom/HTMLTemplateElement.h"
#include "mozilla/dom/IDTracker.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/dom/KeyboardEventBinding.h"
#include "mozilla/dom/IPCBlobUtils.h"
#include "mozilla/dom/NodeBinding.h"
@ -8694,8 +8695,8 @@ nsContentUtils::SendMouseEvent(const nsCOMPtr<nsIPresShell>& aPresShell,
return NS_ERROR_FAILURE;
}
if (aInputSourceArg == nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN) {
aInputSourceArg = nsIDOMMouseEvent::MOZ_SOURCE_MOUSE;
if (aInputSourceArg == MouseEventBinding::MOZ_SOURCE_UNKNOWN) {
aInputSourceArg = MouseEventBinding::MOZ_SOURCE_MOUSE;
}
WidgetMouseEvent event(true, msg, widget,

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

@ -44,7 +44,6 @@
#include "mozilla/RangeBoundary.h"
#include "nsIContentPolicy.h"
#include "nsIDocument.h"
#include "nsIDOMMouseEvent.h"
#include "nsPIDOMWindow.h"
#include "nsRFPService.h"
@ -2125,7 +2124,9 @@ public:
bool aAlt = false,
bool aShift = false,
bool aMeta = false,
uint16_t inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN);
// Including MouseEventBinding here leads
// to incude loops, unfortunately.
uint16_t inputSource = 0 /* MouseEventBinding::MOZ_SOURCE_UNKNOWN */);
static bool CheckMayLoad(nsIPrincipal* aPrincipal, nsIChannel* aChannel, bool aAllowIfInheritsPrincipal);

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

@ -28,7 +28,7 @@ function test_sendMouseEventDefaults() {
// Default value for optionals
is(evt.mozPressure, 0, "check pressure");
is(evt.mozInputSource, SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE, "check input source");
is(evt.mozInputSource, MouseEvent.MOZ_SOURCE_MOUSE, "check input source");
is(evt.isSynthesized, undefined, "check isSynthesized is undefined in content");
is(SpecialPowers.wrap(evt).isSynthesized, true, "check isSynthesized is true from chrome");
SimpleTest.executeSoon(next);
@ -42,7 +42,7 @@ function test_sendMouseEventOptionals() {
var x = 1, y = 2, button = 1, clickCount = 3,
modifiers = SpecialPowers.Ci.nsIDOMNSEvent.SHIFT_MASK,
pressure = 0.5,
source = SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_KEYBOARD;
source = MouseEvent.MOZ_SOURCE_KEYBOARD;
window.addEventListener("mouseup", function(evt) {
is(evt.mozInputSource, source, "explicit input source is valid");

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

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/DragEvent.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/MouseEvents.h"
#include "nsContentUtils.h"
#include "prtime.h"
@ -26,7 +27,7 @@ DragEvent::DragEvent(EventTarget* aOwner,
mEventIsInternal = true;
mEvent->mTime = PR_Now();
mEvent->mRefPoint = LayoutDeviceIntPoint(0, 0);
mEvent->AsMouseEvent()->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
mEvent->AsMouseEvent()->inputSource = MouseEventBinding::MOZ_SOURCE_UNKNOWN;
}
}

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

@ -18,6 +18,7 @@
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/DragEvent.h"
#include "mozilla/dom/Event.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/dom/UIEvent.h"
@ -1892,7 +1893,7 @@ EventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
if (aEvent->AsMouseEvent()) {
startEvent.inputSource = aEvent->AsMouseEvent()->inputSource;
} else if (aEvent->AsTouchEvent()) {
startEvent.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
startEvent.inputSource = MouseEventBinding::MOZ_SOURCE_TOUCH;
} else {
MOZ_ASSERT(false);
}
@ -3221,7 +3222,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
uint32_t flags = nsIFocusManager::FLAG_BYMOUSE |
nsIFocusManager::FLAG_NOSCROLL;
// If this was a touch-generated event, pass that information:
if (mouseEvent->inputSource == nsIDOMMouseEvent::MOZ_SOURCE_TOUCH) {
if (mouseEvent->inputSource == MouseEventBinding::MOZ_SOURCE_TOUCH) {
flags |= nsIFocusManager::FLAG_BYTOUCH;
}
nsCOMPtr<nsIDOMElement> newFocusElement = do_QueryInterface(newFocus);
@ -3301,7 +3302,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
PointerEventHandler::ImplicitlyReleasePointerCapture(pointerEvent);
if (pointerEvent->mMessage == ePointerCancel ||
pointerEvent->inputSource == nsIDOMMouseEvent::MOZ_SOURCE_TOUCH) {
pointerEvent->inputSource == MouseEventBinding::MOZ_SOURCE_TOUCH) {
// After pointercancel, pointer becomes invalid so we can remove relevant
// helper from table. Regarding pointerup with non-hoverable device, the
// pointer also becomes invalid. Hoverable (mouse/pen) pointers are valid

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

@ -19,6 +19,7 @@
#include "mozilla/TextEvents.h"
#include "mozilla/Unused.h"
#include "mozilla/dom/HTMLFormElement.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/dom/TabParent.h"
#include "HTMLInputElement.h"
@ -28,7 +29,6 @@
#include "nsContentUtils.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIDOMMouseEvent.h"
#include "nsIForm.h"
#include "nsIFormControl.h"
#include "nsINode.h"
@ -845,7 +845,7 @@ IMEStateManager::OnClickInEditor(nsPresContext* aPresContext,
}
InputContextAction::Cause cause =
aMouseEvent->inputSource == nsIDOMMouseEvent::MOZ_SOURCE_TOUCH ?
aMouseEvent->inputSource == MouseEventBinding::MOZ_SOURCE_TOUCH ?
InputContextAction::CAUSE_TOUCH : InputContextAction::CAUSE_MOUSE;
InputContextAction action(cause, InputContextAction::FOCUS_NOT_CHANGED);

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

@ -33,7 +33,7 @@ MouseEvent::MouseEvent(EventTarget* aOwner,
mEventIsInternal = true;
mEvent->mTime = PR_Now();
mEvent->mRefPoint = LayoutDeviceIntPoint(0, 0);
mouseEvent->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
mouseEvent->inputSource = MouseEventBinding::MOZ_SOURCE_UNKNOWN;
}
if (mouseEvent) {

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

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/MouseScrollEvent.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/MouseEvents.h"
#include "prtime.h"
@ -25,7 +26,7 @@ MouseScrollEvent::MouseScrollEvent(EventTarget* aOwner,
mEvent->mTime = PR_Now();
mEvent->mRefPoint = LayoutDeviceIntPoint(0, 0);
static_cast<WidgetMouseEventBase*>(mEvent)->inputSource =
nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
MouseEventBinding::MOZ_SOURCE_UNKNOWN;
}
mDetail = mEvent->AsMouseScrollEvent()->mDelta;

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

@ -6,6 +6,7 @@
*
* Portions Copyright 2013 Microsoft Open Technologies, Inc. */
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/dom/PointerEvent.h"
#include "mozilla/dom/PointerEventBinding.h"
#include "mozilla/MouseEvents.h"
@ -31,7 +32,7 @@ PointerEvent::PointerEvent(EventTarget* aOwner,
mEventIsInternal = true;
mEvent->mTime = PR_Now();
mEvent->mRefPoint = LayoutDeviceIntPoint(0, 0);
mouseEvent->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
mouseEvent->inputSource = MouseEventBinding::MOZ_SOURCE_UNKNOWN;
}
// 5.2 Pointer Event types, for all pointer events, |detail| attribute SHOULD
// be 0.
@ -49,29 +50,29 @@ static uint16_t
ConvertStringToPointerType(const nsAString& aPointerTypeArg)
{
if (aPointerTypeArg.EqualsLiteral("mouse")) {
return nsIDOMMouseEvent::MOZ_SOURCE_MOUSE;
return MouseEventBinding::MOZ_SOURCE_MOUSE;
}
if (aPointerTypeArg.EqualsLiteral("pen")) {
return nsIDOMMouseEvent::MOZ_SOURCE_PEN;
return MouseEventBinding::MOZ_SOURCE_PEN;
}
if (aPointerTypeArg.EqualsLiteral("touch")) {
return nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
return MouseEventBinding::MOZ_SOURCE_TOUCH;
}
return nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
return MouseEventBinding::MOZ_SOURCE_UNKNOWN;
}
void
ConvertPointerTypeToString(uint16_t aPointerTypeSrc, nsAString& aPointerTypeDest)
{
switch (aPointerTypeSrc) {
case nsIDOMMouseEvent::MOZ_SOURCE_MOUSE:
case MouseEventBinding::MOZ_SOURCE_MOUSE:
aPointerTypeDest.AssignLiteral("mouse");
break;
case nsIDOMMouseEvent::MOZ_SOURCE_PEN:
case MouseEventBinding::MOZ_SOURCE_PEN:
aPointerTypeDest.AssignLiteral("pen");
break;
case nsIDOMMouseEvent::MOZ_SOURCE_TOUCH:
case MouseEventBinding::MOZ_SOURCE_TOUCH:
aPointerTypeDest.AssignLiteral("touch");
break;
default:

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

@ -8,6 +8,7 @@
#include "nsIFrame.h"
#include "PointerEvent.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/MouseEventBinding.h"
namespace mozilla {
@ -115,7 +116,7 @@ PointerEventHandler::UpdateActivePointerState(WidgetMouseEvent* aEvent)
case ePointerUp:
// In this case we remove information about pointer or turn off active state
if (WidgetPointerEvent* pointerEvent = aEvent->AsPointerEvent()) {
if(pointerEvent->inputSource != nsIDOMMouseEvent::MOZ_SOURCE_TOUCH) {
if(pointerEvent->inputSource != MouseEventBinding::MOZ_SOURCE_TOUCH) {
sActivePointersIds->Put(pointerEvent->pointerId,
new PointerInfo(false,
pointerEvent->inputSource,
@ -140,7 +141,7 @@ PointerEventHandler::SetPointerCaptureById(uint32_t aPointerId,
nsIContent* aContent)
{
MOZ_ASSERT(aContent);
if (nsIDOMMouseEvent::MOZ_SOURCE_MOUSE == GetPointerType(aPointerId)) {
if (MouseEventBinding::MOZ_SOURCE_MOUSE == GetPointerType(aPointerId)) {
nsIPresShell::SetCapturingContent(aContent, CAPTURE_PREVENTDRAG);
}
@ -165,7 +166,7 @@ PointerEventHandler::ReleasePointerCaptureById(uint32_t aPointerId)
{
PointerCaptureInfo* pointerCaptureInfo = GetPointerCaptureInfo(aPointerId);
if (pointerCaptureInfo && pointerCaptureInfo->mPendingContent) {
if (nsIDOMMouseEvent::MOZ_SOURCE_MOUSE == GetPointerType(aPointerId)) {
if (MouseEventBinding::MOZ_SOURCE_MOUSE == GetPointerType(aPointerId)) {
nsIPresShell::SetCapturingContent(nullptr, CAPTURE_PREVENTDRAG);
}
pointerCaptureInfo->mPendingContent = nullptr;
@ -294,7 +295,7 @@ PointerEventHandler::ImplicitlyCapturePointer(nsIFrame* aFrame,
WidgetPointerEvent* pointerEvent = aEvent->AsPointerEvent();
NS_WARNING_ASSERTION(pointerEvent,
"Call ImplicitlyCapturePointer with non-pointer event");
if (pointerEvent->inputSource != nsIDOMMouseEvent::MOZ_SOURCE_TOUCH) {
if (pointerEvent->inputSource != MouseEventBinding::MOZ_SOURCE_TOUCH) {
// We only implicitly capture the pointer for touch device.
return;
}
@ -471,7 +472,7 @@ PointerEventHandler::InitPointerEventFromTouch(
aPointerEvent->mFlags = aTouchEvent->mFlags;
aPointerEvent->button = button;
aPointerEvent->buttons = buttons;
aPointerEvent->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
aPointerEvent->inputSource = MouseEventBinding::MOZ_SOURCE_TOUCH;
}
/* static */ void
@ -604,7 +605,7 @@ PointerEventHandler::GetPointerType(uint32_t aPointerId)
if (sActivePointersIds->Get(aPointerId, &pointerInfo) && pointerInfo) {
return pointerInfo->mPointerType;
}
return nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
return MouseEventBinding::MOZ_SOURCE_UNKNOWN;
}
/* static */ bool

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

@ -172,7 +172,7 @@ public:
private:
// GetPointerType returns pointer type like mouse, pen or touch for pointer
// event with pointerId. The return value must be one of
// nsIDOMMouseEvent::MOZ_SOURCE_*
// MouseEventBinding::MOZ_SOURCE_*
static uint16_t GetPointerType(uint32_t aPointerId);
// GetPointerPrimaryState returns state of attribute isPrimary for pointer

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

@ -4,6 +4,7 @@
* 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 "mozilla/dom/MouseEventBinding.h"
#include "mozilla/dom/SimpleGestureEvent.h"
#include "mozilla/TouchEvents.h"
#include "prtime.h"
@ -29,7 +30,7 @@ SimpleGestureEvent::SimpleGestureEvent(EventTarget* aOwner,
mEvent->mTime = PR_Now();
mEvent->mRefPoint = LayoutDeviceIntPoint(0, 0);
static_cast<WidgetMouseEventBase*>(mEvent)->inputSource =
nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
MouseEventBinding::MOZ_SOURCE_UNKNOWN;
}
}

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

@ -4,6 +4,7 @@
* 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 "mozilla/dom/MouseEventBinding.h"
#include "mozilla/dom/WheelEvent.h"
#include "mozilla/MouseEvents.h"
#include "prtime.h"
@ -32,7 +33,7 @@ WheelEvent::WheelEvent(EventTarget* aOwner,
mEventIsInternal = true;
mEvent->mTime = PR_Now();
mEvent->mRefPoint = LayoutDeviceIntPoint(0, 0);
mEvent->AsWheelEvent()->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
mEvent->AsWheelEvent()->inputSource = MouseEventBinding::MOZ_SOURCE_UNKNOWN;
}
}

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

@ -38,7 +38,7 @@ function runTests() {
});
synthesizeMouseAtCenter(target0, { type: "mousemove",
inputSource: SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE,
inputSource: MouseEvent.MOZ_SOURCE_MOUSE,
isWidgetEventSynthesized: true });
synthesizeMouseAtCenter(target1, { type: "mousedown" });
synthesizeMouseAtCenter(target1, { type: "mouseup" });

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

@ -40,11 +40,11 @@ function runTests() {
});
synthesizeMouseAtCenter(link1, { type: "mousedown",
inputSource: SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE });
inputSource: MouseEvent.MOZ_SOURCE_MOUSE });
synthesizeMouseAtCenter(link1, { type: "mousemove",
inputSource: SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE });
inputSource: MouseEvent.MOZ_SOURCE_MOUSE });
synthesizeMouseAtCenter(link1, { type: "mouseup",
inputSource: SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE });
inputSource: MouseEvent.MOZ_SOURCE_MOUSE });
}
SimpleTest.waitForFocus(() => {

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

@ -48,7 +48,7 @@ function runTests() {
is(receivePointerEvents, false, "Shouldn't dispatch pointer events in the system group");
SimpleTest.finish();
});
let source = SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE;
let source = MouseEvent.MOZ_SOURCE_MOUSE;
synthesizeMouse(target, 5, 5, { type: "mousemove", inputSource: source },
iframe.contentWindow);
synthesizeMouse(target, 5, 5, { type: "mousedown", inputSource: source },

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

@ -67,7 +67,7 @@ function runTests() {
done.addEventListener("mouseup", () => {
SimpleTest.finish();
});
let source = SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE;
let source = MouseEvent.MOZ_SOURCE_MOUSE;
synthesizeMouse(target0, 5, 5, { type: "mousemove", inputSource: source },
iframe.contentWindow);
synthesizeMouse(target0, 5, 5, { type: "mousedown", inputSource: source },

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

@ -26,8 +26,8 @@ function prepareListener(eventName, expectedValue) {
};
}
const INPUT_SOURCE_UNKNOWN = SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_UNKNOWN;
const INPUT_SOURCE_KEYBOARD = SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_KEYBOARD;
const INPUT_SOURCE_UNKNOWN = MouseEvent.MOZ_SOURCE_UNKNOWN;
const INPUT_SOURCE_KEYBOARD = MouseEvent.MOZ_SOURCE_KEYBOARD;
function doTest() {
var eventNames = [

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

@ -29,13 +29,13 @@ function check(event) {
function doTest() {
setup();
expectedInputSource = SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_KEYBOARD;
expectedInputSource = MouseEvent.MOZ_SOURCE_KEYBOARD;
testKeyboard();
expectedInputSource = SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE;
expectedInputSource = MouseEvent.MOZ_SOURCE_MOUSE;
testMouse();
expectedInputSource = SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_UNKNOWN;
expectedInputSource = MouseEvent.MOZ_SOURCE_UNKNOWN;
testScriptedClicks();
cleanup();

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

@ -11,9 +11,9 @@
#include "mozilla/EventDispatcher.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/dom/HTMLLabelElementBinding.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "nsFocusManager.h"
#include "nsContentUtils.h"
#include "nsIDOMMouseEvent.h"
#include "nsQueryObject.h"
#include "mozilla/dom/ShadowRoot.h"
@ -157,8 +157,8 @@ HTMLLabelElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
// but we don't want to pass FLAG_BYMOUSE if this click event was
// caused by the user pressing an accesskey.
nsCOMPtr<nsIDOMElement> elem = do_QueryInterface(content);
bool byMouse = (mouseEvent->inputSource != nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD);
bool byTouch = (mouseEvent->inputSource == nsIDOMMouseEvent::MOZ_SOURCE_TOUCH);
bool byMouse = (mouseEvent->inputSource != MouseEventBinding::MOZ_SOURCE_KEYBOARD);
bool byTouch = (mouseEvent->inputSource == MouseEventBinding::MOZ_SOURCE_TOUCH);
fm->SetFocus(elem, nsIFocusManager::FLAG_BYMOVEFOCUS |
(byMouse ? nsIFocusManager::FLAG_BYMOUSE : 0) |
(byTouch ? nsIFocusManager::FLAG_BYTOUCH : 0));
@ -209,7 +209,7 @@ HTMLLabelElement::PerformAccesskey(bool aKeyCausesActivation,
// Click on it if the users prefs indicate to do so.
WidgetMouseEvent event(aIsTrustedEvent, eMouseClick,
nullptr, WidgetMouseEvent::eReal);
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD;
event.inputSource = MouseEventBinding::MOZ_SOURCE_KEYBOARD;
nsAutoPopupStatePusher popupStatePusher(aIsTrustedEvent ?
openAllowed : openAbused);

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

@ -94,6 +94,7 @@
#include "nsThreadUtils.h"
#include "nsTextFragment.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/dom/TouchEvent.h"
#include "mozilla/ErrorResult.h"
#include "nsHTMLDocument.h"
@ -2497,7 +2498,7 @@ nsGenericHTMLElement::Click(CallerType aCallerType)
WidgetMouseEvent event(aCallerType == CallerType::System,
eMouseClick, nullptr, WidgetMouseEvent::eReal);
event.mFlags.mIsPositionless = true;
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
event.inputSource = MouseEventBinding::MOZ_SOURCE_UNKNOWN;
EventDispatcher::Dispatch(static_cast<nsIContent*>(this), context, &event);
@ -2620,7 +2621,7 @@ nsGenericHTMLElement::DispatchSimulatedClick(nsGenericHTMLElement* aElement,
{
WidgetMouseEvent event(aIsTrusted, eMouseClick, nullptr,
WidgetMouseEvent::eReal);
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD;
event.inputSource = MouseEventBinding::MOZ_SOURCE_KEYBOARD;
event.mFlags.mIsPositionless = true;
return EventDispatcher::Dispatch(ToSupports(aElement), aPresContext, &event);
}

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

@ -16,11 +16,4 @@
[builtinclass, uuid(5bdab8d8-7933-4c5c-b6d1-ab34481237f7)]
interface nsIDOMMouseEvent : nsIDOMUIEvent
{
const unsigned short MOZ_SOURCE_UNKNOWN = 0;
const unsigned short MOZ_SOURCE_MOUSE = 1;
const unsigned short MOZ_SOURCE_PEN = 2;
const unsigned short MOZ_SOURCE_ERASER = 3;
const unsigned short MOZ_SOURCE_CURSOR = 4;
const unsigned short MOZ_SOURCE_TOUCH = 5;
const unsigned short MOZ_SOURCE_KEYBOARD = 6;
};

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

@ -21,6 +21,7 @@
#include "mozilla/EventListenerManager.h"
#include "mozilla/dom/DataTransfer.h"
#include "mozilla/dom/indexedDB/PIndexedDBPermissionRequestChild.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/dom/PaymentRequestChild.h"
#include "mozilla/dom/TelemetryScrollProbe.h"
#include "mozilla/IMEStateManager.h"
@ -1541,7 +1542,7 @@ TabChild::RecvMouseEvent(const nsString& aType,
APZCCallbackHelper::DispatchMouseEvent(GetPresShell(), aType,
CSSPoint(aX, aY), aButton, aClickCount,
aModifiers, aIgnoreRootScrollFrame,
nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN,
MouseEventBinding::MOZ_SOURCE_UNKNOWN,
0 /* Use the default value here. */);
return IPC_OK();
}

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

@ -25,7 +25,7 @@ add_task(async function test() {
// Synthesize mouse down event on browser object over the button, such that
// the event propagates through both processes.
EventUtils.synthesizeMouse(tab.linkedBrowser, 20, 20, { "button": button }, null);
EventUtils.synthesizeMouse(tab.linkedBrowser, 20, 20, { "button": button });
isnot(fm.focusedElement, document.getElementById("urlbar").inputField,
"Failed to move focus away from search bar: button=" + button);

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

@ -91,6 +91,7 @@
#include "mozilla/dom/XULElementBinding.h"
#include "mozilla/dom/BoxObject.h"
#include "mozilla/dom/HTMLIFrameElement.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/dom/MutationEventBinding.h"
#include "mozilla/dom/XULCommandEvent.h"
@ -615,7 +616,7 @@ nsXULElement::PerformAccesskey(bool aKeyCausesActivation,
}
if (aKeyCausesActivation &&
!content->IsAnyOfXULElements(nsGkAtoms::textbox, nsGkAtoms::menulist)) {
elm->ClickWithInputSource(nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD, aIsTrustedEvent);
elm->ClickWithInputSource(MouseEventBinding::MOZ_SOURCE_KEYBOARD, aIsTrustedEvent);
}
} else {
return content->PerformAccesskey(aKeyCausesActivation, aIsTrustedEvent);
@ -1359,7 +1360,7 @@ nsXULElement::DispatchXULCommand(const EventChainVisitor& aVisitor,
// sourceEvent will be the original command event that we're
// handling.
nsCOMPtr<nsIDOMEvent> domEvent = aVisitor.mDOMEvent;
uint16_t inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
uint16_t inputSource = MouseEventBinding::MOZ_SOURCE_UNKNOWN;
while (domEvent) {
Event* event = domEvent->InternalDOMEvent();
NS_ENSURE_STATE(!SameCOMIdentity(event->GetOriginalTarget(),
@ -1662,7 +1663,7 @@ nsXULElement::GetParentTree(nsIDOMXULMultiSelectControlElement** aTreeElement)
void
nsXULElement::Click(CallerType aCallerType)
{
ClickWithInputSource(nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN,
ClickWithInputSource(MouseEventBinding::MOZ_SOURCE_UNKNOWN,
aCallerType == CallerType::System);
}

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

@ -30,6 +30,7 @@
#include "mozilla/dom/EventTarget.h"
#include "mozilla/dom/FragmentOrElement.h"
#include "mozilla/dom/MouseEvent.h"
#include "mozilla/dom/MouseEventBinding.h"
// for event firing in context menus
#include "nsPresContext.h"
@ -192,7 +193,7 @@ nsXULPopupListener::HandleEvent(nsIDOMEvent* aEvent)
if (mIsContext) {
#ifndef NS_CONTEXT_MENU_IS_MOUSEUP
uint16_t inputSource = mouseEvent->MozInputSource();
bool isTouch = inputSource == nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
bool isTouch = inputSource == MouseEventBinding::MOZ_SOURCE_TOUCH;
// If the context menu launches on mousedown,
// we have to fire focus on the content we clicked on
FireFocusOnTargetContent(targetNode, isTouch);

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

@ -15,6 +15,7 @@
#include "InputBlockState.h" // for InputBlockState
#include "InputData.h" // for InputData, etc
#include "Layers.h" // for Layer, etc
#include "mozilla/dom/MouseEventBinding.h" // for MouseEvent constants
#include "mozilla/dom/Touch.h" // for Touch
#include "mozilla/gfx/gfxVars.h" // for gfxVars
#include "mozilla/gfx/GPUParent.h" // for GPUParent
@ -1696,7 +1697,7 @@ APZCTreeManager::ProcessTouchInputForScrollbarDrag(MultiTouchInput& aTouchInput,
// reuse code in InputQueue and APZC for handling scrollbar mouse-drags.
MouseInput mouseInput{MultiTouchTypeToMouseType(aTouchInput.mType),
MouseInput::LEFT_BUTTON,
nsIDOMMouseEvent::MOZ_SOURCE_TOUCH,
dom::MouseEventBinding::MOZ_SOURCE_TOUCH,
WidgetMouseEvent::eLeftButtonFlag,
aTouchInput.mTouches[0].mScreenPoint,
aTouchInput.mTime,

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

@ -11,6 +11,7 @@
#include "gfxPrefs.h"
#include "LayersLogging.h" // For Stringify
#include "mozilla/dom/Element.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/layers/LayerTransactionChild.h"
@ -517,7 +518,7 @@ APZCCallbackHelper::DispatchSynthesizedMouseEvent(EventMessage aMsg,
event.mRefPoint = LayoutDeviceIntPoint::Truncate(aRefPoint.x, aRefPoint.y);
event.mTime = aTime;
event.button = WidgetMouseEvent::eLeftButton;
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
event.inputSource = dom::MouseEventBinding::MOZ_SOURCE_TOUCH;
if (aMsg == eMouseLongTap) {
event.mFlags.mOnlyChromeDispatch = true;
}

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

@ -11,6 +11,7 @@
#include "gfxPrefs.h"
#include "LayersLogging.h"
#include "mozilla/BasicEvents.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/dom/TabGroup.h"
#include "mozilla/IntegerPrintfMacros.h"
@ -20,7 +21,6 @@
#include "mozilla/layers/APZCCallbackHelper.h"
#include "nsCOMPtr.h"
#include "nsDocShell.h"
#include "nsIDOMMouseEvent.h"
#include "nsIDOMWindowUtils.h"
#include "nsINamed.h"
#include "nsIScrollableFrame.h"
@ -31,7 +31,6 @@
#include "nsLayoutUtils.h"
#include "nsQueryFrame.h"
#include "TouchManager.h"
#include "nsIDOMMouseEvent.h"
#include "nsLayoutUtils.h"
#include "nsIScrollableFrame.h"
#include "nsIScrollbarMediator.h"
@ -242,7 +241,7 @@ APZEventState::FireContextmenuEvents(const nsCOMPtr<nsIPresShell>& aPresShell,
bool eventHandled =
APZCCallbackHelper::DispatchMouseEvent(aPresShell, NS_LITERAL_STRING("contextmenu"),
aPoint, 2, 1, WidgetModifiersToDOMModifiers(aModifiers), true,
nsIDOMMouseEvent::MOZ_SOURCE_TOUCH,
dom::MouseEventBinding::MOZ_SOURCE_TOUCH,
0 /* Use the default value here. */);
APZES_LOG("Contextmenu event handled: %d\n", eventHandled);

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

@ -15,6 +15,7 @@
#include "mozilla/TextEvents.h"
#include "mozilla/TouchEvents.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "nsCanvasFrame.h"
#include "nsDocShell.h"
#include "nsFocusManager.h"
@ -537,7 +538,7 @@ AccessibleCaretEventHub::HandleTouchEvent(WidgetTouchEvent* aEvent)
: mActiveTouchId);
nsPoint point = GetTouchEventPosition(aEvent, id);
mManager->SetLastInputSource(nsIDOMMouseEvent::MOZ_SOURCE_TOUCH);
mManager->SetLastInputSource(MouseEventBinding::MOZ_SOURCE_TOUCH);
switch (aEvent->mMessage) {
case eTouchStart:
@ -573,7 +574,7 @@ AccessibleCaretEventHub::HandleTouchEvent(WidgetTouchEvent* aEvent)
nsEventStatus
AccessibleCaretEventHub::HandleKeyboardEvent(WidgetKeyboardEvent* aEvent)
{
mManager->SetLastInputSource(nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD);
mManager->SetLastInputSource(MouseEventBinding::MOZ_SOURCE_KEYBOARD);
switch (aEvent->mMessage) {
case eKeyUp:

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

@ -11,6 +11,7 @@
#include "AccessibleCaretLogger.h"
#include "mozilla/AsyncEventDispatcher.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/dom/NodeFilterBinding.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/dom/TreeWalker.h"
@ -191,7 +192,7 @@ AccessibleCaretManager::OnSelectionChanged(nsIDOMDocument* aDoc,
// For mouse input we don't want to show the carets.
if (sHideCaretsForMouseInput &&
mLastInputSource == nsIDOMMouseEvent::MOZ_SOURCE_MOUSE) {
mLastInputSource == MouseEventBinding::MOZ_SOURCE_MOUSE) {
HideCarets();
return NS_OK;
}
@ -199,7 +200,7 @@ AccessibleCaretManager::OnSelectionChanged(nsIDOMDocument* aDoc,
// When we want to hide the carets for mouse input, hide them for select
// all action fired by keyboard as well.
if (sHideCaretsForMouseInput &&
mLastInputSource == nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD &&
mLastInputSource == MouseEventBinding::MOZ_SOURCE_KEYBOARD &&
(aReason & nsISelectionListener::SELECTALL_REASON)) {
HideCarets();
return NS_OK;
@ -692,7 +693,7 @@ AccessibleCaretManager::OnScrollEnd()
// For mouse input we don't want to show the carets.
if (sHideCaretsForMouseInput &&
mLastInputSource == nsIDOMMouseEvent::MOZ_SOURCE_MOUSE) {
mLastInputSource == MouseEventBinding::MOZ_SOURCE_MOUSE) {
AC_LOG("%s: HideCarets()", __FUNCTION__);
HideCarets();
return;

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

@ -10,13 +10,13 @@
#include "AccessibleCaret.h"
#include "mozilla/dom/CaretStateChangedEvent.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/EnumSet.h"
#include "mozilla/EventForwards.h"
#include "mozilla/RefPtr.h"
#include "mozilla/UniquePtr.h"
#include "nsCOMPtr.h"
#include "nsCoord.h"
#include "nsIDOMMouseEvent.h"
#include "nsIFrame.h"
#include "nsISelectionListener.h"
@ -321,7 +321,7 @@ protected:
// or not show the carets when the selection is updated, as we want to hide
// the carets for mouse-triggered selection changes but show them for other
// input types such as touch.
uint16_t mLastInputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
uint16_t mLastInputSource = dom::MouseEventBinding::MOZ_SOURCE_UNKNOWN;
// Set to true in OnScrollStart() and set to false in OnScrollEnd().
bool mIsScrollStarted = false;

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

@ -10,6 +10,7 @@
#include "mozilla/EventStates.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "nsLayoutUtils.h"
#include "nsGkAtoms.h"
#include "nsFontMetrics.h"
@ -577,7 +578,7 @@ FindFrameTargetedByInputEvent(WidgetGUIEvent* aEvent,
if (aEvent->mClass == eMouseEventClass &&
prefs->mTouchOnly &&
aEvent->AsMouseEvent()->inputSource !=
nsIDOMMouseEvent::MOZ_SOURCE_TOUCH) {
MouseEventBinding::MOZ_SOURCE_TOUCH) {
PET_LOG("Mouse input event is not from a touch source\n");
return target;
}

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

@ -84,9 +84,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1098139
listener.addEventListener("pointerup", ListenerHandler);
listener.addEventListener("pointerout", ListenerHandler);
var rect = target.getBoundingClientRect();
synthesizeMouse(target, rect.width/2, rect.height/2, {type: "mousedown", isPrimary: true, inputSource: SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_TOUCH});
synthesizeMouse(target, rect.width/2, rect.height/2, {type: "mousemove", isPrimary: true, inputSource: SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_TOUCH});
synthesizeMouse(target, rect.width/2, rect.height/2, {type: "mouseup", isPrimary: true, inputSource: SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_TOUCH});
synthesizeMouse(target, rect.width/2, rect.height/2, {type: "mousedown", isPrimary: true, inputSource: MouseEvent.MOZ_SOURCE_TOUCH});
synthesizeMouse(target, rect.width/2, rect.height/2, {type: "mousemove", isPrimary: true, inputSource: MouseEvent.MOZ_SOURCE_TOUCH});
synthesizeMouse(target, rect.width/2, rect.height/2, {type: "mouseup", isPrimary: true, inputSource: MouseEvent.MOZ_SOURCE_TOUCH});
finishTest();
}
function finishTest() {

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

@ -152,14 +152,14 @@ function execTest() {
// dialer.
testMouseClick("dialer", 20, 1, "dialer", "correct hit on dialer with mouse input");
testMouseClick("dialer", 20, 1, "dialer", "correct hit on dialer with touch input", {
inputSource: SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_TOUCH
inputSource: MouseEvent.MOZ_SOURCE_TOUCH
});
// Now this is it: we tap inside 'apps', but very close to the border between
// 'apps' and 'dialer'. Without the fix from this bug, this test will fail.
testMouseClick("apps", 20, 1, "apps", "apps <iframe mozbrowser remote> hit for mouse input");
testMouseClick("apps", 20, 1, "apps", "apps <iframe mozbrowser remote> hit for touch input", {
inputSource: SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_TOUCH
inputSource: MouseEvent.MOZ_SOURCE_TOUCH
});
// Show small red spots of where the click happened

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

@ -133,10 +133,10 @@ function runTest() {
function test2() {
testMouseClick("t", 100 + 11*mm, 10, "body", "disabled for mouse input");
testMouseClick("t", 100 + 11*mm, 10, "t", "enabled for touch input", {
inputSource: SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_TOUCH
inputSource: MouseEvent.MOZ_SOURCE_TOUCH
});
testMouseClick("t", 100 + 13*mm, 10, "body", "basic functionality for touch", {
inputSource: SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_TOUCH
inputSource: MouseEvent.MOZ_SOURCE_TOUCH
});
SpecialPowers.pushPrefEnv({"set": [["ui.mouse.radius.inputSource.touchOnly", false]]}, test3);
}
@ -245,7 +245,7 @@ function test3() {
var rect = document.getElementById("t8").getBoundingClientRect();
testMouseClick("t8", rect.left + 1, rect.top + 1, "t8", "content editable enabled for mouse input");
testMouseClick("t8", rect.left + 1, rect.top + 1, "t8", "content editable enabled for touch input", {
inputSource: SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_TOUCH
inputSource: MouseEvent.MOZ_SOURCE_TOUCH
});
setShowing("t8", false);
@ -254,7 +254,7 @@ function test3() {
var rect = document.getElementById("t9").getBoundingClientRect();
testMouseClick("t9", rect.left + 1, rect.top + 1, "t9", "div enabled with mouse input");
testMouseClick("t9", rect.left + 1, rect.top + 1, "t9", "div enabled with touch input", {
inputSource: SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_TOUCH
inputSource: MouseEvent.MOZ_SOURCE_TOUCH
});
setShowing("t9", false);

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

@ -26,6 +26,7 @@
#include "mozilla/dom/HTMLOptionsCollection.h"
#include "mozilla/dom/HTMLSelectElement.h"
#include "mozilla/dom/MouseEvent.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/EventStateManager.h"
#include "mozilla/EventStates.h"
#include "mozilla/LookAndFeel.h"
@ -1855,7 +1856,7 @@ nsListControlFrame::MouseDown(nsIDOMEvent* aMouseEvent)
}
uint16_t inputSource = mouseEvent->MozInputSource();
bool isSourceTouchEvent = inputSource == nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
bool isSourceTouchEvent = inputSource == MouseEventBinding::MOZ_SOURCE_TOUCH;
if (FireShowDropDownEvent(mContent, !mComboboxFrame->IsDroppedDownOrHasParentPopup(),
isSourceTouchEvent)) {
return NS_OK;

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

@ -17,6 +17,7 @@
#include "nsDisplayList.h"
#include "nsContentUtils.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/EventStateManager.h"
#include "mozilla/EventStates.h"
#include "mozilla/MouseEvents.h"
@ -210,7 +211,7 @@ nsButtonBoxFrame::DoMouseClick(WidgetGUIEvent* aEvent, bool aTrustEvent)
bool isControl = false;
bool isAlt = false;
bool isMeta = false;
uint16_t inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
uint16_t inputSource = MouseEventBinding::MOZ_SOURCE_UNKNOWN;
if(aEvent) {
WidgetInputEvent* inputEvent = aEvent->AsInputEvent();

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

@ -25,6 +25,7 @@
#include "nsMenuPopupFrame.h"
#include "nsIScreenManager.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "nsError.h"
#include "nsICSSDeclaration.h"
#include "nsStyledElement.h"
@ -540,7 +541,7 @@ nsResizerFrame::MouseClicked(WidgetMouseEvent* aEvent)
bool isControl = false;
bool isAlt = false;
bool isMeta = false;
uint16_t inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
uint16_t inputSource = MouseEventBinding::MOZ_SOURCE_UNKNOWN;
if(aEvent) {
isShift = aEvent->IsShift();

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

@ -18,6 +18,7 @@
#include "nsDisplayList.h"
#include "nsContentUtils.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/dom/MouseEventBinding.h"
using namespace mozilla;
@ -173,7 +174,7 @@ nsTitleBarFrame::MouseClicked(WidgetMouseEvent* aEvent)
bool isControl = false;
bool isAlt = false;
bool isMeta = false;
uint16_t inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
uint16_t inputSource = dom::MouseEventBinding::MOZ_SOURCE_UNKNOWN;
if(aEvent) {
isShift = aEvent->IsShift();

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

@ -265,20 +265,20 @@ event.synthesizeMouse = function(
* Object which may contain the properties "shiftKey", "ctrlKey",
* "altKey", "metaKey", "accessKey", "clickCount", "button", and
* "type".
* @param {Window=} window
* @param {Window=} win
* Window object. Defaults to the current window.
*/
event.synthesizeMouseAtPoint = function(
left, top, opts, window = undefined) {
left, top, opts, win = window) {
let domutils = getDOMWindowUtils(window);
let domutils = getDOMWindowUtils(win);
let button = opts.button || 0;
let clickCount = opts.clickCount || 1;
let modifiers = event.parseModifiers_(opts);
let pressure = ("pressure" in opts) ? opts.pressure : 0;
let inputSource = ("inputSource" in opts) ? opts.inputSource :
Ci.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE;
win.MouseEvent.MOZ_SOURCE_MOUSE;
let isDOMEventSynthesized =
("isSynthesized" in opts) ? opts.isSynthesized : true;
let isWidgetEventSynthesized;

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

@ -105,6 +105,19 @@ function _EU_isAndroid(aWindow = window) {
}
function _EU_maybeWrap(o) {
// We're used in some contexts where there is no SpecialPowers and also in
// some where it exists but has no wrap() method. And this is somewhat
// independent of whether window.Components is a thing...
var haveWrap = false;
try {
haveWrap = SpecialPowers.wrap != undefined;
} catch (e) {
// Just leave it false.
}
if (!haveWrap) {
// Not much we can do here.
return o;
}
var c = Object.getOwnPropertyDescriptor(window, 'Components');
return c.value && !c.writable ? o : SpecialPowers.wrap(o);
}
@ -418,15 +431,18 @@ function synthesizeMouseAtPoint(left, top, aEvent, aWindow = window)
var modifiers = _parseModifiers(aEvent, aWindow);
var pressure = ("pressure" in aEvent) ? aEvent.pressure : 0;
// aWindow might be cross-origin from us.
var MouseEvent = _EU_maybeWrap(aWindow).MouseEvent;
// Default source to mouse.
var inputSource = ("inputSource" in aEvent) ? aEvent.inputSource :
_EU_Ci.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE;
MouseEvent.MOZ_SOURCE_MOUSE;
// Compute a pointerId if needed.
var id;
if ("id" in aEvent) {
id = aEvent.id;
} else {
var isFromPen = inputSource === _EU_Ci.nsIDOMMouseEvent.MOZ_SOURCE_PEN;
var isFromPen = inputSource === MouseEvent.MOZ_SOURCE_PEN;
id = isFromPen ? utils.DEFAULT_PEN_POINTER_ID :
utils.DEFAULT_MOUSE_POINTER_ID;
}

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

@ -1299,7 +1299,7 @@ function mouseClickOnColumnHeader(aColumns, aColumnIndex, aButton, aClickCount)
// Target the middle of the column header.
synthesizeMouse(columnHeader, columnWidth / 2, 3,
{ button: aButton,
clickCount: i }, null);
clickCount: i });
}
}
@ -1312,7 +1312,7 @@ function mouseDblClickOnCell(tree, row, column, testname) {
// get cell coordinates
var rect = tree.treeBoxObject.getCoordsForCellItem(row, column, "text");
synthesizeMouse(tree.body, rect.x, rect.y, { clickCount: 2 }, null);
synthesizeMouse(tree.body, rect.x, rect.y, { clickCount: 2 });
}
function compareArrays(arr1, arr2) {

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

@ -5,6 +5,7 @@
#include "InputData.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/dom/Touch.h"
#include "mozilla/dom/WheelEventBinding.h"
#include "mozilla/TextEvents.h"
@ -272,7 +273,7 @@ MultiTouchInput::ToWidgetMouseEvent(nsIWidget* aWidget) const
event.mTime = mTime;
event.button = WidgetMouseEvent::eLeftButton;
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
event.inputSource = MouseEventBinding::MOZ_SOURCE_TOUCH;
event.mModifiers = modifiers;
event.mFlags.mHandledByAPZ = mHandledByAPZ;
event.mFocusSequenceNumber = mFocusSequenceNumber;

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

@ -12,7 +12,6 @@
#include "mozilla/MathAlgorithms.h"
#include "mozilla/dom/DataTransfer.h"
#include "nsCOMPtr.h"
#include "nsIDOMMouseEvent.h"
/******************************************************************************
* nsDragDropEventStatus
@ -124,7 +123,9 @@ protected:
, buttons(0)
, pressure(0)
, hitCluster(false)
, inputSource(nsIDOMMouseEvent::MOZ_SOURCE_MOUSE)
// Including MouseEventBinding.h here leads to an include loop, so
// we have to hardcode MouseEventBinding::MOZ_SOURCE_MOUSE.
, inputSource(/* MouseEventBinding::MOZ_SOURCE_MOUSE = */ 1)
{
}
@ -135,7 +136,9 @@ protected:
, buttons(0)
, pressure(0)
, hitCluster(false)
, inputSource(nsIDOMMouseEvent::MOZ_SOURCE_MOUSE)
// Including MouseEventBinding.h here leads to an include loop, so
// we have to hardcode MouseEventBinding::MOZ_SOURCE_MOUSE.
, inputSource(/* MouseEventBinding::MOZ_SOURCE_MOUSE = */ 1)
{
}
@ -180,7 +183,7 @@ public:
// Touch near a cluster of links (true)
bool hitCluster;
// Possible values at nsIDOMMouseEvent
// Possible values a in MouseEvent
uint16_t inputSource;
// ID of the canvas HitRegion

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

@ -18,6 +18,7 @@
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/Unused.h"
#include "mozilla/Preferences.h"
#include "mozilla/layers/RenderTrace.h"
@ -601,7 +602,7 @@ public:
ScreenPoint origin = ScreenPoint(aX, aY);
MouseInput input(mouseType, buttonType, nsIDOMMouseEvent::MOZ_SOURCE_MOUSE, ConvertButtons(buttons), origin, aTime, GetEventTimeStamp(aTime), GetModifiers(aMetaState));
MouseInput input(mouseType, buttonType, MouseEventBinding::MOZ_SOURCE_MOUSE, ConvertButtons(buttons), origin, aTime, GetEventTimeStamp(aTime), GetModifiers(aMetaState));
ScrollableLayerGuid guid;
uint64_t blockId;
@ -2014,7 +2015,7 @@ nsWindow::DispatchHitTest(const WidgetTouchEvent& aEvent)
WidgetMouseEvent::eReal);
hittest.mRefPoint = aEvent.mTouches[0]->mRefPoint;
hittest.mIgnoreRootScrollFrame = true;
hittest.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
hittest.inputSource = MouseEventBinding::MOZ_SOURCE_TOUCH;
nsEventStatus status;
DispatchEvent(&hittest, status);

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

@ -18,6 +18,7 @@
#include "mozilla/TextEvents.h"
#include "mozilla/TouchEvents.h"
#include "mozilla/dom/DataTransfer.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/dom/SimpleGestureEventBinding.h"
#include "mozilla/dom/WheelEventBinding.h"
@ -5298,7 +5299,7 @@ GetIntegerDeltaForEvent(NSEvent* aEvent)
MOZ_ASSERT(aOutGeckoEvent->pressure >= 0.0 &&
aOutGeckoEvent->pressure <= 1.0);
}
aOutGeckoEvent->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_PEN;
aOutGeckoEvent->inputSource = dom::MouseEventBinding::MOZ_SOURCE_PEN;
aOutGeckoEvent->tiltX = lround([aPointerEvent tilt].x * 90);
aOutGeckoEvent->tiltY = lround([aPointerEvent tilt].y * 90);
aOutGeckoEvent->tangentialPressure = [aPointerEvent tangentialPressure];

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

@ -37,6 +37,7 @@
#include "mozilla/dom/DataTransferItemList.h"
#include "mozilla/dom/DataTransfer.h"
#include "mozilla/dom/DragEvent.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/Unused.h"
#include "nsFrameLoader.h"
@ -60,7 +61,7 @@ nsBaseDragService::nsBaseDragService()
mDragAction(DRAGDROP_ACTION_NONE),
mDragActionFromChildProcess(DRAGDROP_ACTION_UNINITIALIZED), mTargetSize(0,0),
mContentPolicyType(nsIContentPolicy::TYPE_OTHER),
mSuppressLevel(0), mInputSource(nsIDOMMouseEvent::MOZ_SOURCE_MOUSE)
mSuppressLevel(0), mInputSource(MouseEventBinding::MOZ_SOURCE_MOUSE)
{
}
@ -478,7 +479,7 @@ nsBaseDragService::EndDragSession(bool aDoneDrag, uint32_t aKeyModifiers)
mImageOffset = CSSIntPoint();
mScreenPosition = CSSIntPoint();
mEndDragPoint = LayoutDeviceIntPoint(0, 0);
mInputSource = nsIDOMMouseEvent::MOZ_SOURCE_MOUSE;
mInputSource = MouseEventBinding::MOZ_SOURCE_MOUSE;
return NS_OK;
}

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

@ -34,6 +34,7 @@
#include "mozilla/BasicEvents.h"
#include "mozilla/TouchEvents.h"
#include "mozilla/Unused.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "GeckoProfiler.h"
@ -147,7 +148,7 @@ private:
event.mClickCount = 1;
event.button = WidgetMouseEvent::eLeftButton;
event.mTime = PR_IntervalNow();
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
event.inputSource = MouseEventBinding::MOZ_SOURCE_UNKNOWN;
nsEventStatus status;
aWindow->DispatchEvent(&event, status);

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

@ -11,6 +11,7 @@
#include "WinPointerEvents.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/WindowsVersion.h"
#include "mozilla/dom/MouseEventBinding.h"
using namespace mozilla;
using namespace mozilla::widget;
@ -158,7 +159,7 @@ WinPointerInfo*
WinPointerEvents::GetCachedPointerInfo(UINT aMsg, WPARAM aWParam)
{
if (!sLibraryHandle || !sPointerEventEnabled ||
MOUSE_INPUT_SOURCE() != nsIDOMMouseEvent::MOZ_SOURCE_PEN ||
MOUSE_INPUT_SOURCE() != dom::MouseEventBinding::MOZ_SOURCE_PEN ||
ShouldFirePointerEventByWinPointerMessages()) {
return nullptr;
}

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

@ -16,6 +16,7 @@
#include "KeyboardLayout.h"
#include "nsIDOMMouseEvent.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/DataSurfaceHelpers.h"
#include "mozilla/HangMonitor.h"
@ -1078,11 +1079,12 @@ WinUtils::GetNativeMessage(UINT aInternalMessage)
uint16_t
WinUtils::GetMouseInputSource()
{
int32_t inputSource = nsIDOMMouseEvent::MOZ_SOURCE_MOUSE;
int32_t inputSource = dom::MouseEventBinding::MOZ_SOURCE_MOUSE;
LPARAM lParamExtraInfo = ::GetMessageExtraInfo();
if ((lParamExtraInfo & TABLET_INK_SIGNATURE) == TABLET_INK_CHECK) {
inputSource = (lParamExtraInfo & TABLET_INK_TOUCH) ?
nsIDOMMouseEvent::MOZ_SOURCE_TOUCH : nsIDOMMouseEvent::MOZ_SOURCE_PEN;
dom::MouseEventBinding::MOZ_SOURCE_TOUCH :
dom::MouseEventBinding::MOZ_SOURCE_PEN;
}
return static_cast<uint16_t>(inputSource);
}

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

@ -394,7 +394,7 @@ public:
/**
* GetMouseInputSource() returns a pointing device information. The value is
* one of nsIDOMMouseEvent::MOZ_SOURCE_*. This method MUST be called during
* one of MouseEventBinding::MOZ_SOURCE_*. This method MUST be called during
* mouse message handling.
*/
static uint16_t GetMouseInputSource();

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

@ -126,6 +126,7 @@
#include "WinTaskbar.h"
#include "WidgetUtils.h"
#include "nsIWidgetListener.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/dom/Touch.h"
#include "mozilla/gfx/2D.h"
#include "nsToolkitCompsCID.h"
@ -4318,7 +4319,7 @@ bool nsWindow::TouchEventShouldStartDrag(EventMessage aEventMessage,
WidgetMouseEvent::eReal);
hittest.mRefPoint = aEventPoint;
hittest.mIgnoreRootScrollFrame = true;
hittest.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
hittest.inputSource = MouseEventBinding::MOZ_SOURCE_TOUCH;
DispatchInputEvent(&hittest);
EventTarget* target = hittest.GetDOMEventTarget();
@ -4422,7 +4423,7 @@ nsWindow::DispatchMouseEvent(EventMessage aEventMessage, WPARAM wParam,
// Since it is unclear whether a user will use the digitizer,
// Postpone initialization until first PEN message will be found.
if (nsIDOMMouseEvent::MOZ_SOURCE_PEN == aInputSource
if (MouseEventBinding::MOZ_SOURCE_PEN == aInputSource
// Messages should be only at topLevel window.
&& nsWindowType::eWindowType_toplevel == mWindowType
// Currently this scheme is used only when pointer events is enabled.
@ -5665,7 +5666,7 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam,
pointerInfo.pointerId = pointerId;
DispatchMouseEvent(eMouseExitFromWidget, wParam, pos, false,
WidgetMouseEvent::eLeftButton,
nsIDOMMouseEvent::MOZ_SOURCE_PEN, &pointerInfo);
MouseEventBinding::MOZ_SOURCE_PEN, &pointerInfo);
InkCollector::sInkCollector->ClearTarget();
InkCollector::sInkCollector->ClearPointerId();
}
@ -5677,7 +5678,7 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam,
// If the context menu is brought up by a touch long-press, then
// the APZ code is responsible for dealing with this, so we don't
// need to do anything.
if (mTouchWindow && MOUSE_INPUT_SOURCE() == nsIDOMMouseEvent::MOZ_SOURCE_TOUCH) {
if (mTouchWindow && MOUSE_INPUT_SOURCE() == MouseEventBinding::MOZ_SOURCE_TOUCH) {
MOZ_ASSERT(mAPZC); // since mTouchWindow is true, APZ must be enabled
result = true;
break;
@ -7021,7 +7022,7 @@ bool nsWindow::OnGesture(WPARAM wParam, LPARAM lParam)
wheelEvent.button = 0;
wheelEvent.mTime = ::GetMessageTime();
wheelEvent.mTimeStamp = GetMessageTimeStamp(wheelEvent.mTime);
wheelEvent.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
wheelEvent.inputSource = MouseEventBinding::MOZ_SOURCE_TOUCH;
bool endFeedback = true;
@ -7058,7 +7059,7 @@ bool nsWindow::OnGesture(WPARAM wParam, LPARAM lParam)
event.button = 0;
event.mTime = ::GetMessageTime();
event.mTimeStamp = GetMessageTimeStamp(event.mTime);
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
event.inputSource = MouseEventBinding::MOZ_SOURCE_TOUCH;
nsEventStatus status;
DispatchEvent(&event, status);
@ -7940,7 +7941,7 @@ nsWindow::DealWithPopups(HWND aWnd, UINT aMessage,
case WM_NCMBUTTONDOWN:
if (nativeMessage != WM_TOUCH &&
IsTouchSupportEnabled(aWnd) &&
MOUSE_INPUT_SOURCE() == nsIDOMMouseEvent::MOZ_SOURCE_TOUCH) {
MOUSE_INPUT_SOURCE() == MouseEventBinding::MOZ_SOURCE_TOUCH) {
// If any of these mouse events are really compatibility events that
// Windows is sending for touch inputs, then don't allow them to dismiss
// popups when APZ is enabled (instead we do the dismissing as part of
@ -8472,7 +8473,7 @@ bool nsWindow::OnPointerEvents(UINT msg, WPARAM aWParam, LPARAM aLParam)
// location
LPARAM newLParam = lParamToClient(aLParam);
DispatchMouseEvent(message, aWParam, newLParam, false, button,
nsIDOMMouseEvent::MOZ_SOURCE_PEN, &pointerInfo);
MouseEventBinding::MOZ_SOURCE_PEN, &pointerInfo);
// Consume WM_POINTER* to stop Windows fires WM_*BUTTONDOWN / WM_*BUTTONUP
// WM_MOUSEMOVE.
return true;

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

@ -30,6 +30,7 @@
#include "mozilla/MouseEvents.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/webrender/WebRenderTypes.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "nsMargin.h"
#include "nsRegionFwd.h"
@ -234,7 +235,7 @@ public:
int16_t aButton =
mozilla::WidgetMouseEvent::eLeftButton,
uint16_t aInputSource =
nsIDOMMouseEvent::MOZ_SOURCE_MOUSE,
mozilla::dom::MouseEventBinding::MOZ_SOURCE_MOUSE,
WinPointerInfo* aPointerInfo = nullptr);
virtual bool DispatchWindowEvent(mozilla::WidgetGUIEvent* aEvent,
nsEventStatus& aStatus);