Bug 1436508 part 9. Remove nsIDOMKeyEvent::DOM_KEY* constants. r=masayuki
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 09 Feb 2018 11:17:09 -0500
changeset 403181 498d0e9ef3da
parent 403180 745e6034684b
child 403182 b01bd36c3899
push id33416
push userarchaeopteryx@coole-files.de
push date2018-02-09 22:32 +0000
treeherdermozilla-central@c2cddb0cbb20 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1436508
milestone60.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 1436508 part 9. Remove nsIDOMKeyEvent::DOM_KEY* constants. r=masayuki MozReview-Commit-ID: JXCCrbaMcn
dom/events/KeyboardEvent.cpp
dom/interfaces/events/nsIDOMKeyEvent.idl
toolkit/components/resistfingerprinting/nsRFPService.cpp
widget/TextEvents.h
--- a/dom/events/KeyboardEvent.cpp
+++ b/dom/events/KeyboardEvent.cpp
@@ -364,17 +364,17 @@ KeyboardEvent::ShouldResistFingerprintin
   //   4. The caller type is system.
   //   5. The pref privcy.resistFingerprinting' is false, we fast return here since
   //      we don't need to do any QI of following codes.
   if (mInitializedByCtor ||
       aCallerType == CallerType::System ||
       mEvent->mFlags.mInSystemGroup ||
       !nsContentUtils::ShouldResistFingerprinting() ||
       mEvent->AsKeyboardEvent()->mLocation ==
-        nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD) {
+        KeyboardEventBinding::DOM_KEY_LOCATION_NUMPAD) {
     return false;
   }
 
   nsCOMPtr<nsIDocument> doc = GetDocument();
 
   return doc && !nsContentUtils::IsChromeDoc(doc);
 }
 
--- a/dom/interfaces/events/nsIDOMKeyEvent.idl
+++ b/dom/interfaces/events/nsIDOMKeyEvent.idl
@@ -219,14 +219,9 @@ interface nsIDOMKeyEvent : nsIDOMUIEvent
   const unsigned long DOM_VK_EREOF          = 0xF9;
   const unsigned long DOM_VK_PLAY           = 0xFA;
   const unsigned long DOM_VK_ZOOM           = 0xFB;
   const unsigned long DOM_VK_PA1            = 0xFD;
 
   // OEM specific virtual keyCode of Windows should pass through DOM keyCode
   // for compatibility with the other web browsers on Windows.
   const unsigned long DOM_VK_WIN_OEM_CLEAR  = 0xFE;
-
-  const unsigned long DOM_KEY_LOCATION_STANDARD = 0x00;
-  const unsigned long DOM_KEY_LOCATION_LEFT     = 0x01;
-  const unsigned long DOM_KEY_LOCATION_RIGHT    = 0x02;
-  const unsigned long DOM_KEY_LOCATION_NUMPAD   = 0x03;
 };
--- a/toolkit/components/resistfingerprinting/nsRFPService.cpp
+++ b/toolkit/components/resistfingerprinting/nsRFPService.cpp
@@ -9,16 +9,17 @@
 #include <time.h>
 
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/Logging.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Services.h"
 #include "mozilla/StaticPtr.h"
 #include "mozilla/TextEvents.h"
+#include "mozilla/dom/KeyboardEventBinding.h"
 
 #include "nsCOMPtr.h"
 #include "nsCoord.h"
 #include "nsServiceManagerUtils.h"
 #include "nsString.h"
 #include "nsXULAppAPI.h"
 #include "nsPrintfCString.h"
 
@@ -615,17 +616,18 @@ nsRFPService::GetSpoofedCode(const nsIDo
   if (!GetSpoofedKeyCodeInfo(aDoc, aKeyboardEvent, keyCodeInfo)) {
     return false;
   }
 
   WidgetKeyboardEvent::GetDOMCodeName(keyCodeInfo.mCode, aOut);
 
   // We need to change the 'Left' with 'Right' if the location indicates
   // it's a right key.
-  if (aKeyboardEvent->mLocation == nsIDOMKeyEvent::DOM_KEY_LOCATION_RIGHT &&
+  if (aKeyboardEvent->mLocation ==
+        dom::KeyboardEventBinding::DOM_KEY_LOCATION_RIGHT &&
       StringEndsWith(aOut, NS_LITERAL_STRING("Left"))) {
     aOut.ReplaceLiteral(aOut.Length() - 4, 4, u"Right");
   }
 
   return true;
 }
 
 /* static */
--- a/widget/TextEvents.h
+++ b/widget/TextEvents.h
@@ -10,18 +10,18 @@
 
 #include "mozilla/Assertions.h"
 #include "mozilla/BasicEvents.h"
 #include "mozilla/CheckedInt.h"
 #include "mozilla/EventForwards.h" // for KeyNameIndex, temporarily
 #include "mozilla/FontRange.h"
 #include "mozilla/TextRange.h"
 #include "mozilla/WritingModes.h"
+#include "mozilla/dom/KeyboardEventBinding.h"
 #include "nsCOMPtr.h"
-#include "nsIDOMKeyEvent.h"
 #include "nsISelectionController.h"
 #include "nsISelectionListener.h"
 #include "nsITransferable.h"
 #include "nsRect.h"
 #include "nsString.h"
 #include "nsTArray.h"
 
 class nsStringHashKey;
@@ -38,20 +38,20 @@ enum
 #undef NS_DEFINE_VK
   NS_VK_UNKNOWN = 0xFF
 };
 
 namespace mozilla {
 
 enum : uint32_t
 {
-  eKeyLocationStandard = nsIDOMKeyEvent::DOM_KEY_LOCATION_STANDARD,
-  eKeyLocationLeft     = nsIDOMKeyEvent::DOM_KEY_LOCATION_LEFT,
-  eKeyLocationRight    = nsIDOMKeyEvent::DOM_KEY_LOCATION_RIGHT,
-  eKeyLocationNumpad   = nsIDOMKeyEvent::DOM_KEY_LOCATION_NUMPAD
+  eKeyLocationStandard = dom::KeyboardEventBinding::DOM_KEY_LOCATION_STANDARD,
+  eKeyLocationLeft     = dom::KeyboardEventBinding::DOM_KEY_LOCATION_LEFT,
+  eKeyLocationRight    = dom::KeyboardEventBinding::DOM_KEY_LOCATION_RIGHT,
+  eKeyLocationNumpad   = dom::KeyboardEventBinding::DOM_KEY_LOCATION_NUMPAD
 };
 
 const nsCString GetDOMKeyCodeName(uint32_t aKeyCode);
 
 namespace dom {
   class PBrowserParent;
   class PBrowserChild;
 } // namespace dom