import changes from `dev' branch of rmottola/Arctic-Fox:

- Bug 895274 part.230 Rename NS_SELECT_START to eSelectStart r=smaug (776d2bc554)
- Bug 895274 part.231 Rename NS_SELECT_EVENT_START to eSelectEventFirst r=smaug (184da9374f)
- Bug 895274 part.232 Rename NS_EDITOR_INPUT to eEditorInput r=smaug (d88f5cda72)
- Bug 895274 part.233 Rename NS_EDITOR_EVENT_START to eEditorEventFirst r=smaug (82736919d5)
- Bug 895274 part.234 Rename NS_SPEAKERMANAGER_SPEAKERFORCEDCHANGE to eSpeakerForcedChange r=smaug (91da06db86)
- Bug 895274 part.235 Rename NS_SPEAKERMANAGER_EVENT_START to eSpeakerManagerEventFirst r=smaug (26e36e83dd)
- Bug 895274 part.236 Rename NS_MEDIARECORDER_EVENT_START to eMediaRecorderEventFirst r=smaug (4119ab24ab)
- Bug 895274 part.237 Rename NS_MEDIARECORDER_DATAAVAILABLE to eMediaRecorderDataAvailable r=smaug (1cb86629f3)
- Bug 895274 part.238 Rename NS_MEDIARECORDER_WARNING to eMediaRecorderWarning r=smaug (5fc925dbfe)
- Bug 895274 part.239 Rename NS_MEDIARECORDER_STOP to eMediaRecorderStop r=smaug (222663f16a)
- Bug 895274 part.240 Rename NS_TOUCH_EVENT_START to eTouchEventFirst r=smaug (88e32a70f8)
- Bug 1143618 - Change Window::OnTouch implementation to use MultiTouchInput class. r=kats (6afe05d5ad)
- Bug 895274 part.241 Rename NS_TOUCH_START to eTouchStart r=smaug (859229088b)
- Bug 1142437 - Better deal with delayed state change notifications from APZ. r=botond (b9a2fd85e0)
- Bug 1134917 - Hoist assertion into the one callsite where it is actually valid. r=botond (6946d8647a)
- Bug 895274 part.242 Rename NS_TOUCH_MOVE to eTouchMove r=smaug (ef20dc27c8)
- Bug 1171158: Convert some code to use range-based for loops in nsPresShell.cpp. r=mats (91375e2954)
- Bug 895274 part.243 Rename NS_TOUCH_END to eTouchEnd r=smaug (a1a9812c14)
- Bug 895274 part.244 Rename NS_TOUCH_CANCEL to eTouchCancel r=smaug (6d2ec155ee)
- Bug 895274 part.245 Rename NS_SHOW_EVENT to eShow r=smaug (835e74bd43)
- Bug 895274 part.246 Rename NS_MESSAGE to eMessage r=smaug (c5efac2b22)
- fix after Bug 895274 part.243 (ac85766640)
This commit is contained in:
2022-05-03 12:08:49 +08:00
parent 2327f70281
commit 7b202d32b4
32 changed files with 251 additions and 240 deletions
+4 -2
View File
@@ -1831,10 +1831,12 @@ Accessible::DispatchClickEvent(nsIContent *aContent, uint32_t aActionIndex)
int32_t y = presContext->AppUnitsToDevPixels(point.y + size.height / 2);
// Simulate a touch interaction by dispatching touch events with mouse events.
nsCoreUtils::DispatchTouchEvent(NS_TOUCH_START, x, y, aContent, frame, presShell, widget);
nsCoreUtils::DispatchTouchEvent(eTouchStart, x, y, aContent, frame,
presShell, widget);
nsCoreUtils::DispatchMouseEvent(eMouseDown, x, y, aContent, frame,
presShell, widget);
nsCoreUtils::DispatchTouchEvent(NS_TOUCH_END, x, y, aContent, frame, presShell, widget);
nsCoreUtils::DispatchTouchEvent(eTouchEnd, x, y, aContent, frame,
presShell, widget);
nsCoreUtils::DispatchMouseEvent(eMouseUp, x, y, aContent, frame,
presShell, widget);
}
+1 -1
View File
@@ -814,7 +814,7 @@ nsIContent::PreHandleEvent(EventChainPreVisitor& aVisitor)
case eFormReset:
case eResize:
case eScroll:
case NS_SELECT_START:
case eSelectStart:
stopEvent = true;
break;
case eUnidentifiedEvent:
+4 -4
View File
@@ -979,13 +979,13 @@ nsDOMWindowUtils::SendTouchEventCommon(const nsAString& aType,
}
EventMessage msg;
if (aType.EqualsLiteral("touchstart")) {
msg = NS_TOUCH_START;
msg = eTouchStart;
} else if (aType.EqualsLiteral("touchmove")) {
msg = NS_TOUCH_MOVE;
msg = eTouchMove;
} else if (aType.EqualsLiteral("touchend")) {
msg = NS_TOUCH_END;
msg = eTouchEnd;
} else if (aType.EqualsLiteral("touchcancel")) {
msg = NS_TOUCH_CANCEL;
msg = eTouchCancel;
} else {
return NS_ERROR_UNEXPECTED;
}
+3 -3
View File
@@ -737,7 +737,7 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
// nsPresShell::HandleEventInternal() for details.
if (EventStateManager::IsHandlingUserInput()) {
switch(aEvent->mMessage) {
case NS_EDITOR_INPUT:
case eEditorInput:
if (PopupAllowedForEvent("input")) {
abuse = openControlled;
}
@@ -799,12 +799,12 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
case eTouchEventClass:
if (aEvent->mFlags.mIsTrusted) {
switch (aEvent->mMessage) {
case NS_TOUCH_START :
case eTouchStart:
if (PopupAllowedForEvent("touchstart")) {
abuse = openControlled;
}
break;
case NS_TOUCH_END :
case eTouchEnd:
if (PopupAllowedForEvent("touchend")) {
abuse = openControlled;
}
+12 -12
View File
@@ -219,7 +219,7 @@ EVENT(ended,
EventNameType_HTML,
eBasicEventClass)
EVENT(input,
NS_EDITOR_INPUT,
eEditorInput,
EventNameType_HTMLXUL,
eEditorInputEventClass)
EVENT(invalid,
@@ -351,7 +351,7 @@ EVENT(lostpointercapture,
EventNameType_All,
ePointerEventClass)
EVENT(selectstart,
NS_SELECT_START,
eSelectStart,
EventNameType_HTMLXUL,
eBasicEventClass)
@@ -394,7 +394,7 @@ EVENT(select,
EventNameType_HTMLXUL,
eBasicEventClass)
EVENT(show,
NS_SHOW_EVENT,
eShow,
EventNameType_HTML,
eBasicEventClass)
EVENT(stalled,
@@ -500,7 +500,7 @@ WINDOW_EVENT(languagechange,
// need a different macro to flag things like that (IDL, but not content
// attributes on body/frameset), or is just using EventNameType_None enough?
WINDOW_EVENT(message,
NS_MESSAGE,
eMessage,
EventNameType_None,
eBasicEventClass)
WINDOW_EVENT(offline,
@@ -572,19 +572,19 @@ WINDOW_ONLY_EVENT(moznetworkdownload,
#endif // MOZ_B2G
TOUCH_EVENT(touchstart,
NS_TOUCH_START,
eTouchStart,
EventNameType_All,
eTouchEventClass)
TOUCH_EVENT(touchend,
NS_TOUCH_END,
eTouchEnd,
EventNameType_All,
eTouchEventClass)
TOUCH_EVENT(touchmove,
NS_TOUCH_MOVE,
eTouchMove,
EventNameType_All,
eTouchEventClass )
TOUCH_EVENT(touchcancel,
NS_TOUCH_CANCEL,
eTouchCancel,
EventNameType_All,
eTouchEventClass)
@@ -663,22 +663,22 @@ NON_IDL_EVENT(open,
eBasicEventClass)
NON_IDL_EVENT(dataavailable,
NS_MEDIARECORDER_DATAAVAILABLE,
eMediaRecorderDataAvailable,
EventNameType_None,
eBasicEventClass)
NON_IDL_EVENT(stop,
NS_MEDIARECORDER_STOP,
eMediaRecorderStop,
EventNameType_None,
eBasicEventClass)
NON_IDL_EVENT(warning,
NS_MEDIARECORDER_WARNING,
eMediaRecorderWarning,
EventNameType_None,
eBasicEventClass)
NON_IDL_EVENT(speakerforcedchange,
NS_SPEAKERMANAGER_SPEAKERFORCEDCHANGE,
eSpeakerForcedChange,
EventNameType_None,
eBasicEventClass)
+6 -7
View File
@@ -519,7 +519,7 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
nsCOMPtr<nsINode> node = do_QueryInterface(aTargetContent);
if (node &&
(aEvent->mMessage == eKeyUp || aEvent->mMessage == eMouseUp ||
aEvent->mMessage == eWheel || aEvent->mMessage == NS_TOUCH_END ||
aEvent->mMessage == eWheel || aEvent->mMessage == eTouchEnd ||
aEvent->mMessage == ePointerUp)) {
nsIDocument* doc = node->OwnerDoc();
while (doc && !doc->UserHasInteracted()) {
@@ -1169,10 +1169,10 @@ CrossProcessSafeEvent(const WidgetEvent& aEvent)
}
case eTouchEventClass:
switch (aEvent.mMessage) {
case NS_TOUCH_START:
case NS_TOUCH_MOVE:
case NS_TOUCH_END:
case NS_TOUCH_CANCEL:
case eTouchStart:
case eTouchMove:
case eTouchEnd:
case eTouchCancel:
return true;
default:
return false;
@@ -1205,8 +1205,7 @@ EventStateManager::HandleCrossProcessEvent(WidgetEvent* aEvent,
//
// NB: the elements of |targets| must be unique, for correctness.
nsAutoTArray<nsCOMPtr<nsIContent>, 1> targets;
if (aEvent->mClass != eTouchEventClass ||
aEvent->mMessage == NS_TOUCH_START) {
if (aEvent->mClass != eTouchEventClass || aEvent->mMessage == eTouchStart) {
// If this event only has one target, and it's remote, add it to
// the array.
nsIFrame* frame = GetEventTarget();
+3 -4
View File
@@ -122,8 +122,7 @@ TouchEvent::Touches()
{
if (!mTouches) {
WidgetTouchEvent* touchEvent = mEvent->AsTouchEvent();
if (mEvent->mMessage == NS_TOUCH_END ||
mEvent->mMessage == NS_TOUCH_CANCEL) {
if (mEvent->mMessage == eTouchEnd || mEvent->mMessage == eTouchCancel) {
// for touchend events, remove any changed touches from the touches array
WidgetTouchEvent::AutoTouchArray unchangedTouches;
const WidgetTouchEvent::TouchArray& touches = touchEvent->touches;
@@ -150,8 +149,8 @@ TouchEvent::TargetTouches()
for (uint32_t i = 0; i < touches.Length(); ++i) {
// for touchend/cancel events, don't append to the target list if this is a
// touch that is ending
if ((mEvent->mMessage != NS_TOUCH_END &&
mEvent->mMessage != NS_TOUCH_CANCEL) || !touches[i]->mChanged) {
if ((mEvent->mMessage != eTouchEnd && mEvent->mMessage != eTouchCancel) ||
!touches[i]->mChanged) {
if (touches[i]->mTarget == mEvent->originalTarget) {
targetTouches.AppendElement(touches[i]);
}
+5 -5
View File
@@ -3277,7 +3277,7 @@ HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
textControl = numberControlFrame->GetAnonTextControl();
}
if (textControl && aVisitor.mEvent->originalTarget == textControl) {
if (aVisitor.mEvent->mMessage == NS_EDITOR_INPUT) {
if (aVisitor.mEvent->mMessage == eEditorInput) {
// Propogate the anon text control's new value to our HTMLInputElement:
nsAutoString value;
numberControlFrame->GetValueOfAnonTextControl(value);
@@ -4059,7 +4059,7 @@ HTMLInputElement::PostHandleEventForRangeThumb(EventChainPostVisitor& aVisitor)
switch (aVisitor.mEvent->mMessage)
{
case eMouseDown:
case NS_TOUCH_START: {
case eTouchStart: {
if (mIsDraggingRange) {
break;
}
@@ -4091,7 +4091,7 @@ HTMLInputElement::PostHandleEventForRangeThumb(EventChainPostVisitor& aVisitor)
} break;
case eMouseMove:
case NS_TOUCH_MOVE:
case eTouchMove:
if (!mIsDraggingRange) {
break;
}
@@ -4106,7 +4106,7 @@ HTMLInputElement::PostHandleEventForRangeThumb(EventChainPostVisitor& aVisitor)
break;
case eMouseUp:
case NS_TOUCH_END:
case eTouchEnd:
if (!mIsDraggingRange) {
break;
}
@@ -4125,7 +4125,7 @@ HTMLInputElement::PostHandleEventForRangeThumb(EventChainPostVisitor& aVisitor)
}
break;
case NS_TOUCH_CANCEL:
case eTouchCancel:
if (mIsDraggingRange) {
CancelRangeThumbDrag();
}
+1 -1
View File
@@ -78,7 +78,7 @@ HTMLMenuElement::SendShowEvent()
return NS_ERROR_FAILURE;
}
WidgetEvent event(true, NS_SHOW_EVENT);
WidgetEvent event(true, eShow);
event.mFlags.mBubbles = false;
event.mFlags.mCancelable = false;
+5 -5
View File
@@ -2020,7 +2020,7 @@ TabChild::UpdateTapState(const WidgetTouchEvent& aEvent, nsEventStatus aStatus)
}
bool currentlyTrackingTouch = (mActivePointerId >= 0);
if (aEvent.mMessage == NS_TOUCH_START) {
if (aEvent.mMessage == eTouchStart) {
if (currentlyTrackingTouch || aEvent.touches.Length() > 1) {
// We're tracking a possible tap for another point, or we saw a
// touchstart for a later pointer after we canceled tracking of
@@ -2061,14 +2061,14 @@ TabChild::UpdateTapState(const WidgetTouchEvent& aEvent, nsEventStatus aStatus)
LayoutDevicePoint currentPoint = LayoutDevicePoint(trackedTouch->mRefPoint.x, trackedTouch->mRefPoint.y);
int64_t time = aEvent.time;
switch (aEvent.mMessage) {
case NS_TOUCH_MOVE:
case eTouchMove:
if (std::abs(currentPoint.x - mGestureDownPoint.x) > sDragThreshold.width ||
std::abs(currentPoint.y - mGestureDownPoint.y) > sDragThreshold.height) {
CancelTapTracking();
}
return;
case NS_TOUCH_END:
case eTouchEnd:
if (!TouchManager::gPreventMouseEvents) {
APZCCallbackHelper::DispatchSynthesizedMouseEvent(
eMouseMove, time, currentPoint, 0, mPuppetWidget);
@@ -2078,7 +2078,7 @@ TabChild::UpdateTapState(const WidgetTouchEvent& aEvent, nsEventStatus aStatus)
eMouseUp, time, currentPoint, 0, mPuppetWidget);
}
// fall through
case NS_TOUCH_CANCEL:
case eTouchCancel:
CancelTapTracking();
return;
@@ -2145,7 +2145,7 @@ TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent,
APZCCallbackHelper::ApplyCallbackTransform(localEvent, aGuid,
mPuppetWidget->GetDefaultScale());
if (localEvent.mMessage == NS_TOUCH_START && AsyncPanZoomEnabled()) {
if (localEvent.mMessage == eTouchStart && AsyncPanZoomEnabled()) {
if (gfxPrefs::TouchActionEnabled()) {
APZCCallbackHelper::SendSetAllowedTouchBehaviorNotification(mPuppetWidget,
localEvent, aInputBlockId, mSetAllowedTouchBehaviorCallback);
+4 -4
View File
@@ -1805,7 +1805,7 @@ bool TabParent::SendRealTouchEvent(WidgetTouchEvent& event)
// confuses remote content and the panning and zooming logic into thinking
// that the added touches are part of the touchend/cancel, when actually
// they're not.
if (event.mMessage == NS_TOUCH_END || event.mMessage == NS_TOUCH_CANCEL) {
if (event.mMessage == eTouchEnd || event.mMessage == eTouchCancel) {
for (int i = event.touches.Length() - 1; i >= 0; i--) {
if (!event.touches[i]->mChanged) {
event.touches.RemoveElementAt(i);
@@ -1827,7 +1827,7 @@ bool TabParent::SendRealTouchEvent(WidgetTouchEvent& event)
event.touches[i]->mRefPoint += offset;
}
return (event.mMessage == NS_TOUCH_MOVE) ?
return (event.mMessage == eTouchMove) ?
PBrowserParent::SendRealTouchMoveEvent(event, guid, blockId, apzResponse) :
PBrowserParent::SendRealTouchEvent(event, guid, blockId, apzResponse);
}
@@ -2956,8 +2956,8 @@ TabParent::InjectTouchEvent(const nsAString& aType,
{
EventMessage msg;
nsContentUtils::GetEventMessageAndAtom(aType, eTouchEventClass, &msg);
if (msg != NS_TOUCH_START && msg != NS_TOUCH_MOVE &&
msg != NS_TOUCH_END && msg != NS_TOUCH_CANCEL) {
if (msg != eTouchStart && msg != eTouchMove &&
msg != eTouchEnd && msg != eTouchCancel) {
return NS_ERROR_FAILURE;
}
+1 -1
View File
@@ -1828,7 +1828,7 @@ public:
// Even if the change is caused by untrusted event, we need to dispatch
// trusted input event since it's a fact.
InternalEditorInputEvent inputEvent(true, NS_EDITOR_INPUT, widget);
InternalEditorInputEvent inputEvent(true, eEditorInput, widget);
inputEvent.time = static_cast<uint64_t>(PR_Now() / 1000);
inputEvent.mIsComposing = mIsComposing;
nsEventStatus status = nsEventStatus_eIgnore;
+15 -13
View File
@@ -216,7 +216,7 @@ APZEventState::ProcessLongTap(const nsCOMPtr<nsIPresShell>& aPresShell,
return;
}
SendPendingTouchPreventedResponse(false, aGuid);
SendPendingTouchPreventedResponse(false);
// Converting the modifiers to DOM format for the DispatchMouseEvent call
// is the most useless thing ever because nsDOMWindowUtils::SendMouseEvent
@@ -253,7 +253,7 @@ APZEventState::ProcessTouchEvent(const WidgetTouchEvent& aEvent,
uint64_t aInputBlockId,
nsEventStatus aApzResponse)
{
if (aEvent.mMessage == NS_TOUCH_START && aEvent.touches.Length() > 0) {
if (aEvent.mMessage == eTouchStart && aEvent.touches.Length() > 0) {
mActiveElementManager->SetTargetElement(aEvent.touches[0]->GetTarget());
}
@@ -261,7 +261,7 @@ APZEventState::ProcessTouchEvent(const WidgetTouchEvent& aEvent,
aEvent.mFlags.mMultipleActionsPrevented;
bool sentContentResponse = false;
switch (aEvent.mMessage) {
case NS_TOUCH_START: {
case eTouchStart: {
mTouchEndCancelled = false;
if (mPendingTouchPreventedResponse) {
// We can enter here if we get two TOUCH_STARTs in a row and didn't
@@ -282,17 +282,20 @@ APZEventState::ProcessTouchEvent(const WidgetTouchEvent& aEvent,
break;
}
case NS_TOUCH_END:
case eTouchEnd:
if (isTouchPrevented) {
mTouchEndCancelled = true;
mEndTouchIsClick = false;
}
// fall through
case NS_TOUCH_CANCEL:
mActiveElementManager->HandleTouchEnd(mEndTouchIsClick);
case eTouchCancel:
mActiveElementManager->HandleTouchEndEvent(mEndTouchIsClick);
// fall through
case NS_TOUCH_MOVE: {
sentContentResponse = SendPendingTouchPreventedResponse(isTouchPrevented, aGuid);
case eTouchMove: {
if (mPendingTouchPreventedResponse) {
MOZ_ASSERT(aGuid == mPendingTouchPreventedGuid);
}
sentContentResponse = SendPendingTouchPreventedResponse(isTouchPrevented);
break;
}
@@ -304,8 +307,8 @@ APZEventState::ProcessTouchEvent(const WidgetTouchEvent& aEvent,
aApzResponse == nsEventStatus_eConsumeDoDefault &&
gfxPrefs::PointerEventsEnabled()) {
WidgetTouchEvent cancelEvent(aEvent);
cancelEvent.mMessage = NS_TOUCH_CANCEL;
cancelEvent.mFlags.mCancelable = false; // mMessage != NS_TOUCH_CANCEL;
cancelEvent.mMessage = eTouchCancel;
cancelEvent.mFlags.mCancelable = false; // mMessage != eTouchCancel;
for (uint32_t i = 0; i < cancelEvent.touches.Length(); ++i) {
if (mozilla::dom::Touch* touch = cancelEvent.touches[i]) {
touch->convertToPointer = true;
@@ -391,6 +394,7 @@ APZEventState::ProcessAPZStateChange(const nsCOMPtr<nsIDocument>& aDocument,
case APZStateChange::EndTouch:
{
mEndTouchIsClick = aArg;
mActiveElementManager->HandleTouchEnd();
break;
}
default:
@@ -401,11 +405,9 @@ APZEventState::ProcessAPZStateChange(const nsCOMPtr<nsIDocument>& aDocument,
}
bool
APZEventState::SendPendingTouchPreventedResponse(bool aPreventDefault,
const ScrollableLayerGuid& aGuid)
APZEventState::SendPendingTouchPreventedResponse(bool aPreventDefault)
{
if (mPendingTouchPreventedResponse) {
MOZ_ASSERT(aGuid == mPendingTouchPreventedGuid);
mContentReceivedInputBlockCallback->Run(mPendingTouchPreventedGuid,
mPendingTouchPreventedBlockId, aPreventDefault);
mPendingTouchPreventedResponse = false;
+1 -2
View File
@@ -71,8 +71,7 @@ public:
int aArg);
private:
~APZEventState();
bool SendPendingTouchPreventedResponse(bool aPreventDefault,
const ScrollableLayerGuid& aGuid);
bool SendPendingTouchPreventedResponse(bool aPreventDefault);
already_AddRefed<nsIWidget> GetWidget() const;
private:
nsWeakPtr mWidget;
+9 -2
View File
@@ -109,9 +109,9 @@ ActiveElementManager::HandlePanStart()
}
void
ActiveElementManager::HandleTouchEnd(bool aWasClick)
ActiveElementManager::HandleTouchEndEvent(bool aWasClick)
{
AEM_LOG("Touch end, aWasClick: %d\n", aWasClick);
AEM_LOG("Touch end event, aWasClick: %d\n", aWasClick);
// If the touch was a click, make mTarget :active right away.
// nsEventStateManager will reset the active element when processing
@@ -129,6 +129,13 @@ ActiveElementManager::HandleTouchEnd(bool aWasClick)
ResetTouchBlockState();
}
void
ActiveElementManager::HandleTouchEnd()
{
AEM_LOG("Touch end, clearing pan state\n");
mCanBePanSet = false;
}
bool
ActiveElementManager::ActiveElementUsesStyle() const
{
+11 -5
View File
@@ -32,14 +32,15 @@ public:
/**
* Specify the target of a touch. Typically this should be called right
* before HandleTouchStart(), but we give callers the flexibility to specify
* the target later if they don't know it at the time they call
* HandleTouchStart().
* after HandleTouchStart(), but in cases where the APZ needs to wait for
* a content response the HandleTouchStart() may be delayed, in which case
* this function can be called first.
* |aTarget| may be nullptr.
*/
void SetTargetElement(dom::EventTarget* aTarget);
/**
* Handle a touch-start event.
* Handle a touch-start state notification from APZ. This notification
* may be delayed until after touch listeners have responded to the APZ.
* @param aCanBePan whether the touch can be a pan
*/
void HandleTouchStart(bool aCanBePan);
@@ -51,7 +52,12 @@ public:
* Handle a touch-end or touch-cancel event.
* @param aWasClick whether the touch was a click
*/
void HandleTouchEnd(bool aWasClick);
void HandleTouchEndEvent(bool aWasClick);
/**
* Handle a touch-end state notification from APZ. This notification may be
* delayed until after touch listeners have responded to the APZ.
*/
void HandleTouchEnd();
/**
* @return true iff the currently active element (or one of its ancestors)
* actually had a style for the :active pseudo-class. The currently active
+12 -12
View File
@@ -569,28 +569,28 @@ AccessibleCaretEventHub::HandleTouchEvent(WidgetTouchEvent* aEvent)
nsPoint point = GetTouchEventPosition(aEvent, id);
switch (aEvent->mMessage) {
case NS_TOUCH_START:
AC_LOGV("Before NS_TOUCH_START, state: %s", mState->Name());
case eTouchStart:
AC_LOGV("Before eTouchStart, state: %s", mState->Name());
rv = mState->OnPress(this, point, id);
AC_LOGV("After NS_TOUCH_START, state: %s, consume: %d", mState->Name(), rv);
AC_LOGV("After eTouchStart, state: %s, consume: %d", mState->Name(), rv);
break;
case NS_TOUCH_MOVE:
AC_LOGV("Before NS_TOUCH_MOVE, state: %s", mState->Name());
case eTouchMove:
AC_LOGV("Before eTouchMove, state: %s", mState->Name());
rv = mState->OnMove(this, point);
AC_LOGV("After NS_TOUCH_MOVE, state: %s, consume: %d", mState->Name(), rv);
AC_LOGV("After eTouchMove, state: %s, consume: %d", mState->Name(), rv);
break;
case NS_TOUCH_END:
AC_LOGV("Before NS_TOUCH_END, state: %s", mState->Name());
case eTouchEnd:
AC_LOGV("Before eTouchEnd, state: %s", mState->Name());
rv = mState->OnRelease(this);
AC_LOGV("After NS_TOUCH_END, state: %s, consume: %d", mState->Name(), rv);
AC_LOGV("After eTouchEnd, state: %s, consume: %d", mState->Name(), rv);
break;
case NS_TOUCH_CANCEL:
AC_LOGV("Before NS_TOUCH_CANCEL, state: %s", mState->Name());
case eTouchCancel:
AC_LOGV("Before eTouchCancel, state: %s", mState->Name());
rv = mState->OnRelease(this);
AC_LOGV("After NS_TOUCH_CANCEL, state: %s, consume: %d", mState->Name(),
AC_LOGV("After eTouchCancel, state: %s, consume: %d", mState->Name(),
rv);
break;
+5 -6
View File
@@ -197,11 +197,11 @@ SelectionCarets::HandleEvent(WidgetEvent* aEvent)
nsPoint ptInRoot =
nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, movePoint, rootFrame);
if (aEvent->mMessage == NS_TOUCH_START ||
if (aEvent->mMessage == eTouchStart ||
(aEvent->mMessage == eMouseDown &&
mouseEvent->button == WidgetMouseEvent::eLeftButton)) {
// If having a active touch, ignore other touch down event
if (aEvent->mMessage == NS_TOUCH_START && mActiveTouchId >= 0) {
if (aEvent->mMessage == eTouchStart && mActiveTouchId >= 0) {
return nsEventStatus_eConsumeNoDefault;
}
@@ -224,8 +224,8 @@ SelectionCarets::HandleEvent(WidgetEvent* aEvent)
mActiveTouchId = -1;
LaunchLongTapDetector();
}
} else if (aEvent->mMessage == NS_TOUCH_END ||
aEvent->mMessage == NS_TOUCH_CANCEL ||
} else if (aEvent->mMessage == eTouchEnd ||
aEvent->mMessage == eTouchCancel ||
aEvent->mMessage == eMouseUp) {
CancelLongTapDetector();
if (mDragMode != NONE) {
@@ -237,8 +237,7 @@ SelectionCarets::HandleEvent(WidgetEvent* aEvent)
}
return nsEventStatus_eConsumeNoDefault;
}
} else if (aEvent->mMessage == NS_TOUCH_MOVE ||
aEvent->mMessage == eMouseMove) {
} else if (aEvent->mMessage == eTouchMove || aEvent->mMessage == eMouseMove) {
if (mDragMode == START_FRAME || mDragMode == END_FRAME) {
if (mActiveTouchId == nowTouchId) {
ptInRoot.y += mCaretCenterToDownPointOffsetY;
+6 -6
View File
@@ -762,25 +762,25 @@ TouchCaret::HandleEvent(WidgetEvent* aEvent)
nsEventStatus status = nsEventStatus_eIgnore;
switch (aEvent->mMessage) {
case NS_TOUCH_START:
case eTouchStart:
status = HandleTouchDownEvent(aEvent->AsTouchEvent());
break;
case eMouseDown:
status = HandleMouseDownEvent(aEvent->AsMouseEvent());
break;
case NS_TOUCH_END:
case eTouchEnd:
status = HandleTouchUpEvent(aEvent->AsTouchEvent());
break;
case eMouseUp:
status = HandleMouseUpEvent(aEvent->AsMouseEvent());
break;
case NS_TOUCH_MOVE:
case eTouchMove:
status = HandleTouchMoveEvent(aEvent->AsTouchEvent());
break;
case eMouseMove:
status = HandleMouseMoveEvent(aEvent->AsMouseEvent());
break;
case NS_TOUCH_CANCEL:
case eTouchCancel:
mTouchesId.Clear();
SetState(TOUCHCARET_NONE);
LaunchExpirationTimer();
@@ -897,7 +897,7 @@ TouchCaret::HandleTouchMoveEvent(WidgetTouchEvent* aEvent)
break;
case TOUCHCARET_TOUCHDRAG_INACTIVE:
// Consume NS_TOUCH_MOVE event in TOUCHCARET_TOUCHDRAG_INACTIVE state.
// Consume eTouchMove event in TOUCHCARET_TOUCHDRAG_INACTIVE state.
status = nsEventStatus_eConsumeNoDefault;
break;
}
@@ -1097,7 +1097,7 @@ TouchCaret::HandleTouchDownEvent(WidgetTouchEvent* aEvent)
case TOUCHCARET_MOUSEDRAG_ACTIVE:
case TOUCHCARET_TOUCHDRAG_ACTIVE:
case TOUCHCARET_TOUCHDRAG_INACTIVE:
// Consume NS_TOUCH_START event.
// Consume eTouchStart event.
status = nsEventStatus_eConsumeNoDefault;
break;
}
+5 -5
View File
@@ -56,7 +56,7 @@ EvictTouchPoint(nsRefPtr<dom::Touch>& aTouch,
nsPoint pt(aTouch->mRefPoint.x, aTouch->mRefPoint.y);
nsCOMPtr<nsIWidget> widget = frame->GetView()->GetNearestWidget(&pt);
if (widget) {
WidgetTouchEvent event(true, NS_TOUCH_END, widget);
WidgetTouchEvent event(true, eTouchEnd, widget);
event.widget = widget;
event.time = PR_IntervalNow();
event.touches.AppendElement(aTouch);
@@ -102,7 +102,7 @@ TouchManager::PreHandleEvent(WidgetEvent* aEvent,
nsCOMPtr<nsIContent>& aCurrentEventContent)
{
switch (aEvent->mMessage) {
case NS_TOUCH_START: {
case eTouchStart: {
aIsHandlingUserInput = true;
WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent();
// if there is only one touch in this touchstart event, assume that it is
@@ -128,7 +128,7 @@ TouchManager::PreHandleEvent(WidgetEvent* aEvent,
}
break;
}
case NS_TOUCH_MOVE: {
case eTouchMove: {
// Check for touches that changed. Mark them add to queue
WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent();
WidgetTouchEvent::TouchArray& touches = touchEvent->touches;
@@ -190,10 +190,10 @@ TouchManager::PreHandleEvent(WidgetEvent* aEvent,
}
break;
}
case NS_TOUCH_END:
case eTouchEnd:
aIsHandlingUserInput = true;
// Fall through to touchcancel code
case NS_TOUCH_CANCEL: {
case eTouchCancel: {
// Remove the changed touches
// need to make sure we only remove touches that are ending here
WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent();
@@ -163,17 +163,17 @@ public:
static UniquePtr<WidgetEvent> CreateTouchPressEvent(nscoord aX, nscoord aY)
{
return CreateTouchEvent(NS_TOUCH_START, aX, aY);
return CreateTouchEvent(eTouchStart, aX, aY);
}
static UniquePtr<WidgetEvent> CreateTouchMoveEvent(nscoord aX, nscoord aY)
{
return CreateTouchEvent(NS_TOUCH_MOVE, aX, aY);
return CreateTouchEvent(eTouchMove, aX, aY);
}
static UniquePtr<WidgetEvent> CreateTouchReleaseEvent(nscoord aX, nscoord aY)
{
return CreateTouchEvent(NS_TOUCH_END, aX, aY);
return CreateTouchEvent(eTouchEnd, aX, aY);
}
static UniquePtr<WidgetEvent> CreateWheelEvent(EventMessage aMessage)
+21 -33
View File
@@ -494,7 +494,7 @@ public:
nsIFrame* frame = mPresShell->GetCurrentEventFrame();
if (!frame &&
(aVisitor.mEvent->mMessage == eMouseUp ||
aVisitor.mEvent->mMessage == NS_TOUCH_END)) {
aVisitor.mEvent->mMessage == eTouchEnd)) {
// Redirect BUTTON_UP and TOUCH_END events to the root frame to ensure
// that capturing is released.
frame = mPresShell->GetRootFrame();
@@ -2657,9 +2657,7 @@ PresShell::FrameNeedsReflow(nsIFrame *aFrame, IntrinsicDirty aIntrinsicDirty,
nsIFrame::ChildListIterator lists(f);
for (; !lists.IsDone(); lists.Next()) {
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
nsIFrame* kid = childFrames.get();
for (nsIFrame* kid : lists.CurrentList()) {
kid->MarkIntrinsicISizesDirty();
stack.AppendElement(kid);
}
@@ -4472,8 +4470,7 @@ nsIPresShell::ReconstructStyleDataInternal()
restyleManager->PostRestyleEvent(root, eRestyle_Subtree,
NS_STYLE_HINT_NONE);
} else {
for (uint32_t i = 0; i < scopeRoots.Length(); i++) {
Element* scopeRoot = scopeRoots[i];
for (Element* scopeRoot : scopeRoots) {
restyleManager->PostRestyleEvent(scopeRoot, eRestyle_Subtree,
NS_STYLE_HINT_NONE);
}
@@ -5050,9 +5047,7 @@ PresShell::PaintRangePaintInfo(nsTArray<nsAutoPtr<RangePaintInfo> >* aItems,
frameSelection->SetDisplaySelection(nsISelectionController::SELECTION_HIDDEN);
// next, paint each range in the selection
int32_t count = aItems->Length();
for (int32_t i = 0; i < count; i++) {
RangePaintInfo* rangeInfo = (*aItems)[i];
for (RangePaintInfo* rangeInfo : *aItems) {
// the display lists paint relative to the offset from the reference
// frame, so account for that translation too:
gfxPoint rootOffset =
@@ -5724,10 +5719,7 @@ PresShell::MarkImagesInSubtreeVisible(nsIFrame* aFrame, const nsRect& aRect)
continue;
}
nsFrameList children = childLists.CurrentList();
for (nsFrameList::Enumerator e(children); !e.AtEnd(); e.Next()) {
nsIFrame* child = e.get();
for (nsIFrame* child : childLists.CurrentList()) {
nsRect r = rect - child->GetPosition();
if (!r.IntersectRect(r, child->GetVisualOverflowRect())) {
continue;
@@ -6684,16 +6676,16 @@ DispatchPointerFromMouseOrTouch(PresShell* aShell,
// loop over all touches and dispatch pointer events on each touch
// copy the event
switch (touchEvent->mMessage) {
case NS_TOUCH_MOVE:
case eTouchMove:
pointerMessage = ePointerMove;
break;
case NS_TOUCH_END:
case eTouchEnd:
pointerMessage = ePointerUp;
break;
case NS_TOUCH_START:
case eTouchStart:
pointerMessage = ePointerDown;
break;
case NS_TOUCH_CANCEL:
case eTouchCancel:
pointerMessage = ePointerCancel;
break;
default:
@@ -7289,8 +7281,7 @@ PresShell::HandleEvent(nsIFrame* aFrame,
}
// all touch events except for touchstart use a captured target
if (aEvent->mClass == eTouchEventClass &&
aEvent->mMessage != NS_TOUCH_START) {
if (aEvent->mClass == eTouchEventClass && aEvent->mMessage != eTouchStart) {
captureRetarget = true;
}
@@ -7306,7 +7297,7 @@ PresShell::HandleEvent(nsIFrame* aFrame,
if (!captureRetarget && !isWindowLevelMouseExit) {
nsPoint eventPoint;
uint32_t flags = 0;
if (aEvent->mMessage == NS_TOUCH_START) {
if (aEvent->mMessage == eTouchStart) {
flags |= INPUT_IGNORE_ROOT_SCROLL_FRAME;
WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent();
// if this is a continuing session, ensure that all these events are
@@ -7472,14 +7463,12 @@ PresShell::HandleEvent(nsIFrame* aFrame,
PresShell* shell =
static_cast<PresShell*>(frame->PresContext()->PresShell());
switch (aEvent->mMessage) {
case NS_TOUCH_MOVE:
case NS_TOUCH_CANCEL:
case NS_TOUCH_END: {
case eTouchMove:
case eTouchCancel:
case eTouchEnd: {
// get the correct shell to dispatch to
WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent();
WidgetTouchEvent::TouchArray& touches = touchEvent->touches;
for (uint32_t i = 0; i < touches.Length(); ++i) {
dom::Touch* touch = touches[i];
for (dom::Touch* touch : touchEvent->touches) {
if (!touch) {
break;
}
@@ -8065,16 +8054,15 @@ PresShell::DispatchTouchEventToDOM(WidgetEvent* aEvent,
// calling preventDefault on touchstart or the first touchmove for a
// point prevents mouse events. calling it on the touchend should
// prevent click dispatching.
bool canPrevent = (aEvent->mMessage == NS_TOUCH_START) ||
(aEvent->mMessage == NS_TOUCH_MOVE && aTouchIsNew) ||
(aEvent->mMessage == NS_TOUCH_END);
bool canPrevent = (aEvent->mMessage == eTouchStart) ||
(aEvent->mMessage == eTouchMove && aTouchIsNew) ||
(aEvent->mMessage == eTouchEnd);
bool preventDefault = false;
nsEventStatus tmpStatus = nsEventStatus_eIgnore;
WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent();
// loop over all touches and dispatch events on any that have changed
for (uint32_t i = 0; i < touchEvent->touches.Length(); ++i) {
dom::Touch* touch = touchEvent->touches[i];
for (dom::Touch* touch : touchEvent->touches) {
if (!touch || !touch->mChanged) {
continue;
}
@@ -10740,8 +10728,8 @@ nsIPresShell::MarkFixedFramesForReflow(IntrinsicDirty aIntrinsicDirty)
nsIFrame* rootFrame = mFrameConstructor->GetRootFrame();
if (rootFrame) {
const nsFrameList& childList = rootFrame->GetChildList(nsIFrame::kFixedList);
for (nsFrameList::Enumerator e(childList); !e.AtEnd(); e.Next()) {
FrameNeedsReflow(e.get(), aIntrinsicDirty, NS_FRAME_IS_DIRTY);
for (nsIFrame* childFrame : childList) {
FrameNeedsReflow(childFrame, aIntrinsicDirty, NS_FRAME_IS_DIRTY);
}
}
}
+2 -4
View File
@@ -2616,11 +2616,9 @@ nsFrame::HandleEvent(nsPresContext* aPresContext,
if ((aEvent->mClass == eMouseEventClass &&
aEvent->AsMouseEvent()->button == WidgetMouseEvent::eLeftButton) ||
aEvent->mClass == eTouchEventClass) {
if (aEvent->mMessage == eMouseDown ||
aEvent->mMessage == NS_TOUCH_START) {
if (aEvent->mMessage == eMouseDown || aEvent->mMessage == eTouchStart) {
HandlePress(aPresContext, aEvent, aEventStatus);
} else if (aEvent->mMessage == eMouseUp ||
aEvent->mMessage == NS_TOUCH_END) {
} else if (aEvent->mMessage == eMouseUp || aEvent->mMessage == eTouchEnd) {
HandleRelease(aPresContext, aEvent, aEventStatus);
}
}
+3 -3
View File
@@ -62,7 +62,7 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
bool doDefault = true;
switch (aEvent->mMessage) {
case NS_TOUCH_START:
case eTouchStart:
case eMouseDown: {
if (aEvent->mClass == eTouchEventClass ||
(aEvent->mClass == eMouseEventClass &&
@@ -128,7 +128,7 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
}
break;
case NS_TOUCH_END:
case eTouchEnd:
case eMouseUp: {
if (aEvent->mClass == eTouchEventClass ||
(aEvent->mClass == eMouseEventClass &&
@@ -143,7 +143,7 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
}
break;
case NS_TOUCH_MOVE:
case eTouchMove:
case eMouseMove: {
if (mTrackingMouseMove)
{
+5 -5
View File
@@ -442,7 +442,7 @@ nsSliderFrame::HandleEvent(nsPresContext* aPresContext,
if (isDraggingThumb())
{
switch (aEvent->mMessage) {
case NS_TOUCH_MOVE:
case eTouchMove:
case eMouseMove: {
nsPoint eventPoint;
if (!GetEventPoint(aEvent, eventPoint)) {
@@ -504,7 +504,7 @@ nsSliderFrame::HandleEvent(nsPresContext* aPresContext,
}
break;
case NS_TOUCH_END:
case eTouchEnd:
case eMouseUp:
if (ShouldScrollForEvent(aEvent)) {
StopDrag();
@@ -1011,8 +1011,8 @@ bool
nsSliderFrame::ShouldScrollForEvent(WidgetGUIEvent* aEvent)
{
switch (aEvent->mMessage) {
case NS_TOUCH_START:
case NS_TOUCH_END:
case eTouchStart:
case eTouchEnd:
return true;
case eMouseDown:
case eMouseUp: {
@@ -1038,7 +1038,7 @@ nsSliderFrame::ShouldScrollToClickForEvent(WidgetGUIEvent* aEvent)
return false;
}
if (aEvent->mMessage == NS_TOUCH_START) {
if (aEvent->mMessage == eTouchStart) {
return GetScrollToClick();
}
+18 -18
View File
@@ -347,7 +347,7 @@ NS_EVENT_MESSAGE(eBeforePrint, ePrintEventFirst)
NS_EVENT_MESSAGE(eAfterPrint, ePrintEventFirst + 1)
NS_EVENT_MESSAGE(NS_MESSAGE_EVENT_START, 4700)
NS_EVENT_MESSAGE(NS_MESSAGE, NS_MESSAGE_EVENT_START)
NS_EVENT_MESSAGE(eMessage, NS_MESSAGE_EVENT_START)
// Open and close events
NS_EVENT_MESSAGE(eOpenCloseEventFirst, 4800)
@@ -361,18 +361,18 @@ NS_EVENT_MESSAGE(eDeviceProximity, eDeviceEventFirst + 2)
NS_EVENT_MESSAGE(eUserProximity, eDeviceEventFirst + 3)
NS_EVENT_MESSAGE(eDeviceLight, eDeviceEventFirst + 4)
NS_EVENT_MESSAGE(NS_SHOW_EVENT, 5000)
NS_EVENT_MESSAGE(eShow, 5000)
// Fullscreen DOM API
NS_EVENT_MESSAGE(eFullscreenEventFirst, 5100)
NS_EVENT_MESSAGE(eFullscreenChange, eFullscreenEventFirst)
NS_EVENT_MESSAGE(eFullscreenError, eFullscreenEventFirst + 1)
NS_EVENT_MESSAGE(NS_TOUCH_EVENT_START, 5200)
NS_EVENT_MESSAGE(NS_TOUCH_START, NS_TOUCH_EVENT_START)
NS_EVENT_MESSAGE(NS_TOUCH_MOVE, NS_TOUCH_EVENT_START + 1)
NS_EVENT_MESSAGE(NS_TOUCH_END, NS_TOUCH_EVENT_START + 2)
NS_EVENT_MESSAGE(NS_TOUCH_CANCEL, NS_TOUCH_EVENT_START + 3)
NS_EVENT_MESSAGE(eTouchEventFirst, 5200)
NS_EVENT_MESSAGE(eTouchStart, eTouchEventFirst)
NS_EVENT_MESSAGE(eTouchMove, eTouchEventFirst + 1)
NS_EVENT_MESSAGE(eTouchEnd, eTouchEventFirst + 2)
NS_EVENT_MESSAGE(eTouchCancel, eTouchEventFirst + 3)
// Pointerlock DOM API
NS_EVENT_MESSAGE(ePointerLockEventFirst, 5300)
@@ -400,14 +400,14 @@ NS_EVENT_MESSAGE(eNetworkUpload, eNetworkEventFirst + 1)
NS_EVENT_MESSAGE(eNetworkDownload, eNetworkEventFirst + 2)
// MediaRecorder events.
NS_EVENT_MESSAGE(NS_MEDIARECORDER_EVENT_START, 5700)
NS_EVENT_MESSAGE(NS_MEDIARECORDER_DATAAVAILABLE, NS_MEDIARECORDER_EVENT_START + 1)
NS_EVENT_MESSAGE(NS_MEDIARECORDER_WARNING, NS_MEDIARECORDER_EVENT_START + 2)
NS_EVENT_MESSAGE(NS_MEDIARECORDER_STOP, NS_MEDIARECORDER_EVENT_START + 3)
NS_EVENT_MESSAGE(eMediaRecorderEventFirst, 5700)
NS_EVENT_MESSAGE(eMediaRecorderDataAvailable, eMediaRecorderEventFirst + 1)
NS_EVENT_MESSAGE(eMediaRecorderWarning, eMediaRecorderEventFirst + 2)
NS_EVENT_MESSAGE(eMediaRecorderStop, eMediaRecorderEventFirst + 3)
// SpeakerManager events
NS_EVENT_MESSAGE(NS_SPEAKERMANAGER_EVENT_START, 5800)
NS_EVENT_MESSAGE(NS_SPEAKERMANAGER_SPEAKERFORCEDCHANGE, NS_SPEAKERMANAGER_EVENT_START + 1)
NS_EVENT_MESSAGE(eSpeakerManagerEventFirst, 5800)
NS_EVENT_MESSAGE(eSpeakerForcedChange, eSpeakerManagerEventFirst + 1)
#ifdef MOZ_GAMEPAD
// Gamepad input events
@@ -421,13 +421,13 @@ NS_EVENT_MESSAGE(eGamepadEventLast, eGamepadDisconnected)
#endif
// input and beforeinput events.
NS_EVENT_MESSAGE(NS_EDITOR_EVENT_START, 6100)
NS_EVENT_MESSAGE(NS_EDITOR_INPUT, NS_EDITOR_EVENT_START)
NS_EVENT_MESSAGE(eEditorEventFirst, 6100)
NS_EVENT_MESSAGE(eEditorInput, eEditorEventFirst)
// Selection events
NS_EVENT_MESSAGE(NS_SELECT_EVENT_START, 6200)
NS_EVENT_MESSAGE(NS_SELECT_START, NS_SELECT_EVENT_START)
NS_EVENT_MESSAGE(eSelectionChange, NS_SELECT_EVENT_START + 1)
NS_EVENT_MESSAGE(eSelectEventFirst, 6200)
NS_EVENT_MESSAGE(eSelectStart, eSelectEventFirst)
NS_EVENT_MESSAGE(eSelectionChange, eSelectEventFirst + 1)
// Visibility change
NS_EVENT_MESSAGE(NS_VISIBILITY_START, 6300)
+8 -8
View File
@@ -36,16 +36,16 @@ MultiTouchInput::MultiTouchInput(const WidgetTouchEvent& aTouchEvent)
"Can only copy from WidgetTouchEvent on main thread");
switch (aTouchEvent.mMessage) {
case NS_TOUCH_START:
case eTouchStart:
mType = MULTITOUCH_START;
break;
case NS_TOUCH_MOVE:
case eTouchMove:
mType = MULTITOUCH_MOVE;
break;
case NS_TOUCH_END:
case eTouchEnd:
mType = MULTITOUCH_END;
break;
case NS_TOUCH_CANCEL:
case eTouchCancel:
mType = MULTITOUCH_CANCEL;
break;
default:
@@ -84,16 +84,16 @@ MultiTouchInput::ToWidgetTouchEvent(nsIWidget* aWidget) const
EventMessage touchEventMessage = eVoidEvent;
switch (mType) {
case MULTITOUCH_START:
touchEventMessage = NS_TOUCH_START;
touchEventMessage = eTouchStart;
break;
case MULTITOUCH_MOVE:
touchEventMessage = NS_TOUCH_MOVE;
touchEventMessage = eTouchMove;
break;
case MULTITOUCH_END:
touchEventMessage = NS_TOUCH_END;
touchEventMessage = eTouchEnd;
break;
case MULTITOUCH_CANCEL:
touchEventMessage = NS_TOUCH_CANCEL;
touchEventMessage = eTouchCancel;
break;
default:
MOZ_ASSERT_UNREACHABLE("Did not assign a type to WidgetTouchEvent in MultiTouchInput");
+5 -1
View File
@@ -81,7 +81,10 @@ public:
INPUTDATA_AS_CHILD_TYPE(TapGestureInput, TAPGESTURE_INPUT)
INPUTDATA_AS_CHILD_TYPE(ScrollWheelInput, SCROLLWHEEL_INPUT)
InputData()
InputData(InputType aInputType)
: mInputType(aInputType),
mTime(0),
modifiers(0)
{
}
@@ -208,6 +211,7 @@ public:
}
MultiTouchInput()
: InputData(MULTITOUCH_INPUT)
{
}
+2 -2
View File
@@ -173,7 +173,7 @@ public:
time = aOther.time;
timeStamp = aOther.timeStamp;
touches.AppendElements(aOther.touches);
mFlags.mCancelable = mMessage != NS_TOUCH_CANCEL;
mFlags.mCancelable = mMessage != eTouchCancel;
MOZ_COUNT_CTOR(WidgetTouchEvent);
}
@@ -181,7 +181,7 @@ public:
: WidgetInputEvent(aIsTrusted, aMessage, aWidget, eTouchEventClass)
{
MOZ_COUNT_CTOR(WidgetTouchEvent);
mFlags.mCancelable = mMessage != NS_TOUCH_CANCEL;
mFlags.mCancelable = mMessage != eTouchCancel;
}
virtual ~WidgetTouchEvent()
+2 -2
View File
@@ -989,7 +989,7 @@ nsBaseWidget::ProcessUntransformedAPZEvent(WidgetInputEvent* aEvent,
// TODO: Eventually we'll be able to move the SendSetTargetAPZCNotification
// call into APZEventState::Process*Event() as well.
if (WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent()) {
if (touchEvent->mMessage == NS_TOUCH_START) {
if (touchEvent->mMessage == eTouchStart) {
if (gfxPrefs::TouchActionEnabled()) {
APZCCallbackHelper::SendSetAllowedTouchBehaviorNotification(this, *touchEvent,
aInputBlockId, mSetAllowedTouchBehaviorCallback);
@@ -2607,7 +2607,7 @@ case _value: eventName.AssignLiteral(_name) ; break
_ASSIGN_eventName(eDragEnter,"eDragEnter");
_ASSIGN_eventName(eDragExit,"eDragExit");
_ASSIGN_eventName(eDragOver,"eDragOver");
_ASSIGN_eventName(NS_EDITOR_INPUT,"NS_EDITOR_INPUT");
_ASSIGN_eventName(eEditorInput,"eEditorInput");
_ASSIGN_eventName(eFocus,"eFocus");
_ASSIGN_eventName(eFormSelect,"eFormSelect");
_ASSIGN_eventName(eFormChange,"eFormChange");
+8 -4
View File
@@ -201,13 +201,15 @@ private:
CFDictionaryAddValue(mTouches, touch, (void*)mNextTouchID);
mNextTouchID++;
}
[self sendTouchEvent:NS_TOUCH_START touches:[event allTouches] widget:mGeckoChild];
[self sendTouchEvent:eTouchStart
touches:[event allTouches]
widget:mGeckoChild];
}
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
ALOG("[ChildView[%p] touchesCancelled", self);
[self sendTouchEvent:NS_TOUCH_CANCEL touches:touches widget:mGeckoChild];
[self sendTouchEvent:eTouchCancel touches:touches widget:mGeckoChild];
for (UITouch* touch : touches) {
CFDictionaryRemoveValue(mTouches, touch);
}
@@ -222,7 +224,7 @@ private:
if (!mGeckoChild)
return;
[self sendTouchEvent:NS_TOUCH_END touches:touches widget:mGeckoChild];
[self sendTouchEvent:eTouchEnd touches:touches widget:mGeckoChild];
for (UITouch* touch : touches) {
CFDictionaryRemoveValue(mTouches, touch);
}
@@ -237,7 +239,9 @@ private:
if (!mGeckoChild)
return;
[self sendTouchEvent:NS_TOUCH_MOVE touches:[event allTouches] widget:mGeckoChild];
[self sendTouchEvent:eTouchMove
touches:[event allTouches]
widget:mGeckoChild];
}
- (void)setNeedsDisplayInRect:(CGRect)aRect
+61 -57
View File
@@ -183,6 +183,7 @@
#include "mozilla/layers/APZCTreeManager.h"
#include "mozilla/layers/InputAPZContext.h"
#include "InputData.h"
using namespace mozilla;
using namespace mozilla::dom;
@@ -6240,86 +6241,89 @@ bool nsWindow::OnTouch(WPARAM wParam, LPARAM lParam)
PTOUCHINPUT pInputs = new TOUCHINPUT[cInputs];
if (mGesture.GetTouchInputInfo((HTOUCHINPUT)lParam, cInputs, pInputs)) {
WidgetTouchEvent* touchEventToSend = nullptr;
WidgetTouchEvent* touchEndEventToSend = nullptr;
nsEventStatus status;
MultiTouchInput touchInput, touchEndInput;
// Walk across the touch point array processing each contact point
// Walk across the touch point array processing each contact point.
for (uint32_t i = 0; i < cInputs; i++) {
EventMessage msg;
bool addToEvent = false, addToEndEvent = false;
// N.B.: According with MS documentation
// https://msdn.microsoft.com/en-us/library/windows/desktop/dd317334(v=vs.85).aspx
// TOUCHEVENTF_DOWN cannot be combined with TOUCHEVENTF_MOVE or TOUCHEVENTF_UP.
// Possibly, it means that TOUCHEVENTF_MOVE and TOUCHEVENTF_UP can be combined together.
if (pInputs[i].dwFlags & (TOUCHEVENTF_DOWN | TOUCHEVENTF_MOVE)) {
// Create a standard touch event to send
if (!touchEventToSend) {
touchEventToSend = new WidgetTouchEvent(true, NS_TOUCH_MOVE, this);
touchEventToSend->time = ::GetMessageTime();
touchEventToSend->timeStamp =
GetMessageTimeStamp(touchEventToSend->time);
if (touchInput.mTimeStamp.IsNull()) {
// Initialize a touch event to send.
touchInput.mType = MultiTouchInput::MULTITOUCH_MOVE;
touchInput.mTime = ::GetMessageTime();
touchInput.mTimeStamp = GetMessageTimeStamp(touchInput.mTime);
ModifierKeyState modifierKeyState;
modifierKeyState.InitInputEvent(*touchEventToSend);
touchInput.modifiers = modifierKeyState.GetModifiers();
}
// Pres shell expects this event to be a NS_TOUCH_START if new contact
// points have been added since the last event sent.
// Pres shell expects this event to be a eTouchStart
// if any new contact points have been added since the last event sent.
if (pInputs[i].dwFlags & TOUCHEVENTF_DOWN) {
touchEventToSend->mMessage = msg = NS_TOUCH_START;
} else {
msg = NS_TOUCH_MOVE;
touchInput.mType = MultiTouchInput::MULTITOUCH_START;
}
} else if (pInputs[i].dwFlags & TOUCHEVENTF_UP) {
// Pres shell expects removed contacts points to be delivered in a
// separate NS_TOUCH_END event containing only the contact points
// that were removed.
if (!touchEndEventToSend) {
touchEndEventToSend = new WidgetTouchEvent(true, NS_TOUCH_END, this);
touchEndEventToSend->time = ::GetMessageTime();
touchEndEventToSend->timeStamp =
GetMessageTimeStamp(touchEndEventToSend->time);
addToEvent = true;
}
if (pInputs[i].dwFlags & TOUCHEVENTF_UP) {
// Pres shell expects removed contacts points to be delivered in a separate
// eTouchEnd event containing only the contact points that were removed.
if (touchEndInput.mTimeStamp.IsNull()) {
// Initialize a touch event to send.
touchEndInput.mType = MultiTouchInput::MULTITOUCH_END;
touchEndInput.mTime = ::GetMessageTime();
touchEndInput.mTimeStamp = GetMessageTimeStamp(touchEndInput.mTime);
ModifierKeyState modifierKeyState;
modifierKeyState.InitInputEvent(*touchEndEventToSend);
touchEndInput.modifiers = modifierKeyState.GetModifiers();
}
msg = NS_TOUCH_END;
} else {
// Filter out spurious Windows events we don't understand, like palm
// contact.
addToEndEvent = true;
}
if (!addToEvent && !addToEndEvent) {
// Filter out spurious Windows events we don't understand, like palm contact.
continue;
}
// Setup the touch point we'll append to the touch event array
// Setup the touch point we'll append to the touch event array.
nsPointWin touchPoint;
touchPoint.x = TOUCH_COORD_TO_PIXEL(pInputs[i].x);
touchPoint.y = TOUCH_COORD_TO_PIXEL(pInputs[i].y);
touchPoint.ScreenToClient(mWnd);
nsRefPtr<Touch> touch =
new Touch(pInputs[i].dwID,
LayoutDeviceIntPoint::FromUntyped(touchPoint),
/* radius, if known */
pInputs[i].dwFlags & TOUCHINPUTMASKF_CONTACTAREA ?
nsIntPoint(
TOUCH_COORD_TO_PIXEL(pInputs[i].cxContact) / 2,
TOUCH_COORD_TO_PIXEL(pInputs[i].cyContact) / 2) :
nsIntPoint(1,1),
/* rotation angle and force */
0.0f, 0.0f);
// Append to the appropriate event
if (msg == NS_TOUCH_START || msg == NS_TOUCH_MOVE) {
touchEventToSend->touches.AppendElement(touch);
} else {
touchEndEventToSend->touches.AppendElement(touch);
// Initialize the touch data.
SingleTouchData touchData(pInputs[i].dwID, // aIdentifier
ScreenIntPoint::FromUntyped(touchPoint), // aScreenPoint
/* radius, if known */
pInputs[i].dwFlags & TOUCHINPUTMASKF_CONTACTAREA
? ScreenSize(
TOUCH_COORD_TO_PIXEL(pInputs[i].cxContact) / 2,
TOUCH_COORD_TO_PIXEL(pInputs[i].cyContact) / 2)
: ScreenSize(1, 1), // aRadius
0.0f, // aRotationAngle
0.0f); // aForce
// Append touch data to the appropriate event.
if (addToEvent) {
touchInput.mTouches.AppendElement(touchData);
}
if (addToEndEvent) {
touchEndInput.mTouches.AppendElement(touchData);
}
}
// Dispatch touch start and move event if we have one.
if (touchEventToSend) {
status = DispatchAPZAwareEvent(touchEventToSend);
delete touchEventToSend;
// Dispatch touch start and touch move event if we have one.
if (!touchInput.mTimeStamp.IsNull()) {
// Convert MultiTouchInput to WidgetTouchEvent interface.
WidgetTouchEvent widgetTouchEvent = touchInput.ToWidgetTouchEvent(this);
DispatchAPZAwareEvent(&widgetTouchEvent);
}
// Dispatch touch end event if we have one.
if (touchEndEventToSend) {
status = DispatchAPZAwareEvent(touchEndEventToSend);
delete touchEndEventToSend;
if (!touchEndInput.mTimeStamp.IsNull()) {
// Convert MultiTouchInput to WidgetTouchEvent interface.
WidgetTouchEvent widgetTouchEvent = touchEndInput.ToWidgetTouchEvent(this);
DispatchAPZAwareEvent(&widgetTouchEvent);
}
}