Backed out changeset c1a7c1bc1aeb due to busted build.

This commit is contained in:
Mounir Lamouri 2011-04-20 22:26:06 +02:00
Родитель 732897cc3f
Коммит 2af4853be5
90 изменённых файлов: 415 добавлений и 224 удалений

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -60,7 +60,7 @@
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsIScrollableFrame.h"
#include "nsEventStateManager.h"
#include "nsIEventStateManager.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
// nsEventStateManager::GetRegisteredAccessKey() method.
// nsIEventStateManager::GetRegisteredAccessKey() method.
if (!aContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::accesskey))
return 0;
@ -222,11 +222,13 @@ nsCoreUtils::GetAccessKeyFor(nsIContent *aContent)
if (!presContext)
return 0;
nsEventStateManager *esm = presContext->EventStateManager();
nsIEventStateManager *esm = presContext->EventStateManager();
if (!esm)
return 0;
return esm->GetRegisteredAccessKey(aContent);
PRUint32 key = 0;
esm->GetRegisteredAccessKey(aContent, &key);
return key;
}
nsIContent *

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -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 nsEventStateManager.
// menu are't registered by nsIEventStateManager.
nsAutoString accesskey;
mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::accesskey,
accesskey);

Просмотреть файл

@ -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 nsEventStateManager. Also see nsEventStateManager
* content state, use nsIEventStateManager. Also see nsIEventStateManager
* for the possible bits that could be set here.
*/
virtual nsEventStates IntrinsicState() const;

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -0,0 +1,167 @@
/* -*- 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__

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -39,6 +39,7 @@
#ifndef nsEventStateManager_h__
#define nsEventStateManager_h__
#include "nsIEventStateManager.h"
#include "nsEvent.h"
#include "nsGUIEvent.h"
#include "nsIContent.h"
@ -55,7 +56,6 @@
#include "nsIScrollableFrame.h"
#include "nsFocusManager.h"
#include "nsIDocument.h"
#include "nsEventStates.h"
class nsIPresShell;
class nsIDocShell;
@ -75,6 +75,7 @@ class TabParent;
*/
class nsEventStateManager : public nsSupportsWeakReference,
public nsIEventStateManager,
public nsIObserver
{
friend class nsMouseWheelTransaction;
@ -85,7 +86,7 @@ public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_NSIOBSERVER
nsresult Init();
NS_IMETHOD Init();
nsresult Shutdown();
/* The PreHandleEvent method is called before event dispatch to either
@ -95,86 +96,44 @@ public:
* PostHandleEvent. Any centralized event processing which must occur before
* DOM or frame event handling should occur here as well.
*/
nsresult PreHandleEvent(nsPresContext* aPresContext,
nsEvent *aEvent,
nsIFrame* aTargetFrame,
nsEventStatus* aStatus,
nsIView* aView);
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.
*/
nsresult PostHandleEvent(nsPresContext* aPresContext,
nsEvent *aEvent,
nsIFrame* aTargetFrame,
nsEventStatus* aStatus,
nsIView* aView);
NS_IMETHOD PostHandleEvent(nsPresContext* aPresContext,
nsEvent *aEvent,
nsIFrame* aTargetFrame,
nsEventStatus* aStatus,
nsIView* aView);
void NotifyDestroyPresContext(nsPresContext* aPresContext);
void SetPresContext(nsPresContext* aPresContext);
void ClearFrameRefs(nsIFrame* aFrame);
NS_IMETHOD NotifyDestroyPresContext(nsPresContext* aPresContext);
NS_IMETHOD SetPresContext(nsPresContext* aPresContext);
NS_IMETHOD ClearFrameRefs(nsIFrame* aFrame);
nsIFrame* GetEventTarget();
already_AddRefed<nsIContent> GetEventTargetContent(nsEvent* aEvent);
NS_IMETHOD GetEventTarget(nsIFrame **aFrame);
NS_IMETHOD GetEventTargetContent(nsEvent* aEvent, nsIContent** aContent);
/**
* 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);
/**
* 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);
// Access Key Registration
NS_IMETHOD RegisterAccessKey(nsIContent* aContent, PRUint32 aKey);
NS_IMETHOD UnregisterAccessKey(nsIContent* aContent, PRUint32 aKey);
NS_IMETHOD GetRegisteredAccessKey(nsIContent* aContent, PRUint32* aKey);
/**
* 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);
NS_IMETHOD SetCursor(PRInt32 aCursor, imgIContainer* aContainer,
PRBool aHaveHotspot, float aHotspotX, float aHotspotY,
nsIWidget* aWidget, PRBool aLockCursor);
static void StartHandlingUserInput()
{
@ -191,23 +150,16 @@ 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,
nsIObserver)
nsIEventStateManager)
static nsIDocument* sMouseOverDocument;
static nsEventStateManager* GetActiveEventStateManager() { return sActiveESM; }
static nsIEventStateManager* GetActiveEventStateManager() { return sActiveESM; }
// Sets aNewESM to be the active event state manager, and
// if aContent is non-null, marks the object as active.
@ -537,6 +489,4 @@ private:
static void operator delete(void* /*memory*/) {}
};
#define NS_EVENT_NEEDS_FRAME(event) (!NS_IS_ACTIVATION_EVENT(event))
#endif // nsEventStateManager_h__

Просмотреть файл

@ -86,7 +86,7 @@
#include "nsString.h"
#include "nsUnicharUtils.h"
#include "nsGkAtoms.h"
#include "nsEventStateManager.h"
#include "nsIEventStateManager.h"
#include "nsIDOMEvent.h"
#include "nsIDOMNSEvent.h"
#include "nsDOMCSSDeclaration.h"
@ -1056,8 +1056,9 @@ 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);
nsCOMPtr<nsIContent> target;
aVisitor.mPresContext->EventStateManager()->
GetEventTargetContent(aVisitor.mEvent, getter_AddRefs(target));
return !target || !IsArea(target) || IsArea(this);
}
@ -3352,7 +3353,7 @@ nsGenericHTMLElement::RegUnRegAccessKey(PRBool aDoReg)
nsPresContext *presContext = GetPresContext();
if (presContext) {
nsEventStateManager *esm = presContext->EventStateManager();
nsIEventStateManager *esm = presContext->EventStateManager();
// Register or unregister as appropriate.
if (aDoReg) {

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -98,6 +98,7 @@
#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";

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -89,7 +89,7 @@ class nsFrameManager;
class nsILinkHandler;
class nsStyleContext;
class nsIAtom;
class nsEventStateManager;
class nsIEventStateManager;
class nsIURI;
class nsILookAndFeel;
class nsICSSPseudoComparator;

Просмотреть файл

@ -118,7 +118,6 @@
#include "nsViewsCID.h"
#include "nsPresArena.h"
#include "nsFrameManager.h"
#include "nsEventStateManager.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "nsILayoutHistoryState.h"
@ -3778,7 +3777,7 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, PRBool aScroll)
}
// Hold a reference to the ESM in case event dispatch tears us down.
nsRefPtr<nsEventStateManager> esm = mPresContext->EventStateManager();
nsCOMPtr<nsIEventStateManager> esm = mPresContext->EventStateManager();
if (aAnchorName.IsEmpty()) {
NS_ASSERTION(!aScroll, "can't scroll to empty anchor name");
@ -6509,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.
nsEventStateManager* activeESM =
nsIEventStateManager* activeESM =
nsEventStateManager::GetActiveEventStateManager();
if (activeESM && NS_IS_MOUSE_EVENT(aEvent) &&
activeESM != shell->GetPresContext()->EventStateManager() &&
@ -6795,7 +6794,7 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsIView *aView,
}
#endif
nsRefPtr<nsEventStateManager> manager = mPresContext->EventStateManager();
nsCOMPtr<nsIEventStateManager> manager = mPresContext->EventStateManager();
nsresult rv = NS_OK;
if (!NS_EVENT_NEEDS_FRAME(aEvent) || GetCurrentEventFrame()) {

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -59,7 +59,7 @@
#include "nsHTMLParts.h"
#include "nsIDOMEventTarget.h"
#include "nsEventDispatcher.h"
#include "nsEventStateManager.h"
#include "nsIEventStateManager.h"
#include "nsIEventListenerManager.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMMouseEvent.h"
@ -87,6 +87,7 @@
#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
@ -2071,8 +2072,9 @@ nsListControlFrame::GetIndexFromDOMEvent(nsIDOMEvent* aMouseEvent,
}
}
nsCOMPtr<nsIContent> content = PresContext()->EventStateManager()->
GetEventTargetContent(nsnull);
nsCOMPtr<nsIContent> content;
PresContext()->EventStateManager()->
GetEventTargetContent(nsnull, getter_AddRefs(content));
nsCOMPtr<nsIContent> optionContent = GetOptionFromContent(content);
if (optionContent) {

Просмотреть файл

@ -92,6 +92,7 @@
#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

Просмотреть файл

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

Просмотреть файл

@ -2076,7 +2076,9 @@ 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
if (!aPresContext->EventStateManager()->EventStatusOK(aEvent))
PRBool eventOK;
aPresContext->EventStateManager()->EventStatusOK(aEvent, &eventOK);
if (!eventOK)
return NS_OK;
nsresult rv;

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -43,7 +43,7 @@ class nsIDOMDocument;
class nsIDOMElement;
class nsIDOMNode;
class nsIDOMWindowInternal;
class nsEventStateManager;
class nsIEventStateManager;
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 nsEventStateManager* GetEventStateManagerFor(nsIDOMElement *aElement);
static nsIEventStateManager* GetEventStateManagerFor(nsIDOMElement *aElement);
static nsBindingManager* GetBindingManagerFor(nsIDOMNode* aNode);
static nsIDOMDocument* GetSubDocumentFor(nsIDOMNode* aNode);
static nsIDOMNode* GetContainerFor(nsIDOMDocument* aDoc);

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -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 nsEventStates.h.
* Event states are defined in nsIEventStateManager.h.
*/
virtual nsRestyleHint
HasStateDependentStyle(StateRuleProcessorData* aData) = 0;

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -48,7 +48,7 @@
#include "nsPresContext.h"
#include "nsIPresShell.h"
#include "nsGUIEvent.h"
#include "nsEventStateManager.h"
#include "nsIEventStateManager.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) {
nsEventStateManager *esm = aPresContext->EventStateManager();
nsIEventStateManager *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
nsEventStateManager *esm = aPresContext->EventStateManager();
nsIEventStateManager *esm = aPresContext->EventStateManager();
nsEventStates buttonState = esm->GetContentState(mContent);
if (buttonState.HasAllStates(NS_EVENT_STATE_ACTIVE |
NS_EVENT_STATE_HOVER)) {

Просмотреть файл

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

Просмотреть файл

@ -73,7 +73,7 @@
#include "nsLayoutUtils.h"
#include "nsContentUtils.h"
#include "nsCSSFrameConstructor.h"
#include "nsEventStateManager.h"
#include "nsIEventStateManager.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.
nsEventStateManager *esm = PresContext()->EventStateManager();
nsIEventStateManager *esm = PresContext()->EventStateManager();
nsEventStates state = esm->GetContentState(mContent);

Просмотреть файл

@ -62,7 +62,7 @@
#include "nsIDOMDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMXULLabelElement.h"
#include "nsEventStateManager.h"
#include "nsIEventStateManager.h"
#include "nsITheme.h"
#include "nsUnicharUtils.h"
#include "nsContentUtils.h"
@ -1151,15 +1151,17 @@ 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
nsEventStateManager *esm = PresContext()->EventStateManager();
nsIEventStateManager *esm = PresContext()->EventStateManager();
PRUint32 key = accessKey.First();
if (aDoReg)
esm->RegisterAccessKey(mContent, key);
rv = esm->RegisterAccessKey(mContent, key);
else
esm->UnregisterAccessKey(mContent, key);
rv = esm->UnregisterAccessKey(mContent, key);
return NS_OK;
return rv;
}

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -51,6 +51,7 @@
#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"

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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