Bug 1322736 part.3 Remove dom::BeforeAfterKeyboardEvent and InternalBeforeAfterKeyboardEvent r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 16 Dec 2016 16:25:22 +0900
changeset 373777 7b39662d8bc1bd2ef28c72595af143b4c20a491a
parent 373776 5506b339ec9cc067810165e9158e6815b29249b0
child 373778 91e4d7e9bcf22516f0e0a6ed0e7bdd0518eaa8c1
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1322736
milestone53.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 1322736 part.3 Remove dom::BeforeAfterKeyboardEvent and InternalBeforeAfterKeyboardEvent r=smaug MozReview-Commit-ID: Eyz2HjIdQEW
dom/events/BeforeAfterKeyboardEvent.cpp
dom/events/BeforeAfterKeyboardEvent.h
dom/events/EventDispatcher.cpp
dom/events/moz.build
dom/events/test/test_all_synthetic_events.html
dom/webidl/BeforeAfterKeyboardEvent.webidl
dom/webidl/moz.build
layout/base/PresShell.cpp
layout/base/PresShell.h
widget/EventClassList.h
widget/TextEvents.h
widget/nsGUIEventIPC.h
deleted file mode 100644
--- a/dom/events/BeforeAfterKeyboardEvent.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/dom/BeforeAfterKeyboardEvent.h"
-#include "mozilla/TextEvents.h"
-#include "prtime.h"
-
-namespace mozilla {
-namespace dom {
-
-BeforeAfterKeyboardEvent::BeforeAfterKeyboardEvent(
-                                       EventTarget* aOwner,
-                                       nsPresContext* aPresContext,
-                                       InternalBeforeAfterKeyboardEvent* aEvent)
-  : KeyboardEvent(aOwner, aPresContext,
-                  aEvent ? aEvent :
-                           new InternalBeforeAfterKeyboardEvent(false,
-                                                                eVoidEvent,
-                                                                nullptr))
-{
-  MOZ_ASSERT(mEvent->mClass == eBeforeAfterKeyboardEventClass,
-             "event type mismatch eBeforeAfterKeyboardEventClass");
-
-  if (!aEvent) {
-    mEventIsInternal = true;
-    mEvent->mTime = PR_Now();
-  }
-}
-
-// static
-already_AddRefed<BeforeAfterKeyboardEvent>
-BeforeAfterKeyboardEvent::Constructor(
-                            EventTarget* aOwner,
-                            const nsAString& aType,
-                            const BeforeAfterKeyboardEventInit& aParam)
-{
-  RefPtr<BeforeAfterKeyboardEvent> event =
-    new BeforeAfterKeyboardEvent(aOwner, nullptr, nullptr);
-  ErrorResult rv;
-  event->InitWithKeyboardEventInit(aOwner, aType, aParam, rv);
-  if (NS_WARN_IF(rv.Failed())) {
-    rv.SuppressException();
-  }
-
-  event->mEvent->AsBeforeAfterKeyboardEvent()->mEmbeddedCancelled =
-    aParam.mEmbeddedCancelled;
-
-  return event.forget();
-}
-
-// static
-already_AddRefed<BeforeAfterKeyboardEvent>
-BeforeAfterKeyboardEvent::Constructor(
-                            const GlobalObject& aGlobal,
-                            const nsAString& aType,
-                            const BeforeAfterKeyboardEventInit& aParam,
-                            ErrorResult& aRv)
-{
-  nsCOMPtr<EventTarget> owner = do_QueryInterface(aGlobal.GetAsSupports());
-  return Constructor(owner, aType, aParam);
-}
-
-Nullable<bool>
-BeforeAfterKeyboardEvent::GetEmbeddedCancelled()
-{
-  return Nullable<bool>();
-}
-
-} // namespace dom
-} // namespace mozilla
-
-using namespace mozilla;
-using namespace mozilla::dom;
-
-already_AddRefed<BeforeAfterKeyboardEvent>
-NS_NewDOMBeforeAfterKeyboardEvent(EventTarget* aOwner,
-                                  nsPresContext* aPresContext,
-                                  InternalBeforeAfterKeyboardEvent* aEvent)
-{
-  RefPtr<BeforeAfterKeyboardEvent> it =
-    new BeforeAfterKeyboardEvent(aOwner, aPresContext, aEvent);
-  return it.forget();
-}
deleted file mode 100644
--- a/dom/events/BeforeAfterKeyboardEvent.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla_dom_BeforeAfterKeyboardEvent_h_
-#define mozilla_dom_BeforeAfterKeyboardEvent_h_
-
-#include "mozilla/dom/KeyboardEvent.h"
-#include "mozilla/dom/BeforeAfterKeyboardEventBinding.h"
-
-namespace mozilla {
-namespace dom {
-
-class BeforeAfterKeyboardEvent : public KeyboardEvent
-{
-public:
-  BeforeAfterKeyboardEvent(EventTarget* aOwner,
-                           nsPresContext* aPresContext,
-                           InternalBeforeAfterKeyboardEvent* aEvent);
-
-  virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
-  {
-    return BeforeAfterKeyboardEventBinding::Wrap(aCx, this, aGivenProto);
-  }
-
-  static already_AddRefed<BeforeAfterKeyboardEvent>
-  Constructor(const GlobalObject& aGlobal,
-              const nsAString& aType,
-              const BeforeAfterKeyboardEventInit& aParam,
-              ErrorResult& aRv);
-
-  static already_AddRefed<BeforeAfterKeyboardEvent>
-  Constructor(EventTarget* aOwner, const nsAString& aType,
-              const BeforeAfterKeyboardEventInit& aEventInitDict);
-
-  Nullable<bool> GetEmbeddedCancelled();
-};
-
-} // namespace dom
-} // namespace mozilla
-
-already_AddRefed<mozilla::dom::BeforeAfterKeyboardEvent>
-NS_NewDOMBeforeAfterKeyboardEvent(mozilla::dom::EventTarget* aOwner,
-                                  nsPresContext* aPresContext,
-                                  mozilla::InternalBeforeAfterKeyboardEvent* aEvent);
-
-#endif // mozilla_dom_BeforeAfterKeyboardEvent_h_
--- a/dom/events/EventDispatcher.cpp
+++ b/dom/events/EventDispatcher.cpp
@@ -8,17 +8,16 @@
 #include "nsContentUtils.h"
 #include "nsError.h"
 #include <new>
 #include "nsIContent.h"
 #include "nsIDocument.h"
 #include "nsINode.h"
 #include "nsPIDOMWindow.h"
 #include "AnimationEvent.h"
-#include "BeforeAfterKeyboardEvent.h"
 #include "BeforeUnloadEvent.h"
 #include "ClipboardEvent.h"
 #include "CommandEvent.h"
 #include "CompositionEvent.h"
 #include "DataContainerEvent.h"
 #include "DeviceMotionEvent.h"
 #include "DragEvent.h"
 #include "GeckoProfiler.h"
@@ -908,19 +907,16 @@ EventDispatcher::CreateEvent(EventTarget
     case eUIEventClass:
       return NS_NewDOMUIEvent(aOwner, aPresContext, aEvent->AsGUIEvent());
     case eScrollAreaEventClass:
       return NS_NewDOMScrollAreaEvent(aOwner, aPresContext,
                                       aEvent->AsScrollAreaEvent());
     case eKeyboardEventClass:
       return NS_NewDOMKeyboardEvent(aOwner, aPresContext,
                                     aEvent->AsKeyboardEvent());
-    case eBeforeAfterKeyboardEventClass:
-      return NS_NewDOMBeforeAfterKeyboardEvent(aOwner, aPresContext,
-                                               aEvent->AsBeforeAfterKeyboardEvent());
     case eCompositionEventClass:
       return NS_NewDOMCompositionEvent(aOwner, aPresContext,
                                        aEvent->AsCompositionEvent());
     case eMouseEventClass:
       return NS_NewDOMMouseEvent(aOwner, aPresContext, aEvent->AsMouseEvent());
     case eFocusEventClass:
       return NS_NewDOMFocusEvent(aOwner, aPresContext, aEvent->AsFocusEvent());
     case eMouseScrollEventClass:
--- a/dom/events/moz.build
+++ b/dom/events/moz.build
@@ -31,17 +31,16 @@ EXPORTS.mozilla += [
     'KeyNameList.h',
     'PhysicalKeyCodeNameList.h',
     'TextComposition.h',
     'VirtualKeyCodeList.h',
 ]
 
 EXPORTS.mozilla.dom += [
     'AnimationEvent.h',
-    'BeforeAfterKeyboardEvent.h',
     'BeforeUnloadEvent.h',
     'ClipboardEvent.h',
     'CommandEvent.h',
     'CompositionEvent.h',
     'CustomEvent.h',
     'DataContainerEvent.h',
     'DataTransfer.h',
     'DataTransferItem.h',
@@ -74,17 +73,16 @@ EXPORTS.mozilla.dom += [
 ]
 
 if CONFIG['MOZ_WEBSPEECH']:
     EXPORTS.mozilla.dom += ['SpeechRecognitionError.h']
 
 UNIFIED_SOURCES += [
     'AnimationEvent.cpp',
     'AsyncEventDispatcher.cpp',
-    'BeforeAfterKeyboardEvent.cpp',
     'BeforeUnloadEvent.cpp',
     'ClipboardEvent.cpp',
     'CommandEvent.cpp',
     'CompositionEvent.cpp',
     'ContentEventHandler.cpp',
     'CustomEvent.cpp',
     'DataContainerEvent.cpp',
     'DataTransfer.cpp',
--- a/dom/events/test/test_all_synthetic_events.html
+++ b/dom/events/test/test_all_synthetic_events.html
@@ -33,20 +33,16 @@ const kEventConstructors = {
                                                        },
                                              },
   AnimationPlaybackEvent:                    { create: function (aName, aProps) {
                                                          return new AnimationPlaybackEvent(aName, aProps);
                                                        },
                                              },
   AudioProcessingEvent:                      { create: null, // Cannot create untrusted event from JS.
                                              },
-  BeforeAfterKeyboardEvent:                  { create: function (aName, aProps) {
-                                                         return new BeforeAfterKeyboardEvent(aName, aProps);
-                                                       },
-                                             },
   BeforeUnloadEvent:                         { create: function (aName, aProps) {
                                                          var e = document.createEvent("beforeunloadevent");
                                                          e.initEvent(aName, aProps.bubbles, aProps.cancelable);
                                                          return e;
                                                        },
                                              },
   BlobEvent:                                 { create: function (aName, aProps) {
                                                          return new BlobEvent(aName, aProps);
deleted file mode 100644
--- a/dom/webidl/BeforeAfterKeyboardEvent.webidl
+++ /dev/null
@@ -1,19 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-[Constructor(DOMString typeArg,
- optional BeforeAfterKeyboardEventInit eventInitDict),
- Pref="dom.beforeAfterKeyboardEvent.enabled",
- ChromeOnly]
-interface BeforeAfterKeyboardEvent : KeyboardEvent
-{
-  readonly attribute boolean? embeddedCancelled;
-};
-
-dictionary BeforeAfterKeyboardEventInit : KeyboardEventInit
-{
-  boolean? embeddedCancelled = null;
-};
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -44,17 +44,16 @@ WEBIDL_FILES = [
     'AudioStreamTrack.webidl',
     'AudioTrack.webidl',
     'AudioTrackList.webidl',
     'AudioWorkletGlobalScope.webidl',
     'AutocompleteInfo.webidl',
     'BarProp.webidl',
     'BaseKeyframeTypes.webidl',
     'BatteryManager.webidl',
-    'BeforeAfterKeyboardEvent.webidl',
     'BeforeUnloadEvent.webidl',
     'BiquadFilterNode.webidl',
     'Blob.webidl',
     'BoxObject.webidl',
     'BroadcastChannel.webidl',
     'BrowserElement.webidl',
     'BrowserElementAudioChannel.webidl',
     'BrowserElementDictionaries.webidl',
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -43,17 +43,16 @@
 #include "winuser.h"
 #endif
 
 #include "gfxPrefs.h"
 #include "gfxUserFontSet.h"
 #include "nsPresContext.h"
 #include "nsIContent.h"
 #include "nsIContentIterator.h"
-#include "mozilla/dom/BeforeAfterKeyboardEvent.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/Event.h" // for Event::GetEventPopupControlState()
 #include "mozilla/dom/ShadowRoot.h"
 #include "mozilla/dom/PointerEvent.h"
 #include "nsIDocument.h"
 #include "nsAnimationManager.h"
 #include "nsNameSpaceManager.h"  // for Pref-related rule management (bugs 22963,20760,31816)
 #include "nsFrame.h"
@@ -84,17 +83,16 @@
 #include "nsCaret.h"
 #include "AccessibleCaretEventHub.h"
 #include "nsIDOMHTMLDocument.h"
 #include "nsFrameManager.h"
 #include "nsXPCOM.h"
 #include "nsILayoutHistoryState.h"
 #include "nsILineIterator.h" // for ScrollContentIntoView
 #include "PLDHashTable.h"
-#include "mozilla/dom/BeforeAfterKeyboardEventBinding.h"
 #include "mozilla/dom/Touch.h"
 #include "mozilla/dom/TouchEvent.h"
 #include "mozilla/dom/PointerEventBinding.h"
 #include "nsIObserverService.h"
 #include "nsDocShell.h"        // for reflow observation
 #include "nsIBaseWindow.h"
 #include "nsError.h"
 #include "nsLayoutUtils.h"
--- a/layout/base/PresShell.h
+++ b/layout/base/PresShell.h
@@ -779,17 +779,17 @@ protected:
   nsRevocableEventPtr<nsRunnableMethod<PresShell>> mUpdateApproximateFrameVisibilityEvent;
 
   // A set of frames that were visible or could be visible soon at the time
   // that we last did an approximate frame visibility update.
   VisibleFrames mApproximatelyVisibleFrames;
 
 
   //////////////////////////////////////////////////////////////////////////////
-  // Methods for dispatching KeyboardEvent and BeforeAfterKeyboardEvent.
+  // Methods for dispatching KeyboardEvent.
   //////////////////////////////////////////////////////////////////////////////
 
   void HandleKeyboardEvent(nsINode* aTarget,
                            mozilla::WidgetKeyboardEvent& aEvent,
                            bool aEmbeddedCancelled,
                            nsEventStatus* aStatus,
                            mozilla::EventDispatchingCallback* aEventCB);
 
--- a/widget/EventClassList.h
+++ b/widget/EventClassList.h
@@ -21,17 +21,16 @@ NS_EVENT_CLASS(Widget, InputEvent)
 NS_EVENT_CLASS(Internal, UIEvent)
 
 // TextEvents.h
 NS_EVENT_CLASS(Widget, KeyboardEvent)
 NS_EVENT_CLASS(Widget, CompositionEvent)
 NS_EVENT_CLASS(Widget, QueryContentEvent)
 NS_EVENT_CLASS(Widget, SelectionEvent)
 NS_EVENT_CLASS(Internal, EditorInputEvent)
-NS_EVENT_CLASS(Internal, BeforeAfterKeyboardEvent)
 
 // MouseEvents.h
 NS_EVENT_CLASS(Widget, MouseEventBase)
 NS_EVENT_CLASS(Widget, MouseEvent)
 NS_EVENT_CLASS(Widget, DragEvent)
 NS_EVENT_CLASS(Widget, MouseScrollEvent)
 NS_EVENT_CLASS(Widget, WheelEvent)
 NS_EVENT_CLASS(Widget, PointerEvent)
--- a/widget/TextEvents.h
+++ b/widget/TextEvents.h
@@ -415,78 +415,16 @@ private:
   typedef nsDataHashtable<nsStringHashKey,
                           KeyNameIndex> KeyNameIndexHashtable;
   typedef nsDataHashtable<nsStringHashKey,
                           CodeNameIndex> CodeNameIndexHashtable;
   static KeyNameIndexHashtable* sKeyNameIndexHashtable;
   static CodeNameIndexHashtable* sCodeNameIndexHashtable;
 };
 
-
-/******************************************************************************
- * mozilla::InternalBeforeAfterKeyboardEvent
- *
- * This is extended from WidgetKeyboardEvent and is mapped to DOM event
- * "BeforeAfterKeyboardEvent".
- ******************************************************************************/
-class InternalBeforeAfterKeyboardEvent : public WidgetKeyboardEvent
-{
-private:
-  friend class dom::PBrowserParent;
-  friend class dom::PBrowserChild;
-
-  InternalBeforeAfterKeyboardEvent()
-  {
-  }
-
-public:
-  // Extra member for InternalBeforeAfterKeyboardEvent. Indicates whether
-  // default actions of keydown/keyup event is prevented.
-  Nullable<bool> mEmbeddedCancelled;
-
-  virtual InternalBeforeAfterKeyboardEvent* AsBeforeAfterKeyboardEvent() override
-  {
-    return this;
-  }
-
-  InternalBeforeAfterKeyboardEvent(bool aIsTrusted, EventMessage aMessage,
-                                   nsIWidget* aWidget)
-    : WidgetKeyboardEvent(aIsTrusted, aMessage, aWidget,
-                          eBeforeAfterKeyboardEventClass)
-  {
-  }
-
-  virtual WidgetEvent* Duplicate() const override
-  {
-    MOZ_ASSERT(mClass == eBeforeAfterKeyboardEventClass,
-               "Duplicate() must be overridden by sub class");
-    // Not copying widget, it is a weak reference.
-    InternalBeforeAfterKeyboardEvent* result =
-      new InternalBeforeAfterKeyboardEvent(false, mMessage, nullptr);
-    result->AssignBeforeAfterKeyEventData(*this, true);
-    result->mFlags = mFlags;
-    return result;
-  }
-
-  void AssignBeforeAfterKeyEventData(
-         const InternalBeforeAfterKeyboardEvent& aEvent,
-         bool aCopyTargets)
-  {
-    AssignKeyEventData(aEvent, aCopyTargets);
-    mEmbeddedCancelled = aEvent.mEmbeddedCancelled;
-  }
-
-  void AssignBeforeAfterKeyEventData(
-         const WidgetKeyboardEvent& aEvent,
-         bool aCopyTargets)
-  {
-    AssignKeyEventData(aEvent, aCopyTargets);
-  }
-};
-
 /******************************************************************************
  * mozilla::WidgetCompositionEvent
  ******************************************************************************/
 
 class WidgetCompositionEvent : public WidgetGUIEvent
 {
 private:
   friend class mozilla::dom::PBrowserParent;
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -478,47 +478,16 @@ struct ParamTraits<mozilla::WidgetKeyboa
         static_cast<paramType::InputMethodAppState>(inputMethodAppState);
       return true;
     }
     return false;
   }
 };
 
 template<>
-struct ParamTraits<mozilla::InternalBeforeAfterKeyboardEvent>
-{
-  typedef mozilla::InternalBeforeAfterKeyboardEvent paramType;
-
-  static void Write(Message* aMsg, const paramType& aParam)
-  {
-    WriteParam(aMsg, static_cast<mozilla::WidgetKeyboardEvent>(aParam));
-    WriteParam(aMsg, aParam.mEmbeddedCancelled.IsNull());
-    WriteParam(aMsg, aParam.mEmbeddedCancelled.Value());
-  }
-
-  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
-  {
-    bool isNull;
-    bool value;
-    bool rv =
-      ReadParam(aMsg, aIter,
-                static_cast<mozilla::WidgetKeyboardEvent*>(aResult)) &&
-      ReadParam(aMsg, aIter, &isNull) &&
-      ReadParam(aMsg, aIter, &value);
-
-    aResult->mEmbeddedCancelled = Nullable<bool>();
-    if (rv && !isNull) {
-      aResult->mEmbeddedCancelled.SetValue(value);
-    }
-
-    return rv;
-  }
-};
-
-template<>
 struct ParamTraits<mozilla::TextRangeStyle>
 {
   typedef mozilla::TextRangeStyle paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
     WriteParam(aMsg, aParam.mDefinedStyles);
     WriteParam(aMsg, aParam.mLineStyle);