2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; 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) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Mats Palmgren <mats.palmgren@bredband.net>
|
|
|
|
*
|
|
|
|
* 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 ***** */
|
|
|
|
|
|
|
|
#ifndef nsEventStateManager_h__
|
|
|
|
#define nsEventStateManager_h__
|
|
|
|
|
|
|
|
#include "nsIEventStateManager.h"
|
2009-04-01 14:59:02 -07:00
|
|
|
#include "nsEvent.h"
|
2009-08-13 13:54:09 -07:00
|
|
|
#include "nsGUIEvent.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIContent.h"
|
|
|
|
#include "nsIObserver.h"
|
|
|
|
#include "nsWeakReference.h"
|
|
|
|
#include "nsHashtable.h"
|
|
|
|
#include "nsITimer.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIDocument.h"
|
|
|
|
#include "nsCOMArray.h"
|
|
|
|
#include "nsIFrame.h"
|
2007-08-10 14:25:24 -07:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2007-10-30 12:13:37 -07:00
|
|
|
#include "nsIMarkupDocumentViewer.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class nsIScrollableView;
|
|
|
|
class nsIPresShell;
|
|
|
|
class nsIDocShell;
|
|
|
|
class nsIDocShellTreeNode;
|
|
|
|
class nsIDocShellTreeItem;
|
|
|
|
class nsIFocusController;
|
|
|
|
class imgIContainer;
|
2008-08-27 05:07:27 -07:00
|
|
|
class nsDOMDataTransfer;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// mac uses click-hold context menus, a holdover from 4.x
|
2008-11-17 18:08:34 -08:00
|
|
|
// touch screens (like hildon) could use this also,
|
|
|
|
// perhaps we should move to NS_TOUCHSCREEN
|
2009-04-16 09:03:18 -07:00
|
|
|
#if defined(XP_MACOSX) || defined(MOZ_PLATFORM_HILDON)
|
2007-03-22 10:30:00 -07:00
|
|
|
#define CLICK_HOLD_CONTEXT_MENUS 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Event listener manager
|
|
|
|
*/
|
|
|
|
|
|
|
|
class nsEventStateManager : public nsSupportsWeakReference,
|
|
|
|
public nsIEventStateManager,
|
|
|
|
public nsIObserver
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsEventStateManager();
|
|
|
|
virtual ~nsEventStateManager();
|
|
|
|
|
2007-08-10 14:25:24 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECL_NSIOBSERVER
|
|
|
|
|
|
|
|
NS_IMETHOD Init();
|
|
|
|
nsresult Shutdown();
|
|
|
|
|
|
|
|
/* The PreHandleEvent method is called before event dispatch to either
|
|
|
|
* the DOM or frames. Any processing which must not be prevented or
|
|
|
|
* cancelled should occur here. Any processing which is intended to
|
|
|
|
* be conditional based on either DOM or frame processing should occur in
|
|
|
|
* PostHandleEvent. Any centralized event processing which must occur before
|
|
|
|
* DOM or frame event handling should occur here as well.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD PreHandleEvent(nsPresContext* aPresContext,
|
|
|
|
nsEvent *aEvent,
|
|
|
|
nsIFrame* aTargetFrame,
|
|
|
|
nsEventStatus* aStatus,
|
|
|
|
nsIView* aView);
|
|
|
|
|
|
|
|
/* The PostHandleEvent method should contain all system processing which
|
|
|
|
* should occur conditionally based on DOM or frame processing. It should
|
|
|
|
* also contain any centralized event processing which must occur after
|
|
|
|
* DOM and frame processing.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD PostHandleEvent(nsPresContext* aPresContext,
|
|
|
|
nsEvent *aEvent,
|
|
|
|
nsIFrame* aTargetFrame,
|
|
|
|
nsEventStatus* aStatus,
|
|
|
|
nsIView* aView);
|
|
|
|
|
|
|
|
NS_IMETHOD NotifyDestroyPresContext(nsPresContext* aPresContext);
|
|
|
|
NS_IMETHOD SetPresContext(nsPresContext* aPresContext);
|
|
|
|
NS_IMETHOD ClearFrameRefs(nsIFrame* aFrame);
|
|
|
|
|
|
|
|
NS_IMETHOD GetEventTarget(nsIFrame **aFrame);
|
|
|
|
NS_IMETHOD GetEventTargetContent(nsEvent* aEvent, nsIContent** aContent);
|
|
|
|
|
|
|
|
NS_IMETHOD GetContentState(nsIContent *aContent, PRInt32& aState);
|
|
|
|
virtual PRBool SetContentState(nsIContent *aContent, PRInt32 aState);
|
Bug 178324, refactor focus by moving all focus handling into one place and simplifying it, add many tests, fixes many other bugs too numerous to mention in this small checkin comment, r=josh,smichaud,ere,dbaron,marco,neil,gavin,smaug,sr=smaug (CLOSED TREE)
2009-06-10 11:00:39 -07:00
|
|
|
NS_IMETHOD ContentRemoved(nsIDocument* aDocument, nsIContent* aContent);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD EventStatusOK(nsGUIEvent* aEvent, PRBool *aOK);
|
|
|
|
|
|
|
|
// Access Key Registration
|
|
|
|
NS_IMETHOD RegisterAccessKey(nsIContent* aContent, PRUint32 aKey);
|
|
|
|
NS_IMETHOD UnregisterAccessKey(nsIContent* aContent, PRUint32 aKey);
|
2007-08-28 23:52:46 -07:00
|
|
|
NS_IMETHOD GetRegisteredAccessKey(nsIContent* aContent, PRUint32* aKey);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
NS_IMETHOD SetCursor(PRInt32 aCursor, imgIContainer* aContainer,
|
|
|
|
PRBool aHaveHotspot, float aHotspotX, float aHotspotY,
|
|
|
|
nsIWidget* aWidget, PRBool aLockCursor);
|
|
|
|
|
|
|
|
static void StartHandlingUserInput()
|
|
|
|
{
|
|
|
|
++sUserInputEventDepth;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void StopHandlingUserInput()
|
|
|
|
{
|
|
|
|
--sUserInputEventDepth;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PRBool IsHandlingUserInput()
|
|
|
|
{
|
|
|
|
return sUserInputEventDepth > 0;
|
|
|
|
}
|
|
|
|
|
2007-08-10 18:44:44 -07:00
|
|
|
NS_IMETHOD_(PRBool) IsHandlingUserInputExternal() { return IsHandlingUserInput(); }
|
|
|
|
|
2007-08-10 14:25:24 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsEventStateManager,
|
|
|
|
nsIEventStateManager)
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
void UpdateCursor(nsPresContext* aPresContext, nsEvent* aEvent, nsIFrame* aTargetFrame, nsEventStatus* aStatus);
|
|
|
|
/**
|
|
|
|
* Turn a GUI mouse event into a mouse event targeted at the specified
|
|
|
|
* content. This returns the primary frame for the content (or null
|
|
|
|
* if it goes away during the event).
|
|
|
|
*/
|
|
|
|
nsIFrame* DispatchMouseEvent(nsGUIEvent* aEvent, PRUint32 aMessage,
|
|
|
|
nsIContent* aTargetContent,
|
|
|
|
nsIContent* aRelatedContent);
|
|
|
|
/**
|
|
|
|
* Synthesize DOM and frame mouseover and mouseout events from this
|
|
|
|
* MOUSE_MOVE or MOUSE_EXIT event.
|
|
|
|
*/
|
|
|
|
void GenerateMouseEnterExit(nsGUIEvent* aEvent);
|
|
|
|
/**
|
|
|
|
* Tell this ESM and ESMs in parent documents that the mouse is
|
|
|
|
* over some content in this document.
|
|
|
|
*/
|
|
|
|
void NotifyMouseOver(nsGUIEvent* aEvent, nsIContent* aContent);
|
|
|
|
/**
|
|
|
|
* Tell this ESM and ESMs in affected child documents that the mouse
|
|
|
|
* has exited this document's currently hovered content.
|
|
|
|
* @param aEvent the event that triggered the mouseout
|
|
|
|
* @param aMovingInto the content node we've moved into. This is used to set
|
|
|
|
* the relatedTarget for mouseout events. Also, if it's non-null
|
|
|
|
* NotifyMouseOut will NOT change the current hover content to null;
|
|
|
|
* in that case the caller is responsible for updating hover state.
|
|
|
|
*/
|
|
|
|
void NotifyMouseOut(nsGUIEvent* aEvent, nsIContent* aMovingInto);
|
|
|
|
void GenerateDragDropEnterExit(nsPresContext* aPresContext, nsGUIEvent* aEvent);
|
2007-04-11 21:37:39 -07:00
|
|
|
/**
|
|
|
|
* Fire the dragenter and dragexit/dragleave events when the mouse moves to a
|
|
|
|
* new target.
|
|
|
|
*
|
|
|
|
* @param aRelatedTarget relatedTarget to set for the event
|
|
|
|
* @param aTargetContent target to set for the event
|
|
|
|
* @param aTargetFrame target frame for the event
|
|
|
|
*/
|
|
|
|
void FireDragEnterOrExit(nsPresContext* aPresContext,
|
|
|
|
nsGUIEvent* aEvent,
|
|
|
|
PRUint32 aMsg,
|
|
|
|
nsIContent* aRelatedTarget,
|
|
|
|
nsIContent* aTargetContent,
|
|
|
|
nsWeakFrame& aTargetFrame);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult SetClickCount(nsPresContext* aPresContext, nsMouseEvent *aEvent, nsEventStatus* aStatus);
|
|
|
|
nsresult CheckForAndDispatchClick(nsPresContext* aPresContext, nsMouseEvent *aEvent, nsEventStatus* aStatus);
|
|
|
|
void EnsureDocument(nsPresContext* aPresContext);
|
|
|
|
void FlushPendingEvents(nsPresContext* aPresContext);
|
|
|
|
|
2007-05-17 20:49:14 -07:00
|
|
|
/**
|
|
|
|
* The phases of HandleAccessKey processing. See below.
|
|
|
|
*/
|
2007-03-22 10:30:00 -07:00
|
|
|
typedef enum {
|
|
|
|
eAccessKeyProcessingNormal = 0,
|
|
|
|
eAccessKeyProcessingUp,
|
|
|
|
eAccessKeyProcessingDown
|
|
|
|
} ProcessingAccessKeyState;
|
2007-05-17 20:49:14 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Access key handling. If there is registered content for the accesskey
|
|
|
|
* given by the key event and modifier mask then call
|
|
|
|
* content.PerformAccesskey(), otherwise call HandleAccessKey() recursively,
|
|
|
|
* on descendant docshells first, then on the ancestor (with |aBubbledFrom|
|
|
|
|
* set to the docshell associated with |this|), until something matches.
|
|
|
|
*
|
|
|
|
* @param aPresContext the presentation context
|
|
|
|
* @param aEvent the key event
|
|
|
|
* @param aStatus the event status
|
|
|
|
* @param aBubbledFrom is used by an ancestor to avoid calling HandleAccessKey()
|
|
|
|
* on the child the call originally came from, i.e. this is the child
|
2009-01-23 01:02:09 -08:00
|
|
|
* that recursively called us in its Up phase. The initial caller
|
2007-05-17 20:49:14 -07:00
|
|
|
* passes |nsnull| here. This is to avoid an infinite loop.
|
|
|
|
* @param aAccessKeyState Normal, Down or Up processing phase (see enums
|
2008-08-25 23:53:00 -07:00
|
|
|
* above). The initial event receiver uses 'normal', then 'down' when
|
2007-05-17 20:49:14 -07:00
|
|
|
* processing children and Up when recursively calling its ancestor.
|
|
|
|
* @param aModifierMask modifier mask for the key event
|
|
|
|
*/
|
2007-03-22 10:30:00 -07:00
|
|
|
void HandleAccessKey(nsPresContext* aPresContext,
|
|
|
|
nsKeyEvent* aEvent,
|
|
|
|
nsEventStatus* aStatus,
|
2007-05-17 20:49:14 -07:00
|
|
|
nsIDocShellTreeItem* aBubbledFrom,
|
2007-03-22 10:30:00 -07:00
|
|
|
ProcessingAccessKeyState aAccessKeyState,
|
|
|
|
PRInt32 aModifierMask);
|
|
|
|
|
2008-04-14 21:16:24 -07:00
|
|
|
PRBool ExecuteAccessKey(nsTArray<PRUint32>& aAccessCharCodes,
|
|
|
|
PRBool aIsTrustedEvent);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
//---------------------------------------------
|
|
|
|
// DocShell Focus Traversal Methods
|
|
|
|
//---------------------------------------------
|
|
|
|
|
Bug 178324, refactor focus by moving all focus handling into one place and simplifying it, add many tests, fixes many other bugs too numerous to mention in this small checkin comment, r=josh,smichaud,ere,dbaron,marco,neil,gavin,smaug,sr=smaug (CLOSED TREE)
2009-06-10 11:00:39 -07:00
|
|
|
nsIContent* GetFocusedContent();
|
2007-03-22 10:30:00 -07:00
|
|
|
PRBool IsShellVisible(nsIDocShell* aShell);
|
|
|
|
|
2009-04-02 12:34:31 -07:00
|
|
|
// These functions are for mousewheel and pixel scrolling
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult GetParentScrollingView(nsInputEvent* aEvent,
|
|
|
|
nsPresContext* aPresContext,
|
|
|
|
nsIFrame* &targetOuterFrame,
|
|
|
|
nsPresContext* &presCtxOuter);
|
2009-04-02 12:34:31 -07:00
|
|
|
void SendLineScrollEvent(nsIFrame* aTargetFrame,
|
|
|
|
nsMouseScrollEvent* aEvent,
|
|
|
|
nsPresContext* aPresContext,
|
|
|
|
nsEventStatus* aStatus,
|
|
|
|
PRInt32 aNumLines);
|
2008-09-17 04:27:19 -07:00
|
|
|
void SendPixelScrollEvent(nsIFrame* aTargetFrame,
|
|
|
|
nsMouseScrollEvent* aEvent,
|
|
|
|
nsPresContext* aPresContext,
|
|
|
|
nsEventStatus* aStatus);
|
2007-03-22 10:30:00 -07:00
|
|
|
typedef enum {
|
|
|
|
eScrollByPixel,
|
|
|
|
eScrollByLine,
|
|
|
|
eScrollByPage
|
|
|
|
} ScrollQuantity;
|
|
|
|
nsresult DoScrollText(nsPresContext* aPresContext,
|
|
|
|
nsIFrame* aTargetFrame,
|
2009-05-19 19:05:59 -07:00
|
|
|
nsMouseScrollEvent* aMouseEvent,
|
2007-03-22 10:30:00 -07:00
|
|
|
ScrollQuantity aScrollQuantity);
|
|
|
|
void DoScrollHistory(PRInt32 direction);
|
2008-02-13 03:00:45 -08:00
|
|
|
void DoScrollZoom(nsIFrame *aTargetFrame, PRInt32 adjustment);
|
2007-10-30 12:13:37 -07:00
|
|
|
nsresult GetMarkupDocumentViewer(nsIMarkupDocumentViewer** aMv);
|
|
|
|
nsresult ChangeTextSize(PRInt32 change);
|
2007-10-25 16:02:20 -07:00
|
|
|
nsresult ChangeFullZoom(PRInt32 change);
|
2007-03-22 10:30:00 -07:00
|
|
|
// end mousewheel functions
|
|
|
|
|
2009-08-13 13:54:09 -07:00
|
|
|
/*
|
|
|
|
* When a touch gesture is about to start, this function determines what
|
|
|
|
* kind of gesture interaction we will want to use, based on what is
|
|
|
|
* underneath the initial touch point.
|
|
|
|
* Currently it decides between panning (finger scrolling) or dragging
|
|
|
|
* the target element, as well as the orientation to trigger panning and
|
|
|
|
* display visual boundary feedback. The decision is stored back in aEvent.
|
|
|
|
*/
|
|
|
|
void DecideGestureEvent(nsGestureNotifyEvent* aEvent, nsIFrame* targetFrame);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// routines for the d&d gesture tracking state machine
|
|
|
|
void BeginTrackingDragGesture ( nsPresContext* aPresContext, nsMouseEvent* inDownEvent,
|
|
|
|
nsIFrame* inDownFrame ) ;
|
|
|
|
void StopTrackingDragGesture ( ) ;
|
|
|
|
void GenerateDragGesture ( nsPresContext* aPresContext, nsMouseEvent *aEvent ) ;
|
2008-08-27 05:07:27 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Determine which node the drag should be targeted at.
|
|
|
|
* This is either the node clicked when there is a selection, or, for HTML,
|
|
|
|
* the element with a draggable property set to true.
|
|
|
|
*
|
|
|
|
* aSelectionTarget - target to check for selection
|
|
|
|
* aDataTransfer - data transfer object that will contain the data to drag
|
|
|
|
* aIsSelection - [out] set to true if a selection is being dragged
|
2008-09-25 07:45:03 -07:00
|
|
|
* aIsInEditor - [out] set to true if the content is in an editor field
|
2008-08-27 05:07:27 -07:00
|
|
|
* aTargetNode - [out] the draggable node, or null if there isn't one
|
|
|
|
*/
|
|
|
|
void DetermineDragTarget(nsPresContext* aPresContext,
|
|
|
|
nsIContent* aSelectionTarget,
|
|
|
|
nsDOMDataTransfer* aDataTransfer,
|
|
|
|
PRBool* aIsSelection,
|
2008-09-25 07:45:03 -07:00
|
|
|
PRBool* aIsInEditor,
|
2008-08-27 05:07:27 -07:00
|
|
|
nsIContent** aTargetNode);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Perform the default handling for the dragstart/draggesture event and set up a
|
|
|
|
* drag for aDataTransfer if it contains any data.
|
|
|
|
*
|
|
|
|
* aDragEvent - the dragstart/draggesture event
|
|
|
|
* aDataTransfer - the data transfer that holds the data to be dragged
|
|
|
|
* aDragTarget - the target of the drag
|
|
|
|
* aIsSelection - true if a selection is being dragged
|
|
|
|
*/
|
|
|
|
void DoDefaultDragStart(nsPresContext* aPresContext,
|
|
|
|
nsDragEvent* aDragEvent,
|
|
|
|
nsDOMDataTransfer* aDataTransfer,
|
|
|
|
nsIContent* aDragTarget,
|
|
|
|
PRBool aIsSelection);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
PRBool IsTrackingDragGesture ( ) const { return mGestureDownContent != nsnull; }
|
|
|
|
/**
|
|
|
|
* Set the fields of aEvent to reflect the mouse position and modifier keys
|
|
|
|
* that were set when the user first pressed the mouse button (stored by
|
|
|
|
* BeginTrackingDragGesture). aEvent->widget must be
|
|
|
|
* mCurrentTarget->GetWindow().
|
|
|
|
*/
|
|
|
|
void FillInEventFromGestureDown(nsMouseEvent* aEvent);
|
|
|
|
|
2009-08-07 08:11:17 -07:00
|
|
|
nsresult DoContentCommandEvent(nsContentCommandEvent* aEvent);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
PRInt32 mLockCursor;
|
|
|
|
|
|
|
|
nsWeakFrame mCurrentTarget;
|
|
|
|
nsCOMPtr<nsIContent> mCurrentTargetContent;
|
|
|
|
nsWeakFrame mLastMouseOverFrame;
|
|
|
|
nsCOMPtr<nsIContent> mLastMouseOverElement;
|
|
|
|
nsWeakFrame mLastDragOverFrame;
|
|
|
|
|
|
|
|
// member variables for the d&d gesture state machine
|
2009-01-14 19:27:09 -08:00
|
|
|
nsIntPoint mGestureDownPoint; // screen coordinates
|
2007-03-22 10:30:00 -07:00
|
|
|
// The content to use as target if we start a d&d (what we drag).
|
|
|
|
nsCOMPtr<nsIContent> mGestureDownContent;
|
|
|
|
// The content of the frame where the mouse-down event occurred. It's the same
|
|
|
|
// as the target in most cases but not always - for example when dragging
|
|
|
|
// an <area> of an image map this is the image. (bug 289667)
|
|
|
|
nsCOMPtr<nsIContent> mGestureDownFrameOwner;
|
|
|
|
// State of keys when the original gesture-down happened
|
|
|
|
PRPackedBool mGestureDownShift;
|
|
|
|
PRPackedBool mGestureDownControl;
|
|
|
|
PRPackedBool mGestureDownAlt;
|
|
|
|
PRPackedBool mGestureDownMeta;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIContent> mLastLeftMouseDownContent;
|
|
|
|
nsCOMPtr<nsIContent> mLastMiddleMouseDownContent;
|
|
|
|
nsCOMPtr<nsIContent> mLastRightMouseDownContent;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIContent> mActiveContent;
|
|
|
|
nsCOMPtr<nsIContent> mHoverContent;
|
|
|
|
nsCOMPtr<nsIContent> mDragOverContent;
|
|
|
|
nsCOMPtr<nsIContent> mURLTargetContent;
|
|
|
|
|
|
|
|
// The last element on which we fired a mouseover event, or null if
|
|
|
|
// the last mouseover event we fired has finished processing.
|
|
|
|
nsCOMPtr<nsIContent> mFirstMouseOverEventElement;
|
|
|
|
|
|
|
|
// The last element on which we fired a mouseout event, or null if
|
|
|
|
// the last mouseout event we fired has finished processing.
|
|
|
|
nsCOMPtr<nsIContent> mFirstMouseOutEventElement;
|
|
|
|
|
|
|
|
nsPresContext* mPresContext; // Not refcnted
|
|
|
|
nsCOMPtr<nsIDocument> mDocument; // Doesn't necessarily need to be owner
|
|
|
|
|
|
|
|
PRUint32 mLClickCount;
|
|
|
|
PRUint32 mMClickCount;
|
|
|
|
PRUint32 mRClickCount;
|
|
|
|
|
|
|
|
PRPackedBool mNormalLMouseEventInProcess;
|
|
|
|
|
|
|
|
PRPackedBool m_haveShutdown;
|
|
|
|
|
2007-11-28 12:14:12 -08:00
|
|
|
// Array for accesskey support
|
|
|
|
nsCOMArray<nsIContent> mAccessKeys;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-09-17 04:27:19 -07:00
|
|
|
// Unlocks pixel scrolling
|
|
|
|
PRPackedBool mLastLineScrollConsumedX;
|
|
|
|
PRPackedBool mLastLineScrollConsumedY;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#ifdef CLICK_HOLD_CONTEXT_MENUS
|
|
|
|
enum { kClickHoldDelay = 500 } ; // 500ms == 1/2 second
|
|
|
|
|
|
|
|
void CreateClickHoldTimer ( nsPresContext* aPresContext, nsIFrame* inDownFrame,
|
|
|
|
nsGUIEvent* inMouseDownEvent ) ;
|
|
|
|
void KillClickHoldTimer ( ) ;
|
|
|
|
void FireContextClick ( ) ;
|
|
|
|
static void sClickHoldCallback ( nsITimer* aTimer, void* aESM ) ;
|
|
|
|
|
|
|
|
nsCOMPtr<nsITimer> mClickHoldTimer;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static PRInt32 sUserInputEventDepth;
|
|
|
|
};
|
|
|
|
|
2009-09-10 09:11:41 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsAutoHandlingUserInputStatePusher
|
|
|
|
{
|
|
|
|
public:
|
2009-09-10 09:11:41 -07:00
|
|
|
nsAutoHandlingUserInputStatePusher(PRBool aIsHandlingUserInput)
|
|
|
|
: mIsHandlingUserInput(aIsHandlingUserInput)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
if (aIsHandlingUserInput) {
|
|
|
|
nsEventStateManager::StartHandlingUserInput();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
~nsAutoHandlingUserInputStatePusher()
|
|
|
|
{
|
|
|
|
if (mIsHandlingUserInput) {
|
|
|
|
nsEventStateManager::StopHandlingUserInput();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
PRBool mIsHandlingUserInput;
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Hide so that this class can only be stack-allocated
|
|
|
|
static void* operator new(size_t /*size*/) CPP_THROW_NEW { return nsnull; }
|
|
|
|
static void operator delete(void* /*memory*/) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsEventStateManager_h__
|