зеркало из https://github.com/mozilla/gecko-dev.git
Back out bug 378028 due to mochitest failures.
This commit is contained in:
Родитель
7338c6bc07
Коммит
deb0e936d9
|
@ -39,6 +39,9 @@
|
|||
#endif
|
||||
*/
|
||||
|
||||
// From nsMouseScrollEvent::kIsHorizontal
|
||||
const MOUSE_SCROLL_IS_HORIZONTAL = 1 << 2;
|
||||
|
||||
// One of the possible values for the mousewheel.* preferences.
|
||||
// From nsEventStateManager.cpp.
|
||||
const MOUSE_SCROLL_ZOOM = 3;
|
||||
|
@ -145,7 +148,7 @@ var FullZoom = {
|
|||
// Construct the "mousewheel action" pref key corresponding to this event.
|
||||
// Based on nsEventStateManager::GetBasePrefKeyForMouseWheel.
|
||||
var pref = "mousewheel";
|
||||
if (event.axis == event.HORIZONTAL_AXIS)
|
||||
if (event.scrollFlags & MOUSE_SCROLL_IS_HORIZONTAL)
|
||||
pref += ".horizscroll";
|
||||
|
||||
if (event.shiftKey)
|
||||
|
|
|
@ -81,8 +81,6 @@ NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext,
|
|||
nsresult
|
||||
NS_NewDOMMouseEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, class nsInputEvent *aEvent);
|
||||
nsresult
|
||||
NS_NewDOMMouseScrollEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, class nsInputEvent *aEvent);
|
||||
nsresult
|
||||
NS_NewDOMKeyboardEvent(nsIDOMEvent** aInstancePtrResult, nsPresContext* aPresContext, class nsKeyEvent *aEvent);
|
||||
nsresult
|
||||
NS_NewDOMMutationEvent(nsIDOMEvent** aResult, nsPresContext* aPresContext, class nsMutationEvent* aEvent);
|
||||
|
|
|
@ -75,7 +75,6 @@ CPPSRCS = \
|
|||
nsDOMKeyboardEvent.cpp \
|
||||
nsDOMTextEvent.cpp \
|
||||
nsDOMMouseEvent.cpp \
|
||||
nsDOMMouseScrollEvent.cpp \
|
||||
nsDOMMutationEvent.cpp \
|
||||
nsDOMPopupBlockedEvent.cpp \
|
||||
nsDOMBeforeUnloadEvent.cpp \
|
||||
|
|
|
@ -67,6 +67,9 @@ nsDOMMouseEvent::nsDOMMouseEvent(nsPresContext* aPresContext,
|
|||
case NS_MOUSE_EVENT:
|
||||
mDetail = static_cast<nsMouseEvent*>(mEvent)->clickCount;
|
||||
break;
|
||||
case NS_MOUSE_SCROLL_EVENT:
|
||||
mDetail = static_cast<nsMouseScrollEvent*>(mEvent)->delta;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -74,12 +77,15 @@ nsDOMMouseEvent::nsDOMMouseEvent(nsPresContext* aPresContext,
|
|||
|
||||
nsDOMMouseEvent::~nsDOMMouseEvent()
|
||||
{
|
||||
if (mEventIsInternal && mEvent) {
|
||||
if (mEventIsInternal) {
|
||||
switch (mEvent->eventStructType)
|
||||
{
|
||||
case NS_MOUSE_EVENT:
|
||||
delete static_cast<nsMouseEvent*>(mEvent);
|
||||
break;
|
||||
case NS_MOUSE_SCROLL_EVENT:
|
||||
delete static_cast<nsMouseScrollEvent*>(mEvent);
|
||||
break;
|
||||
default:
|
||||
delete mEvent;
|
||||
break;
|
||||
|
@ -123,7 +129,10 @@ nsDOMMouseEvent::InitMouseEvent(const nsAString & aType, PRBool aCanBubble, PRBo
|
|||
inputEvent->refPoint.x = aScreenX;
|
||||
inputEvent->refPoint.y = aScreenY;
|
||||
|
||||
if (mEvent->eventStructType == NS_MOUSE_EVENT) {
|
||||
if (mEvent->eventStructType == NS_MOUSE_SCROLL_EVENT) {
|
||||
nsMouseScrollEvent* scrollEvent = static_cast<nsMouseScrollEvent*>(mEvent);
|
||||
scrollEvent->delta = aDetail;
|
||||
} else {
|
||||
nsMouseEvent* mouseEvent = static_cast<nsMouseEvent*>(mEvent);
|
||||
mouseEvent->clickCount = aDetail;
|
||||
}
|
||||
|
|
|
@ -65,8 +65,4 @@ public:
|
|||
NS_IMETHOD GetWhich(PRUint32 *aWhich);
|
||||
};
|
||||
|
||||
#define NS_FORWARD_TO_NSDOMMOUSEEVENT \
|
||||
NS_FORWARD_NSIDOMMOUSEEVENT(nsDOMMouseEvent::) \
|
||||
NS_FORWARD_TO_NSDOMUIEVENT
|
||||
|
||||
#endif // nsDOMMouseEvent_h__
|
||||
|
|
|
@ -566,12 +566,10 @@ nsEventDispatcher::CreateEvent(nsPresContext* aPresContext,
|
|||
return NS_NewDOMKeyboardEvent(aDOMEvent, aPresContext,
|
||||
static_cast<nsKeyEvent*>(aEvent));
|
||||
case NS_MOUSE_EVENT:
|
||||
case NS_MOUSE_SCROLL_EVENT:
|
||||
case NS_POPUP_EVENT:
|
||||
return NS_NewDOMMouseEvent(aDOMEvent, aPresContext,
|
||||
static_cast<nsInputEvent*>(aEvent));
|
||||
case NS_MOUSE_SCROLL_EVENT:
|
||||
return NS_NewDOMMouseScrollEvent(aDOMEvent, aPresContext,
|
||||
static_cast<nsInputEvent*>(aEvent));
|
||||
case NS_POPUPBLOCKED_EVENT:
|
||||
return NS_NewDOMPopupBlockedEvent(aDOMEvent, aPresContext,
|
||||
static_cast<nsPopupBlockedEvent*>
|
||||
|
@ -614,10 +612,9 @@ nsEventDispatcher::CreateEvent(nsPresContext* aPresContext,
|
|||
|
||||
if (aEventType.LowerCaseEqualsLiteral("mouseevent") ||
|
||||
aEventType.LowerCaseEqualsLiteral("mouseevents") ||
|
||||
aEventType.LowerCaseEqualsLiteral("mousescrollevents") ||
|
||||
aEventType.LowerCaseEqualsLiteral("popupevents"))
|
||||
return NS_NewDOMMouseEvent(aDOMEvent, aPresContext, nsnull);
|
||||
if (aEventType.LowerCaseEqualsLiteral("mousescrollevents"))
|
||||
return NS_NewDOMMouseScrollEvent(aDOMEvent, aPresContext, nsnull);
|
||||
if (aEventType.LowerCaseEqualsLiteral("keyboardevent") ||
|
||||
aEventType.LowerCaseEqualsLiteral("keyevents"))
|
||||
return NS_NewDOMKeyboardEvent(aDOMEvent, aPresContext, nsnull);
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
|
||||
interface nsIDOMElement;
|
||||
|
||||
[scriptable, uuid(ee6500aa-fd51-4b89-801f-d4fbf2663beb)]
|
||||
[scriptable, uuid(ef136142-9925-45f4-a3e4-6f0d275c6aa8)]
|
||||
interface nsIDOMWindowUtils : nsISupports {
|
||||
|
||||
/**
|
||||
|
@ -127,33 +127,6 @@ interface nsIDOMWindowUtils : nsISupports {
|
|||
in long aClickCount,
|
||||
in long aModifiers);
|
||||
|
||||
/** Synthesize a mouse scroll event for a window. The event types supported
|
||||
* are:
|
||||
* DOMMouseScroll
|
||||
*
|
||||
* Events are sent in coordinates offset by aX and aY from the window.
|
||||
*
|
||||
* Cannot be accessed from unprivileged context (not content-accessible)
|
||||
* Will throw a DOM security error if called without UniversalXPConnect
|
||||
* privileges.
|
||||
*
|
||||
* @param aType event type
|
||||
* @param aX x offset
|
||||
* @param aY y offset
|
||||
* @param aButton button to synthesize
|
||||
* @param aScrollFlags flag bits --- see nsMouseScrollFlags in nsGUIEvent.h
|
||||
* @param aDelta the direction and amount to scroll (in lines or pixels,
|
||||
* depending on whether kIsPixels is set in aScrollFlags)
|
||||
* @param aModifiers modifiers pressed, using constants defined in nsIDOMNSEvent
|
||||
*/
|
||||
void sendMouseScrollEvent(in AString aType,
|
||||
in long aX,
|
||||
in long aY,
|
||||
in long aButton,
|
||||
in long aScrollFlags,
|
||||
in long aDelta,
|
||||
in long aModifiers);
|
||||
|
||||
/**
|
||||
* Synthesize a key event to the window. The event types supported are:
|
||||
* keydown, keyup, keypress
|
||||
|
|
|
@ -56,7 +56,6 @@ SDK_XPIDLSRCS = \
|
|||
nsIDOMEventGroup.idl \
|
||||
nsIDOMCustomEvent.idl \
|
||||
nsIDOMMouseEvent.idl \
|
||||
nsIDOMMouseScrollEvent.idl \
|
||||
nsIDOMUIEvent.idl \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -83,7 +83,6 @@ enum nsDOMClassInfoID {
|
|||
eDOMClassInfo_MutationEvent_id,
|
||||
eDOMClassInfo_UIEvent_id,
|
||||
eDOMClassInfo_MouseEvent_id,
|
||||
eDOMClassInfo_MouseScrollEvent_id,
|
||||
eDOMClassInfo_KeyboardEvent_id,
|
||||
eDOMClassInfo_PopupBlockedEvent_id,
|
||||
|
||||
|
|
|
@ -234,7 +234,6 @@
|
|||
#include "nsIDOMDataContainerEvent.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsIDOMMouseScrollEvent.h"
|
||||
#include "nsIDOMCommandEvent.h"
|
||||
#include "nsIDOMPopupBlockedEvent.h"
|
||||
#include "nsIDOMBeforeUnloadEvent.h"
|
||||
|
@ -651,8 +650,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(MouseEvent, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(MouseScrollEvent, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(KeyboardEvent, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(PopupBlockedEvent, nsDOMGenericSH,
|
||||
|
@ -2108,11 +2105,6 @@ nsDOMClassInfo::Init()
|
|||
DOM_CLASSINFO_UI_EVENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(MouseScrollEvent, nsIDOMMouseScrollEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMouseScrollEvent)
|
||||
DOM_CLASSINFO_UI_EVENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(HTMLDocument, nsIDOMHTMLDocument)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLDocument)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSHTMLDocument)
|
||||
|
|
|
@ -246,49 +246,6 @@ nsDOMWindowUtils::SendMouseEvent(const nsAString& aType,
|
|||
return widget->DispatchEvent(&event, status);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::SendMouseScrollEvent(const nsAString& aType,
|
||||
PRInt32 aX,
|
||||
PRInt32 aY,
|
||||
PRInt32 aButton,
|
||||
PRInt32 aScrollFlags,
|
||||
PRInt32 aDelta,
|
||||
PRInt32 aModifiers)
|
||||
{
|
||||
PRBool hasCap = PR_FALSE;
|
||||
if (NS_FAILED(nsContentUtils::GetSecurityManager()->IsCapabilityEnabled("UniversalXPConnect", &hasCap))
|
||||
|| !hasCap)
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
|
||||
// get the widget to send the event to
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
if (!widget)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRInt32 msg;
|
||||
if (aType.EqualsLiteral("DOMMouseScroll"))
|
||||
msg = NS_MOUSE_SCROLL;
|
||||
else
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsMouseScrollEvent event(PR_TRUE, msg, widget);
|
||||
event.isShift = (aModifiers & nsIDOMNSEvent::SHIFT_MASK) ? PR_TRUE : PR_FALSE;
|
||||
event.isControl = (aModifiers & nsIDOMNSEvent::CONTROL_MASK) ? PR_TRUE : PR_FALSE;
|
||||
event.isAlt = (aModifiers & nsIDOMNSEvent::ALT_MASK) ? PR_TRUE : PR_FALSE;
|
||||
event.isMeta = (aModifiers & nsIDOMNSEvent::META_MASK) ? PR_TRUE : PR_FALSE;
|
||||
event.button = aButton;
|
||||
event.widget = widget;
|
||||
event.delta = aDelta;
|
||||
event.scrollFlags = aScrollFlags;
|
||||
|
||||
event.time = PR_IntervalNow();
|
||||
event.refPoint.x = aX;
|
||||
event.refPoint.y = aY;
|
||||
|
||||
nsEventStatus status;
|
||||
return widget->DispatchEvent(&event, status);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::SendKeyEvent(const nsAString& aType,
|
||||
PRInt32 aKeyCode,
|
||||
|
|
|
@ -187,7 +187,7 @@ function _parseModifiers(aEvent)
|
|||
* aOffsetY. This allows mouse clicks to be simulated by calling this method.
|
||||
*
|
||||
* aEvent is an object which may contain the properties:
|
||||
* shiftKey, ctrlKey, altKey, metaKey, accessKey, clickCount, button, type
|
||||
* shiftKey, ctrlKey, altKey, metaKey, accessKey, type
|
||||
*
|
||||
* If the type is specified, an mouse event of that type is fired. Otherwise,
|
||||
* a mousedown followed by a mouse up is performed.
|
||||
|
@ -221,59 +221,6 @@ function synthesizeMouse(aTarget, aOffsetX, aOffsetY, aEvent, aWindow)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Synthesize a mouse scroll event on a target. The actual client point is determined
|
||||
* by taking the aTarget's client box and offseting it by aOffsetX and
|
||||
* aOffsetY.
|
||||
*
|
||||
* aEvent is an object which may contain the properties:
|
||||
* shiftKey, ctrlKey, altKey, metaKey, accessKey, button, type, axis, units, delta
|
||||
*
|
||||
* If the type is specified, an mouse scroll event of that type is fired. Otherwise,
|
||||
* "DOMMouseScroll" is used.
|
||||
*
|
||||
* If the axis is specified, it must be one of "horizontal" or "vertical". If not specified,
|
||||
* "vertical" is used.
|
||||
*
|
||||
* 'delta' is the amount to scroll by (can be positive or negative). It must
|
||||
* be specified. 'units' is the units of 'delta', either "pixels" or "lines"; "lines"
|
||||
* is the default if 'units' is ommitted.
|
||||
*
|
||||
* aWindow is optional, and defaults to the current window object.
|
||||
*/
|
||||
function synthesizeMouseScroll(aTarget, aOffsetX, aOffsetY, aEvent, aWindow)
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
|
||||
if (!aWindow)
|
||||
aWindow = window;
|
||||
|
||||
var utils = aWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
|
||||
getInterface(Components.interfaces.nsIDOMWindowUtils);
|
||||
if (utils) {
|
||||
// See nsMouseScrollFlags in nsGUIEvent.h
|
||||
const kIsVertical = 0x02;
|
||||
const kIsHorizontal = 0x04;
|
||||
const kIsPixels = 0x08;
|
||||
|
||||
var button = aEvent.button || 0;
|
||||
var modifiers = _parseModifiers(aEvent);
|
||||
|
||||
var left = aTarget.boxObject.x;
|
||||
var top = aTarget.boxObject.y;
|
||||
|
||||
var type = aEvent.type || "DOMMouseScroll";
|
||||
var axis = aEvent.axis || "vertical";
|
||||
var units = aEvent.units || "lines";
|
||||
var scrollFlags = (axis == "horizontal") ? kIsHorizontal : kIsVertical;
|
||||
if (units == "pixels") {
|
||||
scrollFlags |= kIsPixels;
|
||||
}
|
||||
utils.sendMouseScrollEvent(type, left + aOffsetX, top + aOffsetY, button,
|
||||
scrollFlags, aEvent.delta, modifiers);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Synthesize a key event. It is targeted at whatever would be targeted by an
|
||||
* actual keypress by the user, typically the focused element.
|
||||
|
|
|
@ -101,7 +101,6 @@ _TEST_FILES = test_bug360220.xul \
|
|||
test_menu_hide.xul \
|
||||
test_focus.xul \
|
||||
test_tabindex.xul \
|
||||
test_mousescroll.xul \
|
||||
test_scrollbar.xul \
|
||||
test_sorttemplate.xul \
|
||||
$(NULL)
|
||||
|
|
|
@ -23,13 +23,6 @@ function testtag_tree(treeid, treerowinfoid, seltype, columnstype, testid)
|
|||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
// Stop keystrokes that aren't handled by the tree from leaking out and
|
||||
// scrolling the main Mochitests window!
|
||||
function preventDefault(event) {
|
||||
event.preventDefault();
|
||||
}
|
||||
document.addEventListener("keypress", preventDefault, false);
|
||||
|
||||
var multiple = (seltype == "multiple");
|
||||
var editable = false;
|
||||
|
||||
|
@ -100,10 +93,6 @@ function testtag_tree(treeid, treerowinfoid, seltype, columnstype, testid)
|
|||
// do the sorting tests last as it will cause the rows to rearrange
|
||||
testtag_tree_TreeView_rows_sort(tree, testid, rowInfo);
|
||||
|
||||
testtag_tree_mousescroll(tree);
|
||||
|
||||
document.removeEventListener("keypress", preventDefault, false);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
@ -1061,30 +1050,8 @@ function testtag_tree_column_reorder()
|
|||
checkColumns(tree, reference, "drag to itself");
|
||||
is(document.treecolDragging, null, "drag to itself completed");
|
||||
|
||||
// XXX roc should this be here???
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function testtag_tree_mousescroll(aTree)
|
||||
{
|
||||
function helper(aStart, aDelta)
|
||||
{
|
||||
aTree.treeBoxObject.scrollToRow(aStart);
|
||||
synthesizeMouseScroll(aTree.body, 1, 1,
|
||||
{type:"mousescroll", axis:"vertical", delta:aDelta});
|
||||
is(aTree.treeBoxObject.getFirstVisibleRow(), aStart + aDelta, "mouse-scroll vertical starting " + aStart + " delta " + aDelta);
|
||||
|
||||
aTree.treeBoxObject.scrollToRow(aStart);
|
||||
// Check that horizontal scrolling has no effect
|
||||
synthesizeMouseScroll(aTree.body, 1, 1,
|
||||
{type:"mousescroll", axis:"horizontal", delta:aDelta});
|
||||
is(aTree.treeBoxObject.getFirstVisibleRow(), aStart, "mouse-scroll horizontal starting " + aStart + " delta " + aDelta);
|
||||
}
|
||||
|
||||
helper(2, -1);
|
||||
helper(2, 1);
|
||||
helper(2, -2);
|
||||
helper(2, 2);
|
||||
}
|
||||
|
||||
function synthesizeColumnDrag(aTree, aMouseDownColumnNumber, aMouseUpColumnNumber, aAfter)
|
||||
|
|
|
@ -865,9 +865,6 @@
|
|||
<handlers>
|
||||
<handler event="DOMMouseScroll" phase="capturing">
|
||||
<![CDATA[
|
||||
if (event.axis == event.HORIZONTAL_AXIS)
|
||||
return;
|
||||
|
||||
var listBox = this.parentNode.listBoxObject;
|
||||
var rows = event.detail;
|
||||
if (rows == NSUIEvent.SCROLL_PAGE_UP)
|
||||
|
|
|
@ -360,18 +360,7 @@
|
|||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="DOMMouseScroll"><![CDATA[
|
||||
// prevent horizontal scrolling from scrolling a vertical scrollbox
|
||||
if (event.axis == event.HORIZONTAL_AXIS &&
|
||||
this.getAttribute("orient") != "horizontal")
|
||||
return;
|
||||
// We allow vertical scrolling to scroll a horizontal scrollbox
|
||||
// because many users have a vertical scroll wheel but no
|
||||
// horizontal support.
|
||||
|
||||
this.scrollByIndex(event.detail);
|
||||
event.stopPropagation();
|
||||
]]></handler>
|
||||
<handler event="DOMMouseScroll" action="this.scrollByIndex(event.detail); event.stopPropagation();"/>
|
||||
|
||||
<handler event="underflow"><![CDATA[
|
||||
// filter underflow events which were dispatched on nested scrollboxes
|
||||
|
|
|
@ -633,8 +633,6 @@
|
|||
<![CDATA[
|
||||
if (this._editingColumn)
|
||||
return;
|
||||
if (event.axis == event.HORIZONTAL_AXIS)
|
||||
return;
|
||||
|
||||
var rows = event.detail;
|
||||
if (rows == NSUIEvent.SCROLL_PAGE_UP)
|
||||
|
|
Загрузка…
Ссылка в новой задаче