Bug 363067, Add nsPIDOMEventTarget and kill nsIChromeEventHandler, r=jst, sr=sicking

This commit is contained in:
Olli.Pettay%helsinki.fi 2007-02-15 23:04:33 +00:00
Родитель 47eef2357e
Коммит 805e0ff0f8
48 изменённых файлов: 316 добавлений и 594 удалений

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

@ -43,7 +43,6 @@
#include "nsIAccessibleCaret.h"
#include "nsIBaseWindow.h"
#include "nsICaret.h"
#include "nsIChromeEventHandler.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeNode.h"
@ -264,7 +263,7 @@ nsRootAccessible::GetChromeEventHandler(nsIDOMEventTarget **aChromeTarget)
nsCOMPtr<nsIDOMWindow> domWin;
GetWindow(getter_AddRefs(domWin));
nsCOMPtr<nsPIDOMWindow> privateDOMWindow(do_QueryInterface(domWin));
nsCOMPtr<nsIChromeEventHandler> chromeEventHandler;
nsCOMPtr<nsPIDOMEventTarget> chromeEventHandler;
if (privateDOMWindow) {
chromeEventHandler = privateDOMWindow->GetChromeEventHandler();
}

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

@ -802,13 +802,10 @@ public:
* @param aCreateIfNotFound If PR_FALSE, returns a listener manager only if
* one already exists.
* @param aResult [out] Set to the eventlistener manager for aNode.
* @param aCreated [out] Set to PR_TRUE if a new eventlistener manager was
* created.
*/
static nsresult GetListenerManager(nsINode *aNode,
PRBool aCreateIfNotFound,
nsIEventListenerManager **aResult,
PRBool *aCreated);
nsIEventListenerManager **aResult);
/**
* Remove the eventlistener manager for aNode.

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

@ -38,6 +38,7 @@
#ifndef nsINode_h___
#define nsINode_h___
#include "nsPIDOMEventTarget.h"
#include "nsEvent.h"
#include "nsPropertyTable.h"
#include "nsTObserverArray.h"
@ -96,11 +97,11 @@ class nsNodeSupportsWeakRefTearoff;
// IID for the nsINode interface
#define NS_INODE_IID \
{ 0x0d2a583d, 0x7a99, 0x426b, \
{ 0x89, 0xfa, 0xca, 0x8d, 0x63, 0xbb, 0xd7, 0x3f } }
{ 0x22ab1440, 0xa6ee, 0x4da7, \
{ 0xbc, 0x3b, 0x94, 0x2e, 0x56, 0x0d, 0xdc, 0xe0 } }
// hack to make egcs / gcc 2.95.2 happy
class nsINode_base : public nsISupports {
class nsINode_base : public nsPIDOMEventTarget {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_INODE_IID)
};
@ -442,65 +443,6 @@ public:
return mNodeInfo->NodeInfoManager()->DocumentPrincipal();
}
/**
* Called before the capture phase of the event flow.
* This is used to create the event target chain and implementations
* should set the necessary members of nsEventChainPreVisitor.
* At least aVisitor.mCanHandle must be set,
* usually also aVisitor.mParentTarget if mCanHandle is PR_TRUE.
* First one tells that this object can handle the aVisitor.mEvent event and
* the latter one is the possible parent object for the event target chain.
* @see nsEventDispatcher.h for more documentation about aVisitor.
*
* @param aVisitor the visitor object which is used to create the
* event target chain for event dispatching.
*
* @note Only nsEventDispatcher should call this method.
*/
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) = 0;
/**
* Called after the bubble phase of the system event group.
* The default handling of the event should happen here.
* @param aVisitor the visitor object which is used during post handling.
*
* @see nsEventDispatcher.h for documentation about aVisitor.
* @note Only nsEventDispatcher should call this method.
*/
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor) = 0;
/**
* Dispatch an event.
* @param aEvent the event that is being dispatched.
* @param aDOMEvent the event that is being dispatched, use if you want to
* dispatch nsIDOMEvent, not only nsEvent.
* @param aPresContext the current presentation context, can be nsnull.
* @param aEventStatus the status returned from the function, can be nsnull.
*
* @note If both aEvent and aDOMEvent are used, aEvent must be the internal
* event of the aDOMEvent.
*
* If aDOMEvent is not nsnull (in which case aEvent can be nsnull) it is used
* for dispatching, otherwise aEvent is used.
*
* @deprecated This method is here just until all the callers outside Gecko
* have been converted to use nsIDOMEventTarget::dispatchEvent.
*/
virtual nsresult DispatchDOMEvent(nsEvent* aEvent,
nsIDOMEvent* aDOMEvent,
nsPresContext* aPresContext,
nsEventStatus* aEventStatus) = 0;
/**
* Get the event listener manager, the guy you talk to to register for events
* on this node.
* @param aCreateIfNotFound If PR_FALSE, returns a listener manager only if
* one already exists. [IN]
* @param aResult The event listener manager [OUT]
*/
NS_IMETHOD GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult);
/**
* Get the parent nsIContent for this node.
* @return the parent, or null if no parent or the parent is not an nsIContent
@ -609,6 +551,9 @@ public:
nsNodeWeakReference* mWeakReference;
};
/**
* Functions for managing flags and slots
*/
#ifdef DEBUG
nsSlots* DebugGetSlots()
{
@ -616,10 +561,34 @@ public:
}
#endif
PRBool HasFlag(PtrBits aFlag) const
{
return !!(GetFlags() & aFlag);
}
PtrBits GetFlags() const
{
return NS_UNLIKELY(HasSlots()) ? FlagsAsSlots()->mFlags : mFlagsOrSlots;
}
void SetFlags(PtrBits aFlagsToSet)
{
NS_ASSERTION(!(aFlagsToSet & (NODE_IS_ANONYMOUS | NODE_MAY_HAVE_FRAME)) ||
IsNodeOfType(eCONTENT),
"Flag only permitted on nsIContent nodes");
PtrBits* flags = HasSlots() ? &FlagsAsSlots()->mFlags :
&mFlagsOrSlots;
*flags |= aFlagsToSet;
}
void UnsetFlags(PtrBits aFlagsToUnset)
{
PtrBits* flags = HasSlots() ? &FlagsAsSlots()->mFlags :
&mFlagsOrSlots;
*flags &= ~aFlagsToUnset;
}
protected:
/**
* Functions for managing flags and slots
*/
// Override this function to create a custom slots class.
virtual nsINode::nsSlots* CreateSlots();
@ -654,33 +623,6 @@ protected:
return slots;
}
PtrBits GetFlags() const
{
return NS_UNLIKELY(HasSlots()) ? FlagsAsSlots()->mFlags : mFlagsOrSlots;
}
PRBool HasFlag(PtrBits aFlag) const
{
return !!(GetFlags() & aFlag);
}
void SetFlags(PtrBits aFlagsToSet)
{
NS_ASSERTION(!(aFlagsToSet & (NODE_IS_ANONYMOUS | NODE_MAY_HAVE_FRAME)) ||
IsNodeOfType(eCONTENT),
"Flag only permitted on nsIContent nodes");
PtrBits* flags = HasSlots() ? &FlagsAsSlots()->mFlags :
&mFlagsOrSlots;
*flags |= aFlagsToSet;
}
void UnsetFlags(PtrBits aFlagsToUnset)
{
PtrBits* flags = HasSlots() ? &FlagsAsSlots()->mFlags :
&mFlagsOrSlots;
*flags &= ~aFlagsToUnset;
}
nsCOMPtr<nsINodeInfo> mNodeInfo;
enum { PARENT_BIT_INDOCUMENT = 1 << 0, PARENT_BIT_PARENT_IS_CONTENT = 1 << 1 };

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

@ -2911,12 +2911,14 @@ nsContentUtils::TraverseListenerManager(nsINode *aNode,
nsresult
nsContentUtils::GetListenerManager(nsINode *aNode,
PRBool aCreateIfNotFound,
nsIEventListenerManager **aResult,
PRBool *aCreated)
nsIEventListenerManager **aResult)
{
*aResult = nsnull;
*aCreated = PR_FALSE;
if (!aCreateIfNotFound && !aNode->HasFlag(NODE_HAS_LISTENERMANAGER)) {
return NS_OK;
}
if (!sEventListenerManagersHash.ops) {
// We're already shut down, don't bother creating an event listener
// manager.
@ -2957,7 +2959,7 @@ nsContentUtils::GetListenerManager(nsINode *aNode,
entry->mListenerManager->SetListenerTarget(aNode);
*aCreated = PR_TRUE;
aNode->SetFlags(NODE_HAS_LISTENERMANAGER);
}
NS_ADDREF(*aResult = entry->mListenerManager);

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

@ -93,6 +93,7 @@ NS_INTERFACE_MAP_BEGIN(nsDOMAttribute)
NS_INTERFACE_MAP_ENTRY(nsIDOMNode)
NS_INTERFACE_MAP_ENTRY(nsIDOM3Node)
NS_INTERFACE_MAP_ENTRY(nsIDOM3Attr)
NS_INTERFACE_MAP_ENTRY(nsPIDOMEventTarget)
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference,
new nsNodeSupportsWeakRefTearoff(this))
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMAttr)
@ -734,6 +735,13 @@ nsDOMAttribute::DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
nsDOMAttribute::GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult)
{
return nsContentUtils::GetListenerManager(this, aCreateIfNotFound, aResult);
}
nsresult
nsDOMAttribute::EnsureChildState(PRBool aSetText, PRBool &aHasChild) const
{

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

@ -100,6 +100,8 @@ public:
virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
nsPresContext* aPresContext,
nsEventStatus* aEventStatus);
virtual nsresult GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult);
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
static void Initialize();

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

@ -908,6 +908,7 @@ NS_INTERFACE_MAP_BEGIN(nsDocument)
NS_INTERFACE_MAP_ENTRY(nsIDOM3EventTarget)
NS_INTERFACE_MAP_ENTRY(nsIDOMNSEventTarget)
NS_INTERFACE_MAP_ENTRY(nsIDOMNode)
NS_INTERFACE_MAP_ENTRY(nsPIDOMEventTarget)
NS_INTERFACE_MAP_ENTRY(nsIDOM3Node)
NS_INTERFACE_MAP_ENTRY(nsIDOM3Document)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)

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

@ -53,7 +53,6 @@
#include "nsIDOMWindow.h"
#include "nsPIDOMWindow.h"
#include "nsIWebNavigation.h"
#include "nsIChromeEventHandler.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeNode.h"
@ -65,6 +64,7 @@
#include "nsIScriptGlobalObject.h"
#include "nsIScriptSecurityManager.h"
#include "nsFrameLoader.h"
#include "nsIDOMEventTarget.h"
#include "nsIURI.h"
#include "nsIURL.h"
@ -397,7 +397,7 @@ nsFrameLoader::EnsureDocShell()
// Make sure all shells have links back to the content element
// in the nearest enclosing chrome shell.
nsCOMPtr<nsIChromeEventHandler> chromeEventHandler;
nsCOMPtr<nsIDOMEventTarget> chromeEventHandler;
if (parentType == nsIDocShellTreeItem::typeChrome) {
// Our parent shell is a chrome shell. It is therefore our nearest

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

@ -90,6 +90,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN(nsGenericDOMDataNode)
NS_INTERFACE_MAP_ENTRY(nsIContent)
NS_INTERFACE_MAP_ENTRY(nsINode)
NS_INTERFACE_MAP_ENTRY(nsPIDOMEventTarget)
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMEventReceiver,
nsDOMEventRTTearoff::Create(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMEventTarget,
@ -702,6 +703,13 @@ nsGenericDOMDataNode::DispatchDOMEvent(nsEvent* aEvent,
aPresContext, aEventStatus);
}
nsresult
nsGenericDOMDataNode::GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult)
{
return nsContentUtils::GetListenerManager(this, aCreateIfNotFound, aResult);
}
PRUint32
nsGenericDOMDataNode::GetChildCount() const
{

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

@ -180,6 +180,8 @@ public:
virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
nsPresContext* aPresContext,
nsEventStatus* aEventStatus);
virtual nsresult GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult);
// Implementation for nsIContent
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,

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

@ -214,25 +214,11 @@ nsINode::UnsetProperty(PRUint16 aCategory, nsIAtom *aPropertyName,
aStatus);
}
NS_IMETHODIMP
nsINode::GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult)
nsresult
nsGenericElement::GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult)
{
// No need to call nsContentUtils::GetListenerManager if we don't have
// an event listener manager.
if (!aCreateIfNotFound && !HasFlag(NODE_HAS_LISTENERMANAGER)) {
*aResult = nsnull;
return NS_OK;
}
PRBool created;
nsresult rv =
nsContentUtils::GetListenerManager(this, aCreateIfNotFound, aResult,
&created);
if (NS_SUCCEEDED(rv) && created) {
SetFlags(NODE_HAS_LISTENERMANAGER);
}
return rv;
return nsContentUtils::GetListenerManager(this, aCreateIfNotFound, aResult);
}
nsINode::nsSlots*
@ -3034,6 +3020,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_INTERFACE_MAP_BEGIN(nsGenericElement)
NS_INTERFACE_MAP_ENTRY(nsIContent)
NS_INTERFACE_MAP_ENTRY(nsINode)
NS_INTERFACE_MAP_ENTRY(nsPIDOMEventTarget)
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3Node, new nsNode3Tearoff(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMNSElement, new nsNSElementTearoff(this))
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMEventReceiver,

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

@ -394,6 +394,8 @@ public:
virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
nsPresContext* aPresContext,
nsEventStatus* aEventStatus);
virtual nsresult GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult);
// nsIContent interface methods
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,

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

@ -219,9 +219,8 @@ nsNodeUtils::LastRelease(nsINode* aNode, PRBool aDelete)
#ifdef DEBUG
if (nsContentUtils::IsInitialized()) {
nsCOMPtr<nsIEventListenerManager> manager;
PRBool created;
nsContentUtils::GetListenerManager(aNode, PR_FALSE,
getter_AddRefs(manager), &created);
getter_AddRefs(manager));
if (!manager) {
NS_ERROR("Huh, our bit says we have a listener manager list, "
"but there's nothing in the hash!?!!");

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

@ -54,6 +54,7 @@ EXPORTS = \
nsIPrivateCompositionEvent.h \
nsPLDOMEvent.h \
nsEventDispatcher.h \
nsPIDOMEventTarget.h \
$(NULL)
include $(topsrcdir)/config/rules.mk

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

@ -44,7 +44,7 @@
class nsIContent;
class nsIDocument;
class nsPresContext;
class nsIChromeEventHandler;
class nsPIDOMEventTarget;
class nsIScriptGlobalObject;
class nsEventTargetChainItem;
@ -53,21 +53,20 @@ class nsEventTargetChainItem;
* About event dispatching:
* When either nsEventDispatcher::Dispatch or
* nsEventDispatcher::DispatchDOMEvent is called an event target chain is
* created. nsEventDispatcher creates the chain by calling PreHandleEvent
* (or PreHandleChromeEvent) on each event target and the creation continues
* until either the mCanHandle member of the nsEventChainPreVisitor object is
* PR_FALSE or the mParentTarget does not point to a new target.
* The event target chain is created on the stack.
* created. nsEventDispatcher creates the chain by calling PreHandleEvent
* on each event target and the creation continues until either the mCanHandle
* member of the nsEventChainPreVisitor object is PR_FALSE or the mParentTarget
* does not point to a new target. The event target chain is created in the
* heap.
*
* If the event needs retargeting, mEventTargetAtParent must be set in
* PreHandleEvent or PreHandleChromeEvent.
* PreHandleEvent.
*
* The capture, target and bubble phases of the event dispatch are handled
* by iterating through the event target chain. Iteration happens twice,
* first for the default event group and then for the system event group.
* While dispatching the event for the system event group PostHandleEvent
* (or PostHandleChromeEvent) is called right after calling event listener for
* the current event target.
* is called right after calling event listener for the current event target.
*/
class nsEventChainVisitor {
@ -132,34 +131,25 @@ public:
nsIDOMEvent* aDOMEvent,
nsEventStatus aEventStatus = nsEventStatus_eIgnore)
: nsEventChainVisitor(aPresContext, aEvent, aDOMEvent, aEventStatus),
mCanHandle(PR_TRUE), mParentIsChromeHandler(PR_FALSE),
mForceContentDispatch(PR_FALSE) {}
mCanHandle(PR_TRUE), mForceContentDispatch(PR_FALSE) {}
void Reset() {
mItemFlags = 0;
mItemData = nsnull;
mCanHandle = PR_TRUE;
mParentIsChromeHandler = PR_FALSE;
mForceContentDispatch = PR_FALSE;
mParentTarget = nsnull;
mEventTargetAtParent = nsnull;
}
/**
* Member that must be set in PreHandleEvent or PreHandleChromeEvent by event
* targets. If set to false, indicates that this event target will not be
* handling the event and construction of the event target chain is complete.
* The target that sets mCanHandle to false is NOT included in the event target
* chain.
* Member that must be set in PreHandleEvent by event targets. If set to false,
* indicates that this event target will not be handling the event and
* construction of the event target chain is complete. The target that sets
* mCanHandle to false is NOT included in the event target chain.
*/
PRPackedBool mCanHandle;
/**
* Member that is set to PR_TRUE in PreHandleEvent or PreHandleChromeEvent if
* and only if mParentTarget is set to a chrome event handler.
*/
PRPackedBool mParentIsChromeHandler;
/**
* If mForceContentDispatch is set to PR_TRUE,
* content dispatching is not disabled for this event target.
@ -206,7 +196,7 @@ class nsEventDispatcher
{
public:
/**
* aTarget should QI to nsINode, nsPIDOMWindow or nsIChromeEventHandler.
* aTarget should QI to nsPIDOMEventTarget.
* If the target of aEvent is set before calling this method, the target of
* aEvent is used as the target (unless there is event
* retargeting) and the originalTarget of the DOM Event.
@ -220,8 +210,7 @@ public:
nsEvent* aEvent,
nsIDOMEvent* aDOMEvent = nsnull,
nsEventStatus* aEventStatus = nsnull,
nsDispatchingCallback* aCallback = nsnull,
PRBool aTargetIsChromeHandler = PR_FALSE);
nsDispatchingCallback* aCallback = nsnull);
/**
* Dispatches an event.

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

@ -0,0 +1,122 @@
/* -*- 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 Mozilla.org.
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Olli Pettay <Olli.Pettay@helsinki.fi> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either 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 nsPIDOMEventTarget_h_
#define nsPIDOMEventTarget_h_
#include "nsISupports.h"
#include "nsEvent.h"
class nsIDOMEvent;
class nsPresContext;
class nsEventChainPreVisitor;
class nsEventChainPostVisitor;
class nsIEventListenerManager;
// 764756cd-8af2-4a25-919d-ca95759a1be1
#define NS_PIDOMEVENTTARGET_IID \
{ 0x764756cd, 0x8af2, 0x4a25, \
{ 0x91, 0x9d, 0xca, 0x95, 0x75, 0x9a, 0x1b, 0xe1 } }
class nsPIDOMEventTarget : public nsISupports
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_PIDOMEVENTTARGET_IID)
/**
* Called before the capture phase of the event flow.
* This is used to create the event target chain and implementations
* should set the necessary members of nsEventChainPreVisitor.
* At least aVisitor.mCanHandle must be set,
* usually also aVisitor.mParentTarget if mCanHandle is PR_TRUE.
* First one tells that this object can handle the aVisitor.mEvent event and
* the latter one is the possible parent object for the event target chain.
* @see nsEventDispatcher.h for more documentation about aVisitor.
*
* @param aVisitor the visitor object which is used to create the
* event target chain for event dispatching.
*
* @note Only nsEventDispatcher should call this method.
*/
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) = 0;
/**
* Called after the bubble phase of the system event group.
* The default handling of the event should happen here.
* @param aVisitor the visitor object which is used during post handling.
*
* @see nsEventDispatcher.h for documentation about aVisitor.
* @note Only nsEventDispatcher should call this method.
*/
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor) = 0;
/**
* Dispatch an event.
* @param aEvent the event that is being dispatched.
* @param aDOMEvent the event that is being dispatched, use if you want to
* dispatch nsIDOMEvent, not only nsEvent.
* @param aPresContext the current presentation context, can be nsnull.
* @param aEventStatus the status returned from the function, can be nsnull.
*
* @note If both aEvent and aDOMEvent are used, aEvent must be the internal
* event of the aDOMEvent.
*
* If aDOMEvent is not nsnull (in which case aEvent can be nsnull) it is used
* for dispatching, otherwise aEvent is used.
*
* @deprecated This method is here just until all the callers outside Gecko
* have been converted to use nsIDOMEventTarget::dispatchEvent.
*/
virtual nsresult DispatchDOMEvent(nsEvent* aEvent,
nsIDOMEvent* aDOMEvent,
nsPresContext* aPresContext,
nsEventStatus* aEventStatus) = 0;
/**
* Get the event listener manager, the guy you talk to to register for events
* on this node.
* @param aCreateIfNotFound If PR_FALSE, returns a listener manager only if
* one already exists. [IN]
* @param aResult The event listener manager [OUT]
*/
virtual nsresult GetListenerManager(PRBool aCreateIfNotFound,
nsIEventListenerManager** aResult) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsPIDOMEventTarget, NS_PIDOMEVENTTARGET_IID)
#endif // !defined(nsPIDOMEventTarget_h_)

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

@ -40,7 +40,7 @@
#include "nsIAtom.h"
#include "nsDOMEvent.h"
#include "nsINode.h"
#include "nsIChromeEventHandler.h"
#include "nsPIDOMEventTarget.h"
#include "nsPresContext.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIDOMEventReceiver.h"
@ -54,22 +54,13 @@
#include NEW_H
#include "nsFixedSizeAllocator.h"
#define NS_TARGET_CHAIN_IS_NODE (1 << 0)
#define NS_TARGET_CHAIN_IS_WINDOW (1 << 1)
#define NS_TARGET_CHAIN_IS_CHROMEHANDLER (1 << 2)
#define NS_TARGET_CHAIN_FORCE_CONTENT_DISPATCH (1 << 3)
#define NS_TARGET_CHAIN_TYPE_MASK \
(NS_TARGET_CHAIN_IS_NODE | NS_TARGET_CHAIN_IS_WINDOW | \
NS_TARGET_CHAIN_IS_CHROMEHANDLER)
#define NS_TARGET_CHAIN_FORCE_CONTENT_DISPATCH (1 << 0)
// nsEventTargetChainItem represents a single item in the event target chain.
class nsEventTargetChainItem
{
private:
nsEventTargetChainItem(nsISupports* aTarget,
PRBool aTargetIsChromeHandler,
nsEventTargetChainItem* aChild = nsnull);
void Destroy(nsFixedSizeAllocator* aAllocator);
@ -77,13 +68,11 @@ private:
public:
static nsEventTargetChainItem* Create(nsFixedSizeAllocator* aAllocator,
nsISupports* aTarget,
PRBool aTargetIsChromeHandler,
nsEventTargetChainItem* aChild = nsnull)
{
void* place = aAllocator->Alloc(sizeof(nsEventTargetChainItem));
return place
? ::new (place) nsEventTargetChainItem(aTarget, aTargetIsChromeHandler,
aChild)
? ::new (place) nsEventTargetChainItem(aTarget, aChild)
: nsnull;
}
@ -97,7 +86,7 @@ public:
PRBool IsValid()
{
return !!(mFlags & NS_TARGET_CHAIN_TYPE_MASK);
return !!(mTarget);
}
nsISupports* GetNewTarget()
@ -122,10 +111,10 @@ public:
return !!(mFlags & NS_TARGET_CHAIN_FORCE_CONTENT_DISPATCH);
}
nsISupports* CurrentTarget();
already_AddRefed<nsIEventListenerManager> GetListenerManager(
PRBool aCreateIfNotFound);
nsISupports* CurrentTarget()
{
return mTarget;
}
/**
* Dispatches event through the event target chain.
@ -138,9 +127,8 @@ public:
nsDispatchingCallback* aCallback);
/**
* Resets aVisitor object and calls PreHandleEvent
* (or PreHandleChromeEvent). Copies mItemFlags and mItemData to the
* current nsEventTargetChainItem.
* Resets aVisitor object and calls PreHandleEvent.
* Copies mItemFlags and mItemData to the current nsEventTargetChainItem.
*/
nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
@ -152,64 +140,28 @@ public:
nsresult HandleEvent(nsEventChainPostVisitor& aVisitor, PRUint32 aFlags);
/**
* Copies mItemFlags and mItemData to aVisitor and calls PostHandleEvent
* (or PostHandleChromeEvent).
* Copies mItemFlags and mItemData to aVisitor and calls PostHandleEvent.
*/
nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
union {
nsINode* mNode;
nsPIDOMWindow* mWindow;
nsIChromeEventHandler* mChromeHandler;
};
nsEventTargetChainItem* mChild;
nsEventTargetChainItem* mParent;
PRUint16 mFlags;
PRUint16 mItemFlags;
nsCOMPtr<nsISupports> mItemData;
nsCOMPtr<nsPIDOMEventTarget> mTarget;
nsEventTargetChainItem* mChild;
nsEventTargetChainItem* mParent;
PRUint16 mFlags;
PRUint16 mItemFlags;
nsCOMPtr<nsISupports> mItemData;
// Event retargeting must happen whenever mNewTarget is non-null.
nsCOMPtr<nsISupports> mNewTarget;
nsCOMPtr<nsISupports> mNewTarget;
};
nsEventTargetChainItem::nsEventTargetChainItem(nsISupports* aTarget,
PRBool aTargetIsChromeHandler,
nsEventTargetChainItem* aChild)
: mNode(nsnull), mChild(aChild), mParent(nsnull), mFlags(0), mItemFlags(0)
: mTarget(do_QueryInterface(aTarget)), mChild(aChild), mParent(nsnull), mFlags(0), mItemFlags(0)
{
if (mChild) {
mChild->mParent = this;
}
// If the target is explicitly marked to be a chrome handler.
if (aTargetIsChromeHandler) {
nsCOMPtr<nsIChromeEventHandler> ceh = do_QueryInterface(aTarget);
if (ceh) {
ceh.swap(mChromeHandler);
mFlags |= NS_TARGET_CHAIN_IS_CHROMEHANDLER;
}
} else {
nsCOMPtr<nsINode> node = do_QueryInterface(aTarget);
if (node) {
node.swap(mNode);
mFlags |= NS_TARGET_CHAIN_IS_NODE;
} else {
nsCOMPtr<nsPIDOMWindow> window =
do_QueryInterface(aTarget);
if (window) {
window.swap(mWindow);
mFlags |= NS_TARGET_CHAIN_IS_WINDOW;
} else {
nsCOMPtr<nsIChromeEventHandler> ceh = do_QueryInterface(aTarget);
if (ceh) {
ceh.swap(mChromeHandler);
mFlags |= NS_TARGET_CHAIN_IS_CHROMEHANDLER;
}
}
}
}
NS_POSTCONDITION((mFlags & NS_TARGET_CHAIN_TYPE_MASK),
"No event target in event target chain!");
}
void
@ -225,119 +177,17 @@ nsEventTargetChainItem::Destroy(nsFixedSizeAllocator* aAllocator)
mParent = nsnull;
}
switch (mFlags & NS_TARGET_CHAIN_TYPE_MASK) {
case NS_TARGET_CHAIN_IS_NODE:
NS_RELEASE(mNode);
break;
case NS_TARGET_CHAIN_IS_WINDOW:
NS_RELEASE(mWindow);
break;
case NS_TARGET_CHAIN_IS_CHROMEHANDLER:
NS_RELEASE(mChromeHandler);
break;
default:
NS_WARNING("Unknown type in event target chain!!!");
break;
}
}
already_AddRefed<nsIEventListenerManager>
nsEventTargetChainItem::GetListenerManager(PRBool aCreateIfNotFound)
{
nsIEventListenerManager* manager = nsnull;
switch (mFlags & NS_TARGET_CHAIN_TYPE_MASK) {
case NS_TARGET_CHAIN_IS_NODE:
{
mNode->GetListenerManager(aCreateIfNotFound, &manager);
break;
}
case NS_TARGET_CHAIN_IS_WINDOW:
{
nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(mWindow));
if (receiver) {
receiver->GetListenerManager(aCreateIfNotFound, &manager);
}
break;
}
case NS_TARGET_CHAIN_IS_CHROMEHANDLER:
{
nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(mChromeHandler));
if (receiver) {
receiver->GetListenerManager(aCreateIfNotFound, &manager);
}
break;
}
default:
{
NS_WARNING("Unknown type in event target chain!!!");
break;
}
}
return manager;
}
nsISupports*
nsEventTargetChainItem::CurrentTarget()
{
nsCOMPtr<nsIDOMEventTarget> eventTarget;
switch (mFlags & NS_TARGET_CHAIN_TYPE_MASK) {
case NS_TARGET_CHAIN_IS_NODE:
{
return mNode;
}
case NS_TARGET_CHAIN_IS_WINDOW:
{
return mWindow;
break;
}
case NS_TARGET_CHAIN_IS_CHROMEHANDLER:
{
return mChromeHandler;
break;
}
default:
{
NS_WARNING("Unknown type in event target chain!!!");
break;
}
}
return nsnull;
mTarget = nsnull;
}
nsresult
nsEventTargetChainItem::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
{
aVisitor.Reset();
nsresult rv = NS_OK;
switch (mFlags & NS_TARGET_CHAIN_TYPE_MASK) {
case NS_TARGET_CHAIN_IS_NODE:
{
rv = mNode->PreHandleEvent(aVisitor);
break;
}
case NS_TARGET_CHAIN_IS_WINDOW:
{
rv = mWindow->PreHandleEvent(aVisitor);
break;
}
case NS_TARGET_CHAIN_IS_CHROMEHANDLER:
{
rv = mChromeHandler->PreHandleChromeEvent(aVisitor);
break;
}
default:
{
NS_WARNING("Unknown type in event target chain!!!");
break;
}
}
nsresult rv = mTarget->PreHandleEvent(aVisitor);
SetForceContentDispatch(aVisitor.mForceContentDispatch);
mItemFlags = aVisitor.mItemFlags;
mItemData = aVisitor.mItemData;
return rv;
}
@ -345,8 +195,8 @@ nsresult
nsEventTargetChainItem::HandleEvent(nsEventChainPostVisitor& aVisitor,
PRUint32 aFlags)
{
nsCOMPtr<nsIEventListenerManager> lm =
nsEventTargetChainItem::GetListenerManager(PR_FALSE);
nsCOMPtr<nsIEventListenerManager> lm;
mTarget->GetListenerManager(PR_FALSE, getter_AddRefs(lm));
if (lm) {
aVisitor.mEvent->currentTarget = CurrentTarget();
@ -363,26 +213,7 @@ nsEventTargetChainItem::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
{
aVisitor.mItemFlags = mItemFlags;
aVisitor.mItemData = mItemData;
switch (mFlags & NS_TARGET_CHAIN_TYPE_MASK) {
case NS_TARGET_CHAIN_IS_NODE:
{
return mNode->PostHandleEvent(aVisitor);
}
case NS_TARGET_CHAIN_IS_WINDOW:
{
return mWindow->PostHandleEvent(aVisitor);
}
case NS_TARGET_CHAIN_IS_CHROMEHANDLER:
{
return mChromeHandler->PostHandleChromeEvent(aVisitor);
}
default:
{
NS_WARNING("Unknown type in event target chain!!!");
break;
}
}
mTarget->PostHandleEvent(aVisitor);
return NS_OK;
}
@ -534,8 +365,7 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget,
nsEvent* aEvent,
nsIDOMEvent* aDOMEvent,
nsEventStatus* aEventStatus,
nsDispatchingCallback* aCallback,
PRBool aTargetIsChromeHandler)
nsDispatchingCallback* aCallback)
{
NS_ASSERTION(aEvent, "Trying to dispatch without nsEvent!");
NS_ENSURE_TRUE(!NS_IS_EVENT_IN_DISPATCH(aEvent),
@ -569,7 +399,7 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget,
// Create the event target chain item for the event target.
nsEventTargetChainItem* targetEtci =
nsEventTargetChainItem::Create(pool.GetPool(), aTarget, aTargetIsChromeHandler);
nsEventTargetChainItem::Create(pool.GetPool(), aTarget);
NS_ENSURE_TRUE(targetEtci, NS_ERROR_OUT_OF_MEMORY);
if (!targetEtci->IsValid()) {
nsEventTargetChainItem::Destroy(pool.GetPool(), targetEtci);
@ -602,7 +432,6 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget,
while (preVisitor.mParentTarget) {
nsEventTargetChainItem* parentEtci =
nsEventTargetChainItem::Create(pool.GetPool(), preVisitor.mParentTarget,
preVisitor.mParentIsChromeHandler,
topEtci);
if (!parentEtci) {
rv = NS_ERROR_OUT_OF_MEMORY;

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

@ -97,7 +97,6 @@
#include "nsIServiceManager.h"
#include "nsIScriptSecurityManager.h"
#include "nsIChromeEventHandler.h"
#include "nsIFocusController.h"
#include "nsIDOMXULElement.h"

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

@ -87,14 +87,14 @@ public:
NS_IMETHOD GetHrefURI(nsIURI** aURI) = 0;
/**
* Dispatch a LinkAdded event to the nsIChromeEventHandler for this document.
* Dispatch a LinkAdded event to the chrome event handler for this document.
* This is used to notify the chrome listeners when restoring a page
* presentation. Currently, this only applies to HTML <link> elements.
*/
NS_IMETHOD LinkAdded() = 0;
/**
* Dispatch a LinkRemoved event to the nsIChromeEventHandler for this
* Dispatch a LinkRemoved event to the chrome event handler for this
* document. This is used to notify the chrome listeners when saving a page
* presentation (since the document is not torn down). Currently, this only
* applies to HTML <link> elements.

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

@ -3052,7 +3052,6 @@ nsGenericHTMLFrameElement::~nsGenericHTMLFrameElement()
NS_INTERFACE_MAP_BEGIN(nsGenericHTMLFrameElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMNSHTMLFrameElement)
NS_INTERFACE_MAP_ENTRY(nsIChromeEventHandler)
NS_INTERFACE_MAP_ENTRY(nsIFrameLoaderOwner)
NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement)
@ -3201,18 +3200,6 @@ nsGenericHTMLFrameElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
return rv;
}
NS_IMETHODIMP
nsGenericHTMLFrameElement::PreHandleChromeEvent(nsEventChainPreVisitor& aVisitor)
{
return PreHandleEvent(aVisitor);
}
NS_IMETHODIMP
nsGenericHTMLFrameElement::PostHandleChromeEvent(nsEventChainPostVisitor& aVisitor)
{
return NS_OK;
}
//----------------------------------------------------------------------
void

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

@ -43,7 +43,6 @@
#include "nsINameSpaceManager.h" // for kNameSpaceID_None
#include "nsIFormControl.h"
#include "nsIDOMNSHTMLFrameElement.h"
#include "nsIChromeEventHandler.h"
#include "nsFrameLoader.h"
class nsIDOMAttr;
@ -843,8 +842,7 @@ protected:
class nsGenericHTMLFrameElement : public nsGenericHTMLElement,
public nsIDOMNSHTMLFrameElement,
public nsIFrameLoaderOwner,
public nsIChromeEventHandler
public nsIFrameLoaderOwner
{
public:
nsGenericHTMLFrameElement(nsINodeInfo *aNodeInfo)
@ -859,9 +857,6 @@ public:
// nsIDOMNSHTMLFrameElement
NS_DECL_NSIDOMNSHTMLFRAMEELEMENT
// nsIChromeEventHandler
NS_DECL_NSICHROMEEVENTHANDLER
// nsIFrameLoaderOwner
NS_DECL_NSIFRAMELOADEROWNER

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

@ -433,8 +433,6 @@ nsXULElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
inst = NS_STATIC_CAST(nsIScriptEventHandlerOwner*,
new nsXULElement::nsScriptEventHandlerOwnerTearoff(this));
NS_ENSURE_TRUE(inst, NS_ERROR_OUT_OF_MEMORY);
} else if (aIID.Equals(NS_GET_IID(nsIChromeEventHandler))) {
inst = NS_STATIC_CAST(nsIChromeEventHandler *, this);
} else if (aIID.Equals(NS_GET_IID(nsIDOMElementCSSInlineStyle))) {
inst = NS_STATIC_CAST(nsIDOMElementCSSInlineStyle *,
new nsXULElementTearoff(this));
@ -2243,22 +2241,6 @@ nsXULElement::AddPopupListener(nsIAtom* aName)
return NS_OK;
}
//*****************************************************************************
// nsXULElement::nsIChromeEventHandler
//*****************************************************************************
NS_IMETHODIMP
nsXULElement::PreHandleChromeEvent(nsEventChainPreVisitor& aVisitor)
{
return PreHandleEvent(aVisitor);
}
NS_IMETHODIMP
nsXULElement::PostHandleChromeEvent(nsEventChainPostVisitor& aVisitor)
{
return NS_OK;
}
//----------------------------------------------------------------------
nsGenericElement::nsAttrInfo

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

@ -70,7 +70,6 @@
#include "nsIXULPrototypeCache.h"
#include "nsIXULTemplateBuilder.h"
#include "nsIBoxObject.h"
#include "nsIChromeEventHandler.h"
#include "nsIXBLService.h"
#include "nsICSSOMFactory.h"
#include "nsLayoutCID.h"
@ -440,9 +439,7 @@ public:
#define XUL_ELEMENT_LAZY_STATE_OFFSET NODE_TYPE_SPECIFIC_BITS_OFFSET
class nsXULElement : public nsGenericElement,
public nsIDOMXULElement,
public nsIChromeEventHandler
class nsXULElement : public nsGenericElement, public nsIDOMXULElement
{
public:
/**
@ -579,9 +576,6 @@ public:
// nsIDOMXULElement
NS_DECL_NSIDOMXULELEMENT
// nsIChromeEventHandler
NS_DECL_NSICHROMEEVENTHANDLER
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
nsresult GetStyle(nsIDOMCSSStyleDeclaration** aStyle);

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

@ -67,7 +67,7 @@
#include "nsIMarkupDocumentViewer.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsIChromeEventHandler.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMChromeWindow.h"
#include "nsIDOMWindowInternal.h"
#include "nsIWebBrowserChrome.h"
@ -1110,10 +1110,12 @@ nsDocShell::GetContentViewer(nsIContentViewer ** aContentViewer)
}
NS_IMETHODIMP
nsDocShell::SetChromeEventHandler(nsIChromeEventHandler * aChromeEventHandler)
nsDocShell::SetChromeEventHandler(nsIDOMEventTarget* aChromeEventHandler)
{
nsCOMPtr<nsPIDOMEventTarget> piTarget =
do_QueryInterface(aChromeEventHandler);
// Weak reference. Don't addref.
mChromeEventHandler = aChromeEventHandler;
mChromeEventHandler = piTarget;
NS_ASSERTION(!mScriptGlobal,
"SetChromeEventHandler() called after the script global "
@ -1126,12 +1128,11 @@ nsDocShell::SetChromeEventHandler(nsIChromeEventHandler * aChromeEventHandler)
}
NS_IMETHODIMP
nsDocShell::GetChromeEventHandler(nsIChromeEventHandler ** aChromeEventHandler)
nsDocShell::GetChromeEventHandler(nsIDOMEventTarget** aChromeEventHandler)
{
NS_ENSURE_ARG_POINTER(aChromeEventHandler);
*aChromeEventHandler = mChromeEventHandler;
NS_IF_ADDREF(*aChromeEventHandler);
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(mChromeEventHandler);
target.swap(*aChromeEventHandler);
return NS_OK;
}

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

@ -104,6 +104,7 @@
#include "nsISecureBrowserUI.h"
#include "nsIObserver.h"
#include "nsDocShellLoadTypes.h"
#include "nsPIDOMEventTarget.h"
class nsIScrollableView;
@ -600,7 +601,7 @@ protected:
// For that reasons don't use nsCOMPtr.
nsIDocShellTreeOwner * mTreeOwner; // Weak Reference
nsIChromeEventHandler * mChromeEventHandler; //Weak Reference
nsPIDOMEventTarget * mChromeEventHandler; //Weak Reference
static nsIURIFixup *sURIFixup;

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

@ -56,7 +56,7 @@ interface nsIURI;
interface nsIChannel;
interface nsIContentViewer;
interface nsIURIContentListener;
interface nsIChromeEventHandler;
interface nsIDOMEventTarget;
interface nsIDocShellLoadInfo;
interface nsIDocumentCharsetInfo;
interface nsIWebNavigation;
@ -68,7 +68,7 @@ interface nsILayoutHistoryState;
interface nsISecureBrowserUI;
interface nsIDOMStorage;
[scriptable, uuid(539355C0-F5C8-4929-A4AA-CB105E8F9997)]
[scriptable, uuid(fbe2a673-4b8b-46a2-b225-398c52cc05cb)]
interface nsIDocShell : nsISupports
{
/**
@ -213,7 +213,7 @@ interface nsIDocShell : nsISupports
* This attribute allows chrome to tie in to handle DOM events that may
* be of interest to chrome.
*/
attribute nsIChromeEventHandler chromeEventHandler;
attribute nsIDOMEventTarget chromeEventHandler;
/**
* The document charset info. This is used by a load to determine priorities

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

@ -45,7 +45,7 @@
#include "nsIDOMXULCommandDispatcher.h"
#include "nsIDOMElement.h"
#include "nsIDOMWindowInternal.h"
#include "nsIChromeEventHandler.h"
#include "nsPIDOMEventTarget.h"
#include "nsIDOMDocument.h"
#include "nsCOMPtr.h"
#include "nsEvent.h"
@ -72,8 +72,8 @@ class nsPresContext;
struct nsTimeout;
#define NS_PIDOMWINDOW_IID \
{ 0xbebce53b, 0xa4ec, 0x49e5, \
{ 0x82, 0x8e, 0x23, 0x08, 0x61, 0x2b, 0x41, 0x9b } }
{ 0xbf81c452, 0xbd39, 0x4001, \
{ 0x85, 0xf4, 0x21, 0x79, 0x36, 0xc5, 0x85, 0x7d } }
class nsPIDOMWindow : public nsIDOMWindowInternal
{
@ -87,7 +87,7 @@ public:
virtual nsresult Activate() = 0;
virtual nsresult Deactivate() = 0;
nsIChromeEventHandler* GetChromeEventHandler() const
nsPIDOMEventTarget* GetChromeEventHandler() const
{
return mChromeEventHandler;
}
@ -311,55 +311,6 @@ public:
virtual PRBool WouldReuseInnerWindow(nsIDocument *aNewDocument) = 0;
/**
* Called before the capture phase of the event flow.
* This is used to create the event target chain and implementations
* should set the necessary members of nsEventChainPreVisitor.
* At least aVisitor.mCanHandle must be set,
* usually also aVisitor.mParentTarget if mCanHandle is PR_TRUE.
* First one tells that this object can handle the aVisitor.mEvent event and
* the latter one is the possible parent object for the event target chain.
* @see nsEventDispatcher.h for more documentation about aVisitor.
*
* @param aVisitor the visitor object which is used to create the
* event target chain for event dispatching.
*
* @note Only nsEventDispatcher should call this method.
*/
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor) = 0;
/**
* Called after the bubble phase of the system event group.
* The default handling of the event should happen here.
* @param aVisitor the visitor object which is used during post handling.
*
* @see nsEventDispatcher.h for documentation about aVisitor.
* @note Only nsEventDispatcher should call this method.
*/
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor) = 0;
/**
* Dispatch an event.
* @param aEvent the event that is being dispatched.
* @param aDOMEvent the event that is being dispatched, use if you want to
* dispatch nsIDOMEvent, not only nsEvent.
* @param aPresContext the current presentation context, can be nsnull.
* @param aEventStatus the status returned from the function, can be nsnull.
*
* @note If both aEvent and aDOMEvent are used, aEvent must be the internal
* event of the aDOMEvent.
*
* If aDOMEvent is not nsnull (in which case aEvent can be nsnull) it is used
* for dispatching, otherwise aEvent is used.
*
* @deprecated This method is here just until all the callers outside Gecko
* have been converted to use nsIDOMEventTarget::dispatchEvent.
*/
virtual nsresult DispatchDOMEvent(nsEvent* aEvent, nsIDOMEvent* aDOMEvent,
nsPresContext* aPresContext,
nsEventStatus* aEventStatus) = 0;
/**
* Get the docshell in this window.
*/
@ -427,7 +378,7 @@ protected:
// These two variables are special in that they're set to the same
// value on both the outer window and the current inner window. Make
// sure you keep them in sync!
nsCOMPtr<nsIChromeEventHandler> mChromeEventHandler; // strong
nsCOMPtr<nsPIDOMEventTarget> mChromeEventHandler; // strong
nsCOMPtr<nsIDOMDocument> mDocument; // strong
// These members are only used on outer windows.

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

@ -41,6 +41,7 @@
#define nsPIWindowRoot_h__
#include "nsISupports.h"
#include "nsPIDOMEventTarget.h"
class nsIFocusController;
@ -49,7 +50,7 @@ class nsIFocusController;
{ 0xc18dee5a, 0xdcf9, 0x4391, \
{ 0xa2, 0x0c, 0x58, 0x1e, 0x76, 0x9d, 0x09, 0x5e } }
class nsPIWindowRoot : public nsISupports {
class nsPIWindowRoot : public nsPIDOMEventTarget {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IWINDOWROOT_IID)

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

@ -681,6 +681,7 @@ NS_INTERFACE_MAP_BEGIN(nsGlobalWindow)
NS_INTERFACE_MAP_ENTRY(nsIScriptGlobalObject)
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventReceiver)
NS_INTERFACE_MAP_ENTRY(nsPIDOMEventTarget)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
NS_INTERFACE_MAP_ENTRY(nsIDOM3EventTarget)
NS_INTERFACE_MAP_ENTRY(nsIDOMNSEventTarget)
@ -1810,7 +1811,9 @@ nsGlobalWindow::SetDocShell(nsIDocShell* aDocShell)
// Get our enclosing chrome shell and retrieve its global window impl, so
// that we can do some forwarding to the chrome document.
mDocShell->GetChromeEventHandler(getter_AddRefs(mChromeEventHandler));
nsCOMPtr<nsIDOMEventTarget> chromeEventHandler;
mDocShell->GetChromeEventHandler(getter_AddRefs(chromeEventHandler));
mChromeEventHandler = do_QueryInterface(chromeEventHandler);
if (!mChromeEventHandler) {
// We have no chrome event handler. If we have a parent,
// get our chrome event handler from the parent. If
@ -1895,11 +1898,7 @@ nsGlobalWindow::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
mIsHandlingResizeEvent = PR_TRUE;
}
// Check chrome document capture here.
if (mChromeEventHandler) {
aVisitor.mParentTarget = mChromeEventHandler;
aVisitor.mParentIsChromeHandler = PR_TRUE;
}
aVisitor.mParentTarget = mChromeEventHandler;
return NS_OK;
}
@ -1910,7 +1909,7 @@ nsGlobalWindow::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
/* mChromeEventHandler and mContext go dangling in the middle of this
function under some circumstances (events that destroy the window)
without this addref. */
nsCOMPtr<nsIChromeEventHandler> kungFuDeathGrip1(mChromeEventHandler);
nsCOMPtr<nsPIDOMEventTarget> kungFuDeathGrip1(mChromeEventHandler);
nsCOMPtr<nsIScriptContext> kungFuDeathGrip2(GetContextInternal());
nsGlobalWindow* outer = GetOuterWindowInternal();
@ -4072,7 +4071,7 @@ nsGlobalWindow::GetWindowRoot(nsIDOMEventTarget **aWindowRoot)
return NS_OK;
}
nsIChromeEventHandler *chromeHandler = piWin->GetChromeEventHandler();
nsPIDOMEventTarget *chromeHandler = piWin->GetChromeEventHandler();
if (!chromeHandler) {
return NS_OK;
}
@ -5623,7 +5622,7 @@ nsGlobalWindow::GetPrivateRoot()
// Get the chrome event handler from the doc shell, since we only
// want to deal with XUL chrome handlers and not the new kind of
// window root handler.
nsCOMPtr<nsIChromeEventHandler> chromeEventHandler;
nsCOMPtr<nsIDOMEventTarget> chromeEventHandler;
docShell->GetChromeEventHandler(getter_AddRefs(chromeEventHandler));
nsCOMPtr<nsIContent> chromeElement(do_QueryInterface(mChromeEventHandler));
@ -5721,18 +5720,16 @@ nsGlobalWindow::Deactivate()
nsIFocusController*
nsGlobalWindow::GetRootFocusController()
{
nsIDOMWindowInternal *rootWindow = nsGlobalWindow::GetPrivateRoot();
nsIDOMWindowInternal* rootWindow = nsGlobalWindow::GetPrivateRoot();
nsCOMPtr<nsIFocusController> fc;
if (rootWindow) {
nsCOMPtr<nsPIDOMWindow> piWin(do_QueryInterface(rootWindow));
if (piWin) {
// Obtain the chrome event handler.
nsCOMPtr<nsPIDOMWindow> piWin(do_QueryInterface(rootWindow));
nsIChromeEventHandler *chromeHandler = piWin->GetChromeEventHandler();
if (chromeHandler) {
nsCOMPtr<nsPIWindowRoot> windowRoot(do_QueryInterface(chromeHandler));
if (windowRoot) {
windowRoot->GetFocusController(getter_AddRefs(fc));
}
nsPIDOMEventTarget* chromeHandler = piWin->GetChromeEventHandler();
nsCOMPtr<nsPIWindowRoot> windowRoot(do_QueryInterface(chromeHandler));
if (windowRoot) {
windowRoot->GetFocusController(getter_AddRefs(fc));
}
}

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

@ -56,7 +56,6 @@
#include "nsDOMWindowList.h"
#include "nsIBaseWindow.h"
#include "nsIBrowserDOMWindow.h"
#include "nsIChromeEventHandler.h"
#include "nsIControllers.h"
#include "nsIDocShellTreeOwner.h"
#include "nsIDocShellTreeItem.h"
@ -95,6 +94,7 @@
#include "nsIDOMStorage.h"
#include "nsIDOMStorageList.h"
#include "nsIDOMStorageWindow.h"
#include "nsPIDOMEventTarget.h"
#define DEFAULT_HOME_PAGE "www.mozilla.org"
#define PREF_BROWSER_STARTUP_HOMEPAGE "browser.startup.homepage"
@ -217,6 +217,7 @@ class nsGlobalWindow : public nsPIDOMWindow,
public nsIDOMJSWindow,
public nsIScriptObjectPrincipal,
public nsIDOMEventReceiver,
public nsPIDOMEventTarget,
public nsIDOM3EventTarget,
public nsIDOMNSEventTarget,
public nsIDOMViewCSS,

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

@ -86,7 +86,7 @@ NS_IMPL_CYCLE_COLLECTION_2_AMBIGUOUS(nsWindowRoot, nsIDOMEventReceiver,
NS_INTERFACE_MAP_BEGIN(nsWindowRoot)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMEventReceiver)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventReceiver)
NS_INTERFACE_MAP_ENTRY(nsIChromeEventHandler)
NS_INTERFACE_MAP_ENTRY(nsPIDOMEventTarget)
NS_INTERFACE_MAP_ENTRY(nsPIWindowRoot)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
NS_INTERFACE_MAP_ENTRY(nsIDOM3EventTarget)
@ -114,11 +114,22 @@ nsWindowRoot::DispatchEvent(nsIDOMEvent* aEvt, PRBool *_retval)
{
nsEventStatus status = nsEventStatus_eIgnore;
nsresult rv = nsEventDispatcher::DispatchDOMEvent(
NS_STATIC_CAST(nsIChromeEventHandler*, this), nsnull, aEvt, nsnull, &status);
NS_STATIC_CAST(nsPIDOMEventTarget*, this), nsnull, aEvt, nsnull, &status);
*_retval = (status != nsEventStatus_eConsumeNoDefault);
return rv;
}
nsresult
nsWindowRoot::DispatchDOMEvent(nsEvent* aEvent,
nsIDOMEvent* aDOMEvent,
nsPresContext* aPresContext,
nsEventStatus* aEventStatus)
{
return nsEventDispatcher::DispatchDOMEvent(NS_STATIC_CAST(nsPIDOMEventTarget*, this),
aEvent, aDOMEvent,
aPresContext, aEventStatus);
}
NS_IMETHODIMP
nsWindowRoot::AddGroupedEventListener(const nsAString & aType, nsIDOMEventListener *aListener,
PRBool aUseCapture, nsIDOMEventGroup *aEvtGrp)
@ -240,7 +251,7 @@ nsWindowRoot::GetSystemEventGroup(nsIDOMEventGroup **aGroup)
NS_IMETHODIMP
nsWindowRoot::PreHandleChromeEvent(nsEventChainPreVisitor& aVisitor)
nsWindowRoot::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
{
aVisitor.mCanHandle = PR_TRUE;
aVisitor.mForceContentDispatch = PR_TRUE; //FIXME! Bug 329119
@ -250,7 +261,7 @@ nsWindowRoot::PreHandleChromeEvent(nsEventChainPreVisitor& aVisitor)
}
NS_IMETHODIMP
nsWindowRoot::PostHandleChromeEvent(nsEventChainPostVisitor& aVisitor)
nsWindowRoot::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
{
return NS_OK;
}
@ -280,7 +291,7 @@ nsWindowRoot::SetScriptTypeID(PRUint32 aScriptType)
///////////////////////////////////////////////////////////////////////////////////
nsresult
NS_NewWindowRoot(nsIDOMWindow* aWindow, nsIChromeEventHandler** aResult)
NS_NewWindowRoot(nsIDOMWindow* aWindow, nsPIDOMEventTarget** aResult)
{
*aResult = new nsWindowRoot(aWindow);
if (!*aResult)

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

@ -50,7 +50,6 @@ class nsEventChainPostVisitor;
#include "nsIDOMEventReceiver.h"
#include "nsIDOM3EventTarget.h"
#include "nsIDOMNSEventTarget.h"
#include "nsIChromeEventHandler.h"
#include "nsIEventListenerManager.h"
#include "nsPIWindowRoot.h"
#include "nsIFocusController.h"
@ -60,7 +59,6 @@ class nsEventChainPostVisitor;
class nsWindowRoot : public nsIDOMEventReceiver,
public nsIDOM3EventTarget,
public nsIDOMNSEventTarget,
public nsIChromeEventHandler,
public nsPIWindowRoot
{
public:
@ -71,7 +69,13 @@ public:
NS_DECL_NSIDOMEVENTTARGET
NS_DECL_NSIDOM3EVENTTARGET
NS_DECL_NSIDOMNSEVENTTARGET
NS_DECL_NSICHROMEEVENTHANDLER
virtual nsresult PreHandleEvent(nsEventChainPreVisitor& aVisitor);
virtual nsresult PostHandleEvent(nsEventChainPostVisitor& aVisitor);
virtual nsresult DispatchDOMEvent(nsEvent* aEvent,
nsIDOMEvent* aDOMEvent,
nsPresContext* aPresContext,
nsEventStatus* aEventStatus);
// nsIDOMEventReceiver
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID);
@ -96,6 +100,6 @@ protected:
extern nsresult
NS_NewWindowRoot(nsIDOMWindow* aWindow,
nsIChromeEventHandler** aResult);
nsPIDOMEventTarget** aResult);
#endif

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

@ -46,7 +46,6 @@
#include "nsIURI.h"
#include "nsIDOMWindow.h"
#include "nsPIDOMWindow.h"
#include "nsIChromeEventHandler.h"
#include "nsIDOMEventReceiver.h"
#include "nsIWidget.h"

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

@ -64,7 +64,6 @@
#include "nsIDOMWindow.h"
#include "nsPIDOMWindow.h"
#include "nsIDOMWindowInternal.h"
#include "nsIChromeEventHandler.h"
// For seting scrollbar visibilty
#include "nsIDOMBarProp.h"

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

@ -67,7 +67,6 @@
#include <nsIDOMWindow.h>
#include <nsPIDOMWindow.h>
#include <nsIDOMWindowInternal.h>
#include <nsIChromeEventHandler.h>
#include <nsIContentViewer.h>
#include <nsIContentViewerEdit.h>
#include <nsIWebBrowserSetup.h>

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

@ -116,10 +116,9 @@ GetEventReceiver ( nsWebBrowser* inBrowser, nsIDOMEventReceiver** outEventRcvr )
NS_ENSURE_TRUE(domWindowPrivate, NS_ERROR_FAILURE);
nsPIDOMWindow *rootWindow = domWindowPrivate->GetPrivateRoot();
NS_ENSURE_TRUE(rootWindow, NS_ERROR_FAILURE);
nsIChromeEventHandler *chromeHandler = rootWindow->GetChromeEventHandler();
NS_ENSURE_TRUE(chromeHandler, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMEventReceiver> rcvr = do_QueryInterface(chromeHandler);
nsCOMPtr<nsIDOMEventReceiver> rcvr =
do_QueryInterface(rootWindow->GetChromeEventHandler());
NS_ENSURE_TRUE(rcvr, NS_ERROR_FAILURE);
*outEventRcvr = rcvr;
NS_IF_ADDREF(*outEventRcvr);

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

@ -52,7 +52,6 @@
#include "nsIWebBrowserChrome.h"
#include "nsIDOMMouseListener.h"
#include "nsIDOMDocument.h"
#include "nsIChromeEventHandler.h"
#include "nsIDOMEventReceiver.h"
#include "nsIEmbeddingSiteWindow.h"
#include "nsIWebProgressListener.h"

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

@ -46,6 +46,7 @@ MODULE = commandhandler
REQUIRES = string \
xpcom \
dom \
content \
widget \
necko \
xuldoc \

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

@ -52,7 +52,6 @@
#include "nsIArray.h"
#include "nsIBaseWindow.h"
#include "nsICategoryManager.h"
#include "nsIChromeEventHandler.h"
#include "nsIComponentManager.h"
#include "nsIDOM3EventTarget.h"
#include "nsIDOMAbstractView.h"

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

@ -251,7 +251,7 @@ nsresult getEventTargetFromWindow(nsIDOMWindow* aWindow, nsIDOM3EventTarget** aE
if (!privateWindow)
return NS_ERROR_UNEXPECTED; // assert
nsIChromeEventHandler *chromeEventHandler = privateWindow->GetChromeEventHandler();
nsPIDOMEventTarget *chromeEventHandler = privateWindow->GetChromeEventHandler();
nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(chromeEventHandler));
if (!receiver)

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

@ -52,7 +52,6 @@
#include "nsPIDOMWindow.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMNSUIEvent.h"
#include "nsIChromeEventHandler.h"
#include "nsIDOMNSEvent.h"
#include "nsIPrefBranch.h"
#include "nsIPrefBranch2.h"
@ -2377,7 +2376,7 @@ nsTypeAheadFind::GetChromeEventHandler(nsIDOMWindow *aDOMWin,
nsIDOMEventTarget **aChromeTarget)
{
nsCOMPtr<nsPIDOMWindow> privateDOMWindow(do_QueryInterface(aDOMWin));
nsIChromeEventHandler *chromeEventHandler = nsnull;
nsPIDOMEventTarget* chromeEventHandler = nsnull;
if (privateDOMWindow) {
chromeEventHandler = privateDOMWindow->GetChromeEventHandler();
}

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

@ -81,7 +81,6 @@ REQUIRES += thebes cairo
endif
XPIDLSRCS = \
nsIChromeEventHandler.idl \
nsIStyleSheetService.idl \
$(NULL)

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

@ -86,7 +86,6 @@
#include "nsIPageSequenceFrame.h"
#include "nsIURL.h"
#include "nsNetUtil.h"
#include "nsIChromeEventHandler.h"
#include "nsIContentViewerEdit.h"
#include "nsIContentViewerFile.h"
#include "nsICSSLoader.h"
@ -2203,7 +2202,7 @@ DocumentViewerImpl::CreateStyleSet(nsIDocument* aDocument,
// Append chrome sheets (scrollbars + forms).
PRBool shouldOverride = PR_FALSE;
nsCOMPtr<nsIDocShell> ds(do_QueryInterface(docShell));
nsCOMPtr<nsIChromeEventHandler> chromeHandler;
nsCOMPtr<nsIDOMEventTarget> chromeHandler;
nsCOMPtr<nsIURI> uri;
nsCOMPtr<nsICSSStyleSheet> csssheet;

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

@ -1,86 +0,0 @@
/* -*- Mode: IDL; tab-width: 4; 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 the Mozilla browser.
*
* The Initial Developer of the Original Code is
* Netscape Communications, Inc.
* Portions created by the Initial Developer are Copyright (C) 1999
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Travis Bogard <travis@netscape.com>
* Olli Pettay <Olli.Pettay@helsinki.fi>
*
* 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 ***** */
#include "nsISupports.idl"
%{ C++
class nsEventChainPreVisitor;
class nsEventChainPostVisitor;
%}
[ref] native nsEventChainPreVisitorRef(nsEventChainPreVisitor);
[ref] native nsEventChainPostVisitorRef(nsEventChainPostVisitor);
interface nsIDOMEvent;
/**
* The nsIChromeEventHandler
*/
[scriptable, uuid(a54dc626-9648-406b-bc82-b5c51b3767d7)]
interface nsIChromeEventHandler : nsISupports
{
/**
* Called before the capture phase of the event flow.
* This is used to create the event target chain and implementations
* should set the necessary members of nsEventChainPreVisitor.
* At least aVisitor.mCanHandle must be set,
* usually also aVisitor.mParentTarget if mCanHandle is PR_TRUE.
* First one tells that this object can handle the aVisitor.mEvent event and
* the latter one is the possible parent object for the event target chain.
* @see nsEventDispatcher.h for more documentation about aVisitor.
*
* @param aVisitor the visitor object which is used to create the
* event target chain for event dispatching.
*
* @note Only nsEventDispatcher should call this method.
*/
[noscript] void PreHandleChromeEvent(in nsEventChainPreVisitorRef aVisitor);
/**
* Called after the bubble phase of the system event group.
* The default handling of the event should happen here.
* @param aVisitor the visitor object which is used during post handling.
*
* @see nsEventDispatcher.h for documentation about aVisitor.
* @note Only nsEventDispatcher should call this method.
*/
[noscript] void PostHandleChromeEvent(in nsEventChainPostVisitorRef aVisitor);
};

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

@ -62,6 +62,7 @@ REQUIRES = \
widget \
gfx \
dom \
content \
layout \
docshell \
$(NULL)

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

@ -52,7 +52,6 @@
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIDocShellTreeItem.h"
#include "nsIChromeEventHandler.h"
#include "nsPIDOMWindow.h"
#include "nsIWebNavigation.h"
#include "nsIContentViewer.h"
@ -905,7 +904,7 @@ nsFormFillController::AddWindowListeners(nsIDOMWindow *aWindow)
return;
nsCOMPtr<nsPIDOMWindow> privateDOMWindow(do_QueryInterface(aWindow));
nsIChromeEventHandler* chromeEventHandler = nsnull;
nsPIDOMEventTarget* chromeEventHandler = nsnull;
if (privateDOMWindow)
chromeEventHandler = privateDOMWindow->GetChromeEventHandler();
@ -964,7 +963,7 @@ nsFormFillController::RemoveWindowListeners(nsIDOMWindow *aWindow)
StopControllingInput();
nsCOMPtr<nsPIDOMWindow> privateDOMWindow(do_QueryInterface(aWindow));
nsIChromeEventHandler* chromeEventHandler = nsnull;
nsPIDOMEventTarget* chromeEventHandler = nsnull;
if (privateDOMWindow)
chromeEventHandler = privateDOMWindow->GetChromeEventHandler();

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

@ -778,8 +778,9 @@ PRBool nsWebShellWindow::ExecuteCloseHandler()
nsCOMPtr<nsIXULWindow> kungFuDeathGrip(this);
nsCOMPtr<nsPIDOMWindow> window(do_GetInterface(mDocShell));
nsCOMPtr<nsPIDOMEventTarget> eventTarget = do_QueryInterface(window);
if (window) {
if (eventTarget) {
nsCOMPtr<nsIContentViewer> contentViewer;
mDocShell->GetContentViewer(getter_AddRefs(contentViewer));
nsCOMPtr<nsIDocumentViewer> docViewer(do_QueryInterface(contentViewer));
@ -793,7 +794,7 @@ PRBool nsWebShellWindow::ExecuteCloseHandler()
nsMouseEvent::eReal);
nsresult rv =
window->DispatchDOMEvent(&event, nsnull, presContext, &status);
eventTarget->DispatchDOMEvent(&event, nsnull, presContext, &status);
if (NS_SUCCEEDED(rv) && status == nsEventStatus_eConsumeNoDefault)
return PR_TRUE;
// else fall through and return PR_FALSE

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

@ -57,6 +57,7 @@ REQUIRES = xpcom \
appshell \
appcomps \
dom \
content \
layout \
js \
uriloader \