Bug 1314388 - Remove SVGZoomEvent; r=longsonr,smaug
☠☠ backed out by 89b885c2cb80 ☠ ☠
authorAryeh Gregor <ayg@aryeh.name>
Tue, 28 Mar 2017 15:55:05 +0300
changeset 350865 b7fab6a89c1d
parent 350864 f079689d79be
child 350866 804d8199aeca
push id31592
push userarchaeopteryx@coole-files.de
push dateSun, 02 Apr 2017 16:52:55 +0000
treeherdermozilla-central@38894655c89e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslongsonr, smaug
bugs1314388
milestone55.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 1314388 - Remove SVGZoomEvent; r=longsonr,smaug Some code in SVGSVGElement.cpp might be unnecessary now, but Robert said to leave it for a followup. MozReview-Commit-ID: 8PpRGeGrREJ
devtools/client/debugger/new/debugger.js
dom/events/EventDispatcher.cpp
dom/events/EventNameList.h
dom/events/test/test_all_synthetic_events.html
dom/smil/test/test_smilTimeEvents.xhtml
dom/svg/SVGSVGElement.cpp
dom/svg/SVGSVGElement.h
dom/svg/SVGZoomEvent.cpp
dom/svg/SVGZoomEvent.h
dom/svg/moz.build
dom/tests/mochitest/general/test_interfaces.js
dom/webidl/SVGZoomEvent.webidl
dom/webidl/moz.build
editor/libeditor/InsertNodeTransaction.cpp
testing/web-platform/meta/dom/nodes/Document-createEvent.html.ini
testing/web-platform/meta/svg/historical.html.ini
testing/web-platform/tests/svg/interfaces.html
widget/BasicEvents.h
widget/ContentEvents.h
widget/EventClassList.h
--- a/devtools/client/debugger/new/debugger.js
+++ b/devtools/client/debugger/new/debugger.js
@@ -73510,17 +73510,16 @@ return /******/ (function(modules) { // 
 			"SVGTSpanElement": false,
 			"SVGUnitTypes": false,
 			"SVGURIReference": false,
 			"SVGUseElement": false,
 			"SVGViewElement": false,
 			"SVGViewSpec": false,
 			"SVGVKernElement": false,
 			"SVGZoomAndPan": false,
-			"SVGZoomEvent": false,
 			"Text": false,
 			"TextDecoder": false,
 			"TextEncoder": false,
 			"TextEvent": false,
 			"TextMetrics": false,
 			"TextTrack": false,
 			"TextTrackCue": false,
 			"TextTrackCueList": false,
--- a/dom/events/EventDispatcher.cpp
+++ b/dom/events/EventDispatcher.cpp
@@ -38,17 +38,16 @@
 #include "mozilla/dom/PageTransitionEvent.h"
 #include "mozilla/dom/PointerEvent.h"
 #include "mozilla/dom/PopStateEvent.h"
 #include "mozilla/dom/RootedDictionary.h"
 #include "mozilla/dom/ScrollAreaEvent.h"
 #include "mozilla/dom/SimpleGestureEvent.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/StorageEvent.h"
-#include "mozilla/dom/SVGZoomEvent.h"
 #include "mozilla/dom/TimeEvent.h"
 #include "mozilla/dom/TouchEvent.h"
 #include "mozilla/dom/TransitionEvent.h"
 #include "mozilla/dom/WheelEvent.h"
 #include "mozilla/dom/WorkerPrivate.h"
 #include "mozilla/dom/XULCommandEvent.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/EventListenerManager.h"
@@ -935,19 +934,16 @@ EventDispatcher::CreateEvent(EventTarget
     case eEditorInputEventClass:
       return NS_NewDOMInputEvent(aOwner, aPresContext,
                                  aEvent->AsEditorInputEvent());
     case eDragEventClass:
       return NS_NewDOMDragEvent(aOwner, aPresContext, aEvent->AsDragEvent());
     case eClipboardEventClass:
       return NS_NewDOMClipboardEvent(aOwner, aPresContext,
                                      aEvent->AsClipboardEvent());
-    case eSVGZoomEventClass:
-      return NS_NewDOMSVGZoomEvent(aOwner, aPresContext,
-                                   aEvent->AsSVGZoomEvent());
     case eSMILTimeEventClass:
       return NS_NewDOMTimeEvent(aOwner, aPresContext,
                                 aEvent->AsSMILTimeEvent());
     case eCommandEventClass:
       return NS_NewDOMCommandEvent(aOwner, aPresContext,
                                    aEvent->AsCommandEvent());
     case eSimpleGestureEventClass:
       return NS_NewDOMSimpleGestureEvent(aOwner, aPresContext,
@@ -1061,24 +1057,16 @@ EventDispatcher::CreateEvent(EventTarget
   if (aEventType.LowerCaseEqualsLiteral("svgevent")) {
     LOG_EVENT_CREATION(SVGEVENT);
     return NS_NewDOMEvent(aOwner, aPresContext, nullptr);
   }
   if (aEventType.LowerCaseEqualsLiteral("svgevents")) {
     LOG_EVENT_CREATION(SVGEVENTS);
     return NS_NewDOMEvent(aOwner, aPresContext, nullptr);
   }
-  if (aEventType.LowerCaseEqualsLiteral("svgzoomevent")) {
-    LOG_EVENT_CREATION(SVGZOOMEVENT);
-    return NS_NewDOMSVGZoomEvent(aOwner, aPresContext, nullptr);
-  }
-  if (aEventType.LowerCaseEqualsLiteral("svgzoomevents")) {
-    LOG_EVENT_CREATION(SVGZOOMEVENTS);
-    return NS_NewDOMSVGZoomEvent(aOwner, aPresContext, nullptr);
-  }
   if (aEventType.LowerCaseEqualsLiteral("timeevent")) {
     LOG_EVENT_CREATION(TIMEEVENT);
     return NS_NewDOMTimeEvent(aOwner, aPresContext, nullptr);
   }
   if (aEventType.LowerCaseEqualsLiteral("timeevents")) {
     LOG_EVENT_CREATION(TIMEEVENTS);
     return NS_NewDOMTimeEvent(aOwner, aPresContext, nullptr);
   }
--- a/dom/events/EventNameList.h
+++ b/dom/events/EventNameList.h
@@ -830,29 +830,16 @@ NON_IDL_EVENT(SVGResize,
               eSVGResize,
               EventNameType_None,
               eBasicEventClass)
 NON_IDL_EVENT(SVGScroll,
               eSVGScroll,
               EventNameType_None,
               eBasicEventClass)
 
-NON_IDL_EVENT(SVGZoom,
-              eSVGZoom,
-              EventNameType_None,
-              eSVGZoomEventClass)
-
-// Only map the ID to the real event name when MESSAGE_TO_EVENT is defined.
-#ifndef MESSAGE_TO_EVENT
-// This is a bit hackish, but SVG's event names are weird.
-NON_IDL_EVENT(zoom,
-              eSVGZoom,
-              EventNameType_SVGSVG,
-              eBasicEventClass)
-#endif
 // Only map the ID to the real event name when MESSAGE_TO_EVENT is defined.
 #ifndef MESSAGE_TO_EVENT
 NON_IDL_EVENT(begin,
               eSMILBeginEvent,
               EventNameType_SMIL,
               eBasicEventClass)
 #endif
 NON_IDL_EVENT(beginEvent,
--- a/dom/events/test/test_all_synthetic_events.html
+++ b/dom/events/test/test_all_synthetic_events.html
@@ -376,23 +376,16 @@ const kEventConstructors = {
                                                        },
                                                chromeOnly: true,
                                              },
   StyleSheetChangeEvent:                     { create: function (aName, aProps) {
                                                          return new StyleSheetChangeEvent(aName, aProps);
                                                        },
                                                chromeOnly: true,
                                              },
-  SVGZoomEvent:                              { create: function (aName, aProps) {
-                                                         var e = document.createEvent("svgzoomevent");
-                                                         e.initUIEvent(aName, aProps.bubbles, aProps.cancelable,
-                                                                       aProps.view, aProps.detail);
-                                                         return e;
-                                                       },
-                                             },
   TCPSocketErrorEvent:                       { create: function(aName, aProps) {
                                                          return new TCPSocketErrorEvent(aName, aProps);
                                                        },
                                              },
   TCPSocketEvent:                            { create: function(aName, aProps) {
                                                          return new TCPSocketEvent(aName, aProps);
                                                        },
                                              },
--- a/dom/smil/test/test_smilTimeEvents.xhtml
+++ b/dom/smil/test/test_smilTimeEvents.xhtml
@@ -317,21 +317,13 @@ for (var i = 0; i < timeEvents.length; +
 is(expectedEvents.length, 0, "Got all the expected events.");
 
 expectedEvents = ["zoom", "SVGZoom"];
 d.addEventListener("zoom", function(e) {
   is(e.type, expectedEvents[0]);
   expectedEvents.shift();
 });
 
-var zoomEvent = document.createEvent("svgzoomevent");
-zoomEvent.initEvent("zoom", true, true);
-d.dispatchEvent(zoomEvent);
-zoomEvent = document.createEvent("svgzoomevent");
-zoomEvent.initEvent("SVGZoom", true, true);
-d.dispatchEvent(zoomEvent);
-is(expectedEvents.length, 0, "Got all the expected events.");
-
 ]]>
 </script>
 </pre>
 </body>
 </html>
--- a/dom/svg/SVGSVGElement.cpp
+++ b/dom/svg/SVGSVGElement.cpp
@@ -470,17 +470,17 @@ SVGSVGElement::SetZoomAndPan(uint16_t aZ
     mEnumAttributes[ZOOMANDPAN].SetBaseValue(aZoomAndPan, this);
     return;
   }
 
   rv.ThrowRangeError<MSG_INVALID_ZOOMANDPAN_VALUE_ERROR>();
 }
 
 //----------------------------------------------------------------------
-// helper methods for implementing SVGZoomEvent:
+// helper method for implementing SetCurrentScale/Translate
 
 void
 SVGSVGElement::SetCurrentScaleTranslate(float s, float x, float y)
 {
   if (s == mCurrentScale &&
       x == mCurrentTranslate.GetX() && y == mCurrentTranslate.GetY()) {
     return;
   }
@@ -494,32 +494,32 @@ SVGSVGElement::SetCurrentScaleTranslate(
   // IMPORTANT: If either mCurrentTranslate *or* mCurrentScale is changed then
   // mPreviousTranslate_x, mPreviousTranslate_y *and* mPreviousScale must all
   // be updated otherwise SVGZoomEvents will end up with invalid data. I.e. an
   // SVGZoomEvent's properties previousScale and previousTranslate must contain
   // the state of currentScale and currentTranslate immediately before the
   // change that caused the event's dispatch, which is *not* necessarily the
   // same thing as the values of currentScale and currentTranslate prior to
   // their own last change.
+  //
+  // XXX This comment is out-of-date due to removal of SVGZoomEvent.  Can we
+  // remove some of this code?
   mPreviousScale = mCurrentScale;
   mPreviousTranslate = mCurrentTranslate;
   
   mCurrentScale = s;
   mCurrentTranslate = SVGPoint(x, y);
 
   // now dispatch the appropriate event if we are the root element
   nsIDocument* doc = GetUncomposedDoc();
   if (doc) {
     nsCOMPtr<nsIPresShell> presShell = doc->GetShell();
     if (presShell && IsRoot()) {
       nsEventStatus status = nsEventStatus_eIgnore;
-      if (mPreviousScale != mCurrentScale) {
-        InternalSVGZoomEvent svgZoomEvent(true, eSVGZoom);
-        presShell->HandleDOMEventWithTarget(this, &svgZoomEvent, &status);
-      } else {
+      if (mPreviousScale == mCurrentScale) {
         WidgetEvent svgScrollEvent(true, eSVGScroll);
         presShell->HandleDOMEventWithTarget(this, &svgScrollEvent, &status);
       }
       InvalidateTransformNotifyFrame();
     }
   }
 }
 
--- a/dom/svg/SVGSVGElement.h
+++ b/dom/svg/SVGSVGElement.h
@@ -127,16 +127,18 @@ public:
   // interfaces:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SVGSVGElement, SVGSVGElementBase)
 
   /**
    * For use by zoom controls to allow currentScale, currentTranslate.x and
    * currentTranslate.y to be set by a single operation that dispatches a
    * single SVGZoom event (instead of one SVGZoom and two SVGScroll events).
+   *
+   * XXX SVGZoomEvent is no more, is this needed?
    */
   void SetCurrentScaleTranslate(float s, float x, float y);
 
   /**
    * Retrieve the value of currentScale and currentTranslate.
    */
   const SVGPoint& GetCurrentTranslate() { return mCurrentTranslate; }
   float GetCurrentScale() { return mCurrentScale; }
deleted file mode 100644
--- a/dom/svg/SVGZoomEvent.cpp
+++ /dev/null
@@ -1,103 +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 "DOMSVGPoint.h"
-#include "mozilla/ContentEvents.h"
-#include "mozilla/dom/Element.h"
-#include "mozilla/dom/SVGSVGElement.h"
-#include "mozilla/dom/SVGZoomEvent.h"
-#include "nsIDocument.h"
-#include "nsIPresShell.h"
-#include "prtime.h"
-
-namespace mozilla {
-namespace dom {
-
-//----------------------------------------------------------------------
-// Implementation
-
-NS_IMPL_CYCLE_COLLECTION_INHERITED(SVGZoomEvent, UIEvent, mPreviousTranslate, mNewTranslate)
-
-NS_IMPL_ADDREF_INHERITED(SVGZoomEvent, UIEvent)
-NS_IMPL_RELEASE_INHERITED(SVGZoomEvent, UIEvent)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SVGZoomEvent)
-NS_INTERFACE_MAP_END_INHERITING(UIEvent)
-
-SVGZoomEvent::SVGZoomEvent(EventTarget* aOwner,
-                           nsPresContext* aPresContext,
-                           InternalSVGZoomEvent* aEvent)
-  : UIEvent(aOwner, aPresContext,
-            aEvent ? aEvent : new InternalSVGZoomEvent(false, eSVGZoom))
-  , mPreviousScale(0)
-  , mNewScale(0)
-{
-  if (aEvent) {
-    mEventIsInternal = false;
-  }
-  else {
-    mEventIsInternal = true;
-    mEvent->mTime = PR_Now();
-  }
-
-  // We must store the "Previous" and "New" values before this event is
-  // dispatched. Reading the values from the root 'svg' element after we've
-  // been dispatched is not an option since event handler code may change
-  // currentScale and currentTranslate in response to this event.
-  nsIPresShell *presShell;
-  if (mPresContext && (presShell = mPresContext->GetPresShell())) {
-    nsIDocument *doc = presShell->GetDocument();
-    if (doc) {
-      Element *rootElement = doc->GetRootElement();
-      if (rootElement) {
-        // If the root element isn't an SVG 'svg' element
-        // (e.g. if this event was created by calling createEvent on a
-        // non-SVGDocument), then the "New" and "Previous"
-        // properties will be left null which is probably what we want.
-        if (rootElement->IsSVGElement(nsGkAtoms::svg)) {
-          SVGSVGElement *SVGSVGElem =
-            static_cast<SVGSVGElement*>(rootElement);
-
-          mNewScale = SVGSVGElem->GetCurrentScale();
-          mPreviousScale = SVGSVGElem->GetPreviousScale();
-
-          const SVGPoint& translate = SVGSVGElem->GetCurrentTranslate();
-          mNewTranslate =
-            new DOMSVGPoint(translate.GetX(), translate.GetY());
-          mNewTranslate->SetReadonly(true);
-
-          const SVGPoint& prevTranslate = SVGSVGElem->GetPreviousTranslate();
-          mPreviousTranslate =
-            new DOMSVGPoint(prevTranslate.GetX(), prevTranslate.GetY());
-          mPreviousTranslate->SetReadonly(true);
-        }
-      }
-    }
-  }
-}
-
-SVGZoomEvent::~SVGZoomEvent()
-{
-}
-
-} // namespace dom
-} // namespace mozilla
-
-
-////////////////////////////////////////////////////////////////////////
-// Exported creation functions:
-
-using namespace mozilla;
-using namespace mozilla::dom;
-
-already_AddRefed<SVGZoomEvent>
-NS_NewDOMSVGZoomEvent(EventTarget* aOwner,
-                      nsPresContext* aPresContext,
-                      mozilla::InternalSVGZoomEvent* aEvent)
-{
-  RefPtr<SVGZoomEvent> it = new SVGZoomEvent(aOwner, aPresContext, aEvent);
-  return it.forget();
-}
deleted file mode 100644
--- a/dom/svg/SVGZoomEvent.h
+++ /dev/null
@@ -1,78 +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_SVGZoomEvent_h
-#define mozilla_dom_SVGZoomEvent_h
-
-#include "DOMSVGPoint.h"
-#include "mozilla/dom/UIEvent.h"
-#include "mozilla/dom/SVGZoomEventBinding.h"
-#include "mozilla/EventForwards.h"
-
-class nsPresContext;
-
-namespace mozilla {
-
-class nsISVGPoint;
-
-namespace dom {
-
-class SVGZoomEvent final : public UIEvent
-{
-public:
-
-  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SVGZoomEvent, UIEvent)
-  NS_DECL_ISUPPORTS_INHERITED
-
-  SVGZoomEvent(EventTarget* aOwner, nsPresContext* aPresContext,
-               InternalSVGZoomEvent* aEvent);
-
-  // Forward to base class
-  NS_FORWARD_TO_UIEVENT
-
-  virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
-  {
-    return SVGZoomEventBinding::Wrap(aCx, this, aGivenProto);
-  }
-
-  float PreviousScale() const
-  {
-    return mPreviousScale;
-  }
-
-  nsISVGPoint* GetPreviousTranslate() const
-  {
-    return mPreviousTranslate;
-  }
-
-  float NewScale() const
-  {
-    return mNewScale;
-  }
-
-  nsISVGPoint* GetNewTranslate() const
-  {
-    return mNewTranslate;
-  }
-
-private:
-  ~SVGZoomEvent();
-
-  float mPreviousScale;
-  float mNewScale;
-  RefPtr<DOMSVGPoint> mPreviousTranslate;
-  RefPtr<DOMSVGPoint> mNewTranslate;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-already_AddRefed<mozilla::dom::SVGZoomEvent>
-NS_NewDOMSVGZoomEvent(mozilla::dom::EventTarget* aOwner,
-                      nsPresContext* aPresContext,
-                      mozilla::InternalSVGZoomEvent* aEvent);
-
-#endif // mozilla_dom_SVGZoomEvent_h
--- a/dom/svg/moz.build
+++ b/dom/svg/moz.build
@@ -97,17 +97,16 @@ EXPORTS.mozilla.dom += [
     'SVGTextPathElement.h',
     'SVGTextPositioningElement.h',
     'SVGTitleElement.h',
     'SVGTransform.h',
     'SVGTransformableElement.h',
     'SVGTSpanElement.h',
     'SVGUseElement.h',
     'SVGViewElement.h',
-    'SVGZoomEvent.h',
 ]
 
 UNIFIED_SOURCES += [
     'DOMSVGAnimatedLengthList.cpp',
     'DOMSVGAnimatedNumberList.cpp',
     'DOMSVGLength.cpp',
     'DOMSVGLengthList.cpp',
     'DOMSVGNumber.cpp',
@@ -244,17 +243,16 @@ UNIFIED_SOURCES += [
     'SVGTransformableElement.cpp',
     'SVGTransformList.cpp',
     'SVGTransformListParser.cpp',
     'SVGTransformListSMILType.cpp',
     'SVGTSpanElement.cpp',
     'SVGUseElement.cpp',
     'SVGViewBoxSMILType.cpp',
     'SVGViewElement.cpp',
-    'SVGZoomEvent.cpp',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 LOCAL_INCLUDES += [
     '/dom',
     '/dom/base',
--- a/dom/tests/mochitest/general/test_interfaces.js
+++ b/dom/tests/mochitest/general/test_interfaces.js
@@ -1114,18 +1114,16 @@ var interfaceNamesInGlobalScope =
     "SVGUnitTypes",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "SVGUseElement",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "SVGViewElement",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "SVGZoomAndPan",
 // IMPORTANT: Do not change this list without review from a DOM peer!
-    "SVGZoomEvent",
-// IMPORTANT: Do not change this list without review from a DOM peer!
     "Text",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "TextDecoder",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "TextEncoder",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "TextMetrics",
 // IMPORTANT: Do not change this list without review from a DOM peer!
deleted file mode 100644
--- a/dom/webidl/SVGZoomEvent.webidl
+++ /dev/null
@@ -1,25 +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/.
- *
- * The origin of this IDL file is
- * http://www.w3.org/TR/SVG2/
- *
- * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
- * liability, trademark and document use rules apply.
- */
-
-interface SVGZoomEvent : UIEvent {
-  // Not implemented
-  // readonly attribute SVGRect zoomRectScreen;
-
-  [Constant]
-  readonly attribute float previousScale;
-  [Constant]
-  readonly attribute SVGPoint? previousTranslate;
-  [Constant]
-  readonly attribute float newScale;
-  [Constant]
-  readonly attribute SVGPoint? newTranslate;
-};
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -895,17 +895,16 @@ WEBIDL_FILES = [
     'SVGTSpanElement.webidl',
     'SVGUnitTypes.webidl',
     'SVGUnitTypeValues.webidl',
     'SVGURIReference.webidl',
     'SVGUseElement.webidl',
     'SVGViewElement.webidl',
     'SVGZoomAndPan.webidl',
     'SVGZoomAndPanValues.webidl',
-    'SVGZoomEvent.webidl',
     'TCPServerSocket.webidl',
     'TCPServerSocketEvent.webidl',
     'TCPSocket.webidl',
     'TCPSocketErrorEvent.webidl',
     'TCPSocketEvent.webidl',
     'Text.webidl',
     'TextClause.webidl',
     'TextDecoder.webidl',
--- a/editor/libeditor/InsertNodeTransaction.cpp
+++ b/editor/libeditor/InsertNodeTransaction.cpp
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; 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/. */
 
 #include "InsertNodeTransaction.h"
 
 #include "mozilla/EditorBase.h"         // for EditorBase
+#include "mozilla/HTMLEditor.h"         // for HTMLEditor
 
 #include "mozilla/dom/Selection.h"      // for Selection
 
 #include "nsAString.h"
 #include "nsDebug.h"                    // for NS_ENSURE_TRUE, etc.
 #include "nsError.h"                    // for NS_ERROR_NULL_POINTER, etc.
 #include "nsIContent.h"                 // for nsIContent
 #include "nsMemory.h"                   // for nsMemory
@@ -67,18 +68,25 @@ InsertNodeTransaction::DoTransaction()
   ErrorResult rv;
   mParent->InsertBefore(*mNode, ref, rv);
   NS_ENSURE_TRUE(!rv.Failed(), rv.StealNSResult());
 
   // Only set selection to insertion point if editor gives permission
   if (mEditorBase->GetShouldTxnSetSelection()) {
     RefPtr<Selection> selection = mEditorBase->GetSelection();
     NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
-    // Place the selection just after the inserted element
-    selection->Collapse(mParent, mOffset + 1);
+    RefPtr<HTMLEditor> htmlEditor = mEditorBase->AsHTMLEditor();
+    if (htmlEditor) {
+      EditorDOMPoint pt =
+        htmlEditor->mHTMLEditRules->GetGoodSelPointForNode(mNode, nsIEditor::ePrevious);
+      selection->Collapse(pt.node, pt.offset);
+    } else {
+      // Place the selection just after the inserted element
+      selection->Collapse(mNode, mNode->Length());
+    }
   } else {
     // Do nothing - DOM Range gravity will adjust selection
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 InsertNodeTransaction::UndoTransaction()
--- a/testing/web-platform/meta/dom/nodes/Document-createEvent.html.ini
+++ b/testing/web-platform/meta/dom/nodes/Document-createEvent.html.ini
@@ -143,40 +143,16 @@
   [PROGRESSEVENT should be an alias for ProgressEvent.]
     expected: FAIL
     bug: https://github.com/whatwg/dom/issues/362, 1314303
 
   [createEvent('PROGRESSEVENT') should be initialized correctly.]
     expected: FAIL
     bug: https://github.com/whatwg/dom/issues/362, 1314303
 
-  [createEvent('SVGZoomEvent') should be initialized correctly.]
-    expected: FAIL
-    bug: 1314388
-
-  [createEvent('svgzoomevent') should be initialized correctly.]
-    expected: FAIL
-    bug: 1314388
-
-  [createEvent('SVGZOOMEVENT') should be initialized correctly.]
-    expected: FAIL
-    bug: 1314388
-
-  [createEvent('SVGZoomEvents') should be initialized correctly.]
-    expected: FAIL
-    bug: 1314388
-
-  [createEvent('svgzoomevents') should be initialized correctly.]
-    expected: FAIL
-    bug: 1314388
-
-  [createEvent('SVGZOOMEVENTS') should be initialized correctly.]
-    expected: FAIL
-    bug: 1314388
-
   [Should throw NOT_SUPPORTED_ERR for pluralized legacy event interface "TextEvents"]
     expected: FAIL
     bug: 1251198
 
   [TrackEvent should be an alias for TrackEvent.]
     expected: FAIL
     bug: https://github.com/whatwg/dom/issues/362, 1314303
 
@@ -339,14 +315,8 @@
   [Should throw NOT_SUPPORTED_ERR for non-legacy event interface "XULCommandEvent"]
     expected: FAIL
     bug: 1251198
 
   [Should throw NOT_SUPPORTED_ERR for pluralized non-legacy event interface "XULCommandEvents"]
     expected: FAIL
     bug: 1251198
 
-  [Should throw NOT_SUPPORTED_ERR for non-legacy event interface "SVGZoomEvent"]
-    expected: FAIL
-
-  [Should throw NOT_SUPPORTED_ERR for pluralized non-legacy event interface "SVGZoomEvents"]
-    expected: FAIL
-
--- a/testing/web-platform/meta/svg/historical.html.ini
+++ b/testing/web-platform/meta/svg/historical.html.ini
@@ -1,16 +1,13 @@
 [historical.html]
   type: testharness
   [SVGPathSeg interface must be removed]
     expected: FAIL
 
-  [SVGZoomEvent interface must be removed]
-    expected: FAIL
-
   [SVGUnitTypes mixin interface must not be exposed]
     expected: FAIL
 
   [SVGZoomAndPan mixin interface must not be exposed]
     expected: FAIL
 
   [SVGGraphicsElement.prototype.getTransformToElement must be removed]
     expected: FAIL
--- a/testing/web-platform/tests/svg/interfaces.html
+++ b/testing/web-platform/tests/svg/interfaces.html
@@ -978,24 +978,16 @@ SVGCursorElement implements SVGURIRefere
 
 interface SVGScriptElement : SVGElement {
   attribute DOMString type;
   attribute DOMString crossOrigin;
 };
 
 SVGScriptElement implements SVGURIReference;
 
-interface SVGZoomEvent : UIEvent {
-  [SameObject] readonly attribute DOMRectReadOnly zoomRectScreen;
-  readonly attribute float previousScale;
-  [SameObject] readonly attribute DOMPointReadOnly previousTranslate;
-  readonly attribute float newScale;
-  [SameObject] readonly attribute DOMPointReadOnly newTranslate;
-};
-
 interface SVGAElement : SVGGraphicsElement {
   [SameObject] readonly attribute SVGAnimatedString target;
 };
 
 SVGAElement implements SVGURIReference;
 
 interface SVGViewElement : SVGElement {};
 
--- a/widget/BasicEvents.h
+++ b/widget/BasicEvents.h
@@ -319,17 +319,16 @@ private:
         mFlags.mBubbles = true;
         break;
       case eSMILTimeEventClass:
         mFlags.mCancelable = false;
         mFlags.mBubbles = false;
         break;
       case eTransitionEventClass:
       case eAnimationEventClass:
-      case eSVGZoomEventClass:
         mFlags.mCancelable = false;
         mFlags.mBubbles = true;
         break;
       case eCompositionEventClass:
         // XXX compositionstart is cancelable in draft of DOM3 Events.
         //     However, it doesn't make sense for us, we cannot cancel
         //     composition when we send compositionstart event.
         mFlags.mCancelable = false;
--- a/widget/ContentEvents.h
+++ b/widget/ContentEvents.h
@@ -312,48 +312,16 @@ public:
 
     mAnimationName = aEvent.mAnimationName;
     mElapsedTime = aEvent.mElapsedTime;
     mPseudoElement = aEvent.mPseudoElement;
   }
 };
 
 /******************************************************************************
- * mozilla::InternalSVGZoomEvent
- ******************************************************************************/
-
-class InternalSVGZoomEvent : public WidgetGUIEvent
-{
-public:
-  virtual InternalSVGZoomEvent* AsSVGZoomEvent() override { return this; }
-
-  InternalSVGZoomEvent(bool aIsTrusted, EventMessage aMessage)
-    : WidgetGUIEvent(aIsTrusted, aMessage, nullptr, eSVGZoomEventClass)
-  {
-  }
-
-  virtual WidgetEvent* Duplicate() const override
-  {
-    MOZ_ASSERT(mClass == eSVGZoomEventClass,
-               "Duplicate() must be overridden by sub class");
-    // Not copying widget, it is a weak reference.
-    InternalSVGZoomEvent* result = new InternalSVGZoomEvent(false, mMessage);
-    result->AssignSVGZoomEventData(*this, true);
-    result->mFlags = mFlags;
-    return result;
-  }
-
-  void AssignSVGZoomEventData(const InternalSVGZoomEvent& aEvent,
-                              bool aCopyTargets)
-  {
-    AssignGUIEventData(aEvent, aCopyTargets);
-  }
-};
-
-/******************************************************************************
  * mozilla::InternalSMILTimeEvent
  ******************************************************************************/
 
 class InternalSMILTimeEvent : public InternalUIEvent
 {
 public:
   virtual InternalSMILTimeEvent* AsSMILTimeEvent() override
   {
--- a/widget/EventClassList.h
+++ b/widget/EventClassList.h
@@ -43,17 +43,16 @@ NS_EVENT_CLASS(Widget, TouchEvent)
 // ContentEvents.h
 NS_EVENT_CLASS(Internal, ScrollPortEvent)
 NS_EVENT_CLASS(Internal, ScrollAreaEvent)
 NS_EVENT_CLASS(Internal, FormEvent)
 NS_EVENT_CLASS(Internal, ClipboardEvent)
 NS_EVENT_CLASS(Internal, FocusEvent)
 NS_EVENT_CLASS(Internal, TransitionEvent)
 NS_EVENT_CLASS(Internal, AnimationEvent)
-NS_EVENT_CLASS(Internal, SVGZoomEvent)
 NS_EVENT_CLASS(Internal, SMILTimeEvent)
 
 // MiscEvents.h
 NS_EVENT_CLASS(Widget, CommandEvent)
 NS_EVENT_CLASS(Widget, ContentCommandEvent)
 NS_EVENT_CLASS(Widget, PluginEvent)
 
 // InternalMutationEvent.h (dom/events)