From 73b18124821f88d9f49d3256bdc2a55607c9cc76 Mon Sep 17 00:00:00 2001 From: Wes Johnston Date: Mon, 19 Mar 2012 14:34:34 -0700 Subject: [PATCH] Bug 722965 - Remove MOZ_TOUCH ifdefs. r=smaug --- config/autoconf.mk.in | 1 - configure.in | 2 - content/events/src/nsDOMMouseEvent.cpp | 16 ------- content/events/src/nsDOMUIEvent.cpp | 16 ------- layout/base/nsLayoutUtils.cpp | 62 -------------------------- layout/base/nsPresShell.cpp | 15 ------- 6 files changed, 112 deletions(-) diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index 48dc340bbff..4e87fbcaaff 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -154,7 +154,6 @@ MOZ_ANDROID_HISTORY = @MOZ_ANDROID_HISTORY@ MOZ_WEBSMS_BACKEND = @MOZ_WEBSMS_BACKEND@ MOZ_JAVA_COMPOSITOR = @MOZ_JAVA_COMPOSITOR@ MOZ_ONLY_TOUCH_EVENTS = @MOZ_ONLY_TOUCH_EVENTS@ -MOZ_TOUCH = @MOZ_TOUCH@ MOZ_PROFILELOCKING = @MOZ_PROFILELOCKING@ MOZ_FEEDS = @MOZ_FEEDS@ MOZ_TOOLKIT_SEARCH = @MOZ_TOOLKIT_SEARCH@ diff --git a/configure.in b/configure.in index 139c6383299..e9cc403ce7c 100644 --- a/configure.in +++ b/configure.in @@ -4851,7 +4851,6 @@ cairo-uikit) cairo-android) AC_DEFINE(MOZ_WIDGET_ANDROID) - AC_DEFINE(MOZ_TOUCH) MOZ_WIDGET_TOOLKIT=android TK_CFLAGS='$(MOZ_CAIRO_CFLAGS)' TK_LIBS='$(MOZ_CAIRO_LIBS)' @@ -4861,7 +4860,6 @@ cairo-android) if test "$MOZ_BUILD_APP" = "mobile/xul"; then MOZ_OLD_LINKER=1 fi - MOZ_TOUCH=1 ;; cairo-gonk) diff --git a/content/events/src/nsDOMMouseEvent.cpp b/content/events/src/nsDOMMouseEvent.cpp index cf0ba93ecf1..25f2bb966ce 100644 --- a/content/events/src/nsDOMMouseEvent.cpp +++ b/content/events/src/nsDOMMouseEvent.cpp @@ -236,13 +236,9 @@ nsDOMMouseEvent::GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget) NS_METHOD nsDOMMouseEvent::GetScreenX(PRInt32* aScreenX) { NS_ENSURE_ARG_POINTER(aScreenX); -#ifdef MOZ_TOUCH *aScreenX = nsDOMEvent::GetScreenCoords(mPresContext, mEvent, mEvent->refPoint).x; -#else - *aScreenX = GetScreenPoint().x; -#endif return NS_OK; } @@ -250,13 +246,9 @@ NS_IMETHODIMP nsDOMMouseEvent::GetScreenY(PRInt32* aScreenY) { NS_ENSURE_ARG_POINTER(aScreenY); -#ifdef MOZ_TOUCH *aScreenY = nsDOMEvent::GetScreenCoords(mPresContext, mEvent, mEvent->refPoint).y; -#else - *aScreenY = GetScreenPoint().y; -#endif return NS_OK; } @@ -264,14 +256,10 @@ nsDOMMouseEvent::GetScreenY(PRInt32* aScreenY) NS_METHOD nsDOMMouseEvent::GetClientX(PRInt32* aClientX) { NS_ENSURE_ARG_POINTER(aClientX); -#ifdef MOZ_TOUCH *aClientX = nsDOMEvent::GetClientCoords(mPresContext, mEvent, mEvent->refPoint, mClientPoint).x; -#else - *aClientX = GetClientPoint().x; -#endif return NS_OK; } @@ -279,14 +267,10 @@ NS_IMETHODIMP nsDOMMouseEvent::GetClientY(PRInt32* aClientY) { NS_ENSURE_ARG_POINTER(aClientY); -#ifdef MOZ_TOUCH *aClientY = nsDOMEvent::GetClientCoords(mPresContext, mEvent, mEvent->refPoint, mClientPoint).y; -#else - *aClientY = GetClientPoint().y; -#endif return NS_OK; } diff --git a/content/events/src/nsDOMUIEvent.cpp b/content/events/src/nsDOMUIEvent.cpp index 2adcd5c70e6..70537dfff32 100644 --- a/content/events/src/nsDOMUIEvent.cpp +++ b/content/events/src/nsDOMUIEvent.cpp @@ -244,7 +244,6 @@ NS_IMETHODIMP nsDOMUIEvent::GetPageX(PRInt32* aPageX) { NS_ENSURE_ARG_POINTER(aPageX); -#ifdef MOZ_TOUCH if (mPrivateDataDuplicated) { *aPageX = mPagePoint.x; } else { @@ -253,9 +252,6 @@ nsDOMUIEvent::GetPageX(PRInt32* aPageX) mEvent->refPoint, mClientPoint).x; } -#else - *aPageX = GetPagePoint().x; -#endif return NS_OK; } @@ -263,7 +259,6 @@ NS_IMETHODIMP nsDOMUIEvent::GetPageY(PRInt32* aPageY) { NS_ENSURE_ARG_POINTER(aPageY); -#ifdef MOZ_TOUCH if (mPrivateDataDuplicated) { *aPageY = mPagePoint.y; } else { @@ -272,9 +267,6 @@ nsDOMUIEvent::GetPageY(PRInt32* aPageY) mEvent->refPoint, mClientPoint).y; } -#else - *aPageY = GetPagePoint().y; -#endif return NS_OK; } @@ -413,7 +405,6 @@ nsDOMUIEvent::GetIsChar(bool* aIsChar) NS_METHOD nsDOMUIEvent::DuplicatePrivateData() { -#ifdef MOZ_TOUCH mClientPoint = nsDOMEvent::GetClientCoords(mPresContext, mEvent, mEvent->refPoint, @@ -427,13 +418,6 @@ nsDOMUIEvent::DuplicatePrivateData() nsIntPoint screenPoint = nsDOMEvent::GetScreenCoords(mPresContext, mEvent, mEvent->refPoint); -#else - mClientPoint = GetClientPoint(); - mLayerPoint = GetLayerPoint(); - mPagePoint = GetPagePoint(); - // GetScreenPoint converts mEvent->refPoint to right coordinates. - nsIntPoint screenPoint = GetScreenPoint(); -#endif nsresult rv = nsDOMEvent::DuplicatePrivateData(); if (NS_SUCCEEDED(rv)) { mEvent->refPoint = screenPoint; diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 36eb1d75ec7..69325124bc3 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -958,76 +958,14 @@ nsLayoutUtils::GetEventCoordinatesRelativeTo(const nsEvent* aEvent, nsIFrame* aF aEvent->eventStructType != NS_SIMPLE_GESTURE_EVENT && aEvent->eventStructType != NS_GESTURENOTIFY_EVENT && aEvent->eventStructType != NS_MOZTOUCH_EVENT && -#ifdef MOZ_TOUCH aEvent->eventStructType != NS_TOUCH_EVENT && -#endif aEvent->eventStructType != NS_QUERY_CONTENT_EVENT)) return nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE); const nsGUIEvent* GUIEvent = static_cast(aEvent); -#ifdef MOZ_TOUCH return GetEventCoordinatesRelativeTo(aEvent, GUIEvent->refPoint, aFrame); -#else - if (!GUIEvent->widget) - return nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE); - - nsIView* view = aFrame->GetView(); - if (view) { - nsIWidget* widget = view->GetWidget(); - if (widget && widget == GUIEvent->widget) { - // Special case this cause it happens a lot. - // This also fixes bug 664707, events in the extra-special case of select - // dropdown popups that are transformed. - nsPresContext* presContext = aFrame->PresContext(); - nsPoint pt(presContext->DevPixelsToAppUnits(GUIEvent->refPoint.x), - presContext->DevPixelsToAppUnits(GUIEvent->refPoint.y)); - return pt - view->ViewToWidgetOffset(); - } - } - - /* If we walk up the frame tree and discover that any of the frames are - * transformed, we need to do extra work to convert from the global - * space to the local space. - */ - nsIFrame* rootFrame = aFrame; - bool transformFound = false; - - for (nsIFrame* f = aFrame; f; f = GetCrossDocParentFrame(f)) { - if (f->IsTransformed()) - transformFound = true; - rootFrame = f; - } - - nsIView* rootView = rootFrame->GetView(); - if (!rootView) - return nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE); - - nsPoint widgetToView = TranslateWidgetToView(rootFrame->PresContext(), - GUIEvent->widget, GUIEvent->refPoint, - rootView); - - if (widgetToView == nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE)) - return nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE); - - // Convert from root document app units to app units of the document aFrame - // is in. - PRInt32 rootAPD = rootFrame->PresContext()->AppUnitsPerDevPixel(); - PRInt32 localAPD = aFrame->PresContext()->AppUnitsPerDevPixel(); - widgetToView = widgetToView.ConvertAppUnits(rootAPD, localAPD); - - /* If we encountered a transform, we can't do simple arithmetic to figure - * out how to convert back to aFrame's coordinates and must use the CTM. - */ - if (transformFound) - return TransformRootPointToFrame(aFrame, widgetToView); - - /* Otherwise, all coordinate systems are translations of one another, - * so we can just subtract out the different. - */ - return widgetToView - aFrame->GetOffsetToCrossDoc(rootFrame); -#endif } nsPoint diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 6596dc509a3..164da53fdc5 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -5662,7 +5662,6 @@ PresShell::RecordMouseLocation(nsGUIEvent* aEvent) } } -#ifdef MOZ_TOUCH static void EvictTouchPoint(nsCOMPtr& aTouch) { @@ -5710,7 +5709,6 @@ AppendToTouchList(const PRUint32& aKey, nsCOMPtr& aData, void *aTou touches->AppendElement(aData); return PL_DHASH_NEXT; } -#endif // MOZ_TOUCH nsresult PresShell::HandleEvent(nsIFrame *aFrame, @@ -5924,7 +5922,6 @@ PresShell::HandleEvent(nsIFrame *aFrame, // with a window-level mouse exit event since we want to start sending // mouse out events at the root EventStateManager. if (!captureRetarget && !isWindowLevelMouseExit) { -#ifdef MOZ_TOUCH nsPoint eventPoint; if (aEvent->message == NS_TOUCH_START) { // Add any new touches to the queue @@ -5973,10 +5970,6 @@ PresShell::HandleEvent(nsIFrame *aFrame, } else { eventPoint = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, frame); } -#else - nsPoint eventPoint - = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, frame); -#endif { bool ignoreRootScrollFrame = false; if (aEvent->eventStructType == NS_MOUSE_EVENT) { @@ -6376,9 +6369,7 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsEventStatus* aStatus) nsresult rv = NS_OK; if (!NS_EVENT_NEEDS_FRAME(aEvent) || GetCurrentEventFrame()) { -#ifdef MOZ_TOUCH bool touchIsNew = false; -#endif bool isHandlingUserInput = false; // XXX How about IME events and input events for plugins? @@ -6421,7 +6412,6 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsEventStatus* aStatus) case NS_MOUSE_BUTTON_UP: isHandlingUserInput = true; break; -#ifdef MOZ_TOUCH case NS_TOUCH_CANCEL: case NS_TOUCH_END: { // Remove the changed touches @@ -6501,7 +6491,6 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsEventStatus* aStatus) } break; } -#endif case NS_DRAGDROP_DROP: nsCOMPtr session = nsContentUtils::GetDragSession(); if (session) { @@ -6560,14 +6549,10 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsEventStatus* aStatus) // because they do not have a reliable refPoint. if (!IsSynthesizedMouseEvent(aEvent)) { nsPresShellEventCB eventCB(this); -#ifdef MOZ_TOUCH if (aEvent->eventStructType == NS_TOUCH_EVENT) { DispatchTouchEvent(aEvent, aStatus, &eventCB, touchIsNew); } else if (mCurrentEventContent) { -#else - if (mCurrentEventContent) { -#endif nsEventDispatcher::Dispatch(mCurrentEventContent, mPresContext, aEvent, nsnull, aStatus, &eventCB); }