Bug 610305: decom nsEventStateManager r=smaug

This commit is contained in:
David Zbarsky 2011-04-21 19:35:52 +02:00
parent 9740c98fc5
commit 5ecf0a2bd3
95 changed files with 229 additions and 424 deletions

View File

@ -50,7 +50,7 @@
#include "nsAccEvent.h"
#include "nsIDOMDocument.h"
#include "nsIEventStateManager.h"
#include "nsEventStateManager.h"
#include "nsIServiceManager.h"
#ifdef MOZ_XUL
#include "nsIDOMXULMultSelectCntrlEl.h"
@ -203,7 +203,7 @@ AccEvent::CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput)
return;
}
nsIEventStateManager *esm = presShell->GetPresContext()->EventStateManager();
nsEventStateManager *esm = presShell->GetPresContext()->EventStateManager();
if (!esm) {
NS_NOTREACHED("There should always be an ESM for an event");
return;

View File

@ -75,7 +75,7 @@
#include "nsRootAccessibleWrap.h"
#include "nsTextFragment.h"
#include "mozilla/Services.h"
#include "nsIEventStateManager.h"
#include "nsEventStates.h"
#ifdef MOZ_XUL
#include "nsXULAlertAccessible.h"

View File

@ -99,7 +99,7 @@
#include "nsWhitespaceTokenizer.h"
#include "nsAttrName.h"
#include "nsNetUtil.h"
#include "nsIEventStateManager.h"
#include "nsEventStates.h"
#ifdef NS_DEBUG
#include "nsIDOMCharacterData.h"

View File

@ -60,7 +60,7 @@
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsIScrollableFrame.h"
#include "nsIEventStateManager.h"
#include "nsEventStateManager.h"
#include "nsISelection2.h"
#include "nsISelectionController.h"
#include "nsPIDOMWindow.h"
@ -206,7 +206,7 @@ nsCoreUtils::GetAccessKeyFor(nsIContent *aContent)
// Accesskeys are registered by @accesskey attribute only. At first check
// whether it is presented on the given element to avoid the slow
// nsIEventStateManager::GetRegisteredAccessKey() method.
// nsEventStateManager::GetRegisteredAccessKey() method.
if (!aContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::accesskey))
return 0;
@ -222,13 +222,11 @@ nsCoreUtils::GetAccessKeyFor(nsIContent *aContent)
if (!presContext)
return 0;
nsIEventStateManager *esm = presContext->EventStateManager();
nsEventStateManager *esm = presContext->EventStateManager();
if (!esm)
return 0;
PRUint32 key = 0;
esm->GetRegisteredAccessKey(aContent, &key);
return key;
return esm->GetRegisteredAccessKey(aContent);
}
nsIContent *

View File

@ -110,7 +110,7 @@ public:
/**
* Return an accesskey registered on the given element by
* nsIEventStateManager or 0 if there is no registered accesskey.
* nsEventStateManager or 0 if there is no registered accesskey.
*
* @param aContent - the given element.
*/

View File

@ -61,7 +61,7 @@
#include "nsPIDOMWindow.h"
#include "nsIDOMXULPopupElement.h"
#include "nsIEditingSession.h"
#include "nsIEventStateManager.h"
#include "nsEventStateManager.h"
#include "nsIFrame.h"
#include "nsHTMLSelectAccessible.h"
#include "nsIInterfaceRequestorUtils.h"

View File

@ -42,7 +42,7 @@
#include "States.h"
#include "nsCoreUtils.h"
#include "nsIEventStateManager.h"
#include "nsEventStates.h"
////////////////////////////////////////////////////////////////////////////////
// nsHTMLLinkAccessible

View File

@ -401,7 +401,7 @@ nsXULMenuitemAccessible::GetKeyboardShortcut(nsAString& aAccessKey)
static PRInt32 gMenuAccesskeyModifier = -1; // magic value of -1 indicates unitialized state
// We do not use nsCoreUtils::GetAccesskeyFor() because accesskeys for
// menu are't registered by nsIEventStateManager.
// menu are't registered by nsEventStateManager.
nsAutoString accesskey;
mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::accesskey,
accesskey);

View File

@ -789,7 +789,7 @@ public:
/**
* Method to get the _intrinsic_ content state of this content node. This is
* the state that is independent of the node's presentation. To get the full
* content state, use nsIEventStateManager. Also see nsIEventStateManager
* content state, use nsEventStateManager. Also see nsEventStateManager
* for the possible bits that could be set here.
*/
virtual nsEventStates IntrinsicState() const;

View File

@ -39,7 +39,7 @@
#include "Link.h"
#include "nsIEventStateManager.h"
#include "nsEventStates.h"
#include "nsIURL.h"
#include "nsContentUtils.h"

View File

@ -59,7 +59,6 @@
#include "nsDocument.h"
#include "nsUnicharUtils.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIEventStateManager.h"
#include "nsContentList.h"
#include "nsIObserver.h"
#include "nsIBaseWindow.h"

View File

@ -46,7 +46,7 @@
#include "nsXMLElement.h"
#include "nsImageLoadingContent.h"
#include "imgIRequest.h"
#include "nsIEventStateManager.h"
#include "nsEventStates.h"
class nsGenConImageContent : public nsXMLElement,
public nsImageLoadingContent

View File

@ -66,7 +66,7 @@
#include "nsStyleConsts.h"
#include "nsString.h"
#include "nsUnicharUtils.h"
#include "nsIEventStateManager.h"
#include "nsEventStateManager.h"
#include "nsIDOMEvent.h"
#include "nsIPrivateDOMEvent.h"
#include "nsDOMCID.h"
@ -110,7 +110,6 @@
#include "nsIServiceManager.h"
#include "nsIDOMEventListener.h"
#include "nsEventStateManager.h"
#include "nsIWebNavigation.h"
#include "nsIBaseWindow.h"
@ -5379,10 +5378,8 @@ nsGenericElement::PostHandleEventForLinks(nsEventChainPostVisitor& aVisitor)
nsIFocusManager::FLAG_NOSCROLL);
}
nsIEventStateManager* esm =
aVisitor.mPresContext->EventStateManager();
nsEventStateManager::SetActiveManager(
static_cast<nsEventStateManager*>(esm), this);
aVisitor.mPresContext->EventStateManager(), this);
}
}
}

View File

@ -62,7 +62,7 @@
#include "nsPLDOMEvent.h"
#include "nsIPresShell.h"
#include "nsIEventStateManager.h"
#include "nsEventStates.h"
#include "nsGUIEvent.h"
#include "nsIChannel.h"

View File

@ -53,7 +53,7 @@
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMEventTarget.h"
#include "nsIExternalProtocolHandler.h"
#include "nsIEventStateManager.h"
#include "nsEventStates.h"
#include "nsIObjectFrame.h"
#include "nsIPluginDocument.h"
#include "nsIPluginHost.h"

View File

@ -48,7 +48,6 @@ XPIDL_MODULE = content_events
EXPORTS = \
nsMutationEvent.h \
nsIEventListenerManager.h \
nsIEventStateManager.h \
nsIPrivateDOMEvent.h \
nsIPrivateTextEvent.h \
nsIPrivateTextRange.h \

View File

@ -1,167 +0,0 @@
/* -*- 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):
*
* 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 nsIEventStateManager_h__
#define nsIEventStateManager_h__
#include "nsEvent.h"
#include "nsISupports.h"
#include "nsEventStates.h"
class nsIContent;
class nsIDocument;
class nsPresContext;
class nsIDOMEvent;
class nsIFrame;
class nsIView;
class nsIWidget;
class imgIContainer;
/*
* Event state manager interface.
*/
#define NS_IEVENTSTATEMANAGER_IID \
{0x69ab5b16, 0x6690, 0x42fc, \
{ 0xa9, 0xe5, 0xa3, 0xb4, 0xf8, 0x0f, 0xcb, 0xa6 } }
#define NS_EVENT_NEEDS_FRAME(event) (!NS_IS_ACTIVATION_EVENT(event))
class nsIEventStateManager : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IEVENTSTATEMANAGER_IID)
NS_IMETHOD Init() = 0;
NS_IMETHOD PreHandleEvent(nsPresContext* aPresContext,
nsEvent *aEvent,
nsIFrame* aTargetFrame,
nsEventStatus* aStatus,
nsIView* aView) = 0;
NS_IMETHOD PostHandleEvent(nsPresContext* aPresContext,
nsEvent *aEvent,
nsIFrame* aTargetFrame,
nsEventStatus* aStatus,
nsIView* aView) = 0;
NS_IMETHOD SetPresContext(nsPresContext* aPresContext) = 0;
NS_IMETHOD ClearFrameRefs(nsIFrame* aFrame) = 0;
NS_IMETHOD GetEventTarget(nsIFrame **aFrame) = 0;
NS_IMETHOD GetEventTargetContent(nsEvent* aEvent, nsIContent** aContent) = 0;
/**
* Returns the content state of aContent.
* @param aContent The control whose state is requested.
* @param aFollowLabels Whether to reflect a label's content state on its
* associated control. If aFollowLabels is true and
* aContent is a control which has a label that has the
* hover or active content state set, GetContentState
* will pretend that those states are also set on aContent.
* @return The content state.
*/
virtual nsEventStates GetContentState(nsIContent *aContent,
PRBool aFollowLabels = PR_FALSE) = 0;
/**
* Notify that the given NS_EVENT_STATE_* bit has changed for this content.
* @param aContent Content which has changed states. This may be null to
* indicate that nothing is in this state anymore.
* @param aState One of NS_EVENT_STATE_ACTIVE, NS_EVENT_STATE_HOVER,
* NS_EVENT_STATE_DRAGOVER, NS_EVENT_STATE_URLTARGET. Don't
* pass anything else! Passing in a state object that has
* more than one of those states set is not supported.
* @return Whether the content was able to change all states. Returns PR_FALSE
* if a resulting DOM event causes the content node passed in
* to not change states. Note, the frame for the content may
* change as a result of the content state change, because of
* frame reconstructions that may occur, but this does not
* affect the return value.
*/
virtual PRBool SetContentState(nsIContent *aContent, nsEventStates aState) = 0;
NS_IMETHOD ContentRemoved(nsIDocument* aDocument, nsIContent* aContent) = 0;
NS_IMETHOD EventStatusOK(nsGUIEvent* aEvent, PRBool *aOK) = 0;
// Access Key Registration
/**
* Register accesskey on the given element. When accesskey is activated then
* the element will be notified via nsIContent::PerformAccesskey() method.
*
* @param aContent the given element
* @param aKey accesskey
*/
NS_IMETHOD RegisterAccessKey(nsIContent* aContent, PRUint32 aKey) = 0;
/**
* Unregister accesskey for the given element.
*
* @param aContent the given element
* @param aKey accesskey
*/
NS_IMETHOD UnregisterAccessKey(nsIContent* aContent, PRUint32 aKey) = 0;
/**
* Get accesskey registered on the given element or 0 if there is none.
*
* @param aContent the given element
* @param aKey registered accesskey
* @return NS_OK
*/
NS_IMETHOD GetRegisteredAccessKey(nsIContent* aContent, PRUint32* aKey) = 0;
NS_IMETHOD SetCursor(PRInt32 aCursor, imgIContainer* aContainer,
PRBool aHaveHotspot, float aHotspotX, float aHotspotY,
nsIWidget* aWidget, PRBool aLockCursor) = 0;
NS_IMETHOD NotifyDestroyPresContext(nsPresContext* aPresContext) = 0;
/**
* Returns true if the current code is being executed as a result of user input.
* This includes timers or anything else that is initiated from user input.
* However, mouse hover events are not counted as user input, nor are
* page load events. If this method is called from asynchronously executed code,
* such as during layout reflows, it will return false.
*/
NS_IMETHOD_(PRBool) IsHandlingUserInputExternal() = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIEventStateManager, NS_IEVENTSTATEMANAGER_IID)
#endif // nsIEventStateManager_h__

View File

@ -46,6 +46,10 @@ MODULE = content
LIBRARY_NAME = gkconevents_s
LIBXUL_LIBRARY = 1
EXPORTS = \
nsEventStateManager.h \
$(NULL)
CPPSRCS = \
nsEventListenerManager.cpp \
nsEventStateManager.cpp \

View File

@ -39,7 +39,6 @@
#include "nsIServiceManager.h"
#include "nsGUIEvent.h"
#include "nsContentUtils.h"
#include "nsIEventStateManager.h"
#include "nsDOMDataTransfer.h"
#include "nsIDragService.h"

View File

@ -316,8 +316,7 @@ nsDOMEvent::GetTargetFromFrame()
if (!mPresContext) { return nsnull; }
// Get the target frame (have to get the ESM first)
nsIFrame* targetFrame = nsnull;
mPresContext->EventStateManager()->GetEventTarget(&targetFrame);
nsIFrame* targetFrame = mPresContext->EventStateManager()->GetEventTarget();
if (!targetFrame) { return nsnull; }
// get the real content

View File

@ -40,7 +40,6 @@
#include "nsDOMMouseEvent.h"
#include "nsGUIEvent.h"
#include "nsIContent.h"
#include "nsIEventStateManager.h"
#include "nsContentUtils.h"
nsDOMMouseEvent::nsDOMMouseEvent(nsPresContext* aPresContext,

View File

@ -38,7 +38,6 @@
#include "nsDOMMouseScrollEvent.h"
#include "nsGUIEvent.h"
#include "nsIContent.h"
#include "nsIEventStateManager.h"
#include "nsContentUtils.h"
nsDOMMouseScrollEvent::nsDOMMouseScrollEvent(nsPresContext* aPresContext,

View File

@ -47,7 +47,7 @@
#include "nsIDOMNode.h"
#include "nsIContent.h"
#include "nsContentUtils.h"
#include "nsIEventStateManager.h"
#include "nsEventStateManager.h"
#include "nsIFrame.h"
#include "nsLayoutUtils.h"
#include "nsIScrollableFrame.h"
@ -258,7 +258,7 @@ nsDOMUIEvent::GetRangeParent(nsIDOMNode** aRangeParent)
nsIFrame* targetFrame = nsnull;
if (mPresContext) {
mPresContext->EventStateManager()->GetEventTarget(&targetFrame);
targetFrame = mPresContext->EventStateManager()->GetEventTarget();
}
*aRangeParent = nsnull;
@ -286,7 +286,7 @@ nsDOMUIEvent::GetRangeOffset(PRInt32* aRangeOffset)
nsIFrame* targetFrame = nsnull;
if (mPresContext) {
mPresContext->EventStateManager()->GetEventTarget(&targetFrame);
targetFrame = mPresContext->EventStateManager()->GetEventTarget();
}
if (targetFrame) {
@ -334,8 +334,7 @@ nsDOMUIEvent::GetLayerPoint()
return mLayerPoint;
}
// XXX I'm not really sure this is correct; it's my best shot, though
nsIFrame* targetFrame;
mPresContext->EventStateManager()->GetEventTarget(&targetFrame);
nsIFrame* targetFrame = mPresContext->EventStateManager()->GetEventTarget();
if (!targetFrame)
return mLayerPoint;
nsIFrame* layer = nsLayoutUtils::GetClosestLayer(targetFrame);

View File

@ -56,7 +56,6 @@
#ifdef MOZ_SVG
#include "nsGkAtoms.h"
#endif // MOZ_SVG
#include "nsIEventStateManager.h"
#include "nsPIDOMWindow.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIJSEventListener.h"

View File

@ -811,7 +811,7 @@ nsEventStateManager::UpdateUserActivityTimer(void)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsEventStateManager::Init()
{
nsCOMPtr<nsIObserverService> observerService =
@ -996,8 +996,7 @@ nsEventStateManager::Observe(nsISupports *aSubject,
NS_IMPL_CYCLE_COLLECTION_CLASS(nsEventStateManager)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsEventStateManager)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIEventStateManager)
NS_INTERFACE_MAP_ENTRY(nsIEventStateManager)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIObserver)
NS_INTERFACE_MAP_ENTRY(nsIObserver)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_END
@ -1047,8 +1046,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsEventStateManager)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMARRAY(mAccessKeys);
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMETHODIMP
nsresult
nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
nsEvent *aEvent,
nsIFrame* aTargetFrame,
@ -2818,7 +2816,7 @@ NodeAllowsClickThrough(nsINode* aNode)
}
#endif
NS_IMETHODIMP
nsresult
nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
nsEvent *aEvent,
nsIFrame* aTargetFrame,
@ -2993,8 +2991,7 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
ClearGlobalActiveContent(this);
if (IsMouseEventReal(aEvent)) {
if (!mCurrentTarget) {
nsIFrame* targ;
GetEventTarget(&targ);
GetEventTarget();
}
if (mCurrentTarget) {
ret = CheckForAndDispatchClick(presContext, (nsMouseEvent*)aEvent,
@ -3356,28 +3353,24 @@ nsEventStateManager::IsTargetCrossProcess(nsGUIEvent *aEvent)
return TabParent::GetIMETabParent() != nsnull;
}
NS_IMETHODIMP
void
nsEventStateManager::NotifyDestroyPresContext(nsPresContext* aPresContext)
{
nsIMEStateManager::OnDestroyPresContext(aPresContext);
return NS_OK;
}
NS_IMETHODIMP
void
nsEventStateManager::SetPresContext(nsPresContext* aPresContext)
{
mPresContext = aPresContext;
return NS_OK;
}
NS_IMETHODIMP
void
nsEventStateManager::ClearFrameRefs(nsIFrame* aFrame)
{
if (aFrame && aFrame == mCurrentTarget) {
mCurrentTargetContent = aFrame->GetContent();
}
return NS_OK;
}
void
@ -3436,7 +3429,7 @@ nsEventStateManager::UpdateCursor(nsPresContext* aPresContext,
}
}
NS_IMETHODIMP
nsresult
nsEventStateManager::SetCursor(PRInt32 aCursor, imgIContainer* aContainer,
PRBool aHaveHotspot,
float aHotspotX, float aHotspotY,
@ -3698,8 +3691,7 @@ nsEventStateManager::NotifyMouseOut(nsGUIEvent* aEvent, nsIContent* aMovingInto)
docshell->GetPresContext(getter_AddRefs(presContext));
if (presContext) {
nsEventStateManager* kidESM =
static_cast<nsEventStateManager*>(presContext->EventStateManager());
nsEventStateManager* kidESM = presContext->EventStateManager();
// Not moving into any element in this subdocument
kidESM->NotifyMouseOut(aEvent, nsnull);
}
@ -3757,9 +3749,7 @@ nsEventStateManager::NotifyMouseOver(nsGUIEvent* aEvent, nsIContent* aContent)
if (docContent) {
nsIPresShell *parentShell = parentDoc->GetShell();
if (parentShell) {
nsEventStateManager* parentESM =
static_cast<nsEventStateManager*>
(parentShell->GetPresContext()->EventStateManager());
nsEventStateManager* parentESM = parentShell->GetPresContext()->EventStateManager();
parentESM->NotifyMouseOver(aEvent, docContent);
}
}
@ -3804,8 +3794,7 @@ nsEventStateManager::GenerateMouseEnterExit(nsGUIEvent* aEvent)
case NS_MOUSE_MOVE:
{
// Get the target content target (mousemove target == mouseover target)
nsCOMPtr<nsIContent> targetElement;
GetEventTargetContent(aEvent, getter_AddRefs(targetElement));
nsCOMPtr<nsIContent> targetElement = GetEventTargetContent(aEvent);
if (!targetElement) {
// We're always over the document root, even if we're only
// over dead space in a page (whose frame is not associated with
@ -4093,8 +4082,7 @@ nsEventStateManager::CheckForAndDispatchClick(nsPresContext* aPresContext,
nsCOMPtr<nsIPresShell> presShell = mPresContext->GetPresShell();
if (presShell) {
nsCOMPtr<nsIContent> mouseContent;
GetEventTargetContent(aEvent, getter_AddRefs(mouseContent));
nsCOMPtr<nsIContent> mouseContent = GetEventTargetContent(aEvent);
ret = presShell->HandleEventWithTarget(&event, mCurrentTarget,
mouseContent, aStatus);
@ -4120,61 +4108,56 @@ nsEventStateManager::CheckForAndDispatchClick(nsPresContext* aPresContext,
return ret;
}
NS_IMETHODIMP
nsEventStateManager::GetEventTarget(nsIFrame **aFrame)
nsIFrame*
nsEventStateManager::GetEventTarget()
{
nsIPresShell *shell;
if (mCurrentTarget ||
!mPresContext ||
!(shell = mPresContext->GetPresShell())) {
*aFrame = mCurrentTarget;
return NS_OK;
return mCurrentTarget;
}
if (mCurrentTargetContent) {
mCurrentTarget = mPresContext->GetPrimaryFrameFor(mCurrentTargetContent);
if (mCurrentTarget) {
*aFrame = mCurrentTarget;
return NS_OK;
return mCurrentTarget;
}
}
nsIFrame* frame = shell->GetEventTargetFrame();
*aFrame = mCurrentTarget = frame;
return NS_OK;
return (mCurrentTarget = frame);
}
NS_IMETHODIMP
nsEventStateManager::GetEventTargetContent(nsEvent* aEvent,
nsIContent** aContent)
already_AddRefed<nsIContent>
nsEventStateManager::GetEventTargetContent(nsEvent* aEvent)
{
if (aEvent &&
(aEvent->message == NS_FOCUS_CONTENT ||
aEvent->message == NS_BLUR_CONTENT)) {
NS_IF_ADDREF(*aContent = GetFocusedContent());
return NS_OK;
nsCOMPtr<nsIContent> content = GetFocusedContent();
return content.forget();
}
if (mCurrentTargetContent) {
*aContent = mCurrentTargetContent;
NS_IF_ADDREF(*aContent);
return NS_OK;
nsCOMPtr<nsIContent> content = mCurrentTargetContent;
return content.forget();
}
*aContent = nsnull;
nsIContent *content = nsnull;
nsIPresShell *presShell = mPresContext->GetPresShell();
if (presShell) {
*aContent = presShell->GetEventTargetContent(aEvent).get();
content = presShell->GetEventTargetContent(aEvent).get();
}
// Some events here may set mCurrentTarget but not set the corresponding
// event target in the PresShell.
if (!*aContent && mCurrentTarget) {
mCurrentTarget->GetContentForEvent(mPresContext, aEvent, aContent);
if (!content && mCurrentTarget) {
mCurrentTarget->GetContentForEvent(mPresContext, aEvent, &content);
}
return NS_OK;
return content;
}
static already_AddRefed<nsIContent>
@ -4419,7 +4402,7 @@ nsEventStateManager::SetContentState(nsIContent *aContent, nsEventStates aState)
return PR_TRUE;
}
NS_IMETHODIMP
void
nsEventStateManager::ContentRemoved(nsIDocument* aDocument, nsIContent* aContent)
{
// inform the focus manager that the content is being removed. If this
@ -4452,59 +4435,44 @@ nsEventStateManager::ContentRemoved(nsIDocument* aDocument, nsIContent* aContent
// See bug 292146 for why we want to null this out
mLastMouseOverElement = nsnull;
}
return NS_OK;
}
NS_IMETHODIMP
nsEventStateManager::EventStatusOK(nsGUIEvent* aEvent, PRBool *aOK)
PRBool
nsEventStateManager::EventStatusOK(nsGUIEvent* aEvent)
{
*aOK = PR_TRUE;
if (aEvent->message == NS_MOUSE_BUTTON_DOWN &&
static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eLeftButton) {
if (!sNormalLMouseEventInProcess) {
*aOK = PR_FALSE;
}
}
return NS_OK;
return !(aEvent->message == NS_MOUSE_BUTTON_DOWN &&
static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eLeftButton &&
!sNormalLMouseEventInProcess);
}
//-------------------------------------------
// Access Key Registration
//-------------------------------------------
NS_IMETHODIMP
void
nsEventStateManager::RegisterAccessKey(nsIContent* aContent, PRUint32 aKey)
{
if (aContent && mAccessKeys.IndexOf(aContent) == -1)
mAccessKeys.AppendObject(aContent);
return NS_OK;
}
NS_IMETHODIMP
void
nsEventStateManager::UnregisterAccessKey(nsIContent* aContent, PRUint32 aKey)
{
if (aContent)
mAccessKeys.RemoveObject(aContent);
return NS_OK;
}
NS_IMETHODIMP
nsEventStateManager::GetRegisteredAccessKey(nsIContent* aContent,
PRUint32* aKey)
PRUint32
nsEventStateManager::GetRegisteredAccessKey(nsIContent* aContent)
{
NS_ENSURE_ARG(aContent);
NS_ENSURE_ARG_POINTER(aKey);
*aKey = 0;
if (mAccessKeys.IndexOf(aContent) == -1)
return NS_OK;
return 0;
nsAutoString accessKey;
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::accesskey, accessKey);
*aKey = accessKey.First();
return NS_OK;
return accessKey.First();
}
void

View File

@ -39,7 +39,6 @@
#ifndef nsEventStateManager_h__
#define nsEventStateManager_h__
#include "nsIEventStateManager.h"
#include "nsEvent.h"
#include "nsGUIEvent.h"
#include "nsIContent.h"
@ -56,6 +55,7 @@
#include "nsIScrollableFrame.h"
#include "nsFocusManager.h"
#include "nsIDocument.h"
#include "nsEventStates.h"
class nsIPresShell;
class nsIDocShell;
@ -75,7 +75,6 @@ class TabParent;
*/
class nsEventStateManager : public nsSupportsWeakReference,
public nsIEventStateManager,
public nsIObserver
{
friend class nsMouseWheelTransaction;
@ -86,7 +85,7 @@ public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_NSIOBSERVER
NS_IMETHOD Init();
nsresult Init();
nsresult Shutdown();
/* The PreHandleEvent method is called before event dispatch to either
@ -96,44 +95,86 @@ public:
* 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);
nsresult 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);
nsresult 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);
void NotifyDestroyPresContext(nsPresContext* aPresContext);
void SetPresContext(nsPresContext* aPresContext);
void ClearFrameRefs(nsIFrame* aFrame);
NS_IMETHOD GetEventTarget(nsIFrame **aFrame);
NS_IMETHOD GetEventTargetContent(nsEvent* aEvent, nsIContent** aContent);
nsIFrame* GetEventTarget();
already_AddRefed<nsIContent> GetEventTargetContent(nsEvent* aEvent);
/**
* Returns the content state of aContent.
* @param aContent The control whose state is requested.
* @param aFollowLabels Whether to reflect a label's content state on its
* associated control. If aFollowLabels is true and
* aContent is a control which has a label that has the
* hover or active content state set, GetContentState
* will pretend that those states are also set on aContent.
* @return The content state.
*/
virtual nsEventStates GetContentState(nsIContent *aContent,
PRBool aFollowLabels = PR_FALSE);
virtual PRBool SetContentState(nsIContent *aContent, nsEventStates aState);
NS_IMETHOD ContentRemoved(nsIDocument* aDocument, nsIContent* aContent);
NS_IMETHOD EventStatusOK(nsGUIEvent* aEvent, PRBool *aOK);
// Access Key Registration
NS_IMETHOD RegisterAccessKey(nsIContent* aContent, PRUint32 aKey);
NS_IMETHOD UnregisterAccessKey(nsIContent* aContent, PRUint32 aKey);
NS_IMETHOD GetRegisteredAccessKey(nsIContent* aContent, PRUint32* aKey);
/**
* Notify that the given NS_EVENT_STATE_* bit has changed for this content.
* @param aContent Content which has changed states
* @param aState Corresponding state flags such as NS_EVENT_STATE_FOCUS
* @return Whether the content was able to change all states. Returns PR_FALSE
* if a resulting DOM event causes the content node passed in
* to not change states. Note, the frame for the content may
* change as a result of the content state change, because of
* frame reconstructions that may occur, but this does not
* affect the return value.
*/
PRBool SetContentState(nsIContent *aContent, nsEventStates aState);
void ContentRemoved(nsIDocument* aDocument, nsIContent* aContent);
PRBool EventStatusOK(nsGUIEvent* aEvent);
NS_IMETHOD SetCursor(PRInt32 aCursor, imgIContainer* aContainer,
PRBool aHaveHotspot, float aHotspotX, float aHotspotY,
nsIWidget* aWidget, PRBool aLockCursor);
/**
* Register accesskey on the given element. When accesskey is activated then
* the element will be notified via nsIContent::PerformAccesskey() method.
*
* @param aContent the given element
* @param aKey accesskey
*/
void RegisterAccessKey(nsIContent* aContent, PRUint32 aKey);
/**
* Unregister accesskey for the given element.
*
* @param aContent the given element
* @param aKey accesskey
*/
void UnregisterAccessKey(nsIContent* aContent, PRUint32 aKey);
/**
* Get accesskey registered on the given element or 0 if there is none.
*
* @param aContent the given element
* @return registered accesskey
*/
PRUint32 GetRegisteredAccessKey(nsIContent* aContent);
nsresult SetCursor(PRInt32 aCursor, imgIContainer* aContainer,
PRBool aHaveHotspot, float aHotspotX, float aHotspotY,
nsIWidget* aWidget, PRBool aLockCursor);
static void StartHandlingUserInput()
{
@ -150,16 +191,23 @@ public:
return sUserInputEventDepth > 0;
}
/**
* Returns true if the current code is being executed as a result of user input.
* This includes timers or anything else that is initiated from user input.
* However, mouse hover events are not counted as user input, nor are
* page load events. If this method is called from asynchronously executed code,
* such as during layout reflows, it will return false.
*/
NS_IMETHOD_(PRBool) IsHandlingUserInputExternal() { return IsHandlingUserInput(); }
nsPresContext* GetPresContext() { return mPresContext; }
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsEventStateManager,
nsIEventStateManager)
nsIObserver)
static nsIDocument* sMouseOverDocument;
static nsIEventStateManager* GetActiveEventStateManager() { return sActiveESM; }
static nsEventStateManager* GetActiveEventStateManager() { return sActiveESM; }
// Sets aNewESM to be the active event state manager, and
// if aContent is non-null, marks the object as active.
@ -489,4 +537,6 @@ private:
static void operator delete(void* /*memory*/) {}
};
#define NS_EVENT_NEEDS_FRAME(event) (!NS_IS_ACTIVATION_EVENT(event))
#endif // nsEventStateManager_h__

View File

@ -86,7 +86,7 @@
#include "nsString.h"
#include "nsUnicharUtils.h"
#include "nsGkAtoms.h"
#include "nsIEventStateManager.h"
#include "nsEventStateManager.h"
#include "nsIDOMEvent.h"
#include "nsIDOMNSEvent.h"
#include "nsDOMCSSDeclaration.h"
@ -1056,9 +1056,8 @@ nsGenericHTMLElement::CheckHandleEventForAnchorsPreconditions(nsEventChainVisito
//Need to check if we hit an imagemap area and if so see if we're handling
//the event on that map or on a link farther up the tree. If we're on a
//link farther up, do nothing.
nsCOMPtr<nsIContent> target;
aVisitor.mPresContext->EventStateManager()->
GetEventTargetContent(aVisitor.mEvent, getter_AddRefs(target));
nsCOMPtr<nsIContent> target = aVisitor.mPresContext->EventStateManager()->
GetEventTargetContent(aVisitor.mEvent);
return !target || !IsArea(target) || IsArea(this);
}
@ -3353,7 +3352,7 @@ nsGenericHTMLElement::RegUnRegAccessKey(PRBool aDoReg)
nsPresContext *presContext = GetPresContext();
if (presContext) {
nsIEventStateManager *esm = presContext->EventStateManager();
nsEventStateManager *esm = presContext->EventStateManager();
// Register or unregister as appropriate.
if (aDoReg) {

View File

@ -47,7 +47,6 @@
#include "nsIPresShell.h"
#include "nsIDocument.h"
#include "nsPresContext.h"
#include "nsIEventStateManager.h"
#include "nsHTMLDNSPrefetch.h"

View File

@ -41,7 +41,6 @@
#include "nsILink.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"
#include "nsIEventStateManager.h"
#include "nsIURL.h"
#include "nsNetUtil.h"
#include "nsReadableUtils.h"

View File

@ -50,7 +50,6 @@
#include "nsEventStateManager.h"
#include "nsIFrame.h"
#include "nsIFormControlFrame.h"
#include "nsIEventStateManager.h"
#include "nsIDOMEvent.h"
#include "nsIDOMNSEvent.h"
#include "nsIDocument.h"
@ -377,7 +376,7 @@ nsHTMLButtonElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
if (static_cast<nsMouseEvent*>(aVisitor.mEvent)->button ==
nsMouseEvent::eLeftButton) {
if (NS_IS_TRUSTED_EVENT(aVisitor.mEvent)) {
nsIEventStateManager* esm =
nsEventStateManager* esm =
aVisitor.mPresContext->EventStateManager();
nsEventStateManager::SetActiveManager(
static_cast<nsEventStateManager*>(esm), this);

View File

@ -81,7 +81,6 @@
#include "nsIHTMLCollection.h"
#include "nsIConstraintValidation.h"
#include "nsIEventStateManager.h"
#include "nsIDOMHTMLButtonElement.h"

View File

@ -63,7 +63,7 @@
#include "nsIFormControlFrame.h"
#include "nsITextControlFrame.h"
#include "nsIFrame.h"
#include "nsIEventStateManager.h"
#include "nsEventStates.h"
#include "nsIServiceManager.h"
#include "nsIScriptSecurityManager.h"
#include "nsDOMError.h"

View File

@ -47,7 +47,6 @@
#include "nsIDOMDocument.h"
#include "nsIDocument.h"
#include "nsGUIEvent.h"
#include "nsIEventStateManager.h"
#include "nsEventDispatcher.h"
#include "nsPIDOMWindow.h"
#include "nsFocusManager.h"

View File

@ -42,7 +42,6 @@
#include "nsStyleConsts.h"
#include "nsIForm.h"
#include "nsIFormControl.h"
#include "nsIEventStateManager.h"
#include "nsIDocument.h"
#include "nsPIDOMWindow.h"
#include "nsFocusManager.h"

View File

@ -41,7 +41,7 @@
#include "nsStyleConsts.h"
#include "nsIFrame.h"
#include "nsIFormControlFrame.h"
#include "nsIEventStateManager.h"
#include "nsEventStates.h"
#include "nsIDocument.h"
#include "nsEventDispatcher.h"

View File

@ -59,7 +59,7 @@
#include "nsIDOMHTMLSelectElement.h"
#include "nsNodeInfoManager.h"
#include "nsCOMPtr.h"
#include "nsIEventStateManager.h"
#include "nsEventStates.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsContentCreatorFunctions.h"

View File

@ -41,7 +41,7 @@
#include "nsDOMSettableTokenList.h"
#include "nsStubMutationObserver.h"
#include "nsIConstraintValidation.h"
#include "nsIEventStateManager.h"
#include "nsEventStates.h"
#include "mozAutoDocUpdate.h"
#include "nsHTMLFormElement.h"

View File

@ -52,7 +52,7 @@
#include "nsIDOMHTMLOptGroupElement.h"
#include "nsHTMLOptionElement.h"
#include "nsIEventStateManager.h"
#include "nsEventStates.h"
#include "nsGUIEvent.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIBoxObject.h"

View File

@ -58,7 +58,7 @@
#include "nsMappedAttributes.h"
#include "nsIFormControlFrame.h"
#include "nsITextControlFrame.h"
#include "nsIEventStateManager.h"
#include "nsEventStates.h"
#include "nsLinebreakConverter.h"
#include "nsIDocument.h"
#include "nsIFrame.h"

View File

@ -38,7 +38,7 @@
#include "nsRadioVisitor.h"
#include "nsAutoPtr.h"
#include "nsHTMLInputElement.h"
#include "nsIEventStateManager.h"
#include "nsEventStates.h"
#include "nsIDocument.h"
#include "nsIConstraintValidation.h"

View File

@ -124,7 +124,6 @@
#include "nsIMutableArray.h"
#include "nsArrayUtils.h"
#include "nsIEffectiveTLDService.h"
#include "nsIEventStateManager.h"
#include "nsIPrompt.h"
//AHMED 12-2

View File

@ -47,7 +47,7 @@
#include "nsMappedAttributes.h"
#include "nsStyleConsts.h"
#include "nsIDocument.h"
#include "nsIEventStateManager.h"
#include "nsEventStates.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsDOMClassInfoID.h"

View File

@ -48,7 +48,7 @@
#include "nsGkAtoms.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsIEventStateManager.h"
#include "nsEventStateManager.h"
#include "nsIEventListenerManager.h"
#include "nsIDOMEvent.h"
#include "nsGUIEvent.h"
@ -974,7 +974,7 @@ nsXTFElementWrapper::RegUnregAccessKey(PRBool aDoReg)
if (!presContext)
return;
nsIEventStateManager *esm = presContext->EventStateManager();
nsEventStateManager *esm = presContext->EventStateManager();
if (!esm)
return;

View File

@ -83,7 +83,7 @@
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsIDocument.h"
#include "nsIEventListenerManager.h"
#include "nsIEventStateManager.h"
#include "nsEventStateManager.h"
#include "nsFocusManager.h"
#include "nsIFastLoadService.h"
#include "nsHTMLStyleSheet.h"

View File

@ -74,7 +74,6 @@
// for event firing in context menus
#include "nsPresContext.h"
#include "nsIPresShell.h"
#include "nsIEventStateManager.h"
#include "nsFocusManager.h"
#include "nsPIDOMWindow.h"
#include "nsIViewManager.h"
@ -301,7 +300,7 @@ nsXULPopupListener::FireFocusOnTargetContent(nsIDOMNode* aTargetNode)
}
}
nsIEventStateManager *esm = context->EventStateManager();
nsEventStateManager *esm = context->EventStateManager();
nsCOMPtr<nsIContent> focusableContent = do_QueryInterface(element);
esm->SetContentState(focusableContent, NS_EVENT_STATE_ACTIVE);
}

View File

@ -201,7 +201,7 @@
#include "nsIGlobalHistory3.h"
#ifdef DEBUG_DOCSHELL_FOCUS
#include "nsIEventStateManager.h"
#include "nsEventStateManager.h"
#endif
#include "nsIFrame.h"

View File

@ -46,7 +46,6 @@
#include "nsGlobalWindow.h"
#include "nsIDocument.h"
#include "nsFocusManager.h"
#include "nsIEventStateManager.h"
#include "nsEventStateManager.h"
#include "nsFrameManager.h"
#include "nsRefreshDriver.h"

View File

@ -68,7 +68,7 @@
#include "nsFrameTraversal.h"
#include "nsObjectFrame.h"
#include "nsEventDispatcher.h"
#include "nsIEventStateManager.h"
#include "nsEventStateManager.h"
#include "nsIMEStateManager.h"
#include "nsIWebNavigation.h"
#include "nsCaret.h"

View File

@ -127,7 +127,7 @@
#include "nsDOMString.h"
#include "nsIEmbeddingSiteWindow2.h"
#include "nsThreadUtils.h"
#include "nsIEventStateManager.h"
#include "nsEventStateManager.h"
#include "nsIHttpProtocolHandler.h"
#include "nsIJSContextStack.h"
#include "nsIJSRuntimeService.h"

View File

@ -47,7 +47,6 @@
#include "nsPresContext.h"
#include "nsLayoutCID.h"
#include "nsContentCID.h"
#include "nsIEventStateManager.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIDOMWindowInternal.h"
#include "nsString.h"

View File

@ -71,7 +71,6 @@
#include "nsIDOMNSRange.h"
#include "nsEditorUtils.h"
#include "nsIDOMEventTarget.h"
#include "nsIEventStateManager.h"
#include "nsISelectionPrivate.h"
#include "nsIDOMDragEvent.h"
#include "nsIFocusManager.h"

View File

@ -98,7 +98,6 @@
#include "nsIFrame.h"
#include "nsIParserService.h"
#include "nsIEventStateManager.h"
// Some utilities to handle annoying overloading of "A" tag for link and named anchor
static char hrefText[] = "href";

View File

@ -56,7 +56,6 @@
#include "nsIDocShellTreeItem.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsIEventStateManager.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsISelectionController.h"

View File

@ -95,7 +95,6 @@
#include "nsThreadUtils.h"
#include "nsUnicharUtils.h"
#include "nsIContent.h"
#include "nsIEventStateManager.h"
#include "nsIEventListenerManager.h"
#include "nsGUIEvent.h"

View File

@ -66,7 +66,7 @@
#include "nsUnicharUtils.h"
#include "nsStyleSet.h"
#include "nsIViewManager.h"
#include "nsIEventStateManager.h"
#include "nsEventStates.h"
#include "nsStyleConsts.h"
#include "nsTableOuterFrame.h"
#include "nsIDOMXULElement.h"

View File

@ -58,7 +58,6 @@
#include "nsIDocument.h"
#include "nsPresContext.h"
#include "nsIPresShell.h"
#include "nsIEventStateManager.h"
#include "nsStyleSet.h"
#include "nsIStyleSheet.h"
#include "nsCSSStyleSheet.h"

View File

@ -349,7 +349,7 @@ TraverseImageLoader(const void * aKey, nsRefPtr<nsImageLoader>& aData,
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsPresContext)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mDocument);
// NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mDeviceContext); // not xpcom
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mEventManager);
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mEventManager, nsIObserver);
// NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mLookAndFeel); // a service
// NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mLanguage); // an atom

View File

@ -89,7 +89,7 @@ class nsFrameManager;
class nsILinkHandler;
class nsStyleContext;
class nsIAtom;
class nsIEventStateManager;
class nsEventStateManager;
class nsIURI;
class nsILookAndFeel;
class nsICSSPseudoComparator;
@ -545,7 +545,7 @@ public:
void SetPrintPreviewScale(float aScale) { mPPScale = aScale; }
nsDeviceContext* DeviceContext() { return mDeviceContext; }
nsIEventStateManager* EventStateManager() { return mEventManager; }
nsEventStateManager* EventStateManager() { return mEventManager; }
nsIAtom* GetLanguageFromCharset() { return mLanguage; }
float TextZoom() { return mTextZoom; }
@ -1053,7 +1053,7 @@ protected:
// Cannot reintroduce cycles
// since there is no dependency
// from gfx back to layout.
nsIEventStateManager* mEventManager; // [STRONG]
nsEventStateManager* mEventManager; // [STRONG]
nsILookAndFeel* mLookAndFeel; // [STRONG]
nsRefPtr<nsRefreshDriver> mRefreshDriver;
nsRefPtr<nsTransitionManager> mTransitionManager;

View File

@ -84,7 +84,6 @@
#include "nsHashtable.h"
#include "nsIViewObserver.h"
#include "nsContainerFrame.h"
#include "nsEventStateManager.h"
#include "nsDOMEvent.h"
#include "nsGUIEvent.h"
#include "nsHTMLParts.h"
@ -118,6 +117,7 @@
#include "nsViewsCID.h"
#include "nsPresArena.h"
#include "nsFrameManager.h"
#include "nsEventStateManager.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "nsILayoutHistoryState.h"
@ -3777,7 +3777,7 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, PRBool aScroll)
}
// Hold a reference to the ESM in case event dispatch tears us down.
nsCOMPtr<nsIEventStateManager> esm = mPresContext->EventStateManager();
nsRefPtr<nsEventStateManager> esm = mPresContext->EventStateManager();
if (aAnchorName.IsEmpty()) {
NS_ASSERTION(!aScroll, "can't scroll to empty anchor name");
@ -6508,7 +6508,7 @@ PresShell::HandleEvent(nsIView *aView,
//
// Note, currently for backwards compatibility we don't forward mouse events
// to the active document when mouse is over some subdocument.
nsIEventStateManager* activeESM =
nsEventStateManager* activeESM =
nsEventStateManager::GetActiveEventStateManager();
if (activeESM && NS_IS_MOUSE_EVENT(aEvent) &&
activeESM != shell->GetPresContext()->EventStateManager() &&
@ -6794,7 +6794,7 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsIView *aView,
}
#endif
nsCOMPtr<nsIEventStateManager> manager = mPresContext->EventStateManager();
nsRefPtr<nsEventStateManager> manager = mPresContext->EventStateManager();
nsresult rv = NS_OK;
if (!NS_EVENT_NEEDS_FRAME(aEvent) || GetCurrentEventFrame()) {

View File

@ -44,7 +44,7 @@
#include "nsDisplayList.h"
#include "nsITheme.h"
#include "nsThemeConstants.h"
#include "nsIEventStateManager.h"
#include "nsEventStates.h"
#define ACTIVE "active"
#define HOVER "hover"

View File

@ -59,7 +59,6 @@
#include "nsIView.h"
#include "nsIViewManager.h"
#include "nsEventDispatcher.h"
#include "nsIEventStateManager.h"
#include "nsIEventListenerManager.h"
#include "nsIDOMNode.h"
#include "nsIPrivateDOMEvent.h"

View File

@ -91,7 +91,7 @@
#include "nsICapturePicker.h"
#include "nsIFileURL.h"
#include "nsDOMFile.h"
#include "nsIEventStateManager.h"
#include "nsEventStates.h"
namespace dom = mozilla::dom;

View File

@ -38,7 +38,7 @@
#include "nsFormControlFrame.h"
#include "nsGkAtoms.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIEventStateManager.h"
#include "nsEventStateManager.h"
#include "nsILookAndFeel.h"
//#define FCF_NOISY
@ -128,12 +128,13 @@ nsFormControlFrame::RegUnRegAccessKey(nsIFrame * aFrame, PRBool aDoReg)
nsIContent* content = aFrame->GetContent();
content->GetAttr(kNameSpaceID_None, nsGkAtoms::accesskey, accessKey);
if (!accessKey.IsEmpty()) {
nsIEventStateManager *stateManager = presContext->EventStateManager();
nsEventStateManager *stateManager = presContext->EventStateManager();
if (aDoReg) {
return stateManager->RegisterAccessKey(content, (PRUint32)accessKey.First());
stateManager->RegisterAccessKey(content, (PRUint32)accessKey.First());
} else {
return stateManager->UnregisterAccessKey(content, (PRUint32)accessKey.First());
stateManager->UnregisterAccessKey(content, (PRUint32)accessKey.First());
}
return NS_OK;
}
return NS_ERROR_FAILURE;
}

View File

@ -59,7 +59,7 @@
#include "nsHTMLParts.h"
#include "nsIDOMEventTarget.h"
#include "nsEventDispatcher.h"
#include "nsIEventStateManager.h"
#include "nsEventStateManager.h"
#include "nsIEventListenerManager.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMMouseEvent.h"
@ -87,7 +87,6 @@
#include "nsIDOMKeyListener.h"
#include "nsLayoutUtils.h"
#include "nsDisplayList.h"
#include "nsIEventStateManager.h"
// Constants
const nscoord kMaxDropDownRows = 20; // This matches the setting for 4.x browsers
@ -2072,9 +2071,8 @@ nsListControlFrame::GetIndexFromDOMEvent(nsIDOMEvent* aMouseEvent,
}
}
nsCOMPtr<nsIContent> content;
PresContext()->EventStateManager()->
GetEventTargetContent(nsnull, getter_AddRefs(content));
nsCOMPtr<nsIContent> content = PresContext()->EventStateManager()->
GetEventTargetContent(nsnull);
nsCOMPtr<nsIContent> optionContent = GetOptionFromContent(content);
if (optionContent) {

View File

@ -92,7 +92,6 @@
#include "nsIDOM3EventTarget.h"
#include "nsIDOMNSEvent.h"
#include "nsIDOMNSUIEvent.h"
#include "nsIEventStateManager.h"
#include "nsIDOMFocusListener.h" //onchange events
#include "nsIDOMCharacterData.h" //for selection setting helper func

View File

@ -48,7 +48,7 @@
#include "nsGUIEvent.h"
#include "nsStyleConsts.h"
#include "nsGkAtoms.h"
#include "nsIEventStateManager.h"
#include "nsEventStateManager.h"
#include "nsIPresShell.h"
#include "nsIScrollPositionListener.h"
#include "nsDisplayList.h"

View File

@ -66,7 +66,6 @@
#include "nsLayoutErrors.h"
#include "nsDisplayList.h"
#include "nsContentErrors.h"
#include "nsIEventStateManager.h"
#include "nsListControlFrame.h"
#include "nsIBaseWindow.h"
#include "nsThemeConstants.h"

View File

@ -80,7 +80,7 @@
#include "nsIDOMHTMLHRElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIEditorDocShell.h"
#include "nsIEventStateManager.h"
#include "nsEventStateManager.h"
#include "nsISelection.h"
#include "nsISelectionPrivate.h"
#include "nsFrameSelection.h"
@ -2076,9 +2076,7 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
//We often get out of sync state issues with mousedown events that
//get interrupted by alerts/dialogs.
//Check with the ESM to see if we should process this one
PRBool eventOK;
aPresContext->EventStateManager()->EventStatusOK(aEvent, &eventOK);
if (!eventOK)
if (!aPresContext->EventStateManager()->EventStatusOK(aEvent))
return NS_OK;
nsresult rv;

View File

@ -88,7 +88,6 @@
#include "imgIContainer.h"
#include "imgILoader.h"
#include "nsContentPolicyUtils.h"
#include "nsCSSFrameConstructor.h"
#include "nsIPrefBranch2.h"
#include "nsIPrefService.h"
@ -96,7 +95,7 @@
#include "nsIContentPolicy.h"
#include "nsContentPolicyUtils.h"
#include "nsIEventStateManager.h"
#include "nsEventStates.h"
#include "nsLayoutErrors.h"
#include "nsBidiUtils.h"
#include "nsBidiPresUtils.h"

View File

@ -57,6 +57,7 @@
#include "nsIMutableArray.h"
#include "nsBindingManager.h"
#include "nsComputedDOMStyle.h"
#include "nsEventStateManager.h"
///////////////////////////////////////////////////////////////////////////////
@ -236,7 +237,7 @@ inDOMUtils::SetContentState(nsIDOMElement *aElement, nsEventStates::InternalType
{
NS_ENSURE_ARG_POINTER(aElement);
nsCOMPtr<nsIEventStateManager> esm = inLayoutUtils::GetEventStateManagerFor(aElement);
nsRefPtr<nsEventStateManager> esm = inLayoutUtils::GetEventStateManagerFor(aElement);
if (esm) {
nsCOMPtr<nsIContent> content;
content = do_QueryInterface(aElement);
@ -254,7 +255,7 @@ inDOMUtils::GetContentState(nsIDOMElement *aElement, nsEventStates::InternalType
NS_ENSURE_ARG_POINTER(aElement);
nsCOMPtr<nsIEventStateManager> esm = inLayoutUtils::GetEventStateManagerFor(aElement);
nsRefPtr<nsEventStateManager> esm = inLayoutUtils::GetEventStateManagerFor(aElement);
if (esm) {
nsCOMPtr<nsIContent> content;
content = do_QueryInterface(aElement);

View File

@ -40,11 +40,11 @@
#include "inIDOMUtils.h"
#include "nsIEventStateManager.h"
#include "nsISupportsArray.h"
class nsRuleNode;
class nsStyleContext;
class nsIContent;
class inDOMUtils : public inIDOMUtils
{

View File

@ -90,7 +90,7 @@ inLayoutUtils::GetFrameFor(nsIDOMElement* aElement)
return content->GetPrimaryFrame();
}
nsIEventStateManager*
nsEventStateManager*
inLayoutUtils::GetEventStateManagerFor(nsIDOMElement *aElement)
{
NS_PRECONDITION(aElement, "Passing in a null element is bad");

View File

@ -43,7 +43,7 @@ class nsIDOMDocument;
class nsIDOMElement;
class nsIDOMNode;
class nsIDOMWindowInternal;
class nsIEventStateManager;
class nsEventStateManager;
class nsIFrame;
class nsIPresShell;
class nsISupports;
@ -55,7 +55,7 @@ public:
static nsIDOMWindowInternal* GetWindowFor(nsIDOMDocument* aDoc);
static nsIPresShell* GetPresShellFor(nsISupports* aThing);
static nsIFrame* GetFrameFor(nsIDOMElement* aElement);
static nsIEventStateManager* GetEventStateManagerFor(nsIDOMElement *aElement);
static nsEventStateManager* GetEventStateManagerFor(nsIDOMElement *aElement);
static nsBindingManager* GetBindingManagerFor(nsIDOMNode* aNode);
static nsIDOMDocument* GetSubDocumentFor(nsIDOMNode* aNode);
static nsIDOMNode* GetContainerFor(nsIDOMDocument* aDoc);

View File

@ -47,7 +47,6 @@
#include "nsIDocument.h"
#include "nsIDocShell.h"
#include "nsPresContext.h"
#include "nsIEventStateManager.h"
#include "nsFocusManager.h"
#include "nsLiteralString.h"

View File

@ -62,7 +62,7 @@
#include "mozilla/css/GroupRule.h"
#include "nsIDocument.h"
#include "nsPresContext.h"
#include "nsIEventStateManager.h"
#include "nsEventStateManager.h"
#include "nsGkAtoms.h"
#include "nsString.h"
#include "nsUnicharUtils.h"

View File

@ -59,7 +59,7 @@
#include "nsStyleContext.h"
#include "nsGkAtoms.h"
#include "nsPresContext.h"
#include "nsIEventStateManager.h"
#include "nsEventStates.h"
#include "nsIDocument.h"
#include "nsIPresShell.h"
#include "nsStyleConsts.h"

View File

@ -124,7 +124,7 @@ public:
* test is used for optimization only, and may err on the side of
* reporting more dependencies than really exist.
*
* Event states are defined in nsIEventStateManager.h.
* Event states are defined in nsEventStates.h.
*/
virtual nsRestyleHint
HasStateDependentStyle(StateRuleProcessorData* aData) = 0;

View File

@ -62,7 +62,7 @@
#ifdef MOZ_CSS_ANIMATIONS
#include "nsAnimationManager.h"
#endif
#include "nsIEventStateManager.h"
#include "nsEventStates.h"
#include "mozilla/dom/Element.h"
using namespace mozilla::dom;

View File

@ -85,12 +85,11 @@
#include "nsWidgetsCID.h"
#include "nsCSSAnonBoxes.h"
#include "nsHTMLContainerFrame.h"
#include "nsIEventStateManager.h"
#include "nsIDOMDocument.h"
#include "nsIDOMElement.h"
#include "nsITheme.h"
#include "nsTransform2D.h"
#include "nsIEventStateManager.h"
#include "nsEventStateManager.h"
#include "nsEventDispatcher.h"
#include "nsIDOMEvent.h"
#include "nsIPrivateDOMEvent.h"
@ -1930,17 +1929,15 @@ nsBoxFrame::RegUnregAccessKey(PRBool aDoReg)
// With a valid PresContext we can get the ESM
// and register the access key
nsIEventStateManager *esm = PresContext()->EventStateManager();
nsresult rv;
nsEventStateManager *esm = PresContext()->EventStateManager();
PRUint32 key = accessKey.First();
if (aDoReg)
rv = esm->RegisterAccessKey(mContent, key);
esm->RegisterAccessKey(mContent, key);
else
rv = esm->UnregisterAccessKey(mContent, key);
esm->UnregisterAccessKey(mContent, key);
return rv;
return NS_OK;
}
PRBool

View File

@ -48,7 +48,7 @@
#include "nsPresContext.h"
#include "nsIPresShell.h"
#include "nsGUIEvent.h"
#include "nsIEventStateManager.h"
#include "nsEventStateManager.h"
#include "nsIDOMElement.h"
#include "nsDisplayList.h"
#include "nsContentUtils.h"
@ -92,7 +92,7 @@ nsButtonBoxFrame::HandleEvent(nsPresContext* aPresContext,
if (NS_KEY_EVENT == aEvent->eventStructType) {
nsKeyEvent* keyEvent = (nsKeyEvent*)aEvent;
if (NS_VK_SPACE == keyEvent->keyCode) {
nsIEventStateManager *esm = aPresContext->EventStateManager();
nsEventStateManager *esm = aPresContext->EventStateManager();
// :hover:active state
esm->SetContentState(mContent, NS_EVENT_STATE_HOVER);
esm->SetContentState(mContent, NS_EVENT_STATE_ACTIVE);
@ -121,7 +121,7 @@ nsButtonBoxFrame::HandleEvent(nsPresContext* aPresContext,
nsKeyEvent* keyEvent = (nsKeyEvent*)aEvent;
if (NS_VK_SPACE == keyEvent->keyCode) {
// only activate on keyup if we're already in the :hover:active state
nsIEventStateManager *esm = aPresContext->EventStateManager();
nsEventStateManager *esm = aPresContext->EventStateManager();
nsEventStates buttonState = esm->GetContentState(mContent);
if (buttonState.HasAllStates(NS_EVENT_STATE_ACTIVE |
NS_EVENT_STATE_HOVER)) {

View File

@ -43,7 +43,6 @@
#include "nsIDOMEvent.h"
#include "nsStyleConsts.h"
#include "nsGkAtoms.h"
#include "nsIEventStateManager.h"
#include "nsIPresShell.h"
#include "nsBoxFrame.h"
#include "nsStackLayout.h"

View File

@ -57,8 +57,6 @@
#include "nsIDOMNode.h"
#include "nsIDOMElement.h"
#include "nsIEventStateManager.h"
#include "nsContentUtils.h"
/*

View File

@ -73,7 +73,7 @@
#include "nsLayoutUtils.h"
#include "nsContentUtils.h"
#include "nsCSSFrameConstructor.h"
#include "nsIEventStateManager.h"
#include "nsEventStateManager.h"
#include "nsIBoxLayout.h"
#include "nsIPopupBoxObject.h"
#include "nsPIWindowRoot.h"
@ -833,7 +833,7 @@ nsMenuPopupFrame::HidePopup(PRBool aDeselectMenu, nsPopupState aNewState)
// XXX, bug 137033, In Windows, if mouse is outside the window when the menupopup closes, no
// mouse_enter/mouse_exit event will be fired to clear current hover state, we should clear it manually.
// This code may not the best solution, but we can leave it here until we find the better approach.
nsIEventStateManager *esm = PresContext()->EventStateManager();
nsEventStateManager *esm = PresContext()->EventStateManager();
nsEventStates state = esm->GetContentState(mContent);

View File

@ -62,7 +62,7 @@
#include "nsIDOMDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMXULLabelElement.h"
#include "nsIEventStateManager.h"
#include "nsEventStateManager.h"
#include "nsITheme.h"
#include "nsUnicharUtils.h"
#include "nsContentUtils.h"
@ -1151,17 +1151,15 @@ nsTextBoxFrame::RegUnregAccessKey(PRBool aDoReg)
if (accessKey.IsEmpty())
return NS_OK;
nsresult rv;
// With a valid PresContext we can get the ESM
// and (un)register the access key
nsIEventStateManager *esm = PresContext()->EventStateManager();
nsEventStateManager *esm = PresContext()->EventStateManager();
PRUint32 key = accessKey.First();
if (aDoReg)
rv = esm->RegisterAccessKey(mContent, key);
esm->RegisterAccessKey(mContent, key);
else
rv = esm->UnregisterAccessKey(mContent, key);
esm->UnregisterAccessKey(mContent, key);
return rv;
return NS_OK;
}

View File

@ -40,7 +40,7 @@
#include "nsXULLabelFrame.h"
#include "nsHTMLParts.h"
#include "nsINameSpaceManager.h"
#include "nsIEventStateManager.h"
#include "nsEventStateManager.h"
nsIFrame*
NS_NewXULLabelFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
@ -80,16 +80,15 @@ nsXULLabelFrame::RegUnregAccessKey(PRBool aDoReg)
// With a valid PresContext we can get the ESM
// and register the access key
nsIEventStateManager *esm = PresContext()->EventStateManager();
nsresult rv;
nsEventStateManager *esm = PresContext()->EventStateManager();
PRUint32 key = accessKey.First();
if (aDoReg)
rv = esm->RegisterAccessKey(mContent, key);
esm->RegisterAccessKey(mContent, key);
else
rv = esm->UnregisterAccessKey(mContent, key);
esm->UnregisterAccessKey(mContent, key);
return rv;
return NS_OK;
}
/////////////////////////////////////////////////////////////////////////////

View File

@ -42,7 +42,7 @@
#include "nsTreeContentView.h"
#include "nsChildIterator.h"
#include "nsIDOMClassInfo.h"
#include "nsIEventStateManager.h"
#include "nsEventStates.h"
#include "nsINodeInfo.h"
#include "nsIXULSortService.h"
#include "nsContentUtils.h"

View File

@ -51,7 +51,6 @@
#include "mozilla/storage.h"
#include "mozilla/dom/Link.h"
#include "nsDocShellCID.h"
#include "nsIEventStateManager.h"
#include "mozilla/Services.h"
#include "nsThreadUtils.h"
#include "nsNetUtil.h"

View File

@ -69,7 +69,6 @@
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMNSHTMLDocument.h"
#include "nsIDOMHTMLElement.h"
#include "nsIEventStateManager.h"
#include "nsIDocument.h"
#include "nsISelection.h"
#include "nsILink.h"

View File

@ -52,7 +52,7 @@
#include "nsIDocument.h"
#include "nsIFrame.h"
#include "nsIAtom.h"
#include "nsIEventStateManager.h"
#include "nsEventStates.h"
#include "nsINameSpaceManager.h"
#include "nsPresContext.h"
#include "nsILookAndFeel.h"

View File

@ -49,7 +49,6 @@
#include "nsIPresShell.h"
#include "nsIDocument.h"
#include "nsIContent.h"
#include "nsIEventStateManager.h"
#include "nsIViewManager.h"
#include "nsINameSpaceManager.h"
#include "nsILookAndFeel.h"

View File

@ -61,7 +61,6 @@
#include "nsThemeConstants.h"
#include "nsILookAndFeel.h"
#include "nsIServiceManager.h"
#include "nsIEventStateManager.h"
#include "nsIDOMHTMLInputElement.h"
#include <malloc.h>

View File

@ -51,7 +51,7 @@
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIFrame.h"
#include "nsIEventStateManager.h"
#include "nsEventStates.h"
#include "nsINameSpaceManager.h"
#include "nsILookAndFeel.h"
#include "nsIDOMHTMLInputElement.h"

View File

@ -59,7 +59,6 @@
#include "nsISelectionPrivate.h"
#include "nsPresContext.h"
#include "nsIDOMDataTransfer.h"
#include "nsIEventStateManager.h"
#include "nsICanvasElementExternal.h"
#include "nsIImageLoadingContent.h"
#include "imgIContainer.h"

View File

@ -43,7 +43,7 @@
#include "nsIFrame.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsIEventStateManager.h"
#include "nsEventStateManager.h"
#include "nsString.h"
#include "nsINameSpaceManager.h"
#include "nsIDOMHTMLInputElement.h"
@ -91,7 +91,7 @@ nsNativeTheme::GetContentState(nsIFrame* aFrame, PRUint8 aWidgetType)
if (!shell)
return nsEventStates();
nsIEventStateManager* esm = shell->GetPresContext()->EventStateManager();
nsEventStateManager* esm = shell->GetPresContext()->EventStateManager();
nsEventStates flags = esm->GetContentState(aFrame->GetContent(), PR_TRUE);
if (isXULCheckboxRadio && aWidgetType == NS_THEME_RADIO) {

View File

@ -76,7 +76,7 @@ class nsNativeTheme : public nsITimerCallback
nsNativeTheme();
// Returns the content state (hover, focus, etc), see nsIEventStateManager.h
// Returns the content state (hover, focus, etc), see nsEventStateManager.h
nsEventStates GetContentState(nsIFrame* aFrame, PRUint8 aWidgetType);
// Returns whether the widget is already styled by content