mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 02:25:34 +00:00
Merge
This commit is contained in:
commit
4e9cec6bbf
@ -3415,12 +3415,9 @@ nsGenericElement::DispatchClickEvent(nsPresContext* aPresContext,
|
||||
aSourceEvent->widget, nsMouseEvent::eReal);
|
||||
event.refPoint = aSourceEvent->refPoint;
|
||||
PRUint32 clickCount = 1;
|
||||
float pressure = 0;
|
||||
if (aSourceEvent->eventStructType == NS_MOUSE_EVENT) {
|
||||
clickCount = static_cast<nsMouseEvent*>(aSourceEvent)->clickCount;
|
||||
pressure = static_cast<nsMouseEvent*>(aSourceEvent)->pressure;
|
||||
}
|
||||
event.pressure = pressure;
|
||||
event.clickCount = clickCount;
|
||||
event.isShift = aSourceEvent->isShift;
|
||||
event.isControl = aSourceEvent->isControl;
|
||||
|
@ -822,7 +822,6 @@ NS_METHOD nsDOMEvent::DuplicatePrivateData()
|
||||
mouseEvent->context = oldMouseEvent->context;
|
||||
mouseEvent->relatedTarget = oldMouseEvent->relatedTarget;
|
||||
mouseEvent->button = oldMouseEvent->button;
|
||||
mouseEvent->pressure = oldMouseEvent->pressure;
|
||||
newEvent = mouseEvent;
|
||||
break;
|
||||
}
|
||||
|
@ -93,7 +93,6 @@ NS_IMPL_RELEASE_INHERITED(nsDOMMouseEvent, nsDOMUIEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsDOMMouseEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNSMouseEvent)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(MouseEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
|
||||
|
||||
@ -137,24 +136,6 @@ nsDOMMouseEvent::InitMouseEvent(const nsAString & aType, PRBool aCanBubble, PRBo
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMMouseEvent::InitNSMouseEvent(const nsAString & aType, PRBool aCanBubble, PRBool aCancelable,
|
||||
nsIDOMAbstractView *aView, PRInt32 aDetail, PRInt32 aScreenX,
|
||||
PRInt32 aScreenY, PRInt32 aClientX, PRInt32 aClientY,
|
||||
PRBool aCtrlKey, PRBool aAltKey, PRBool aShiftKey,
|
||||
PRBool aMetaKey, PRUint16 aButton, nsIDOMEventTarget *aRelatedTarget,
|
||||
float aPressure)
|
||||
{
|
||||
nsresult rv = nsDOMMouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable,
|
||||
aView, aDetail, aScreenX, aScreenY,
|
||||
aClientX, aClientY, aCtrlKey, aAltKey, aShiftKey,
|
||||
aMetaKey, aButton, aRelatedTarget);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
static_cast<nsMouseEvent_base*>(mEvent)->pressure = aPressure;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMMouseEvent::GetButton(PRUint16* aButton)
|
||||
{
|
||||
@ -268,14 +249,6 @@ nsDOMMouseEvent::GetWhich(PRUint32* aWhich)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMMouseEvent::GetMozPressure(float* aPressure)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPressure);
|
||||
*aPressure = static_cast<nsMouseEvent_base*>(mEvent)->pressure;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult NS_NewDOMMouseEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
nsPresContext* aPresContext,
|
||||
nsInputEvent *aEvent)
|
||||
|
@ -41,14 +41,13 @@
|
||||
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "nsIDOMNSMouseEvent.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsIScrollableView;
|
||||
class nsEvent;
|
||||
|
||||
class nsDOMMouseEvent : public nsDOMUIEvent,
|
||||
public nsIDOMNSMouseEvent
|
||||
class nsDOMMouseEvent : public nsIDOMMouseEvent,
|
||||
public nsDOMUIEvent
|
||||
{
|
||||
public:
|
||||
nsDOMMouseEvent(nsPresContext* aPresContext, nsInputEvent* aEvent);
|
||||
@ -58,10 +57,7 @@ public:
|
||||
|
||||
// nsIDOMMouseEvent Interface
|
||||
NS_DECL_NSIDOMMOUSEEVENT
|
||||
|
||||
// nsIDOMNSMouseEvent Interface
|
||||
NS_DECL_NSIDOMNSMOUSEEVENT
|
||||
|
||||
|
||||
// Forward to base class
|
||||
NS_FORWARD_TO_NSDOMUIEVENT
|
||||
|
||||
|
@ -64,7 +64,6 @@ _TEST_FILES = \
|
||||
test_bug447736.html \
|
||||
test_bug456273.html \
|
||||
test_bug457672.html \
|
||||
test_bug428988.html \
|
||||
bug457672.html \
|
||||
test_draggableprop.html \
|
||||
test_dragstart.html \
|
||||
|
@ -1,45 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=428988
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 428988</title>
|
||||
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=428988">Mozilla Bug 428988</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 428988 **/
|
||||
|
||||
function listenerForClick(evt) {
|
||||
is(Math.round(evt.mozPressure*100), 56, "Wrong .mozPressure");
|
||||
}
|
||||
|
||||
function doTest() {
|
||||
var target = document.getElementById("testTarget");
|
||||
target.addEventListener("click", listenerForClick, true);
|
||||
var me = document.createEvent("MouseEvent");
|
||||
me.initNSMouseEvent("click", true, true, window, 0, 0, 0, 0, 0,
|
||||
false, false, false, false, 0, null, 0.56);
|
||||
target.dispatchEvent(me);
|
||||
target.removeEventListener("click", listenerForClick, true);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(doTest);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
<span id="testTarget" style="border: 1px solid black;">testTarget</span>
|
||||
</body>
|
||||
</html>
|
@ -77,7 +77,6 @@ XPIDLSRCS = \
|
||||
nsIDOMMessageEvent.idl \
|
||||
nsIDOMNotifyPaintEvent.idl \
|
||||
nsIDOMSimpleGestureEvent.idl \
|
||||
nsIDOMNSMouseEvent.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -1,69 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2008
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Oleg Romashin <romaxa@gmail.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIDOMMouseEvent.idl"
|
||||
|
||||
/**
|
||||
* The nsIDOMNSMouseEvent interface extends nsIDOMMouseEvent
|
||||
* by providing various information related to the mouse event.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(1b8e528d-7dca-44ee-8ee6-c44594ebcef1)]
|
||||
interface nsIDOMNSMouseEvent : nsIDOMMouseEvent
|
||||
{
|
||||
// Finger or touch pressure event value
|
||||
// ranges between 0.0 and 1.0
|
||||
readonly attribute float mozPressure;
|
||||
|
||||
void initNSMouseEvent(in DOMString typeArg,
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg,
|
||||
in nsIDOMAbstractView viewArg,
|
||||
in long detailArg,
|
||||
in long screenXArg,
|
||||
in long screenYArg,
|
||||
in long clientXArg,
|
||||
in long clientYArg,
|
||||
in boolean ctrlKeyArg,
|
||||
in boolean altKeyArg,
|
||||
in boolean shiftKeyArg,
|
||||
in boolean metaKeyArg,
|
||||
in unsigned short buttonArg,
|
||||
in nsIDOMEventTarget relatedTargetArg,
|
||||
in float pressure);
|
||||
};
|
@ -465,8 +465,6 @@
|
||||
// Simple gestures include
|
||||
#include "nsIDOMSimpleGestureEvent.h"
|
||||
|
||||
#include "nsIDOMNSMouseEvent.h"
|
||||
|
||||
static NS_DEFINE_CID(kCPluginManagerCID, NS_PLUGINMANAGER_CID);
|
||||
static NS_DEFINE_CID(kDOMSOF_CID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
|
||||
|
||||
@ -2151,20 +2149,17 @@ nsDOMClassInfo::Init()
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(MouseEvent, nsIDOMMouseEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMouseEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSMouseEvent)
|
||||
DOM_CLASSINFO_UI_EVENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(MouseScrollEvent, nsIDOMMouseScrollEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMouseScrollEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMouseEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSMouseEvent)
|
||||
DOM_CLASSINFO_UI_EVENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(DragEvent, nsIDOMDragEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDragEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSMouseEvent)
|
||||
DOM_CLASSINFO_UI_EVENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
|
@ -679,16 +679,12 @@ class nsMouseEvent_base : public nsInputEvent
|
||||
{
|
||||
public:
|
||||
nsMouseEvent_base(PRBool isTrusted, PRUint32 msg, nsIWidget *w, PRUint8 type)
|
||||
: nsInputEvent(isTrusted, msg, w, type), button(0), pressure(0) {}
|
||||
: nsInputEvent(isTrusted, msg, w, type), button(0) {}
|
||||
|
||||
/// The possible related target
|
||||
nsCOMPtr<nsISupports> relatedTarget;
|
||||
|
||||
PRInt16 button;
|
||||
|
||||
// Finger or touch pressure of event
|
||||
// ranges between 0.0 and 1.0
|
||||
float pressure;
|
||||
};
|
||||
|
||||
class nsMouseEvent : public nsMouseEvent_base
|
||||
|
@ -398,7 +398,6 @@ nsWindow::nsWindow()
|
||||
mDragMotionY = 0;
|
||||
mDragMotionTime = 0;
|
||||
mDragMotionTimerID = 0;
|
||||
mLastMotionPressure = 0;
|
||||
|
||||
#ifdef USE_XIM
|
||||
mIMEData = nsnull;
|
||||
@ -2535,15 +2534,6 @@ nsWindow::OnMotionNotifyEvent(GtkWidget *aWidget, GdkEventMotion *aEvent)
|
||||
|
||||
nsMouseEvent event(PR_TRUE, NS_MOUSE_MOVE, this, nsMouseEvent::eReal);
|
||||
|
||||
// should we move this into !synthEvent?
|
||||
gdouble pressure = 0;
|
||||
gdk_event_get_axis ((GdkEvent*)aEvent, GDK_AXIS_PRESSURE, &pressure);
|
||||
// Sometime gdk generate 0 pressure value between normal values
|
||||
// We have to ignore that and use last valid value
|
||||
if (pressure)
|
||||
mLastMotionPressure = pressure;
|
||||
event.pressure = mLastMotionPressure;
|
||||
|
||||
nsRect windowRect;
|
||||
ScreenToWidget(nsRect(nscoord(cursorX), nscoord(cursorY), 1, 1), windowRect);
|
||||
|
||||
@ -2597,14 +2587,6 @@ nsWindow::OnMotionNotifyEvent(GtkWidget *aWidget, GdkEventMotion *aEvent)
|
||||
|
||||
nsMouseEvent event(PR_TRUE, NS_MOUSE_MOVE, this, nsMouseEvent::eReal);
|
||||
|
||||
gdouble pressure = 0;
|
||||
gdk_event_get_axis ((GdkEvent*)aEvent, GDK_AXIS_PRESSURE, &pressure);
|
||||
// Sometime gdk generate 0 pressure value between normal values
|
||||
// We have to ignore that and use last valid value
|
||||
if (pressure)
|
||||
mLastMotionPressure = pressure;
|
||||
event.pressure = mLastMotionPressure;
|
||||
|
||||
if (synthEvent) {
|
||||
#ifdef MOZ_X11
|
||||
event.refPoint.x = nscoord(xevent.xmotion.x);
|
||||
@ -2733,10 +2715,6 @@ nsWindow::OnButtonPressEvent(GtkWidget *aWidget, GdkEventButton *aEvent)
|
||||
if (gConsumeRollupEvent && rolledUp)
|
||||
return;
|
||||
|
||||
gdouble pressure = 0;
|
||||
gdk_event_get_axis ((GdkEvent*)aEvent, GDK_AXIS_PRESSURE, &pressure);
|
||||
mLastMotionPressure = pressure;
|
||||
|
||||
PRUint16 domButton;
|
||||
switch (aEvent->button) {
|
||||
case 1:
|
||||
@ -2753,7 +2731,6 @@ nsWindow::OnButtonPressEvent(GtkWidget *aWidget, GdkEventButton *aEvent)
|
||||
case 7:
|
||||
{
|
||||
nsMouseScrollEvent event(PR_TRUE, NS_MOUSE_SCROLL, this);
|
||||
event.pressure = mLastMotionPressure;
|
||||
event.scrollFlags = nsMouseScrollEvent::kIsHorizontal;
|
||||
event.refPoint.x = nscoord(aEvent->x);
|
||||
event.refPoint.y = nscoord(aEvent->y);
|
||||
@ -2784,7 +2761,6 @@ nsWindow::OnButtonPressEvent(GtkWidget *aWidget, GdkEventButton *aEvent)
|
||||
nsMouseEvent event(PR_TRUE, NS_MOUSE_BUTTON_DOWN, this, nsMouseEvent::eReal);
|
||||
event.button = domButton;
|
||||
InitButtonEvent(event, aEvent);
|
||||
event.pressure = mLastMotionPressure;
|
||||
|
||||
DispatchEvent(&event, status);
|
||||
|
||||
@ -2794,7 +2770,6 @@ nsWindow::OnButtonPressEvent(GtkWidget *aWidget, GdkEventButton *aEvent)
|
||||
nsMouseEvent contextMenuEvent(PR_TRUE, NS_CONTEXTMENU, this,
|
||||
nsMouseEvent::eReal);
|
||||
InitButtonEvent(contextMenuEvent, aEvent);
|
||||
contextMenuEvent.pressure = mLastMotionPressure;
|
||||
DispatchEvent(&contextMenuEvent, status);
|
||||
}
|
||||
}
|
||||
@ -2822,13 +2797,9 @@ nsWindow::OnButtonReleaseEvent(GtkWidget *aWidget, GdkEventButton *aEvent)
|
||||
nsMouseEvent event(PR_TRUE, NS_MOUSE_BUTTON_UP, this, nsMouseEvent::eReal);
|
||||
event.button = domButton;
|
||||
InitButtonEvent(event, aEvent);
|
||||
gdouble pressure = 0;
|
||||
gdk_event_get_axis ((GdkEvent*)aEvent, GDK_AXIS_PRESSURE, &pressure);
|
||||
event.pressure = pressure ? pressure : mLastMotionPressure;
|
||||
|
||||
nsEventStatus status;
|
||||
DispatchEvent(&event, status);
|
||||
mLastMotionPressure = pressure;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -550,7 +550,6 @@ private:
|
||||
guint mDragMotionTime;
|
||||
guint mDragMotionTimerID;
|
||||
nsCOMPtr<nsITimer> mDragLeaveTimer;
|
||||
float mLastMotionPressure;
|
||||
|
||||
static PRBool sIsDraggingOutOf;
|
||||
// drag in progress
|
||||
|
Loading…
Reference in New Issue
Block a user