зеркало из https://github.com/mozilla/pjs.git
Bug 722965 - Remove MOZ_TOUCH ifdefs. r=smaug
This commit is contained in:
Родитель
9cb849f1f0
Коммит
187666328d
|
@ -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@
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<const nsGUIEvent*>(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
|
||||
|
|
|
@ -5662,7 +5662,6 @@ PresShell::RecordMouseLocation(nsGUIEvent* aEvent)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_TOUCH
|
||||
static void
|
||||
EvictTouchPoint(nsCOMPtr<nsIDOMTouch>& aTouch)
|
||||
{
|
||||
|
@ -5710,7 +5709,6 @@ AppendToTouchList(const PRUint32& aKey, nsCOMPtr<nsIDOMTouch>& 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<nsIDragSession> 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);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче