2001-09-25 01:32:19 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-17 21:52:36 +00:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1998-06-23 21:53:02 +00:00
|
|
|
*
|
2004-04-17 21:52:36 +00:00
|
|
|
* 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/
|
1998-06-23 21:53:02 +00:00
|
|
|
*
|
2001-09-25 01:32:19 +00:00
|
|
|
* 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.
|
1998-06-23 21:53:02 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-17 21:52:36 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-25 01:32:19 +00:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 03:40:37 +00:00
|
|
|
*
|
2001-09-25 01:32:19 +00:00
|
|
|
* Contributor(s):
|
2005-06-28 21:40:15 +00:00
|
|
|
* Mats Palmgren <mats.palmgren@bredband.net>
|
2001-09-25 01:32:19 +00:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-17 21:52:36 +00:00
|
|
|
* 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"),
|
2001-09-25 01:32:19 +00:00
|
|
|
* 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
|
2004-04-17 21:52:36 +00:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-25 01:32:19 +00:00
|
|
|
* 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
|
2004-04-17 21:52:36 +00:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-25 01:32:19 +00:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1998-06-23 21:53:02 +00:00
|
|
|
|
|
|
|
#ifndef nsEventStateManager_h__
|
|
|
|
#define nsEventStateManager_h__
|
|
|
|
|
|
|
|
#include "nsIEventStateManager.h"
|
1998-11-18 05:25:26 +00:00
|
|
|
#include "nsGUIEvent.h"
|
2000-02-11 02:38:20 +00:00
|
|
|
#include "nsIContent.h"
|
2000-03-15 04:03:44 +00:00
|
|
|
#include "nsIObserver.h"
|
2000-05-09 19:04:13 +00:00
|
|
|
#include "nsWeakReference.h"
|
2000-05-16 11:36:34 +00:00
|
|
|
#include "nsHashtable.h"
|
2001-03-30 04:45:40 +00:00
|
|
|
#include "nsITimer.h"
|
2003-07-03 20:34:52 +00:00
|
|
|
#include "nsCOMPtr.h"
|
2002-12-17 02:10:57 +00:00
|
|
|
#include "nsIDocument.h"
|
2003-03-17 23:08:36 +00:00
|
|
|
#include "nsCOMArray.h"
|
2000-03-15 04:03:44 +00:00
|
|
|
|
1999-04-30 19:38:39 +00:00
|
|
|
class nsIScrollableView;
|
2000-06-28 20:35:32 +00:00
|
|
|
class nsIPresShell;
|
2001-05-22 23:52:17 +00:00
|
|
|
class nsIDocShell;
|
2001-10-22 22:43:52 +00:00
|
|
|
class nsIDocShellTreeNode;
|
|
|
|
class nsIDocShellTreeItem;
|
2002-09-06 00:19:58 +00:00
|
|
|
class nsIFocusController;
|
2004-12-30 21:56:11 +00:00
|
|
|
class imgIContainer;
|
2001-03-30 04:45:40 +00:00
|
|
|
|
|
|
|
// mac uses click-hold context menus, a holdover from 4.x
|
2001-11-10 23:30:13 +00:00
|
|
|
#if defined(XP_MAC) || defined(XP_MACOSX)
|
2001-03-30 04:45:40 +00:00
|
|
|
#define CLICK_HOLD_CONTEXT_MENUS 1
|
|
|
|
#endif
|
|
|
|
|
1998-11-18 05:25:26 +00:00
|
|
|
|
1998-06-23 21:53:02 +00:00
|
|
|
/*
|
|
|
|
* Event listener manager
|
|
|
|
*/
|
|
|
|
|
2000-05-09 19:04:13 +00:00
|
|
|
class nsEventStateManager : public nsSupportsWeakReference,
|
|
|
|
public nsIEventStateManager,
|
2000-03-15 04:03:44 +00:00
|
|
|
public nsIObserver
|
|
|
|
{
|
1998-06-23 21:53:02 +00:00
|
|
|
public:
|
|
|
|
nsEventStateManager();
|
|
|
|
virtual ~nsEventStateManager();
|
|
|
|
|
1998-08-13 23:37:54 +00:00
|
|
|
NS_DECL_ISUPPORTS
|
2000-03-15 04:03:44 +00:00
|
|
|
NS_DECL_NSIOBSERVER
|
|
|
|
|
2000-03-15 04:29:00 +00:00
|
|
|
NS_IMETHOD Init();
|
2000-03-15 04:03:44 +00:00
|
|
|
nsresult Shutdown();
|
1998-06-23 21:53:02 +00:00
|
|
|
|
1999-12-04 02:22:21 +00:00
|
|
|
/* 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.
|
|
|
|
*/
|
2004-07-31 23:15:21 +00:00
|
|
|
NS_IMETHOD PreHandleEvent(nsPresContext* aPresContext,
|
2000-04-24 04:41:27 +00:00
|
|
|
nsEvent *aEvent,
|
1998-11-24 07:46:58 +00:00
|
|
|
nsIFrame* aTargetFrame,
|
1999-11-24 06:03:41 +00:00
|
|
|
nsEventStatus* aStatus,
|
1999-06-15 03:14:28 +00:00
|
|
|
nsIView* aView);
|
1998-11-24 07:46:58 +00:00
|
|
|
|
1999-12-04 02:22:21 +00:00
|
|
|
/* 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.
|
|
|
|
*/
|
2004-07-31 23:15:21 +00:00
|
|
|
NS_IMETHOD PostHandleEvent(nsPresContext* aPresContext,
|
2002-02-20 07:22:55 +00:00
|
|
|
nsEvent *aEvent,
|
|
|
|
nsIFrame* aTargetFrame,
|
|
|
|
nsEventStatus* aStatus,
|
|
|
|
nsIView* aView);
|
1998-11-18 05:25:26 +00:00
|
|
|
|
2006-04-11 16:37:58 +00:00
|
|
|
NS_IMETHOD NotifyDestroyPresContext(nsPresContext* aPresContext);
|
2004-07-31 23:15:21 +00:00
|
|
|
NS_IMETHOD SetPresContext(nsPresContext* aPresContext);
|
1998-11-19 00:43:36 +00:00
|
|
|
NS_IMETHOD ClearFrameRefs(nsIFrame* aFrame);
|
1998-06-23 21:53:02 +00:00
|
|
|
|
1998-11-18 05:25:26 +00:00
|
|
|
NS_IMETHOD GetEventTarget(nsIFrame **aFrame);
|
1999-12-08 04:54:29 +00:00
|
|
|
NS_IMETHOD GetEventTargetContent(nsEvent* aEvent, nsIContent** aContent);
|
1998-08-07 04:45:03 +00:00
|
|
|
|
1999-03-28 22:22:54 +00:00
|
|
|
NS_IMETHOD GetContentState(nsIContent *aContent, PRInt32& aState);
|
2005-08-24 19:06:07 +00:00
|
|
|
virtual PRBool SetContentState(nsIContent *aContent, PRInt32 aState);
|
1999-07-26 15:02:19 +00:00
|
|
|
NS_IMETHOD GetFocusedContent(nsIContent **aContent);
|
1999-12-08 04:54:29 +00:00
|
|
|
NS_IMETHOD SetFocusedContent(nsIContent* aContent);
|
2005-06-24 04:25:43 +00:00
|
|
|
NS_IMETHOD GetLastFocusedContent(nsIContent **aContent);
|
2003-03-18 23:41:44 +00:00
|
|
|
NS_IMETHOD GetFocusedFrame(nsIFrame **aFrame);
|
2001-11-29 00:04:31 +00:00
|
|
|
NS_IMETHOD ContentRemoved(nsIContent* aContent);
|
2002-02-20 07:22:55 +00:00
|
|
|
NS_IMETHOD EventStatusOK(nsGUIEvent* aEvent, PRBool *aOK);
|
1999-03-02 19:19:24 +00:00
|
|
|
|
2000-02-09 15:14:55 +00:00
|
|
|
// Access Key Registration
|
2002-05-22 00:14:51 +00:00
|
|
|
NS_IMETHOD RegisterAccessKey(nsIContent* aContent, PRUint32 aKey);
|
|
|
|
NS_IMETHOD UnregisterAccessKey(nsIContent* aContent, PRUint32 aKey);
|
2000-02-09 15:14:55 +00:00
|
|
|
|
2005-07-01 04:29:42 +00:00
|
|
|
NS_IMETHOD SetCursor(PRInt32 aCursor, imgIContainer* aContainer,
|
|
|
|
PRBool aHaveHotspot, float aHotspotX, float aHotspotY,
|
|
|
|
nsIWidget* aWidget, PRBool aLockCursor);
|
2000-04-24 04:41:27 +00:00
|
|
|
|
2002-02-01 05:14:44 +00:00
|
|
|
NS_IMETHOD ShiftFocus(PRBool aForward, nsIContent* aStart=nsnull);
|
2001-05-22 23:52:17 +00:00
|
|
|
|
2004-04-29 23:34:19 +00:00
|
|
|
virtual PRBool GetBrowseWithCaret();
|
|
|
|
void ResetBrowseWithCaret();
|
Fixes bug 66597, bug 103284, bug 114440, bug 120023, bug 128741, bug 19259. Cleans up browse with caret, makes it work with XML content docs, creates keyboard toggle for it (Accel+shift+K), synchronizes focus and document selection so that users can tab navigate relative to their last find or click in text, or vice versa, makes tabbing move relative to named anchor that has been jumped to. r=bryner, sr=alecf, a=asa
2002-03-10 06:21:48 +00:00
|
|
|
|
|
|
|
NS_IMETHOD MoveFocusToCaret(PRBool aCanFocusDoc, PRBool *aIsSelectionWithFocus);
|
|
|
|
NS_IMETHOD MoveCaretToFocus();
|
2004-10-29 13:40:25 +00:00
|
|
|
NS_IMETHOD ChangeFocusWith(nsIContent* aFocus, EFocusedWithType aFocusedWith);
|
Fixes bug 66597, bug 103284, bug 114440, bug 120023, bug 128741, bug 19259. Cleans up browse with caret, makes it work with XML content docs, creates keyboard toggle for it (Accel+shift+K), synchronizes focus and document selection so that users can tab navigate relative to their last find or click in text, or vice versa, makes tabbing move relative to named anchor that has been jumped to. r=bryner, sr=alecf, a=asa
2002-03-10 06:21:48 +00:00
|
|
|
|
2004-09-04 19:28:46 +00:00
|
|
|
static void StartHandlingUserInput()
|
|
|
|
{
|
|
|
|
++sUserInputEventDepth;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void StopHandlingUserInput()
|
|
|
|
{
|
|
|
|
--sUserInputEventDepth;
|
|
|
|
}
|
|
|
|
|
|
|
|
static PRBool IsHandlingUserInput()
|
|
|
|
{
|
|
|
|
return sUserInputEventDepth > 0;
|
|
|
|
}
|
|
|
|
|
1998-06-23 21:53:02 +00:00
|
|
|
protected:
|
2005-08-16 17:54:29 +00:00
|
|
|
/**
|
|
|
|
* In certain situations the focus controller's concept of focus gets out of
|
|
|
|
* whack with mCurrentFocus. This is used in known cases to reset the focus
|
|
|
|
* controller's focus. At some point we should probably move to a single
|
|
|
|
* focus storage mechanism because tracking it in several places is error-prone.
|
|
|
|
*/
|
|
|
|
void EnsureFocusSynchronization();
|
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
void UpdateCursor(nsPresContext* aPresContext, nsEvent* aEvent, nsIFrame* aTargetFrame, nsEventStatus* aStatus);
|
2002-12-18 07:13:51 +00:00
|
|
|
/**
|
|
|
|
* Turn a GUI mouse event into a mouse event targeted at the specified
|
2005-03-28 23:39:13 +00:00
|
|
|
* content. This returns the primary frame for the content (or null
|
|
|
|
* if it goes away during the event).
|
2002-12-18 07:13:51 +00:00
|
|
|
*/
|
2005-03-28 23:39:13 +00:00
|
|
|
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.
|
2005-05-03 16:05:48 +00:00
|
|
|
* @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.
|
2005-03-28 23:39:13 +00:00
|
|
|
*/
|
2005-04-07 00:19:08 +00:00
|
|
|
void NotifyMouseOut(nsGUIEvent* aEvent, nsIContent* aMovingInto);
|
2004-07-31 23:15:21 +00:00
|
|
|
void GenerateDragDropEnterExit(nsPresContext* aPresContext, nsGUIEvent* aEvent);
|
|
|
|
nsresult SetClickCount(nsPresContext* aPresContext, nsMouseEvent *aEvent, nsEventStatus* aStatus);
|
|
|
|
nsresult CheckForAndDispatchClick(nsPresContext* aPresContext, nsMouseEvent *aEvent, nsEventStatus* aStatus);
|
2004-04-13 10:27:50 +00:00
|
|
|
nsresult GetNextTabbableContent(nsIContent* aRootContent,
|
|
|
|
nsIContent* aStartContent,
|
|
|
|
nsIFrame* aStartFrame,
|
2003-03-18 23:41:44 +00:00
|
|
|
PRBool forward, PRBool ignoreTabIndex,
|
|
|
|
nsIContent** aResultNode,
|
|
|
|
nsIFrame** aResultFrame);
|
2004-07-24 21:12:43 +00:00
|
|
|
nsIContent *GetNextTabbableMapArea(PRBool aForward, nsIContent *imageContent);
|
2001-05-22 23:52:17 +00:00
|
|
|
|
1999-03-02 19:19:24 +00:00
|
|
|
PRInt32 GetNextTabIndex(nsIContent* aParent, PRBool foward);
|
2004-07-31 23:15:21 +00:00
|
|
|
nsresult SendFocusBlur(nsPresContext* aPresContext, nsIContent *aContent, PRBool aEnsureWindowHasFocus);
|
2000-06-28 20:35:32 +00:00
|
|
|
void EnsureDocument(nsIPresShell* aPresShell);
|
2004-07-31 23:15:21 +00:00
|
|
|
void EnsureDocument(nsPresContext* aPresContext);
|
|
|
|
void FlushPendingEvents(nsPresContext* aPresContext);
|
2004-05-03 21:48:36 +00:00
|
|
|
nsIFocusController* GetFocusControllerForDocument(nsIDocument* aDocument);
|
1999-11-21 01:46:41 +00:00
|
|
|
|
2002-09-03 05:48:06 +00:00
|
|
|
typedef enum {
|
|
|
|
eAccessKeyProcessingNormal = 0,
|
|
|
|
eAccessKeyProcessingUp,
|
|
|
|
eAccessKeyProcessingDown
|
|
|
|
} ProcessingAccessKeyState;
|
2006-07-13 10:18:12 +00:00
|
|
|
void HandleAccessKey(nsPresContext* aPresContext,
|
|
|
|
nsKeyEvent* aEvent,
|
|
|
|
nsEventStatus* aStatus,
|
|
|
|
PRInt32 aChildOffset,
|
|
|
|
ProcessingAccessKeyState aAccessKeyState,
|
|
|
|
PRInt32 aModifierMask);
|
2002-09-03 05:48:06 +00:00
|
|
|
|
2001-05-22 23:52:17 +00:00
|
|
|
//---------------------------------------------
|
|
|
|
// DocShell Focus Traversal Methods
|
|
|
|
//---------------------------------------------
|
|
|
|
|
2002-02-01 05:14:44 +00:00
|
|
|
nsresult ShiftFocusInternal(PRBool aForward, nsIContent* aStart = nsnull);
|
2001-10-22 22:43:52 +00:00
|
|
|
void TabIntoDocument(nsIDocShell* aDocShell, PRBool aForward);
|
|
|
|
void ShiftFocusByDoc(PRBool forward);
|
|
|
|
PRBool IsFrameSetDoc(nsIDocShell* aDocShell);
|
|
|
|
PRBool IsIFrameDoc(nsIDocShell* aDocShell);
|
|
|
|
PRBool IsShellVisible(nsIDocShell* aShell);
|
|
|
|
void GetLastChildDocShell(nsIDocShellTreeItem* aItem,
|
|
|
|
nsIDocShellTreeItem** aResult);
|
|
|
|
void GetNextDocShell(nsIDocShellTreeNode* aNode,
|
|
|
|
nsIDocShellTreeItem** aResult);
|
|
|
|
void GetPrevDocShell(nsIDocShellTreeNode* aNode,
|
|
|
|
nsIDocShellTreeItem** aResult);
|
2001-05-22 23:52:17 +00:00
|
|
|
|
2000-06-28 20:35:32 +00:00
|
|
|
// These functions are for mousewheel scrolling
|
2004-04-19 15:48:14 +00:00
|
|
|
nsresult GetParentScrollingView(nsInputEvent* aEvent,
|
2004-07-31 23:15:21 +00:00
|
|
|
nsPresContext* aPresContext,
|
2000-12-09 07:28:19 +00:00
|
|
|
nsIFrame* &targetOuterFrame,
|
2004-07-31 23:15:21 +00:00
|
|
|
nsPresContext* &presCtxOuter);
|
|
|
|
nsresult DoScrollText(nsPresContext* aPresContext,
|
2004-04-19 15:48:14 +00:00
|
|
|
nsIFrame* aTargetFrame,
|
|
|
|
nsInputEvent* aEvent,
|
|
|
|
PRInt32 aNumLines,
|
|
|
|
PRBool aScrollHorizontal,
|
2004-08-07 14:30:30 +00:00
|
|
|
PRBool aScrollPage);
|
2000-01-11 22:30:22 +00:00
|
|
|
void ForceViewUpdate(nsIView* aView);
|
2004-04-19 15:48:14 +00:00
|
|
|
void DoScrollHistory(PRInt32 direction);
|
|
|
|
void DoScrollTextsize(nsIFrame *aTargetFrame, PRInt32 adjustment);
|
2000-05-15 02:10:11 +00:00
|
|
|
nsresult ChangeTextSize(PRInt32 change);
|
2000-03-16 03:34:52 +00:00
|
|
|
// end mousewheel functions
|
1998-11-18 05:25:26 +00:00
|
|
|
|
1999-08-19 19:48:45 +00:00
|
|
|
// routines for the d&d gesture tracking state machine
|
2005-04-19 23:03:23 +00:00
|
|
|
void BeginTrackingDragGesture ( nsPresContext* aPresContext, nsMouseEvent* inDownEvent,
|
|
|
|
nsIFrame* inDownFrame ) ;
|
1999-08-19 19:48:45 +00:00
|
|
|
void StopTrackingDragGesture ( ) ;
|
2005-04-19 23:03:23 +00:00
|
|
|
void GenerateDragGesture ( nsPresContext* aPresContext, nsMouseEvent *aEvent ) ;
|
2005-03-30 02:14:41 +00:00
|
|
|
PRBool IsTrackingDragGesture ( ) const { return mGestureDownContent != nsnull; }
|
2005-04-19 23:03:23 +00:00
|
|
|
/**
|
|
|
|
* 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().
|
|
|
|
*/
|
2005-04-28 23:48:28 +00:00
|
|
|
void FillInEventFromGestureDown(nsMouseEvent* aEvent);
|
1999-08-19 19:48:45 +00:00
|
|
|
|
1999-12-18 04:02:28 +00:00
|
|
|
PRBool mSuppressFocusChange; // Used only for Ender text fields to suppress a focus firing on mouse down
|
|
|
|
|
Fixes bug 66597, bug 103284, bug 114440, bug 120023, bug 128741, bug 19259. Cleans up browse with caret, makes it work with XML content docs, creates keyboard toggle for it (Accel+shift+K), synchronizes focus and document selection so that users can tab navigate relative to their last find or click in text, or vice versa, makes tabbing move relative to named anchor that has been jumped to. r=bryner, sr=alecf, a=asa
2002-03-10 06:21:48 +00:00
|
|
|
nsresult SetCaretEnabled(nsIPresShell *aPresShell, PRBool aVisibility);
|
|
|
|
nsresult SetContentCaretVisible(nsIPresShell* aPresShell, nsIContent *aContent, PRBool aVisible);
|
|
|
|
void FocusElementButNotDocument(nsIContent *aElement);
|
|
|
|
|
2001-02-15 05:07:46 +00:00
|
|
|
// Return the location of the caret
|
2004-09-01 14:58:34 +00:00
|
|
|
nsresult GetDocSelectionLocation(nsIContent **start, nsIContent **end,
|
|
|
|
nsIFrame **startFrame, PRUint32 *startOffset);
|
2001-02-15 05:07:46 +00:00
|
|
|
|
2002-12-24 20:21:40 +00:00
|
|
|
// To be called before and after you fire an event, to update booleans and
|
|
|
|
// such
|
|
|
|
void BeforeDispatchEvent() { ++mDOMEventLevel; }
|
|
|
|
void AfterDispatchEvent();
|
|
|
|
|
2004-04-29 23:34:19 +00:00
|
|
|
PRInt32 mLockCursor;
|
|
|
|
|
1998-11-24 07:46:58 +00:00
|
|
|
//Any frames here must be checked for validity in ClearFrameRefs
|
1998-11-18 05:25:26 +00:00
|
|
|
nsIFrame* mCurrentTarget;
|
2002-12-17 02:10:57 +00:00
|
|
|
nsCOMPtr<nsIContent> mCurrentTargetContent;
|
1998-11-18 05:25:26 +00:00
|
|
|
nsIFrame* mLastMouseOverFrame;
|
2002-12-17 02:10:57 +00:00
|
|
|
nsCOMPtr<nsIContent> mLastMouseOverElement;
|
1999-05-04 14:44:51 +00:00
|
|
|
nsIFrame* mLastDragOverFrame;
|
2001-02-15 05:07:46 +00:00
|
|
|
|
1999-08-19 19:48:45 +00:00
|
|
|
// member variables for the d&d gesture state machine
|
2005-03-30 02:14:41 +00:00
|
|
|
nsPoint mGestureDownPoint; // screen coordinates
|
2005-06-28 21:40:15 +00:00
|
|
|
// The content to use as target if we start a d&d (what we drag).
|
2005-03-30 02:14:41 +00:00
|
|
|
nsCOMPtr<nsIContent> mGestureDownContent;
|
2005-06-28 21:40:15 +00:00
|
|
|
// 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;
|
2005-04-19 23:03:23 +00:00
|
|
|
// State of keys when the original gesture-down happened
|
|
|
|
PRPackedBool mGestureDownShift;
|
|
|
|
PRPackedBool mGestureDownControl;
|
|
|
|
PRPackedBool mGestureDownAlt;
|
|
|
|
PRPackedBool mGestureDownMeta;
|
1998-11-24 07:46:58 +00:00
|
|
|
|
2002-12-17 02:10:57 +00:00
|
|
|
nsCOMPtr<nsIContent> mLastLeftMouseDownContent;
|
|
|
|
nsCOMPtr<nsIContent> mLastMiddleMouseDownContent;
|
|
|
|
nsCOMPtr<nsIContent> mLastRightMouseDownContent;
|
1999-03-28 22:22:54 +00:00
|
|
|
|
2002-12-17 02:10:57 +00:00
|
|
|
nsCOMPtr<nsIContent> mActiveContent;
|
|
|
|
nsCOMPtr<nsIContent> mHoverContent;
|
|
|
|
nsCOMPtr<nsIContent> mDragOverContent;
|
2003-01-13 23:10:53 +00:00
|
|
|
nsCOMPtr<nsIContent> mURLTargetContent;
|
2002-12-17 02:10:57 +00:00
|
|
|
nsCOMPtr<nsIContent> mCurrentFocus;
|
2005-06-24 04:25:43 +00:00
|
|
|
nsCOMPtr<nsIContent> mLastFocus;
|
2003-03-18 23:41:44 +00:00
|
|
|
nsIFrame* mCurrentFocusFrame;
|
1999-03-02 19:19:24 +00:00
|
|
|
PRInt32 mCurrentTabIndex;
|
2005-10-11 03:33:48 +00:00
|
|
|
EFocusedWithType mLastFocusedWith;
|
2000-02-16 03:52:45 +00:00
|
|
|
|
2001-05-22 23:52:17 +00:00
|
|
|
// DocShell Traversal Data Memebers
|
|
|
|
nsCOMPtr<nsIContent> mLastContentFocus;
|
|
|
|
|
2000-02-16 03:52:45 +00:00
|
|
|
//Anti-recursive stack controls
|
2005-03-28 23:39:13 +00:00
|
|
|
|
2002-12-17 02:10:57 +00:00
|
|
|
nsCOMPtr<nsIContent> mFirstBlurEvent;
|
|
|
|
nsCOMPtr<nsIContent> mFirstFocusEvent;
|
2005-03-28 23:39:13 +00:00
|
|
|
|
|
|
|
// The last element on which we fired a mouseover event, or null if
|
|
|
|
// the last mouseover event we fired has finished processing.
|
2002-12-17 02:10:57 +00:00
|
|
|
nsCOMPtr<nsIContent> mFirstMouseOverEventElement;
|
2005-03-28 23:39:13 +00:00
|
|
|
|
|
|
|
// The last element on which we fired a mouseout event, or null if
|
|
|
|
// the last mouseout event we fired has finished processing.
|
2002-12-17 02:10:57 +00:00
|
|
|
nsCOMPtr<nsIContent> mFirstMouseOutEventElement;
|
1999-09-20 22:18:57 +00:00
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
nsPresContext* mPresContext; // Not refcnted
|
2002-12-17 02:10:57 +00:00
|
|
|
nsCOMPtr<nsIDocument> mDocument; // Doesn't necessarily need to be owner
|
|
|
|
|
1999-09-22 02:29:33 +00:00
|
|
|
PRUint32 mLClickCount;
|
|
|
|
PRUint32 mMClickCount;
|
|
|
|
PRUint32 mRClickCount;
|
|
|
|
|
2004-04-29 23:34:19 +00:00
|
|
|
PRPackedBool mNormalLMouseEventInProcess;
|
2000-05-16 10:22:20 +00:00
|
|
|
|
2002-12-24 20:21:40 +00:00
|
|
|
PRPackedBool m_haveShutdown;
|
|
|
|
|
|
|
|
// To inform people that dispatched events that frames have been cleared and
|
|
|
|
// they need to drop frame refs
|
|
|
|
PRPackedBool mClearedFrameRefsDuringEvent;
|
|
|
|
|
2004-04-29 23:34:19 +00:00
|
|
|
// So we don't have to keep checking accessibility.browsewithcaret pref
|
|
|
|
PRPackedBool mBrowseWithCaret;
|
|
|
|
|
|
|
|
// Recursion guard for tabbing
|
|
|
|
PRPackedBool mTabbedThroughDocument;
|
|
|
|
|
2002-12-24 20:21:40 +00:00
|
|
|
// The number of events we are currently nested in (currently just applies to
|
|
|
|
// those handlers that care about clearing frame refs)
|
|
|
|
PRInt32 mDOMEventLevel;
|
2000-09-15 06:17:54 +00:00
|
|
|
|
2004-04-29 23:34:19 +00:00
|
|
|
//Hashtable for accesskey support
|
|
|
|
nsSupportsHashtable *mAccessKeys;
|
2002-02-01 05:14:44 +00:00
|
|
|
|
2003-03-17 23:08:36 +00:00
|
|
|
nsCOMArray<nsIDocShell> mTabbingFromDocShells;
|
2002-02-01 05:14:44 +00:00
|
|
|
|
2001-03-30 04:45:40 +00:00
|
|
|
#ifdef CLICK_HOLD_CONTEXT_MENUS
|
|
|
|
enum { kClickHoldDelay = 500 } ; // 500ms == 1/2 second
|
|
|
|
|
2005-03-30 02:14:41 +00:00
|
|
|
void CreateClickHoldTimer ( nsPresContext* aPresContext, nsIFrame* inDownFrame,
|
|
|
|
nsGUIEvent* inMouseDownEvent ) ;
|
2001-03-30 04:45:40 +00:00
|
|
|
void KillClickHoldTimer ( ) ;
|
|
|
|
void FireContextClick ( ) ;
|
|
|
|
static void sClickHoldCallback ( nsITimer* aTimer, void* aESM ) ;
|
|
|
|
|
|
|
|
nsCOMPtr<nsITimer> mClickHoldTimer;
|
|
|
|
#endif
|
|
|
|
|
2004-09-04 19:28:46 +00:00
|
|
|
static PRInt32 sUserInputEventDepth;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class nsAutoHandlingUserInputStatePusher
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsAutoHandlingUserInputStatePusher(PRBool aIsHandlingUserInput)
|
|
|
|
: mIsHandlingUserInput(aIsHandlingUserInput)
|
|
|
|
{
|
|
|
|
if (aIsHandlingUserInput) {
|
|
|
|
nsEventStateManager::StartHandlingUserInput();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
~nsAutoHandlingUserInputStatePusher()
|
|
|
|
{
|
|
|
|
if (mIsHandlingUserInput) {
|
|
|
|
nsEventStateManager::StopHandlingUserInput();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
PRBool mIsHandlingUserInput;
|
|
|
|
|
|
|
|
private:
|
2004-09-29 22:10:30 +00:00
|
|
|
// 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*/) {}
|
1998-06-23 21:53:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsEventStateManager_h__
|