Bug 1807812 - Remove WidgetEventTime::mTime, r=masayuki,geckoview-reviewers,m_kato

HTMLSelectEventListener changes are needed, since currently that code works somewhat by accident given that
mTime often contains totally bogus values, like PR_IntervalNow(). Those changes then reveal issues also in
browser_editAddressDialog.js.

Differential Revision: https://phabricator.services.mozilla.com/D165618
This commit is contained in:
Olli Pettay 2023-01-02 12:31:40 +00:00
parent 8f067afa13
commit 5d21de32ac
68 changed files with 175 additions and 430 deletions

View File

@ -133,7 +133,6 @@ void nsCoreUtils::DispatchMouseEvent(EventMessage aMessage, int32_t aX,
event.mClickCount = 1;
event.mButton = MouseButton::ePrimary;
event.mTime = PR_IntervalNow();
event.mInputSource = dom::MouseEvent_Binding::MOZ_SOURCE_UNKNOWN;
nsEventStatus status = nsEventStatus_eIgnore;
@ -154,8 +153,6 @@ void nsCoreUtils::DispatchTouchEvent(EventMessage aMessage, int32_t aX,
WidgetTouchEvent event(true, aMessage, aRootWidget);
event.mTime = PR_IntervalNow();
// XXX: Touch has an identifier of -1 to hint that it is synthesized.
RefPtr<dom::Touch> t = new dom::Touch(-1, LayoutDeviceIntPoint(aX, aY),
LayoutDeviceIntPoint(1, 1), 0.0f, 1.0f);

View File

@ -603,6 +603,8 @@ add_task(async function test_countryAndStateFieldLabels() {
);
}
}
// Dispatch a dummy key event so that <select>'s incremental search is cleared.
EventUtils.synthesizeKey("VK_ACCEPT", {}, win);
}
doc.querySelector("#cancel").click();
@ -906,6 +908,9 @@ add_task(async function test_countrySpecificFieldsGetRequiredness() {
"address-level1 should not be marked as disabled"
);
// Dispatch a dummy key event so that <select>'s incremental search is cleared.
EventUtils.synthesizeKey("VK_ACCEPT", {}, win);
doc.querySelector("#country").focus();
EventUtils.synthesizeKey("Romania", {}, win);

View File

@ -4610,8 +4610,6 @@ nsresult nsContentUtils::DispatchEvent(Document* aDoc, nsISupports* aTarget,
nsCOMPtr<EventTarget> target(do_QueryInterface(aTarget));
aEvent.mTime = PR_Now();
aEvent.mSpecifiedEventType = GetEventTypeFromMessage(aEventMessage);
aEvent.SetDefaultComposed();
aEvent.SetDefaultComposedInNativeAnonymousContent();
@ -4686,9 +4684,6 @@ nsresult nsContentUtils::DispatchInputEvent(
widgetEvent.mSpecifiedEventType = nsGkAtoms::oninput;
widgetEvent.mFlags.mCancelable = false;
widgetEvent.mFlags.mComposed = true;
// Using same time as nsContentUtils::DispatchEvent() for backward
// compatibility.
widgetEvent.mTime = PR_Now();
(new AsyncEventDispatcher(aEventTargetElement, widgetEvent))
->RunDOMEventWhenSafe();
return NS_OK;
@ -4734,10 +4729,6 @@ nsresult nsContentUtils::DispatchInputEvent(
IsCancelableBeforeInputEvent(aEditorInputType);
MOZ_ASSERT(!inputEvent.mFlags.mCancelable || aEventStatus);
// Using same time as old event dispatcher in EditorBase for backward
// compatibility.
inputEvent.mTime = static_cast<uint64_t>(PR_Now() / 1000);
// If there is an editor, set isComposing to true when it has composition.
// Note that EditorBase::IsIMEComposing() may return false even when we
// need to set it to true.
@ -8477,7 +8468,6 @@ nsresult nsContentUtils::SendMouseEvent(
event.mPressure = aPressure;
event.mInputSource = aInputSourceArg;
event.mClickCount = aClickCount;
event.mTime = PR_IntervalNow();
event.mFlags.mIsSynthesizedForTests = aIsDOMEventSynthesized;
event.mExitFrom = exitFrom;

View File

@ -768,8 +768,6 @@ nsDOMWindowUtils::SendWheelEvent(float aX, float aY, double aDeltaX,
wheelEvent.mLineOrPageDeltaX = aLineOrPageDeltaX;
wheelEvent.mLineOrPageDeltaY = aLineOrPageDeltaY;
wheelEvent.mTime = PR_Now() / 1000;
nsPresContext* presContext = GetPresContext();
NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
@ -891,7 +889,6 @@ nsresult nsDOMWindowUtils::SendTouchEventCommon(
}
WidgetTouchEvent event(true, msg, widget);
event.mModifiers = nsContentUtils::GetWidgetModifiers(aModifiers);
event.mTime = PR_Now();
nsPresContext* presContext = GetPresContext();
if (!presContext) {
@ -1454,7 +1451,6 @@ nsDOMWindowUtils::SendSimpleGestureEvent(const nsAString& aType, float aX,
event.mDirection = aDirection;
event.mDelta = aDelta;
event.mClickCount = aClickCount;
event.mTime = PR_IntervalNow();
nsPresContext* presContext = GetPresContext();
if (!presContext) return NS_ERROR_FAILURE;
@ -2302,7 +2298,6 @@ static void InitEvent(WidgetGUIEvent& aEvent,
if (aPt) {
aEvent.mRefPoint = *aPt;
}
aEvent.mTime = PR_IntervalNow();
}
NS_IMETHODIMP

View File

@ -18,7 +18,6 @@ AnimationEvent::AnimationEvent(EventTarget* aOwner, nsPresContext* aPresContext,
mEventIsInternal = false;
} else {
mEventIsInternal = true;
mEvent->mTime = PR_Now();
}
}

View File

@ -20,7 +20,6 @@ ClipboardEvent::ClipboardEvent(EventTarget* aOwner, nsPresContext* aPresContext,
mEventIsInternal = false;
} else {
mEventIsInternal = true;
mEvent->mTime = PR_Now();
}
}

View File

@ -13,7 +13,6 @@ namespace mozilla::dom {
CommandEvent::CommandEvent(EventTarget* aOwner, nsPresContext* aPresContext,
WidgetCommandEvent* aEvent)
: Event(aOwner, aPresContext, aEvent ? aEvent : new WidgetCommandEvent()) {
mEvent->mTime = PR_Now();
if (aEvent) {
mEventIsInternal = false;
} else {

View File

@ -22,7 +22,6 @@ CompositionEvent::CompositionEvent(EventTarget* aOwner,
mEventIsInternal = false;
} else {
mEventIsInternal = true;
mEvent->mTime = PR_Now();
// XXX compositionstart is cancelable in draft of DOM3 Events.
// However, it doesn't make sence for us, we cannot cancel composition

View File

@ -54,8 +54,6 @@ void DeviceMotionEvent::InitDeviceMotionEvent(
this, aRotationRate.mAlpha, aRotationRate.mBeta, aRotationRate.mGamma);
mInterval = aInterval;
if (!aTimeStamp.IsNull()) {
mEvent->mTime = aTimeStamp.Value();
static mozilla::TimeStamp sInitialNow = mozilla::TimeStamp::Now();
static uint64_t sInitialEventTime = aTimeStamp.Value();
mEvent->mTimeStamp =

View File

@ -21,7 +21,6 @@ DragEvent::DragEvent(EventTarget* aOwner, nsPresContext* aPresContext,
mEventIsInternal = false;
} else {
mEventIsInternal = true;
mEvent->mTime = PR_Now();
mEvent->mRefPoint = LayoutDeviceIntPoint(0, 0);
mEvent->AsMouseEvent()->mInputSource =
MouseEvent_Binding::MOZ_SOURCE_UNKNOWN;

View File

@ -95,7 +95,6 @@ void Event::ConstructorInit(EventTarget* aOwner, nsPresContext* aPresContext,
}
*/
mEvent = new WidgetEvent(false, eVoidEvent);
mEvent->mTime = PR_Now();
}
InitPresContextData(aPresContext);

View File

@ -2641,7 +2641,6 @@ void EventStateManager::SendLineScrollEvent(nsIFrame* aTargetFrame,
event.mFlags.mDefaultPrevented = aState.mDefaultPrevented;
event.mFlags.mDefaultPreventedByContent = aState.mDefaultPreventedByContent;
event.mRefPoint = aEvent->mRefPoint;
event.mTime = aEvent->mTime;
event.mTimeStamp = aEvent->mTimeStamp;
event.mModifiers = aEvent->mModifiers;
event.mButtons = aEvent->mButtons;
@ -2680,7 +2679,6 @@ void EventStateManager::SendPixelScrollEvent(nsIFrame* aTargetFrame,
event.mFlags.mDefaultPrevented = aState.mDefaultPrevented;
event.mFlags.mDefaultPreventedByContent = aState.mDefaultPreventedByContent;
event.mRefPoint = aEvent->mRefPoint;
event.mTime = aEvent->mTime;
event.mTimeStamp = aEvent->mTimeStamp;
event.mModifiers = aEvent->mModifiers;
event.mButtons = aEvent->mButtons;
@ -5276,7 +5274,6 @@ nsresult EventStateManager::InitAndDispatchClickEvent(
event.mClickCount = aMouseUpEvent->mClickCount;
event.mModifiers = aMouseUpEvent->mModifiers;
event.mButtons = aMouseUpEvent->mButtons;
event.mTime = aMouseUpEvent->mTime;
event.mTimeStamp = aMouseUpEvent->mTimeStamp;
event.mFlags.mOnlyChromeDispatch =
aNoContentDispatch && !aMouseUpEvent->mUseLegacyNonPrimaryDispatch;

View File

@ -18,7 +18,6 @@ FocusEvent::FocusEvent(EventTarget* aOwner, nsPresContext* aPresContext,
mEventIsInternal = false;
} else {
mEventIsInternal = true;
mEvent->mTime = PR_Now();
}
}

View File

@ -23,7 +23,6 @@ InputEvent::InputEvent(EventTarget* aOwner, nsPresContext* aPresContext,
mEventIsInternal = false;
} else {
mEventIsInternal = true;
mEvent->mTime = PR_Now();
}
}

View File

@ -28,7 +28,6 @@ KeyboardEvent::KeyboardEvent(EventTarget* aOwner, nsPresContext* aPresContext,
mEventIsInternal = false;
} else {
mEventIsInternal = true;
mEvent->mTime = PR_Now();
mEvent->AsKeyboardEvent()->mKeyNameIndex = KEY_NAME_INDEX_USE_STRING;
}
}

View File

@ -28,7 +28,6 @@ MouseEvent::MouseEvent(EventTarget* aOwner, nsPresContext* aPresContext,
mEventIsInternal = false;
} else {
mEventIsInternal = true;
mEvent->mTime = PR_Now();
mEvent->mRefPoint = LayoutDeviceIntPoint(0, 0);
mouseEvent->mInputSource = MouseEvent_Binding::MOZ_SOURCE_UNKNOWN;
}

View File

@ -22,7 +22,6 @@ MouseScrollEvent::MouseScrollEvent(EventTarget* aOwner,
mEventIsInternal = false;
} else {
mEventIsInternal = true;
mEvent->mTime = PR_Now();
mEvent->mRefPoint = LayoutDeviceIntPoint(0, 0);
static_cast<WidgetMouseEventBase*>(mEvent)->mInputSource =
MouseEvent_Binding::MOZ_SOURCE_UNKNOWN;

View File

@ -29,7 +29,6 @@ PointerEvent::PointerEvent(EventTarget* aOwner, nsPresContext* aPresContext,
mEventIsInternal = false;
} else {
mEventIsInternal = true;
mEvent->mTime = PR_Now();
mEvent->mRefPoint = LayoutDeviceIntPoint(0, 0);
mouseEvent->mInputSource = MouseEvent_Binding::MOZ_SOURCE_UNKNOWN;
}

View File

@ -552,7 +552,6 @@ void PointerEventHandler::InitPointerEventFromTouch(
aPointerEvent.tiltX = aTouch.tiltX;
aPointerEvent.tiltY = aTouch.tiltY;
aPointerEvent.twist = aTouch.twist;
aPointerEvent.mTime = aTouchEvent.mTime;
aPointerEvent.mTimeStamp = aTouchEvent.mTimeStamp;
aPointerEvent.mFlags = aTouchEvent.mFlags;
aPointerEvent.mButton = button;

View File

@ -25,7 +25,6 @@ SimpleGestureEvent::SimpleGestureEvent(EventTarget* aOwner,
mEventIsInternal = false;
} else {
mEventIsInternal = true;
mEvent->mTime = PR_Now();
mEvent->mRefPoint = LayoutDeviceIntPoint(0, 0);
static_cast<WidgetMouseEventBase*>(mEvent)->mInputSource =
MouseEvent_Binding::MOZ_SOURCE_UNKNOWN;

View File

@ -202,7 +202,6 @@ BaseEventFlags TextComposition::CloneAndDispatchAs(
WidgetCompositionEvent compositionEvent(aCompositionEvent->IsTrusted(),
aMessage, aCompositionEvent->mWidget);
compositionEvent.mTime = aCompositionEvent->mTime;
compositionEvent.mTimeStamp = aCompositionEvent->mTimeStamp;
compositionEvent.mData = aCompositionEvent->mData;
compositionEvent.mNativeIMEContext = aCompositionEvent->mNativeIMEContext;

View File

@ -61,7 +61,6 @@ TouchEvent::TouchEvent(EventTarget* aOwner, nsPresContext* aPresContext,
}
} else {
mEventIsInternal = true;
mEvent->mTime = PR_Now();
}
}

View File

@ -19,7 +19,6 @@ TransitionEvent::TransitionEvent(EventTarget* aOwner,
mEventIsInternal = false;
} else {
mEventIsInternal = true;
mEvent->mTime = PR_Now();
}
}

View File

@ -40,7 +40,6 @@ UIEvent::UIEvent(EventTarget* aOwner, nsPresContext* aPresContext,
mEventIsInternal = false;
} else {
mEventIsInternal = true;
mEvent->mTime = PR_Now();
}
// Fill mDetail and mView according to the mEvent (widget-generated

View File

@ -29,7 +29,6 @@ WheelEvent::WheelEvent(EventTarget* aOwner, nsPresContext* aPresContext,
}
} else {
mEventIsInternal = true;
mEvent->mTime = PR_Now();
mEvent->mRefPoint = LayoutDeviceIntPoint(0, 0);
mEvent->AsWheelEvent()->mInputSource =
MouseEvent_Binding::MOZ_SOURCE_UNKNOWN;

View File

@ -20,7 +20,6 @@ XULCommandEvent::XULCommandEvent(EventTarget* aOwner,
mEventIsInternal = false;
} else {
mEventIsInternal = true;
mEvent->mTime = PR_Now();
}
}

View File

@ -1612,9 +1612,9 @@ APZEventResult APZCTreeManager::ReceiveInputEvent(
// becasue we might no longer receive any events which will be
// handled by the APZC.
PanGestureInput panInterrupted(
PanGestureInput::PANGESTURE_INTERRUPTED, panInput.mTime,
panInput.mTimeStamp, panInput.mPanStartPoint,
panInput.mPanDisplacement, panInput.modifiers);
PanGestureInput::PANGESTURE_INTERRUPTED, panInput.mTimeStamp,
panInput.mPanStartPoint, panInput.mPanDisplacement,
panInput.modifiers);
Unused << mInputQueue->ReceiveInputEvent(
state.mHit.mTargetApzc,
TargetConfirmationFlags{state.mHit.mHitResult}, panInterrupted);
@ -2128,7 +2128,6 @@ APZEventResult APZCTreeManager::ProcessTouchInputForScrollbarDrag(
dom::MouseEvent_Binding::MOZ_SOURCE_TOUCH,
MouseButtonsFlag::ePrimaryFlag,
aTouchInput.mTouches[0].mScreenPoint,
aTouchInput.mTime,
aTouchInput.mTimeStamp,
aTouchInput.modifiers};
mouseInput.mHandledByAPZ = true;
@ -2240,7 +2239,6 @@ void APZCTreeManager::SynthesizePinchGestureFromMouseWheel(
PinchGestureInput pinchStart{PinchGestureInput::PINCHGESTURE_START,
PinchGestureInput::MOUSEWHEEL,
aWheelInput.mTime,
aWheelInput.mTimeStamp,
ExternalPoint(0, 0),
focusPoint,
@ -2249,7 +2247,6 @@ void APZCTreeManager::SynthesizePinchGestureFromMouseWheel(
aWheelInput.modifiers};
PinchGestureInput pinchScale1{PinchGestureInput::PINCHGESTURE_SCALE,
PinchGestureInput::MOUSEWHEEL,
aWheelInput.mTime,
aWheelInput.mTimeStamp,
ExternalPoint(0, 0),
focusPoint,
@ -2258,7 +2255,6 @@ void APZCTreeManager::SynthesizePinchGestureFromMouseWheel(
aWheelInput.modifiers};
PinchGestureInput pinchScale2{PinchGestureInput::PINCHGESTURE_SCALE,
PinchGestureInput::MOUSEWHEEL,
aWheelInput.mTime,
aWheelInput.mTimeStamp,
ExternalPoint(0, 0),
focusPoint,
@ -2267,7 +2263,6 @@ void APZCTreeManager::SynthesizePinchGestureFromMouseWheel(
aWheelInput.modifiers};
PinchGestureInput pinchEnd{PinchGestureInput::PINCHGESTURE_END,
PinchGestureInput::MOUSEWHEEL,
aWheelInput.mTime,
aWheelInput.mTimeStamp,
ExternalPoint(0, 0),
focusPoint,

View File

@ -255,7 +255,7 @@ APZEventResult APZInputBridge::ReceiveInputEvent(
if (wheelEvent.mDeltaX || wheelEvent.mDeltaY) {
ScreenPoint origin(wheelEvent.mRefPoint.x, wheelEvent.mRefPoint.y);
ScrollWheelInput input(
wheelEvent.mTime, wheelEvent.mTimeStamp, 0, scrollMode,
wheelEvent.mTimeStamp, 0, scrollMode,
ScrollWheelInput::DeltaTypeForDeltaMode(wheelEvent.mDeltaMode),
origin, wheelEvent.mDeltaX, wheelEvent.mDeltaY,
wheelEvent.mAllowToOverrideSystemScrollSpeed, strategy);

View File

@ -63,7 +63,7 @@ ScreenCoord GestureEventListener::GetYSpanFromGestureStartPoint() {
static TapGestureInput CreateTapEvent(const MultiTouchInput& aTouch,
TapGestureInput::TapGestureType aType) {
return TapGestureInput(aType, aTouch.mTime, aTouch.mTimeStamp,
return TapGestureInput(aType, aTouch.mTimeStamp,
aTouch.mTouches[0].mScreenPoint, aTouch.modifiers);
}
@ -327,9 +327,8 @@ nsEventStatus GestureEventListener::HandleInputTouchMove() {
PinchGestureInput pinchEvent(
PinchGestureInput::PINCHGESTURE_START, PinchGestureInput::ONE_TOUCH,
mLastTouchInput.mTime, mLastTouchInput.mTimeStamp,
mLastTouchInput.mScreenOffset, currentFocus, currentSpan,
currentSpan, mLastTouchInput.modifiers);
mLastTouchInput.mTimeStamp, mLastTouchInput.mScreenOffset,
currentFocus, currentSpan, currentSpan, mLastTouchInput.modifiers);
rv = mAsyncPanZoomController->HandleGestureEvent(pinchEvent);
@ -357,9 +356,8 @@ nsEventStatus GestureEventListener::HandleInputTouchMove() {
SetState(GESTURE_PINCH);
PinchGestureInput pinchEvent(
PinchGestureInput::PINCHGESTURE_START, PinchGestureInput::TOUCH,
mLastTouchInput.mTime, mLastTouchInput.mTimeStamp,
mLastTouchInput.mScreenOffset, currentFocus, currentSpan,
currentSpan, mLastTouchInput.modifiers);
mLastTouchInput.mTimeStamp, mLastTouchInput.mScreenOffset,
currentFocus, currentSpan, currentSpan, mLastTouchInput.modifiers);
rv = mAsyncPanZoomController->HandleGestureEvent(pinchEvent);
} else {
@ -386,9 +384,9 @@ nsEventStatus GestureEventListener::HandleInputTouchMove() {
PinchGestureInput pinchEvent(
PinchGestureInput::PINCHGESTURE_SCALE, PinchGestureInput::TOUCH,
mLastTouchInput.mTime, mLastTouchInput.mTimeStamp,
mLastTouchInput.mScreenOffset, GetCurrentFocus(mLastTouchInput),
currentSpan, mPreviousSpan, mLastTouchInput.modifiers);
mLastTouchInput.mTimeStamp, mLastTouchInput.mScreenOffset,
GetCurrentFocus(mLastTouchInput), currentSpan, mPreviousSpan,
mLastTouchInput.modifiers);
rv = mAsyncPanZoomController->HandleGestureEvent(pinchEvent);
mPreviousSpan = currentSpan;
@ -409,9 +407,9 @@ nsEventStatus GestureEventListener::HandleInputTouchMove() {
PinchGestureInput pinchEvent(
PinchGestureInput::PINCHGESTURE_SCALE, PinchGestureInput::ONE_TOUCH,
mLastTouchInput.mTime, mLastTouchInput.mTimeStamp,
mLastTouchInput.mScreenOffset, currentFocus, effectiveSpan,
mPreviousSpan, mLastTouchInput.modifiers);
mLastTouchInput.mTimeStamp, mLastTouchInput.mScreenOffset,
currentFocus, effectiveSpan, mPreviousSpan,
mLastTouchInput.modifiers);
rv = mAsyncPanZoomController->HandleGestureEvent(pinchEvent);
mPreviousSpan = effectiveSpan;
@ -495,10 +493,10 @@ nsEventStatus GestureEventListener::HandleInputTouchEnd() {
type = PinchGestureInput::PINCHGESTURE_FINGERLIFTED;
point = mTouches[0].mScreenPoint;
}
PinchGestureInput pinchEvent(
type, PinchGestureInput::TOUCH, mLastTouchInput.mTime,
mLastTouchInput.mTimeStamp, mLastTouchInput.mScreenOffset, point,
1.0f, 1.0f, mLastTouchInput.modifiers);
PinchGestureInput pinchEvent(type, PinchGestureInput::TOUCH,
mLastTouchInput.mTimeStamp,
mLastTouchInput.mScreenOffset, point, 1.0f,
1.0f, mLastTouchInput.modifiers);
mAsyncPanZoomController->HandleGestureEvent(pinchEvent);
}
@ -510,9 +508,8 @@ nsEventStatus GestureEventListener::HandleInputTouchEnd() {
SetState(GESTURE_NONE);
PinchGestureInput pinchEvent(
PinchGestureInput::PINCHGESTURE_END, PinchGestureInput::ONE_TOUCH,
mLastTouchInput.mTime, mLastTouchInput.mTimeStamp,
mLastTouchInput.mScreenOffset, ScreenPoint(), 1.0f, 1.0f,
mLastTouchInput.modifiers);
mLastTouchInput.mTimeStamp, mLastTouchInput.mScreenOffset,
ScreenPoint(), 1.0f, 1.0f, mLastTouchInput.modifiers);
mAsyncPanZoomController->HandleGestureEvent(pinchEvent);
rv = nsEventStatus_eConsumeNoDefault;

View File

@ -73,9 +73,9 @@ inline PinchGestureInput CreatePinchGestureInput(
PinchGestureInput::PinchGestureType aType, const ScreenPoint& aFocus,
float aCurrentSpan, float aPreviousSpan, TimeStamp timestamp) {
ParentLayerPoint localFocus(aFocus.x, aFocus.y);
PinchGestureInput result(
aType, PinchGestureInput::UNKNOWN, MillisecondsSinceStartup(timestamp),
timestamp, ExternalPoint(0, 0), aFocus, aCurrentSpan, aPreviousSpan, 0);
PinchGestureInput result(aType, PinchGestureInput::UNKNOWN, timestamp,
ExternalPoint(0, 0), aFocus, aCurrentSpan,
aPreviousSpan, 0);
return result;
}

View File

@ -77,8 +77,7 @@ template <class InputReceiver>
APZEventResult Wheel(const RefPtr<InputReceiver>& aTarget,
const ScreenIntPoint& aPoint, const ScreenPoint& aDelta,
TimeStamp aTime) {
ScrollWheelInput input(MillisecondsSinceStartup(aTime), aTime, 0,
ScrollWheelInput::SCROLLMODE_INSTANT,
ScrollWheelInput input(aTime, 0, ScrollWheelInput::SCROLLMODE_INSTANT,
ScrollWheelInput::SCROLLDELTA_PIXEL, aPoint, aDelta.x,
aDelta.y, false, WheelDeltaAdjustmentStrategy::eNone);
return aTarget->ReceiveInputEvent(input);
@ -88,8 +87,7 @@ template <class InputReceiver>
APZEventResult SmoothWheel(const RefPtr<InputReceiver>& aTarget,
const ScreenIntPoint& aPoint,
const ScreenPoint& aDelta, TimeStamp aTime) {
ScrollWheelInput input(MillisecondsSinceStartup(aTime), aTime, 0,
ScrollWheelInput::SCROLLMODE_SMOOTH,
ScrollWheelInput input(aTime, 0, ScrollWheelInput::SCROLLMODE_SMOOTH,
ScrollWheelInput::SCROLLDELTA_LINE, aPoint, aDelta.x,
aDelta.y, false, WheelDeltaAdjustmentStrategy::eNone);
return aTarget->ReceiveInputEvent(input);
@ -99,8 +97,8 @@ template <class InputReceiver>
APZEventResult MouseDown(const RefPtr<InputReceiver>& aTarget,
const ScreenIntPoint& aPoint, TimeStamp aTime) {
MouseInput input(MouseInput::MOUSE_DOWN,
MouseInput::ButtonType::PRIMARY_BUTTON, 0, 0, aPoint,
MillisecondsSinceStartup(aTime), aTime, 0);
MouseInput::ButtonType::PRIMARY_BUTTON, 0, 0, aPoint, aTime,
0);
return aTarget->ReceiveInputEvent(input);
}
@ -108,8 +106,8 @@ template <class InputReceiver>
APZEventResult MouseMove(const RefPtr<InputReceiver>& aTarget,
const ScreenIntPoint& aPoint, TimeStamp aTime) {
MouseInput input(MouseInput::MOUSE_MOVE,
MouseInput::ButtonType::PRIMARY_BUTTON, 0, 0, aPoint,
MillisecondsSinceStartup(aTime), aTime, 0);
MouseInput::ButtonType::PRIMARY_BUTTON, 0, 0, aPoint, aTime,
0);
return aTarget->ReceiveInputEvent(input);
}
@ -117,7 +115,7 @@ template <class InputReceiver>
APZEventResult MouseUp(const RefPtr<InputReceiver>& aTarget,
const ScreenIntPoint& aPoint, TimeStamp aTime) {
MouseInput input(MouseInput::MOUSE_UP, MouseInput::ButtonType::PRIMARY_BUTTON,
0, 0, aPoint, MillisecondsSinceStartup(aTime), aTime, 0);
0, 0, aPoint, aTime, 0);
return aTarget->ReceiveInputEvent(input);
}
@ -128,8 +126,7 @@ APZEventResult PanGesture(PanGestureInput::PanGestureType aType,
const ScreenPoint& aDelta, TimeStamp aTime,
Modifiers aModifiers = MODIFIER_NONE,
bool aSimulateMomentum = false) {
PanGestureInput input(aType, MillisecondsSinceStartup(aTime), aTime, aPoint,
aDelta, aModifiers);
PanGestureInput input(aType, aTime, aPoint, aDelta, aModifiers);
input.mSimulateMomentum = aSimulateMomentum;
if constexpr (std::is_same_v<InputReceiver, TestAsyncPanZoomController>) {
// In the case of TestAsyncPanZoomController we know for sure that the

View File

@ -248,8 +248,7 @@ TEST_F(APZHitTestingTester, TestRepaintFlushOnWheelEvents) {
EXPECT_CALL(*mcc, RequestContentRepaint(_)).Times(AtLeast(3));
ScreenPoint origin(100, 50);
for (int i = 0; i < 3; i++) {
ScrollWheelInput swi(MillisecondsSinceStartup(mcc->Time()), mcc->Time(), 0,
ScrollWheelInput::SCROLLMODE_INSTANT,
ScrollWheelInput swi(mcc->Time(), 0, ScrollWheelInput::SCROLLMODE_INSTANT,
ScrollWheelInput::SCROLLDELTA_PIXEL, origin, 0, 10,
false, WheelDeltaAdjustmentStrategy::eNone);
EXPECT_EQ(nsEventStatus_eConsumeDoDefault,
@ -276,8 +275,7 @@ TEST_F(APZHitTestingTester, TestForceDisableApz) {
TestAsyncPanZoomController* apzcroot = ApzcOf(root);
ScreenPoint origin(100, 50);
ScrollWheelInput swi(MillisecondsSinceStartup(mcc->Time()), mcc->Time(), 0,
ScrollWheelInput::SCROLLMODE_INSTANT,
ScrollWheelInput swi(mcc->Time(), 0, ScrollWheelInput::SCROLLMODE_INSTANT,
ScrollWheelInput::SCROLLDELTA_PIXEL, origin, 0, 10,
false, WheelDeltaAdjustmentStrategy::eNone);
EXPECT_EQ(nsEventStatus_eConsumeDoDefault,
@ -307,8 +305,7 @@ TEST_F(APZHitTestingTester, TestForceDisableApz) {
// With untransforming events we should get normal behaviour (in this case,
// no noticeable untransform, because the repaint request already got
// flushed).
swi = ScrollWheelInput(MillisecondsSinceStartup(mcc->Time()), mcc->Time(), 0,
ScrollWheelInput::SCROLLMODE_INSTANT,
swi = ScrollWheelInput(mcc->Time(), 0, ScrollWheelInput::SCROLLMODE_INSTANT,
ScrollWheelInput::SCROLLDELTA_PIXEL, origin, 0, 0,
false, WheelDeltaAdjustmentStrategy::eNone);
EXPECT_EQ(nsEventStatus_eConsumeDoDefault,

View File

@ -1280,9 +1280,9 @@ TEST_F(APZCOverscrollTester, OverscrollByPanGesturesInterruptedByReflowZoom) {
// A sanity check that pan gestures with ctrl modifier will not be handled by
// APZ.
PanGestureInput panInput(
PanGestureInput::PANGESTURE_START, MillisecondsSinceStartup(mcc->Time()),
mcc->Time(), ScreenIntPoint(5, 5), ScreenPoint(0, -2), MODIFIER_CONTROL);
PanGestureInput panInput(PanGestureInput::PANGESTURE_START, mcc->Time(),
ScreenIntPoint(5, 5), ScreenPoint(0, -2),
MODIFIER_CONTROL);
WidgetWheelEvent wheelEvent = panInput.ToWidgetEvent(nullptr);
EXPECT_FALSE(APZInputBridge::ActionForWheelEvent(&wheelEvent).isSome());

View File

@ -745,8 +745,7 @@ TEST_F(APZScrollHandoffTesterMock, WheelHandoffNonscrollable) {
mcc->AdvanceByMillis(100);
MouseInput mouseInput(MouseInput::MOUSE_MOVE,
MouseInput::ButtonType::PRIMARY_BUTTON, 0, 0,
scrollableLocation,
MillisecondsSinceStartup(mcc->Time()), mcc->Time(), 0);
scrollableLocation, mcc->Time(), 0);
WidgetMouseEvent mouseEvent = mouseInput.ToWidgetEvent(nullptr);
QueueMockHitResult(ScrollableLayerGuid::START_SCROLL_ID + 1);
((APZInputBridge*)manager.get())->ReceiveInputEvent(mouseEvent);

View File

@ -219,8 +219,7 @@ TEST_F(APZCTreeManagerGenericTesterMock, Bug1198900) {
UpdateHitTestingTree();
ScreenPoint origin(100, 50);
ScrollWheelInput swi(MillisecondsSinceStartup(mcc->Time()), mcc->Time(), 0,
ScrollWheelInput::SCROLLMODE_INSTANT,
ScrollWheelInput swi(mcc->Time(), 0, ScrollWheelInput::SCROLLMODE_INSTANT,
ScrollWheelInput::SCROLLDELTA_PIXEL, origin, 0, 10,
false, WheelDeltaAdjustmentStrategy::eNone);
uint64_t blockId;

View File

@ -512,15 +512,14 @@ nsEventStatus APZCCallbackHelper::DispatchWidgetEvent(WidgetGUIEvent& aEvent) {
}
nsEventStatus APZCCallbackHelper::DispatchSynthesizedMouseEvent(
EventMessage aMsg, uint64_t aTime, const LayoutDevicePoint& aRefPoint,
Modifiers aModifiers, int32_t aClickCount, nsIWidget* aWidget) {
EventMessage aMsg, const LayoutDevicePoint& aRefPoint, Modifiers aModifiers,
int32_t aClickCount, nsIWidget* aWidget) {
MOZ_ASSERT(aMsg == eMouseMove || aMsg == eMouseDown || aMsg == eMouseUp ||
aMsg == eMouseLongTap);
WidgetMouseEvent event(true, aMsg, aWidget, WidgetMouseEvent::eReal,
WidgetMouseEvent::eNormal);
event.mRefPoint = LayoutDeviceIntPoint::Truncate(aRefPoint.x, aRefPoint.y);
event.mTime = aTime;
event.mButton = MouseButton::ePrimary;
event.mButtons |= MouseButtonsFlag::ePrimaryFlag;
event.mInputSource = dom::MouseEvent_Binding::MOZ_SOURCE_TOUCH;
@ -563,12 +562,11 @@ void APZCCallbackHelper::FireSingleTapEvent(const LayoutDevicePoint& aPoint,
}
APZCCH_LOG("Dispatching single-tap component events to %s\n",
ToString(aPoint).c_str());
int time = 0;
DispatchSynthesizedMouseEvent(eMouseMove, time, aPoint, aModifiers,
aClickCount, aWidget);
DispatchSynthesizedMouseEvent(eMouseDown, time, aPoint, aModifiers,
aClickCount, aWidget);
DispatchSynthesizedMouseEvent(eMouseUp, time, aPoint, aModifiers, aClickCount,
DispatchSynthesizedMouseEvent(eMouseMove, aPoint, aModifiers, aClickCount,
aWidget);
DispatchSynthesizedMouseEvent(eMouseDown, aPoint, aModifiers, aClickCount,
aWidget);
DispatchSynthesizedMouseEvent(eMouseUp, aPoint, aModifiers, aClickCount,
aWidget);
}

View File

@ -105,7 +105,7 @@ class APZCCallbackHelper {
/* Synthesize a mouse event with the given parameters, and dispatch it
* via the given widget. */
static nsEventStatus DispatchSynthesizedMouseEvent(
EventMessage aMsg, uint64_t aTime, const LayoutDevicePoint& aRefPoint,
EventMessage aMsg, const LayoutDevicePoint& aRefPoint,
Modifiers aModifiers, int32_t aClickCount, nsIWidget* aWidget);
/* Dispatch a mouse event with the given parameters.

View File

@ -213,8 +213,7 @@ PreventDefaultResult APZEventState::FireContextmenuEvents(
// Note that we don't need to check whether mousemove event is consumed or
// not because Chrome also ignores the result.
APZCCallbackHelper::DispatchSynthesizedMouseEvent(
eMouseMove, 0 /* time */, aPoint * aScale, aModifiers, 0 /* clickCount */,
aWidget);
eMouseMove, aPoint * aScale, aModifiers, 0 /* clickCount */, aWidget);
// Converting the modifiers to DOM format for the DispatchMouseEvent call
// is the most useless thing ever because nsDOMWindowUtils::SendMouseEvent
@ -238,7 +237,7 @@ PreventDefaultResult APZEventState::FireContextmenuEvents(
} else {
// If the contextmenu wasn't consumed, fire the eMouseLongTap event.
nsEventStatus status = APZCCallbackHelper::DispatchSynthesizedMouseEvent(
eMouseLongTap, /*time*/ 0, aPoint * aScale, aModifiers,
eMouseLongTap, aPoint * aScale, aModifiers,
/*clickCount*/ 1, aWidget);
if (status == nsEventStatus_eConsumeNoDefault) {
// Assuming no JS actor listens eMouseLongTap events.
@ -275,8 +274,7 @@ void APZEventState::ProcessLongTap(PresShell* aPresShell,
// at this time, because things like text selection or dragging may want
// to know about it.
nsEventStatus status = APZCCallbackHelper::DispatchSynthesizedMouseEvent(
eMouseLongTap, /*time*/ 0, aPoint * aScale, aModifiers, /*clickCount*/ 1,
widget);
eMouseLongTap, aPoint * aScale, aModifiers, /*clickCount*/ 1, widget);
PreventDefaultResult preventDefaultResult =
(status == nsEventStatus_eConsumeNoDefault)

View File

@ -5858,7 +5858,6 @@ void PresShell::ProcessSynthMouseMoveEvent(bool aFromScroll) {
WidgetMouseEvent::eSynthesized);
event.mRefPoint =
LayoutDeviceIntPoint::FromAppUnitsToNearest(refpoint, viewAPD);
event.mTime = PR_IntervalNow();
// XXX set event.mModifiers ?
// XXX mnakano I think that we should get the latest information from widget.

View File

@ -72,7 +72,6 @@ void TouchManager::EvictTouchPoint(RefPtr<Touch>& aTouch,
nsCOMPtr<nsIWidget> widget = frame->GetView()->GetNearestWidget(&pt);
if (widget) {
WidgetTouchEvent event(true, eTouchEnd, widget);
event.mTime = PR_IntervalNow();
event.mTouches.AppendElement(aTouch);
nsEventStatus status;
widget->DispatchEvent(&event, status);

View File

@ -53,7 +53,7 @@ static bool IsOptionInteractivelySelectable(HTMLSelectElement& aSelect,
namespace mozilla {
static StaticAutoPtr<nsString> sIncrementalString;
static DOMTimeStamp gLastKeyTime = 0;
static TimeStamp gLastKeyTime;
static uintptr_t sLastKeyListener = 0;
static constexpr int32_t kNothingSelected = -1;
@ -72,6 +72,11 @@ class MOZ_RAII AutoIncrementalSearchHandler {
if (sLastKeyListener != uintptr_t(&aListener)) {
sLastKeyListener = uintptr_t(&aListener);
GetIncrementalString().Truncate();
// To make it easier to handle time comparisons in the other methods,
// initialize gLastKeyTime to a value in the past.
gLastKeyTime = TimeStamp::Now() -
TimeDuration::FromMilliseconds(
StaticPrefs::ui_menu_incremental_search_timeout() * 2);
}
}
~AutoIncrementalSearchHandler() {
@ -556,7 +561,7 @@ nsresult HTMLSelectEventListener::KeyPress(dom::Event* aKeyEvent) {
// string we will use to find options and start searching at the current
// keystroke. Otherwise, Truncate the string if it's been a long time
// since our last keypress.
if (keyEvent->mTime - gLastKeyTime >
if ((keyEvent->mTimeStamp - gLastKeyTime).ToMilliseconds() >
StaticPrefs::ui_menu_incremental_search_timeout()) {
// If this is ' ' and we are at the beginning of the string, treat it as
// "select this option" (bug 191543)
@ -572,7 +577,7 @@ nsresult HTMLSelectEventListener::KeyPress(dom::Event* aKeyEvent) {
GetIncrementalString().Truncate();
}
gLastKeyTime = keyEvent->mTime;
gLastKeyTime = keyEvent->mTimeStamp;
// Append this keystroke to the search string.
char16_t uniChar = ToLowerCase(static_cast<char16_t>(keyEvent->mCharCode));
@ -677,7 +682,7 @@ nsresult HTMLSelectEventListener::KeyDown(dom::Event* aKeyEvent) {
dropDownMenuOnSpace = mIsCombobox && !mElement->OpenInParentProcess();
#endif
bool withinIncrementalSearchTime =
keyEvent->mTime - gLastKeyTime <=
(keyEvent->mTimeStamp - gLastKeyTime).ToMilliseconds() <=
StaticPrefs::ui_menu_incremental_search_timeout();
if ((dropDownMenuOnUpDown &&
(keyEvent->mKeyCode == NS_VK_UP || keyEvent->mKeyCode == NS_VK_DOWN)) ||

View File

@ -364,7 +364,7 @@ nsresult nsMenuFrame::HandleEvent(nsPresContext* aPresContext,
// When pressing space, don't open the menu if performing an incremental
// search.
if (keyEvent->mCharCode != ' ' ||
!nsMenuPopupFrame::IsWithinIncrementalTime(keyEvent->mTime)) {
!nsMenuPopupFrame::IsWithinIncrementalTime(keyEvent->mTimeStamp)) {
*aEventStatus = nsEventStatus_eConsumeNoDefault;
OpenMenu(false);
}

View File

@ -68,7 +68,7 @@ using mozilla::dom::KeyboardEvent;
int8_t nsMenuPopupFrame::sDefaultLevelIsTop = -1;
DOMTimeStamp nsMenuPopupFrame::sLastKeyTime = 0;
TimeStamp nsMenuPopupFrame::sLastKeyTime;
#ifdef MOZ_WAYLAND
# include "mozilla/WidgetUtilsGtk.h"
@ -2128,7 +2128,7 @@ nsMenuFrame* nsMenuPopupFrame::FindMenuWithShortcut(KeyboardEvent* aKeyEvent,
bool isMenu = parentContent && !parentContent->NodeInfo()->Equals(
nsGkAtoms::menulist, kNameSpaceID_XUL);
DOMTimeStamp keyTime = aKeyEvent->TimeStamp();
TimeStamp keyTime = aKeyEvent->WidgetEventPtr()->mTimeStamp;
if (charCode == 0) {
if (keyCode == dom::KeyboardEvent_Binding::DOM_VK_BACK_SPACE) {

View File

@ -14,6 +14,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/gfx/Types.h"
#include "mozilla/StaticPrefs_ui.h"
#include "mozilla/TimeStamp.h"
#include "nsAtom.h"
#include "nsGkAtoms.h"
#include "nsCOMPtr.h"
@ -306,9 +307,10 @@ class nsMenuPopupFrame final : public nsBoxFrame,
bool& doAction);
void ClearIncrementalString() { mIncrementalString.Truncate(); }
static bool IsWithinIncrementalTime(DOMTimeStamp time) {
return time - sLastKeyTime <=
mozilla::StaticPrefs::ui_menu_incremental_search_timeout();
static bool IsWithinIncrementalTime(mozilla::TimeStamp time) {
return !sLastKeyTime.IsNull() &&
((time - sLastKeyTime).ToMilliseconds() <=
mozilla::StaticPrefs::ui_menu_incremental_search_timeout());
}
#ifdef DEBUG_FRAME_DUMP
@ -647,7 +649,7 @@ class nsMenuPopupFrame final : public nsBoxFrame,
static int8_t sDefaultLevelIsTop;
static DOMTimeStamp sLastKeyTime;
static mozilla::TimeStamp sLastKeyTime;
}; // class nsMenuPopupFrame

View File

@ -419,20 +419,14 @@ struct EventFlags : public BaseEventFlags {
class WidgetEventTime {
public:
// Elapsed time, in milliseconds, from a platform-specific zero time
// to the time the message was created
uint64_t mTime;
// Timestamp when the message was created. Set in parallel to 'time' until we
// determine if it is safe to drop 'time' (see bug 77992).
// Timestamp when the message was created.
TimeStamp mTimeStamp;
WidgetEventTime() : mTime(0), mTimeStamp(TimeStamp::Now()) {}
WidgetEventTime() : mTimeStamp(TimeStamp::Now()) {}
WidgetEventTime(uint64_t aTime, TimeStamp aTimeStamp)
: mTime(aTime), mTimeStamp(aTimeStamp) {}
explicit WidgetEventTime(TimeStamp aTimeStamp) : mTimeStamp(aTimeStamp) {}
void AssignEventTime(const WidgetEventTime& aOther) {
mTime = aOther.mTime;
mTimeStamp = aOther.mTimeStamp;
}
};

View File

@ -25,15 +25,13 @@ InputData::~InputData() = default;
InputData::InputData(InputType aInputType)
: mInputType(aInputType),
mTime(0),
mFocusSequenceNumber(0),
mLayersId{0},
modifiers(0) {}
InputData::InputData(InputType aInputType, uint32_t aTime, TimeStamp aTimeStamp,
InputData::InputData(InputType aInputType, TimeStamp aTimeStamp,
Modifiers aModifiers)
: mInputType(aInputType),
mTime(aTime),
mTimeStamp(aTimeStamp),
mFocusSequenceNumber(0),
mLayersId{0},
@ -78,7 +76,7 @@ already_AddRefed<Touch> SingleTouchData::ToNewDOMTouch() const {
MultiTouchInput::MultiTouchInput(MultiTouchType aType, uint32_t aTime,
TimeStamp aTimeStamp, Modifiers aModifiers)
: InputData(MULTITOUCH_INPUT, aTime, aTimeStamp, aModifiers),
: InputData(MULTITOUCH_INPUT, aTimeStamp, aModifiers),
mType(aType),
mHandledByAPZ(false) {}
@ -88,7 +86,7 @@ MultiTouchInput::MultiTouchInput()
mHandledByAPZ(false) {}
MultiTouchInput::MultiTouchInput(const WidgetTouchEvent& aTouchEvent)
: InputData(MULTITOUCH_INPUT, aTouchEvent.mTime, aTouchEvent.mTimeStamp,
: InputData(MULTITOUCH_INPUT, aTouchEvent.mTimeStamp,
aTouchEvent.mModifiers),
mHandledByAPZ(aTouchEvent.mFlags.mHandledByAPZ),
mButton(aTouchEvent.mButton),
@ -185,7 +183,6 @@ WidgetTouchEvent MultiTouchInput::ToWidgetEvent(nsIWidget* aWidget,
}
event.mModifiers = this->modifiers;
event.mTime = this->mTime;
event.mTimeStamp = this->mTimeStamp;
event.mFlags.mHandledByAPZ = mHandledByAPZ;
event.mFocusSequenceNumber = mFocusSequenceNumber;
@ -242,9 +239,9 @@ MouseInput::MouseInput()
MouseInput::MouseInput(MouseType aType, ButtonType aButtonType,
uint16_t aInputSource, int16_t aButtons,
const ScreenPoint& aPoint, uint32_t aTime,
TimeStamp aTimeStamp, Modifiers aModifiers)
: InputData(MOUSE_INPUT, aTime, aTimeStamp, aModifiers),
const ScreenPoint& aPoint, TimeStamp aTimeStamp,
Modifiers aModifiers)
: InputData(MOUSE_INPUT, aTimeStamp, aModifiers),
mType(aType),
mButtonType(aButtonType),
mInputSource(aInputSource),
@ -254,8 +251,7 @@ MouseInput::MouseInput(MouseType aType, ButtonType aButtonType,
mPreventClickEvent(false) {}
MouseInput::MouseInput(const WidgetMouseEventBase& aMouseEvent)
: InputData(MOUSE_INPUT, aMouseEvent.mTime, aMouseEvent.mTimeStamp,
aMouseEvent.mModifiers),
: InputData(MOUSE_INPUT, aMouseEvent.mTimeStamp, aMouseEvent.mModifiers),
mType(MOUSE_NONE),
mButtonType(NONE),
mInputSource(aMouseEvent.mInputSource),
@ -399,7 +395,6 @@ WidgetMouseEvent MouseInput::ToWidgetEvent(nsIWidget* aWidget) const {
event.mButtons = mButtons;
event.mModifiers = modifiers;
event.mTime = mTime;
event.mTimeStamp = mTimeStamp;
event.mLayersId = mLayersId;
event.mFlags.mHandledByAPZ = mHandledByAPZ;
@ -428,12 +423,11 @@ PanGestureInput::PanGestureInput()
mIsNoLineOrPageDelta(true),
mMayTriggerSwipe(false) {}
PanGestureInput::PanGestureInput(PanGestureType aType, uint32_t aTime,
TimeStamp aTimeStamp,
PanGestureInput::PanGestureInput(PanGestureType aType, TimeStamp aTimeStamp,
const ScreenPoint& aPanStartPoint,
const ScreenPoint& aPanDisplacement,
Modifiers aModifiers)
: InputData(PANGESTURE_INPUT, aTime, aTimeStamp, aModifiers),
: InputData(PANGESTURE_INPUT, aTimeStamp, aModifiers),
mType(aType),
mPanStartPoint(aPanStartPoint),
mPanDisplacement(aPanDisplacement),
@ -448,14 +442,13 @@ PanGestureInput::PanGestureInput(PanGestureType aType, uint32_t aTime,
mMayTriggerSwipe = SwipeTracker::CanTriggerSwipe(*this);
}
PanGestureInput::PanGestureInput(PanGestureType aType, uint32_t aTime,
TimeStamp aTimeStamp,
PanGestureInput::PanGestureInput(PanGestureType aType, TimeStamp aTimeStamp,
const ScreenPoint& aPanStartPoint,
const ScreenPoint& aPanDisplacement,
Modifiers aModifiers,
IsEligibleForSwipe aIsEligibleForSwipe)
: PanGestureInput(aType, aTime, aTimeStamp, aPanStartPoint,
aPanDisplacement, aModifiers) {
: PanGestureInput(aType, aTimeStamp, aPanStartPoint, aPanDisplacement,
aModifiers) {
mMayTriggerSwipe &= bool(aIsEligibleForSwipe);
}
@ -480,7 +473,6 @@ bool PanGestureInput::IsMomentum() const {
WidgetWheelEvent PanGestureInput::ToWidgetEvent(nsIWidget* aWidget) const {
WidgetWheelEvent wheelEvent(true, eWheel, aWidget);
wheelEvent.mModifiers = this->modifiers;
wheelEvent.mTime = mTime;
wheelEvent.mTimeStamp = mTimeStamp;
wheelEvent.mLayersId = mLayersId;
wheelEvent.mRefPoint = RoundedToInt(ViewAs<LayoutDevicePixel>(
@ -571,11 +563,10 @@ PinchGestureInput::PinchGestureInput()
mHandledByAPZ(false) {}
PinchGestureInput::PinchGestureInput(
PinchGestureType aType, PinchGestureSource aSource, uint32_t aTime,
TimeStamp aTimeStamp, const ExternalPoint& aScreenOffset,
const ScreenPoint& aFocusPoint, ScreenCoord aCurrentSpan,
ScreenCoord aPreviousSpan, Modifiers aModifiers)
: InputData(PINCHGESTURE_INPUT, aTime, aTimeStamp, aModifiers),
PinchGestureType aType, PinchGestureSource aSource, TimeStamp aTimeStamp,
const ExternalPoint& aScreenOffset, const ScreenPoint& aFocusPoint,
ScreenCoord aCurrentSpan, ScreenCoord aPreviousSpan, Modifiers aModifiers)
: InputData(PINCHGESTURE_INPUT, aTimeStamp, aModifiers),
mType(aType),
mSource(aSource),
mFocusPoint(aFocusPoint),
@ -598,7 +589,6 @@ bool PinchGestureInput::TransformToLocal(
WidgetWheelEvent PinchGestureInput::ToWidgetEvent(nsIWidget* aWidget) const {
WidgetWheelEvent wheelEvent(true, eWheel, aWidget);
wheelEvent.mModifiers = this->modifiers | MODIFIER_CONTROL;
wheelEvent.mTime = mTime;
wheelEvent.mTimeStamp = mTimeStamp;
wheelEvent.mLayersId = mLayersId;
wheelEvent.mRefPoint = RoundedToInt(ViewAs<LayoutDevicePixel>(
@ -713,19 +703,17 @@ bool PinchGestureInput::SetLineOrPageDeltaY(nsIWidget* aWidget) {
TapGestureInput::TapGestureInput()
: InputData(TAPGESTURE_INPUT), mType(TAPGESTURE_LONG) {}
TapGestureInput::TapGestureInput(TapGestureType aType, uint32_t aTime,
TimeStamp aTimeStamp,
TapGestureInput::TapGestureInput(TapGestureType aType, TimeStamp aTimeStamp,
const ScreenIntPoint& aPoint,
Modifiers aModifiers)
: InputData(TAPGESTURE_INPUT, aTime, aTimeStamp, aModifiers),
: InputData(TAPGESTURE_INPUT, aTimeStamp, aModifiers),
mType(aType),
mPoint(aPoint) {}
TapGestureInput::TapGestureInput(TapGestureType aType, uint32_t aTime,
TimeStamp aTimeStamp,
TapGestureInput::TapGestureInput(TapGestureType aType, TimeStamp aTimeStamp,
const ParentLayerPoint& aLocalPoint,
Modifiers aModifiers)
: InputData(TAPGESTURE_INPUT, aTime, aTimeStamp, aModifiers),
: InputData(TAPGESTURE_INPUT, aTimeStamp, aModifiers),
mType(aType),
mLocalPoint(aLocalPoint) {}
@ -743,7 +731,6 @@ WidgetSimpleGestureEvent TapGestureInput::ToWidgetEvent(
nsIWidget* aWidget) const {
WidgetSimpleGestureEvent event(true, eTapGesture, aWidget);
event.mTime = mTime;
event.mTimeStamp = mTimeStamp;
event.mLayersId = mLayersId;
event.mRefPoint = ViewAs<LayoutDevicePixel>(
@ -773,12 +760,11 @@ ScrollWheelInput::ScrollWheelInput()
mAPZAction(APZWheelAction::Scroll) {}
ScrollWheelInput::ScrollWheelInput(
uint32_t aTime, TimeStamp aTimeStamp, Modifiers aModifiers,
ScrollMode aScrollMode, ScrollDeltaType aDeltaType,
const ScreenPoint& aOrigin, double aDeltaX, double aDeltaY,
bool aAllowToOverrideSystemScrollSpeed,
TimeStamp aTimeStamp, Modifiers aModifiers, ScrollMode aScrollMode,
ScrollDeltaType aDeltaType, const ScreenPoint& aOrigin, double aDeltaX,
double aDeltaY, bool aAllowToOverrideSystemScrollSpeed,
WheelDeltaAdjustmentStrategy aWheelDeltaAdjustmentStrategy)
: InputData(SCROLLWHEEL_INPUT, aTime, aTimeStamp, aModifiers),
: InputData(SCROLLWHEEL_INPUT, aTimeStamp, aModifiers),
mDeltaType(aDeltaType),
mScrollMode(aScrollMode),
mOrigin(aOrigin),
@ -797,7 +783,7 @@ ScrollWheelInput::ScrollWheelInput(
mAPZAction(APZWheelAction::Scroll) {}
ScrollWheelInput::ScrollWheelInput(const WidgetWheelEvent& aWheelEvent)
: InputData(SCROLLWHEEL_INPUT, aWheelEvent.mTime, aWheelEvent.mTimeStamp,
: InputData(SCROLLWHEEL_INPUT, aWheelEvent.mTimeStamp,
aWheelEvent.mModifiers),
mDeltaType(DeltaTypeForDeltaMode(aWheelEvent.mDeltaMode)),
mScrollMode(SCROLLMODE_INSTANT),
@ -867,7 +853,6 @@ ScrollUnit ScrollWheelInput::ScrollUnitForDeltaType(
WidgetWheelEvent ScrollWheelInput::ToWidgetEvent(nsIWidget* aWidget) const {
WidgetWheelEvent wheelEvent(true, eWheel, aWidget);
wheelEvent.mModifiers = this->modifiers;
wheelEvent.mTime = mTime;
wheelEvent.mTimeStamp = mTimeStamp;
wheelEvent.mLayersId = mLayersId;
wheelEvent.mRefPoint = RoundedToInt(ViewAs<LayoutDevicePixel>(
@ -905,8 +890,7 @@ bool ScrollWheelInput::IsCustomizedByUserPrefs() const {
}
KeyboardInput::KeyboardInput(const WidgetKeyboardEvent& aEvent)
: InputData(KEYBOARD_INPUT, aEvent.mTime, aEvent.mTimeStamp,
aEvent.mModifiers),
: InputData(KEYBOARD_INPUT, aEvent.mTimeStamp, aEvent.mModifiers),
mKeyCode(aEvent.mKeyCode),
mCharCode(aEvent.mCharCode),
mHandledByAPZ(false) {

View File

@ -76,14 +76,8 @@ class InputData {
// Warning, this class is serialized and sent over IPC. Any change to its
// fields must be reflected in its ParamTraits<>, in nsGUIEventIPC.h
InputType mInputType;
// Time in milliseconds that this data is relevant to. This only really
// matters when this data is used as an event. We use uint32_t instead of
// TimeStamp because it is easier to convert from WidgetInputEvent. The time
// is platform-specific but it in the case of B2G and Fennec it is since
// startup.
uint32_t mTime;
// Set in parallel to mTime until we determine it is safe to drop
// platform-specific event times (see bug 77992).
// Time that this data is relevant to. This only really matters when this data
// is used as an event.
TimeStamp mTimeStamp;
// The sequence number of the last potentially focus changing event handled
// by APZ. This is used to track when that event has been processed by
@ -108,8 +102,7 @@ class InputData {
explicit InputData(InputType aInputType);
protected:
InputData(InputType aInputType, uint32_t aTime, TimeStamp aTimeStamp,
Modifiers aModifiers);
InputData(InputType aInputType, TimeStamp aTimeStamp, Modifiers aModifiers);
};
/**
@ -293,8 +286,8 @@ class MouseInput : public InputData {
// clang-format on
MouseInput(MouseType aType, ButtonType aButtonType, uint16_t aInputSource,
int16_t aButtons, const ScreenPoint& aPoint, uint32_t aTime,
TimeStamp aTimeStamp, Modifiers aModifiers);
int16_t aButtons, const ScreenPoint& aPoint, TimeStamp aTimeStamp,
Modifiers aModifiers);
explicit MouseInput(const WidgetMouseEventBase& aMouseEvent);
bool IsLeftButton() const;
@ -396,12 +389,12 @@ class PanGestureInput : public InputData {
));
// clang-format on
PanGestureInput(PanGestureType aType, uint32_t aTime, TimeStamp aTimeStamp,
PanGestureInput(PanGestureType aType, TimeStamp aTimeStamp,
const ScreenPoint& aPanStartPoint,
const ScreenPoint& aPanDisplacement, Modifiers aModifiers);
enum class IsEligibleForSwipe : bool { No, Yes };
PanGestureInput(PanGestureType aType, uint32_t aTime, TimeStamp aTimeStamp,
PanGestureInput(PanGestureType aType, TimeStamp aTimeStamp,
const ScreenPoint& aPanStartPoint,
const ScreenPoint& aPanDisplacement, Modifiers aModifiers,
IsEligibleForSwipe aIsEligibleForSwipe);
@ -540,8 +533,7 @@ class PinchGestureInput : public InputData {
// Construct a pinch gesture from a Screen point.
PinchGestureInput(PinchGestureType aType, PinchGestureSource aSource,
uint32_t aTime, TimeStamp aTimeStamp,
const ExternalPoint& aScreenOffset,
TimeStamp aTimeStamp, const ExternalPoint& aScreenOffset,
const ScreenPoint& aFocusPoint, ScreenCoord aCurrentSpan,
ScreenCoord aPreviousSpan, Modifiers aModifiers);
@ -637,12 +629,12 @@ class TapGestureInput : public InputData {
// Construct a tap gesture from a Screen point.
// mLocalPoint remains (0,0) unless it's set later.
TapGestureInput(TapGestureType aType, uint32_t aTime, TimeStamp aTimeStamp,
TapGestureInput(TapGestureType aType, TimeStamp aTimeStamp,
const ScreenIntPoint& aPoint, Modifiers aModifiers);
// Construct a tap gesture from a ParentLayer point.
// mPoint remains (0,0) unless it's set later.
TapGestureInput(TapGestureType aType, uint32_t aTime, TimeStamp aTimeStamp,
TapGestureInput(TapGestureType aType, TimeStamp aTimeStamp,
const ParentLayerPoint& aLocalPoint, Modifiers aModifiers);
bool TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform);
@ -692,7 +684,7 @@ class ScrollWheelInput : public InputData {
);
// clang-format on
ScrollWheelInput(uint32_t aTime, TimeStamp aTimeStamp, Modifiers aModifiers,
ScrollWheelInput(TimeStamp aTimeStamp, Modifiers aModifiers,
ScrollMode aScrollMode, ScrollDeltaType aDeltaType,
const ScreenPoint& aOrigin, double aDeltaX, double aDeltaY,
bool aAllowToOverrideSystemScrollSpeed,

View File

@ -265,7 +265,6 @@ void PuppetWidget::InitEvent(WidgetGUIEvent& aEvent,
// use the point override if provided
aEvent.mRefPoint = *aPoint;
}
aEvent.mTime = PR_Now() / 1000;
}
nsresult PuppetWidget::DispatchEvent(WidgetGUIEvent* aEvent,

View File

@ -209,7 +209,6 @@ nsresult TextEventDispatcher::GetState() const {
}
void TextEventDispatcher::InitEvent(WidgetGUIEvent& aEvent) const {
aEvent.mTime = PR_IntervalNow();
aEvent.mRefPoint = LayoutDeviceIntPoint(0, 0);
aEvent.mFlags.mIsSynthesizedForTests = IsForTests();
if (aEvent.mClass != eCompositionEventClass) {

View File

@ -153,7 +153,6 @@ class WidgetTouchEvent : public WidgetInputEvent {
eTouchEventClass) {
MOZ_COUNT_CTOR(WidgetTouchEvent);
mModifiers = aOther.mModifiers;
mTime = aOther.mTime;
mTimeStamp = aOther.mTimeStamp;
mTouches.AppendElements(aOther.mTouches);
mInputSource = aOther.mInputSource;

View File

@ -402,7 +402,6 @@ static void InitKeyEvent(WidgetKeyboardEvent& aEvent, int32_t aAction,
aEvent.mLocation =
WidgetKeyboardEvent::ComputeLocationFromCodeValue(aEvent.mCodeNameIndex);
aEvent.mTime = aTime;
aEvent.mTimeStamp = nsWindow::GetEventTimeStamp(aTime);
}
@ -560,7 +559,6 @@ void GeckoEditableSupport::SendIMEDummyKeyEvent(nsIWidget* aWidget,
MOZ_ASSERT(mDispatcher);
WidgetKeyboardEvent event(true, msg, aWidget);
event.mTime = PR_Now() / 1000;
// TODO: If we can know scan code of the key event which caused replacing
// composition string, we should set mCodeNameIndex here. Then,
// we should rename this method because it becomes not a "dummy"
@ -1013,7 +1011,6 @@ bool GeckoEditableSupport::DoReplaceText(int32_t aStart, int32_t aEnd,
}
} else if (performDeletion) {
WidgetContentCommandEvent event(true, eContentCommandDelete, widget);
event.mTime = PR_Now() / 1000;
widget->DispatchEvent(&event, status);
if (!mDispatcher || widget->Destroyed()) {
return false;

View File

@ -413,8 +413,8 @@ class NPZCSupport final
}
ScrollWheelInput input(
aTime, nsWindow::GetEventTimeStamp(aTime),
nsWindow::GetModifiers(aMetaState), ScrollWheelInput::SCROLLMODE_SMOOTH,
nsWindow::GetEventTimeStamp(aTime), nsWindow::GetModifiers(aMetaState),
ScrollWheelInput::SCROLLMODE_SMOOTH,
ScrollWheelInput::SCROLLDELTA_PIXEL, origin, aHScroll, aVScroll, false,
// XXX Do we need to support auto-dir scrolling
// for Android widgets with a wheel device?
@ -597,8 +597,8 @@ class NPZCSupport final
MouseInput input(
mouseType, buttonType, MouseEvent_Binding::MOZ_SOURCE_MOUSE,
ConvertButtons(buttons), origin, aTime,
nsWindow::GetEventTimeStamp(aTime), nsWindow::GetModifiers(aMetaState));
ConvertButtons(buttons), origin, nsWindow::GetEventTimeStamp(aTime),
nsWindow::GetModifiers(aMetaState));
APZEventResult result = controller->InputBridge()->ReceiveInputEvent(input);
if (result.GetStatus() == nsEventStatus_eConsumeNoDefault) {
@ -2513,8 +2513,6 @@ void nsWindow::InitEvent(WidgetGUIEvent& event, LayoutDeviceIntPoint* aPoint) {
} else {
event.mRefPoint = LayoutDeviceIntPoint(0, 0);
}
event.mTime = PR_Now() / 1000;
}
void nsWindow::UpdateOverscrollVelocity(const float aX, const float aY) {

View File

@ -1021,8 +1021,8 @@ nsresult nsChildView::SynthesizeNativeTouchPoint(
LayoutDeviceIntPoint pointInWindow = aPoint - WidgetToScreenOffset();
MultiTouchInput inputToDispatch = UpdateSynthesizedTouchState(
mSynthesizedTouchInput.get(), PR_IntervalNow(), TimeStamp::Now(), aPointerId, aPointerState,
pointInWindow, aPointerPressure, aPointerOrientation);
mSynthesizedTouchInput.get(), TimeStamp::Now(), aPointerId, aPointerState, pointInWindow,
aPointerPressure, aPointerOrientation);
DispatchTouchInput(inputToDispatch);
return NS_OK;
@ -1953,10 +1953,8 @@ void nsChildView::DispatchDoubleTapGesture(TimeStamp aEventTimeStamp,
LayoutDeviceIntPoint aScreenPosition,
mozilla::Modifiers aModifiers) {
if (StaticPrefs::apz_mac_enable_double_tap_zoom_touchpad_gesture()) {
PRIntervalTime eventIntervalTime = PR_IntervalNow();
TapGestureInput event{
TapGestureInput::TAPGESTURE_DOUBLE, eventIntervalTime, aEventTimeStamp,
TapGestureInput::TAPGESTURE_DOUBLE, aEventTimeStamp,
ViewAs<ScreenPixel>(aScreenPosition,
PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent),
aModifiers};
@ -1968,7 +1966,6 @@ void nsChildView::DispatchDoubleTapGesture(TimeStamp aEventTimeStamp,
// do what convertCocoaMouseEvent does basically.
geckoEvent.mRefPoint = aScreenPosition;
geckoEvent.mModifiers = aModifiers;
geckoEvent.mTime = PR_IntervalNow();
geckoEvent.mTimeStamp = aEventTimeStamp;
geckoEvent.mClickCount = 1;
@ -2520,7 +2517,6 @@ NSEvent* gLastDragMouseDownEvent = nil; // [strong]
ViewAs<ExternalPixel>(mGeckoChild->WidgetToScreenOffset(),
PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent);
PRIntervalTime eventIntervalTime = PR_IntervalNow();
TimeStamp eventTimeStamp = nsCocoaUtils::GetEventTimeStamp([anEvent timestamp]);
NSEventPhase eventPhase = [anEvent phase];
PinchGestureInput::PinchGestureType pinchGestureType;
@ -2547,7 +2543,6 @@ NSEvent* gLastDragMouseDownEvent = nil; // [strong]
PinchGestureInput event{pinchGestureType,
PinchGestureInput::TRACKPAD,
eventIntervalTime,
eventTimeStamp,
screenOffset,
position,
@ -3153,7 +3148,6 @@ static gfx::IntPoint GetIntegerDeltaForEvent(NSEvent* aEvent) {
Modifiers modifiers = nsCocoaUtils::ModifiersForEvent(theEvent);
PRIntervalTime eventIntervalTime = PR_IntervalNow();
TimeStamp eventTimeStamp = nsCocoaUtils::GetEventTimeStamp([theEvent timestamp]);
ScreenPoint preciseDelta;
@ -3165,26 +3159,25 @@ static gfx::IntPoint GetIntegerDeltaForEvent(NSEvent* aEvent) {
}
if (usePreciseDeltas && hasPhaseInformation) {
PanGestureInput panEvent =
nsCocoaUtils::CreatePanGestureEvent(theEvent, eventIntervalTime, eventTimeStamp, position,
preciseDelta, lineOrPageDelta, modifiers);
PanGestureInput panEvent = nsCocoaUtils::CreatePanGestureEvent(
theEvent, eventTimeStamp, position, preciseDelta, lineOrPageDelta, modifiers);
geckoChildDeathGrip->DispatchAPZWheelInputEvent(panEvent);
} else if (usePreciseDeltas) {
// This is on 10.6 or old touchpads that don't have any phase information.
ScrollWheelInput wheelEvent(
eventIntervalTime, eventTimeStamp, modifiers, ScrollWheelInput::SCROLLMODE_INSTANT,
ScrollWheelInput::SCROLLDELTA_PIXEL, position, preciseDelta.x, preciseDelta.y, false,
// This parameter is used for wheel delta
// adjustment, such as auto-dir scrolling,
// but we do't need to do anything special here
// since this wheel event is sent to
// DispatchAPZWheelInputEvent, which turns this
// ScrollWheelInput back into a WidgetWheelEvent
// and then it goes through the regular handling
// in APZInputBridge. So passing |eNone| won't
// pass up the necessary wheel delta adjustment.
WheelDeltaAdjustmentStrategy::eNone);
ScrollWheelInput wheelEvent(eventTimeStamp, modifiers, ScrollWheelInput::SCROLLMODE_INSTANT,
ScrollWheelInput::SCROLLDELTA_PIXEL, position, preciseDelta.x,
preciseDelta.y, false,
// This parameter is used for wheel delta
// adjustment, such as auto-dir scrolling,
// but we do't need to do anything special here
// since this wheel event is sent to
// DispatchAPZWheelInputEvent, which turns this
// ScrollWheelInput back into a WidgetWheelEvent
// and then it goes through the regular handling
// in APZInputBridge. So passing |eNone| won't
// pass up the necessary wheel delta adjustment.
WheelDeltaAdjustmentStrategy::eNone);
wheelEvent.mLineOrPageDeltaX = lineOrPageDelta.x;
wheelEvent.mLineOrPageDeltaY = lineOrPageDelta.y;
wheelEvent.mIsMomentum = nsCocoaUtils::IsMomentumScrollEvent(theEvent);
@ -3194,7 +3187,7 @@ static gfx::IntPoint GetIntegerDeltaForEvent(NSEvent* aEvent) {
if (StaticPrefs::general_smoothScroll() && StaticPrefs::general_smoothScroll_mouseWheel()) {
scrollMode = ScrollWheelInput::SCROLLMODE_SMOOTH;
}
ScrollWheelInput wheelEvent(eventIntervalTime, eventTimeStamp, modifiers, scrollMode,
ScrollWheelInput wheelEvent(eventTimeStamp, modifiers, scrollMode,
ScrollWheelInput::SCROLLDELTA_LINE, position, lineOrPageDelta.x,
lineOrPageDelta.y, false,
// This parameter is used for wheel delta

View File

@ -457,7 +457,7 @@ class nsCocoaUtils {
static void InvalidateHiDPIState();
static mozilla::PanGestureInput CreatePanGestureEvent(
NSEvent* aNativeEvent, uint32_t aTime, mozilla::TimeStamp aTimeStamp,
NSEvent* aNativeEvent, mozilla::TimeStamp aTimeStamp,
const mozilla::ScreenPoint& aPanStartPoint, const mozilla::ScreenPoint& aPreciseDelta,
const mozilla::gfx::IntPoint& aLineOrPageDelta, mozilla::Modifiers aModifiers);

View File

@ -625,7 +625,6 @@ void nsCocoaUtils::InitInputEvent(WidgetInputEvent& aInputEvent, NSEvent* aNativ
NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;
aInputEvent.mModifiers = ModifiersForEvent(aNativeEvent);
aInputEvent.mTime = PR_IntervalNow();
aInputEvent.mTimeStamp = GetEventTimeStamp([aNativeEvent timestamp]);
NS_OBJC_END_TRY_IGNORE_BLOCK;
@ -1494,9 +1493,11 @@ bool static ShouldConsiderStartingSwipeFromEvent(NSEvent* anEvent) {
[anEvent hasPreciseScrollingDeltas] && [NSEvent isSwipeTrackingFromScrollEventsEnabled];
}
PanGestureInput nsCocoaUtils::CreatePanGestureEvent(
NSEvent* aNativeEvent, uint32_t aTime, TimeStamp aTimeStamp, const ScreenPoint& aPanStartPoint,
const ScreenPoint& aPreciseDelta, const gfx::IntPoint& aLineOrPageDelta, Modifiers aModifiers) {
PanGestureInput nsCocoaUtils::CreatePanGestureEvent(NSEvent* aNativeEvent, TimeStamp aTimeStamp,
const ScreenPoint& aPanStartPoint,
const ScreenPoint& aPreciseDelta,
const gfx::IntPoint& aLineOrPageDelta,
Modifiers aModifiers) {
PanGestureInput::PanGestureType type = PanGestureTypeForEvent(aNativeEvent);
// Always force zero deltas on event types that shouldn't cause any scrolling,
// so that we don't dispatch DOM wheel events for them.
@ -1504,7 +1505,7 @@ PanGestureInput nsCocoaUtils::CreatePanGestureEvent(
type == PanGestureInput::PANGESTURE_MAYSTART || type == PanGestureInput::PANGESTURE_CANCELLED;
PanGestureInput panEvent(
type, aTime, aTimeStamp, aPanStartPoint, !shouldIgnoreDeltas ? aPreciseDelta : ScreenPoint(),
type, aTimeStamp, aPanStartPoint, !shouldIgnoreDeltas ? aPreciseDelta : ScreenPoint(),
aModifiers,
PanGestureInput::IsEligibleForSwipe(ShouldConsiderStartingSwipeFromEvent(aNativeEvent)));

View File

@ -2925,7 +2925,6 @@ void IMContextWrapper::SetCursorPosition(GtkIMContext* aContext) {
mCompositionTargetRange.mOffset, 1);
}
}
InitEvent(queryCaretOrTextRectEvent);
nsEventStatus status;
mLastFocusedWindow->DispatchEvent(&queryCaretOrTextRectEvent, status);
if (queryCaretOrTextRectEvent.Failed()) {
@ -3235,10 +3234,6 @@ nsresult IMContextWrapper::DeleteText(GtkIMContext* aContext, int32_t aOffset,
return NS_OK;
}
void IMContextWrapper::InitEvent(WidgetGUIEvent& aEvent) {
aEvent.mTime = PR_Now() / 1000;
}
bool IMContextWrapper::EnsureToCacheContentSelection(
nsAString* aSelectedString) {
if (aSelectedString) {
@ -3265,7 +3260,6 @@ bool IMContextWrapper::EnsureToCacheContentSelection(
nsEventStatus status;
WidgetQueryContentEvent querySelectedTextEvent(true, eQuerySelectedText,
dispatcherWindow);
InitEvent(querySelectedTextEvent);
dispatcherWindow->DispatchEvent(&querySelectedTextEvent, status);
if (NS_WARN_IF(querySelectedTextEvent.Failed())) {
MOZ_LOG(gIMELog, LogLevel::Error,

View File

@ -599,9 +599,6 @@ class IMContextWrapper final : public TextEventDispatcherListener {
nsresult DeleteText(GtkIMContext* aContext, int32_t aOffset,
uint32_t aNChars);
// Initializes the GUI event.
void InitEvent(WidgetGUIEvent& aEvent);
// Called before destroying the context to work around some platform bugs.
void PrepareToDestroyContext(GtkIMContext* aContext);

View File

@ -1879,7 +1879,6 @@ void KeymapWrapper::InitKeyEvent(WidgetKeyboardEvent& aKeyEvent,
// so link to the GdkEvent (which will vanish soon after return from the
// event callback) to give plugins access to hardware_keycode and state.
// (An XEvent would be nice but the GdkEvent is good enough.)
aKeyEvent.mTime = aGdkKeyEvent->time;
aKeyEvent.mNativeKeyEvent = static_cast<void*>(aGdkKeyEvent);
aKeyEvent.mIsRepeat =
sRepeatState == REPEATING &&

View File

@ -4858,7 +4858,7 @@ bool nsWindow::DispatchContentCommandEvent(EventMessage aMsg) {
}
WidgetEventTime nsWindow::GetWidgetEventTime(guint32 aEventTime) {
return WidgetEventTime(aEventTime, GetEventTimeStamp(aEventTime));
return WidgetEventTime(GetEventTimeStamp(aEventTime));
}
TimeStamp nsWindow::GetEventTimeStamp(guint32 aEventTime) {
@ -5007,7 +5007,7 @@ void nsWindow::OnScrollEvent(GdkEventScroll* aEvent) {
LayoutDeviceIntPoint touchPoint = GetRefPoint(this, aEvent);
PanGestureInput panEvent(
eventType, aEvent->time, GetEventTimeStamp(aEvent->time),
eventType, GetEventTimeStamp(aEvent->time),
ScreenPoint(touchPoint.x, touchPoint.y), deltas,
KeymapWrapper::ComputeKeyModifiers(aEvent->state));
panEvent.mDeltaType = isPageMode ? PanGestureInput::PANDELTA_PAGE
@ -5418,7 +5418,7 @@ gboolean nsWindow::OnTouchpadPinchEvent(GdkEventTouchpadPinch* aEvent) {
}
PinchGestureInput event(
pinchGestureType, PinchGestureInput::TRACKPAD, aEvent->time,
pinchGestureType, PinchGestureInput::TRACKPAD,
GetEventTimeStamp(aEvent->time), ExternalPoint(0, 0),
mCurrentTouchpadFocus,
100.0 * ((aEvent->phase == GDK_TOUCHPAD_GESTURE_PHASE_END)
@ -5511,7 +5511,6 @@ gboolean nsWindow::OnTouchEvent(GdkEventTouch* aEvent) {
WidgetTouchEvent event(true, msg, this);
KeymapWrapper::InitInputEvent(event, aEvent->state);
event.mTime = aEvent->time;
if (msg == eTouchStart || msg == eTouchMove) {
mTouches.InsertOrUpdate(aEvent->sequence, std::move(touch));
@ -8593,7 +8592,6 @@ void nsWindow::EndRemoteDrawingInRegion(
mSurfaceProvider.EndRemoteDrawingInRegion(aDrawTarget, aInvalidRegion);
}
// Code shared begin BeginMoveDrag and BeginResizeDrag
bool nsWindow::GetDragInfo(WidgetMouseEvent* aMouseEvent, GdkWindow** aWindow,
gint* aButton, gint* aRootX, gint* aRootY) {
if (aMouseEvent->mButton != MouseButton::ePrimary) {
@ -8630,12 +8628,13 @@ bool nsWindow::GetDragInfo(WidgetMouseEvent* aMouseEvent, GdkWindow** aWindow,
// Workaround for https://bugzilla.gnome.org/show_bug.cgi?id=789054
// To avoid crashes disable double-click on WM without _NET_WM_MOVERESIZE.
// See _should_perform_ewmh_drag() at gdkwindow-x11.c
// XXXsmaug remove this old hack. gtk should be fixed now.
GdkScreen* screen = gdk_window_get_screen(gdk_window);
GdkAtom atom = gdk_atom_intern("_NET_WM_MOVERESIZE", FALSE);
if (!gdk_x11_screen_supports_net_wm_hint(screen, atom)) {
static unsigned int lastTimeStamp = 0;
if (lastTimeStamp != aMouseEvent->mTime) {
lastTimeStamp = aMouseEvent->mTime;
static TimeStamp lastTimeStamp;
if (lastTimeStamp != aMouseEvent->mTimeStamp) {
lastTimeStamp = aMouseEvent->mTimeStamp;
} else {
return false;
}
@ -8655,57 +8654,6 @@ bool nsWindow::GetDragInfo(WidgetMouseEvent* aMouseEvent, GdkWindow** aWindow,
return true;
}
nsresult nsWindow::BeginResizeDrag(WidgetGUIEvent* aEvent, int32_t aHorizontal,
int32_t aVertical) {
NS_ENSURE_ARG_POINTER(aEvent);
if (aEvent->mClass != eMouseEventClass) {
// you can only begin a resize drag with a mouse event
return NS_ERROR_INVALID_ARG;
}
GdkWindow* gdk_window;
gint button, screenX, screenY;
if (!GetDragInfo(aEvent->AsMouseEvent(), &gdk_window, &button, &screenX,
&screenY)) {
return NS_ERROR_FAILURE;
}
// work out what GdkWindowEdge we're talking about
GdkWindowEdge window_edge;
if (aVertical < 0) {
if (aHorizontal < 0) {
window_edge = GDK_WINDOW_EDGE_NORTH_WEST;
} else if (aHorizontal == 0) {
window_edge = GDK_WINDOW_EDGE_NORTH;
} else {
window_edge = GDK_WINDOW_EDGE_NORTH_EAST;
}
} else if (aVertical == 0) {
if (aHorizontal < 0) {
window_edge = GDK_WINDOW_EDGE_WEST;
} else if (aHorizontal == 0) {
return NS_ERROR_INVALID_ARG;
} else {
window_edge = GDK_WINDOW_EDGE_EAST;
}
} else {
if (aHorizontal < 0) {
window_edge = GDK_WINDOW_EDGE_SOUTH_WEST;
} else if (aHorizontal == 0) {
window_edge = GDK_WINDOW_EDGE_SOUTH;
} else {
window_edge = GDK_WINDOW_EDGE_SOUTH_EAST;
}
}
// tell the window manager to start the resize
gdk_window_begin_resize_drag(gdk_window, window_edge, button, screenX,
screenY, aEvent->mTime);
return NS_OK;
}
nsIWidget::WindowRenderer* nsWindow::GetWindowRenderer() {
if (mIsDestroyed) {
// Prevent external code from triggering the re-creation of the

View File

@ -271,10 +271,6 @@ class nsWindow final : public nsBaseWidget {
static guint32 sLastButtonPressTime;
[[nodiscard]] nsresult BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
int32_t aHorizontal,
int32_t aVertical) override;
MozContainer* GetMozContainer() { return mContainer; }
LayoutDeviceIntSize GetMozContainerSize();
GdkWindow* GetGdkWindow() const { return mGdkWindow; };

View File

@ -512,9 +512,8 @@ nsresult HeadlessWidget::SynthesizeNativeTouchPoint(
LayoutDeviceIntPoint pointInWindow = aPoint - WidgetToScreenOffset();
MultiTouchInput inputToDispatch = UpdateSynthesizedTouchState(
mSynthesizedTouchInput.get(), PR_IntervalNow(), TimeStamp::Now(),
aPointerId, aPointerState, pointInWindow, aPointerPressure,
aPointerOrientation);
mSynthesizedTouchInput.get(), TimeStamp::Now(), aPointerId, aPointerState,
pointInWindow, aPointerPressure, aPointerOrientation);
DispatchTouchInput(inputToDispatch);
return NS_OK;
}
@ -560,8 +559,8 @@ nsresult HeadlessWidget::SynthesizeNativeTouchPadPinch(
// The headless widget does not support modifiers.
// Do not pass `aModifierFlags` because it contains native modifier values.
PinchGestureInput inputToDispatch(
pinchGestureType, PinchGestureInput::TRACKPAD, PR_IntervalNow(),
TimeStamp::Now(), ExternalPoint(0, 0), touchpadPoint,
pinchGestureType, PinchGestureInput::TRACKPAD, TimeStamp::Now(),
ExternalPoint(0, 0), touchpadPoint,
100.0 * ((aEventPhase == PHASE_END) ? ScreenCoord(1.f) : CurrentSpan),
100.0 * ((aEventPhase == PHASE_END) ? ScreenCoord(1.f) : PreviousSpan),
0);
@ -601,8 +600,7 @@ nsresult HeadlessWidget::SynthesizeNativeTouchpadPan(
ScreenPoint touchpadPoint = ViewAs<ScreenPixel>(
aPoint - WidgetToScreenOffset(),
PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent);
PanGestureInput input(eventType, PR_IntervalNow(), TimeStamp::Now(),
touchpadPoint,
PanGestureInput input(eventType, TimeStamp::Now(), touchpadPoint,
ScreenPoint(float(aDeltaX), float(aDeltaY)),
// Same as SynthesizeNativeTouchPadPinch case we ignore
// aModifierFlags.

View File

@ -2135,10 +2135,9 @@ nsresult nsIWidget::ClearNativeTouchSequence(nsIObserver* aObserver) {
}
MultiTouchInput nsBaseWidget::UpdateSynthesizedTouchState(
MultiTouchInput* aState, uint32_t aTime, mozilla::TimeStamp aTimeStamp,
uint32_t aPointerId, TouchPointerState aPointerState,
LayoutDeviceIntPoint aPoint, double aPointerPressure,
uint32_t aPointerOrientation) {
MultiTouchInput* aState, mozilla::TimeStamp aTimeStamp, uint32_t aPointerId,
TouchPointerState aPointerState, LayoutDeviceIntPoint aPoint,
double aPointerPressure, uint32_t aPointerOrientation) {
ScreenIntPoint pointerScreenPoint = ViewAs<ScreenPixel>(
aPoint, PixelCastJustification::LayoutDeviceIsScreenForBounds);
@ -2149,7 +2148,6 @@ MultiTouchInput nsBaseWidget::UpdateSynthesizedTouchState(
// touch(es). We use |inputToDispatch| for this purpose.
MultiTouchInput inputToDispatch;
inputToDispatch.mInputType = MULTITOUCH_INPUT;
inputToDispatch.mTime = aTime;
inputToDispatch.mTimeStamp = aTimeStamp;
int32_t index = aState->IndexOfTouch((int32_t)aPointerId);

View File

@ -274,11 +274,6 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
void SetDrawsInTitlebar(bool aState) override {}
bool ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect) override;
void FreeNativeData(void* data, uint32_t aDataType) override {}
[[nodiscard]] nsresult BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
int32_t aHorizontal,
int32_t aVertical) override {
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult ActivateNativeMenuItemAt(const nsAString& indexString) override {
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -638,10 +633,10 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
* a new MultiTouchInput object that is ready to be dispatched.
*/
mozilla::MultiTouchInput UpdateSynthesizedTouchState(
mozilla::MultiTouchInput* aState, uint32_t aTime,
mozilla::TimeStamp aTimeStamp, uint32_t aPointerId,
TouchPointerState aPointerState, LayoutDeviceIntPoint aPoint,
double aPointerPressure, uint32_t aPointerOrientation);
mozilla::MultiTouchInput* aState, mozilla::TimeStamp aTimeStamp,
uint32_t aPointerId, TouchPointerState aPointerState,
LayoutDeviceIntPoint aPoint, double aPointerPressure,
uint32_t aPointerOrientation);
/**
* Dispatch the given MultiTouchInput through APZ to Gecko (if APZ is enabled)

View File

@ -55,7 +55,6 @@ struct ParamTraits<mozilla::WidgetEvent> {
WriteParam(aWriter, aParam.mMessage);
WriteParam(aWriter, aParam.mRefPoint);
WriteParam(aWriter, aParam.mFocusSequenceNumber);
WriteParam(aWriter, aParam.mTime);
WriteParam(aWriter, aParam.mTimeStamp);
WriteParam(aWriter, aParam.mFlags);
WriteParam(aWriter, aParam.mLayersId);
@ -67,7 +66,6 @@ struct ParamTraits<mozilla::WidgetEvent> {
ReadParam(aReader, &aResult->mMessage) &&
ReadParam(aReader, &aResult->mRefPoint) &&
ReadParam(aReader, &aResult->mFocusSequenceNumber) &&
ReadParam(aReader, &aResult->mTime) &&
ReadParam(aReader, &aResult->mTimeStamp) &&
ReadParam(aReader, &aResult->mFlags) &&
ReadParam(aReader, &aResult->mLayersId);
@ -998,7 +996,6 @@ struct ParamTraits<mozilla::InputData> {
static void Write(MessageWriter* aWriter, const paramType& aParam) {
WriteParam(aWriter, aParam.mInputType);
WriteParam(aWriter, aParam.mTime);
WriteParam(aWriter, aParam.mTimeStamp);
WriteParam(aWriter, aParam.modifiers);
WriteParam(aWriter, aParam.mFocusSequenceNumber);
@ -1007,7 +1004,6 @@ struct ParamTraits<mozilla::InputData> {
static bool Read(MessageReader* aReader, paramType* aResult) {
return ReadParam(aReader, &aResult->mInputType) &&
ReadParam(aReader, &aResult->mTime) &&
ReadParam(aReader, &aResult->mTimeStamp) &&
ReadParam(aReader, &aResult->modifiers) &&
ReadParam(aReader, &aResult->mFocusSequenceNumber) &&

View File

@ -1459,13 +1459,6 @@ class nsIWidget : public nsISupports {
*/
virtual bool ShowsResizeIndicator(LayoutDeviceIntRect* aResizerRect) = 0;
/**
* Begin a window resizing drag, based on the event passed in.
*/
[[nodiscard]] virtual nsresult BeginResizeDrag(
mozilla::WidgetGUIEvent* aEvent, int32_t aHorizontal,
int32_t aVertical) = 0;
// TODO: Make this an enum class with MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS or
// EnumSet class.
enum Modifiers : uint32_t {

View File

@ -424,7 +424,6 @@ bool DManipEventHandler::SendPinch(Phase aPhase, float aScale) {
MOZ_ASSERT_UNREACHABLE("handle all enum values");
}
PRIntervalTime eventIntervalTime = PR_IntervalNow();
TimeStamp eventTimeStamp = TimeStamp::Now();
ModifierKeyState modifierKeyState;
@ -442,7 +441,6 @@ bool DManipEventHandler::SendPinch(Phase aPhase, float aScale) {
PinchGestureInput event{pinchGestureType,
PinchGestureInput::TRACKPAD,
eventIntervalTime,
eventTimeStamp,
screenOffset,
position,
@ -518,15 +516,10 @@ void DManipEventHandler::SendPanCommon(nsWindow* aWindow, Phase aPhase,
}
}
PRIntervalTime eventIntervalTime = PR_IntervalNow();
TimeStamp eventTimeStamp = TimeStamp::Now();
PanGestureInput event{panGestureType,
eventIntervalTime,
eventTimeStamp,
aPosition,
ScreenPoint(aDeltaX, aDeltaY),
aMods};
PanGestureInput event{panGestureType, eventTimeStamp, aPosition,
ScreenPoint(aDeltaX, aDeltaY), aMods};
aWindow->SendAnAPZEvent(event);
}

View File

@ -1937,8 +1937,7 @@ void nsWindow::SetInputRegion(const InputRegion& aInputRegion) {
/**************************************************************
*
* SECTION: nsIWidget::Move, nsIWidget::Resize,
* nsIWidget::Size, nsIWidget::BeginResizeDrag
* SECTION: nsIWidget::Move, nsIWidget::Resize, nsIWidget::Size
*
* Repositioning and sizing a window.
*
@ -2249,61 +2248,6 @@ mozilla::Maybe<bool> nsWindow::IsResizingNativeWidget() {
return Some(false);
}
nsresult nsWindow::BeginResizeDrag(WidgetGUIEvent* aEvent, int32_t aHorizontal,
int32_t aVertical) {
NS_ENSURE_ARG_POINTER(aEvent);
if (aEvent->mClass != eMouseEventClass) {
// you can only begin a resize drag with a mouse event
return NS_ERROR_INVALID_ARG;
}
if (aEvent->AsMouseEvent()->mButton != MouseButton::ePrimary) {
// you can only begin a resize drag with the left mouse button
return NS_ERROR_INVALID_ARG;
}
// work out what sizemode we're talking about
WPARAM syscommand;
if (aVertical < 0) {
if (aHorizontal < 0) {
syscommand = SC_SIZE | WMSZ_TOPLEFT;
} else if (aHorizontal == 0) {
syscommand = SC_SIZE | WMSZ_TOP;
} else {
syscommand = SC_SIZE | WMSZ_TOPRIGHT;
}
} else if (aVertical == 0) {
if (aHorizontal < 0) {
syscommand = SC_SIZE | WMSZ_LEFT;
} else if (aHorizontal == 0) {
return NS_ERROR_INVALID_ARG;
} else {
syscommand = SC_SIZE | WMSZ_RIGHT;
}
} else {
if (aHorizontal < 0) {
syscommand = SC_SIZE | WMSZ_BOTTOMLEFT;
} else if (aHorizontal == 0) {
syscommand = SC_SIZE | WMSZ_BOTTOM;
} else {
syscommand = SC_SIZE | WMSZ_BOTTOMRIGHT;
}
}
// resizing doesn't work if the mouse is already captured
CaptureMouse(false);
// find the top-level window
HWND toplevelWnd = WinUtils::GetTopLevelHWND(mWnd, true);
// tell Windows to start the resize
::PostMessage(toplevelWnd, WM_SYSCOMMAND, syscommand,
POINTTOPOINTS(aEvent->mRefPoint));
return NS_OK;
}
/**************************************************************
*
* SECTION: Window Z-order and state.
@ -4325,7 +4269,7 @@ void nsWindow::InitEvent(WidgetGUIEvent& event, LayoutDeviceIntPoint* aPoint) {
WidgetEventTime nsWindow::CurrentMessageWidgetEventTime() const {
LONG messageTime = ::GetMessageTime();
return WidgetEventTime(messageTime, GetMessageTimeStamp(messageTime));
return WidgetEventTime(GetMessageTimeStamp(messageTime));
}
/**************************************************************
@ -7291,8 +7235,8 @@ Maybe<PanGestureInput> nsWindow::ConvertTouchToPanGesture(
// We need to negate the displacement because for a touch event, moving the
// fingers down results in scrolling up, but for a touchpad gesture, we want
// moving the fingers down to result in scrolling down.
PanGestureInput result(eventType, aTouchInput.mTime, aTouchInput.mTimeStamp,
focusPoint, -displacement, aTouchInput.modifiers);
PanGestureInput result(eventType, aTouchInput.mTimeStamp, focusPoint,
-displacement, aTouchInput.modifiers);
result.mSimulateMomentum = true;
return Some(result);
@ -7335,8 +7279,7 @@ bool nsWindow::OnTouch(WPARAM wParam, LPARAM lParam) {
if (touchInput.mTimeStamp.IsNull()) {
// Initialize a touch event to send.
touchInput.mType = MultiTouchInput::MULTITOUCH_MOVE;
touchInput.mTime = ::GetMessageTime();
touchInput.mTimeStamp = GetMessageTimeStamp(touchInput.mTime);
touchInput.mTimeStamp = GetMessageTimeStamp(::GetMessageTime());
ModifierKeyState modifierKeyState;
touchInput.modifiers = modifierKeyState.GetModifiers();
}
@ -7354,8 +7297,7 @@ bool nsWindow::OnTouch(WPARAM wParam, LPARAM lParam) {
if (touchEndInput.mTimeStamp.IsNull()) {
// Initialize a touch event to send.
touchEndInput.mType = MultiTouchInput::MULTITOUCH_END;
touchEndInput.mTime = ::GetMessageTime();
touchEndInput.mTimeStamp = GetMessageTimeStamp(touchEndInput.mTime);
touchEndInput.mTimeStamp = GetMessageTimeStamp(::GetMessageTime());
ModifierKeyState modifierKeyState;
touchEndInput.modifiers = modifierKeyState.GetModifiers();
}
@ -7429,8 +7371,7 @@ bool nsWindow::OnGesture(WPARAM wParam, LPARAM lParam) {
modifierKeyState.InitInputEvent(wheelEvent);
wheelEvent.mButton = 0;
wheelEvent.mTime = ::GetMessageTime();
wheelEvent.mTimeStamp = GetMessageTimeStamp(wheelEvent.mTime);
wheelEvent.mTimeStamp = GetMessageTimeStamp(::GetMessageTime());
wheelEvent.mInputSource = MouseEvent_Binding::MOZ_SOURCE_TOUCH;
bool endFeedback = true;
@ -7464,8 +7405,7 @@ bool nsWindow::OnGesture(WPARAM wParam, LPARAM lParam) {
ModifierKeyState modifierKeyState;
modifierKeyState.InitInputEvent(event);
event.mButton = 0;
event.mTime = ::GetMessageTime();
event.mTimeStamp = GetMessageTimeStamp(event.mTime);
event.mTimeStamp = GetMessageTimeStamp(::GetMessageTime());
event.mInputSource = MouseEvent_Binding::MOZ_SOURCE_TOUCH;
nsEventStatus status;
@ -8804,9 +8744,7 @@ bool nsWindow::DispatchTouchEventFromWMPointer(
MultiTouchInput touchInput;
touchInput.mType = touchType;
touchInput.mTime = ::GetMessageTime();
touchInput.mTimeStamp =
GetMessageTimeStamp(static_cast<long>(touchInput.mTime));
touchInput.mTimeStamp = GetMessageTimeStamp(::GetMessageTime());
touchInput.mTouches.AppendElement(touchData);
touchInput.mButton = aButton;
touchInput.mButtons = aPointerInfo.mButtons;
@ -9129,7 +9067,7 @@ nsresult nsWindow::SynthesizeNativeTouchPoint(
WidgetEventTime time = CurrentMessageWidgetEventTime();
LayoutDeviceIntPoint pointInWindow = aPoint - WidgetToScreenOffset();
MultiTouchInput inputToDispatch = UpdateSynthesizedTouchState(
mSynthesizedTouchInput.get(), time.mTime, time.mTimeStamp, aPointerId,
mSynthesizedTouchInput.get(), time.mTimeStamp, aPointerId,
aPointerState, pointInWindow, aPointerPressure, aPointerOrientation);
DispatchTouchInput(inputToDispatch);
return NS_OK;

View File

@ -190,9 +190,6 @@ class nsWindow final : public nsBaseWidget {
void Resize(double aX, double aY, double aWidth, double aHeight,
bool aRepaint) override;
mozilla::Maybe<bool> IsResizingNativeWidget() override;
[[nodiscard]] nsresult BeginResizeDrag(mozilla::WidgetGUIEvent* aEvent,
int32_t aHorizontal,
int32_t aVertical) override;
void PlaceBehind(nsTopLevelWidgetZPlacement aPlacement, nsIWidget* aWidget,
bool aActivate) override;
void SetSizeMode(nsSizeMode aMode) override;