Bug 1175442 Make nsContentUtils::SendKeyEvent() take nsIWidget* rather than nsCOMPtr<nsIWidget> r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Thu, 18 Jun 2015 13:41:28 +0900
changeset 267598 328551ccf9eec335cf60f0226694996f539ebc01
parent 267597 83954c7df8ab17e6abbbb730b963fb976a8ce063
child 267599 d7492a39e7428093eae563b329addb44a060cf49
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-esr52@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1175442
milestone41.0a1
Bug 1175442 Make nsContentUtils::SendKeyEvent() take nsIWidget* rather than nsCOMPtr<nsIWidget> r=smaug
dom/base/nsContentUtils.cpp
dom/base/nsContentUtils.h
dom/ipc/TabChild.cpp
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -7570,17 +7570,17 @@ nsContentUtils::GetViewToDispatchEvent(n
         }
       }
     }
   }
   return nullptr;
 }
 
 nsresult
-nsContentUtils::SendKeyEvent(nsCOMPtr<nsIWidget> aWidget,
+nsContentUtils::SendKeyEvent(nsIWidget* aWidget,
                              const nsAString& aType,
                              int32_t aKeyCode,
                              int32_t aCharCode,
                              int32_t aModifiers,
                              uint32_t aAdditionalFlags,
                              bool* aDefaultActionTaken)
 {
   // get the widget to send the event to
--- a/dom/base/nsContentUtils.h
+++ b/dom/base/nsContentUtils.h
@@ -2358,17 +2358,17 @@ public:
                                                      nsPresContext* aPresContext);
   static nsView* GetViewToDispatchEvent(nsPresContext* aPresContext,
                                         nsIPresShell** aPresShell);
 
   /**
    * Synthesize a key event to the given widget
    * (see nsIDOMWindowUtils.sendKeyEvent).
    */
-  static nsresult SendKeyEvent(nsCOMPtr<nsIWidget> aWidget,
+  static nsresult SendKeyEvent(nsIWidget* aWidget,
                                const nsAString& aType,
                                int32_t aKeyCode,
                                int32_t aCharCode,
                                int32_t aModifiers,
                                uint32_t aAdditionalFlags,
                                bool* aDefaultActionTaken);
 
   /**
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -2534,20 +2534,17 @@ TabChild::RecvRealKeyEvent(const WidgetK
 bool
 TabChild::RecvKeyEvent(const nsString& aType,
                        const int32_t& aKeyCode,
                        const int32_t& aCharCode,
                        const int32_t& aModifiers,
                        const bool& aPreventDefault)
 {
   bool ignored = false;
-  // XXX Why nsContentUtils::SendKeyEvent takes nsCOMPtr<nsIWidget> for the
-  //     first argument? Why not just nsIWidget*?
-  nsCOMPtr<nsIWidget> widget(mPuppetWidget);
-  nsContentUtils::SendKeyEvent(widget, aType, aKeyCode, aCharCode,
+  nsContentUtils::SendKeyEvent(mPuppetWidget, aType, aKeyCode, aCharCode,
                                aModifiers, aPreventDefault, &ignored);
   return true;
 }
 
 bool
 TabChild::RecvCompositionEvent(const WidgetCompositionEvent& event)
 {
   WidgetCompositionEvent localEvent(event);