Bug 983049 part.1 Rename nsEventChainVisitor to mozilla::EventChainVisitor r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 18 Mar 2014 13:48:18 +0900
changeset 174004 5c626ba48ddf81b32e98118361c2f9b1102dbda5
parent 174003 a2e5b6d2f31a73c3106304c8f74a7abe12e73f11
child 174005 91778ceb580b76e4c1deb7bce53f4783781a004b
push id41165
push usermasayuki@d-toybox.com
push dateTue, 18 Mar 2014 04:48:26 +0000
treeherdermozilla-inbound@735beb5ce026 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs983049
milestone31.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 983049 part.1 Rename nsEventChainVisitor to mozilla::EventChainVisitor r=smaug
content/base/public/Element.h
content/base/src/Element.cpp
content/html/content/src/nsGenericHTMLElement.cpp
content/html/content/src/nsGenericHTMLElement.h
dom/events/nsEventDispatcher.h
--- a/content/base/public/Element.h
+++ b/content/base/public/Element.h
@@ -97,16 +97,17 @@ enum {
 };
 
 #undef ELEMENT_FLAG_BIT
 
 // Make sure we have space for our bits
 ASSERT_NODE_FLAGS_SPACE(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET);
 
 namespace mozilla {
+class EventChainVisitor;
 class EventListenerManager;
 
 namespace dom {
 
 class Link;
 class UndoManager;
 class DOMRect;
 class DOMRectList;
@@ -1100,18 +1101,18 @@ protected:
   /**
    * Check that we meet the conditions to handle a link event
    * and that we are actually on a link.
    *
    * @param aVisitor event visitor
    * @param aURI the uri of the link, set only if the return value is true [OUT]
    * @return true if we can handle the link event, false otherwise
    */
-  bool CheckHandleEventForLinksPrecondition(nsEventChainVisitor& aVisitor,
-                                              nsIURI** aURI) const;
+  bool CheckHandleEventForLinksPrecondition(EventChainVisitor& aVisitor,
+                                            nsIURI** aURI) const;
 
   /**
    * Handle status bar updates before they can be cancelled.
    */
   nsresult PreHandleEventForLinks(nsEventChainPreVisitor& aVisitor);
 
   /**
    * Handle default actions for link event if the event isn't consumed yet.
--- a/content/base/src/Element.cpp
+++ b/content/base/src/Element.cpp
@@ -2312,17 +2312,17 @@ Element::Describe(nsAString& aOutDescrip
     aOutDescription.Append(' ');
     nsAutoString attributeDescription;
     DescribeAttribute(index, attributeDescription);
     aOutDescription.Append(attributeDescription);
   }
 }
 
 bool
-Element::CheckHandleEventForLinksPrecondition(nsEventChainVisitor& aVisitor,
+Element::CheckHandleEventForLinksPrecondition(EventChainVisitor& aVisitor,
                                               nsIURI** aURI) const
 {
   if (aVisitor.mEventStatus == nsEventStatus_eConsumeNoDefault ||
       (!aVisitor.mEvent->mFlags.mIsTrusted &&
        (aVisitor.mEvent->message != NS_MOUSE_CLICK) &&
        (aVisitor.mEvent->message != NS_KEY_PRESS) &&
        (aVisitor.mEvent->message != NS_UI_ACTIVATE)) ||
       !aVisitor.mPresContext ||
--- a/content/html/content/src/nsGenericHTMLElement.cpp
+++ b/content/html/content/src/nsGenericHTMLElement.cpp
@@ -690,17 +690,18 @@ nsGenericHTMLElement::FindAncestorForm(H
       }
     }
   }
 
   return nullptr;
 }
 
 bool
-nsGenericHTMLElement::CheckHandleEventForAnchorsPreconditions(nsEventChainVisitor& aVisitor)
+nsGenericHTMLElement::CheckHandleEventForAnchorsPreconditions(
+                        EventChainVisitor& aVisitor)
 {
   NS_PRECONDITION(nsCOMPtr<Link>(do_QueryObject(this)),
                   "should be called only when |this| implements |Link|");
 
   if (!aVisitor.mPresContext) {
     // We need a pres context to do link stuff. Some events (e.g. mutation
     // events) don't have one.
     // XXX: ideally, shouldn't we be able to do what we need without one?
--- a/content/html/content/src/nsGenericHTMLElement.h
+++ b/content/html/content/src/nsGenericHTMLElement.h
@@ -35,16 +35,17 @@ class nsILayoutHistoryState;
 class nsIEditor;
 struct nsRect;
 struct nsSize;
 class nsIDOMHTMLMenuElement;
 class nsIDOMHTMLCollection;
 class nsDOMSettableTokenList;
 
 namespace mozilla {
+class EventChainVisitor;
 class EventListenerManager;
 namespace dom {
 class HTMLFormElement;
 class HTMLPropertiesCollection;
 class HTMLMenuElement;
 }
 }
 
@@ -583,17 +584,18 @@ public:
                                int32_t *aTabIndex);
   virtual void PerformAccesskey(bool aKeyCausesActivation,
                                 bool aIsTrustedEvent) MOZ_OVERRIDE;
 
   /**
    * Check if an event for an anchor can be handled
    * @return true if the event can be handled, false otherwise
    */
-  bool CheckHandleEventForAnchorsPreconditions(nsEventChainVisitor& aVisitor);
+  bool CheckHandleEventForAnchorsPreconditions(
+         mozilla::EventChainVisitor& aVisitor);
   nsresult PreHandleEventForAnchors(nsEventChainPreVisitor& aVisitor);
   nsresult PostHandleEventForAnchors(nsEventChainPostVisitor& aVisitor);
   bool IsHTMLLink(nsIURI** aURI) const;
 
   // HTML element methods
   void Compact() { mAttrsAndChildren.Compact(); }
 
   virtual void UpdateEditableState(bool aNotify) MOZ_OVERRIDE;
--- a/dom/events/nsEventDispatcher.h
+++ b/dom/events/nsEventDispatcher.h
@@ -18,18 +18,17 @@ class nsIDOMEvent;
 class nsIScriptGlobalObject;
 class nsPresContext;
 
 template<class E> class nsCOMArray;
 
 namespace mozilla {
 namespace dom {
 class EventTarget;
-}
-}
+} // namespace dom
 
 /**
  * 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 
  * on each event target and the creation continues until either the mCanHandle
  * member of the nsEventChainPreVisitor object is false or the mParentTarget
@@ -41,35 +40,40 @@ class EventTarget;
  *
  * 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
  * is called right after calling event listener for the current event target.
  */
 
-class nsEventChainVisitor {
+class EventChainVisitor
+{
 public:
-  nsEventChainVisitor(nsPresContext* aPresContext,
-                      mozilla::WidgetEvent* aEvent,
-                      nsIDOMEvent* aDOMEvent,
-                      nsEventStatus aEventStatus = nsEventStatus_eIgnore)
-  : mPresContext(aPresContext), mEvent(aEvent), mDOMEvent(aDOMEvent),
-    mEventStatus(aEventStatus), mItemFlags(0)
-  {}
+  EventChainVisitor(nsPresContext* aPresContext,
+                    WidgetEvent* aEvent,
+                    nsIDOMEvent* aDOMEvent,
+                    nsEventStatus aEventStatus = nsEventStatus_eIgnore)
+    : mPresContext(aPresContext)
+    , mEvent(aEvent)
+    , mDOMEvent(aDOMEvent)
+    , mEventStatus(aEventStatus)
+    , mItemFlags(0)
+  {
+  }
 
   /**
    * The prescontext, possibly nullptr.
    */
   nsPresContext* const  mPresContext;
 
   /**
    * The WidgetEvent which is being dispatched. Never nullptr.
    */
-  mozilla::WidgetEvent* const mEvent;
+  WidgetEvent* const mEvent;
 
   /**
    * The DOM Event assiciated with the mEvent. Possibly nullptr if a DOM Event
    * is not (yet) created.
    */
   nsIDOMEvent*          mDOMEvent;
 
   /**
@@ -96,24 +100,27 @@ public:
    *
    * @note This data is different for each item in the event target chain.
    *       It is up to the Pre/PostHandleEvent implementation to decide how to
    *       use this.
    */
   nsCOMPtr<nsISupports> mItemData;
 };
 
-class nsEventChainPreVisitor : public nsEventChainVisitor {
+} // namespace mozilla
+
+class nsEventChainPreVisitor : public mozilla::EventChainVisitor
+{
 public:
   nsEventChainPreVisitor(nsPresContext* aPresContext,
                          mozilla::WidgetEvent* aEvent,
                          nsIDOMEvent* aDOMEvent,
                          nsEventStatus aEventStatus,
                          bool aIsInAnon)
-  : nsEventChainVisitor(aPresContext, aEvent, aDOMEvent, aEventStatus),
+  : mozilla::EventChainVisitor(aPresContext, aEvent, aDOMEvent, aEventStatus),
     mCanHandle(true), mAutomaticChromeDispatch(true),
     mForceContentDispatch(false), mRelatedTargetIsInAnon(false),
     mOriginalTargetIsInAnon(aIsInAnon), mWantsWillHandleEvent(false),
     mMayHaveListenerManager(true), mParentTarget(nullptr),
     mEventTargetAtParent(nullptr) {}
 
   void Reset() {
     mItemFlags = 0;
@@ -179,22 +186,24 @@ public:
 
   /**
    * If the event needs to be retargeted, this is the event target,
    * which should be used when the event is handled at mParentTarget.
    */
   mozilla::dom::EventTarget* mEventTargetAtParent;
 };
 
-class nsEventChainPostVisitor : public nsEventChainVisitor {
+class nsEventChainPostVisitor : public mozilla::EventChainVisitor
+{
 public:
-  nsEventChainPostVisitor(nsEventChainVisitor& aOther)
-  : nsEventChainVisitor(aOther.mPresContext, aOther.mEvent, aOther.mDOMEvent,
-                        aOther.mEventStatus)
-  {}
+  nsEventChainPostVisitor(mozilla::EventChainVisitor& aOther)
+  : mozilla::EventChainVisitor(aOther.mPresContext, aOther.mEvent,
+                               aOther.mDOMEvent, aOther.mEventStatus)
+  {
+  }
 };
 
 /**
  * If an nsDispatchingCallback object is passed to Dispatch,
  * its HandleEvent method is called after handling the default event group,
  * before handling the system event group.
  * This is used in nsPresShell.
  */