Bug 1347073 Get rid of UIEvent.isChar since it's not initialized properly on most platforms and the other browsers don't support this r?smaug draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Tue, 14 Mar 2017 18:29:39 +0900
changeset 500351 109f59230301fb1ff2715214cad5bb71be16003c
parent 500345 c7276cb639bed2fb2580cfdbb469a4754320b001
child 500659 2211cc4299974677d821417e0e88c3a76b1c15a6
push id49700
push usermasayuki@d-toybox.com
push dateFri, 17 Mar 2017 03:43:59 +0000
reviewerssmaug
bugs1347073
milestone55.0a1
Bug 1347073 Get rid of UIEvent.isChar since it's not initialized properly on most platforms and the other browsers don't support this r?smaug UIEvent.isChar is not supported by the other browsers and the value isn't initialized any platforms except on macOS. So, the value isn't useful and we have no reason to keep it. MozReview-Commit-ID: 4BLpo88gSZj
dom/canvas/test/webgl-conf/checkout/deqp/temp_externs/gecko_event.js
dom/events/UIEvent.cpp
dom/events/UIEvent.h
dom/interfaces/events/nsIDOMUIEvent.idl
dom/webidl/UIEvent.webidl
widget/TextEvents.h
widget/cocoa/TextInputHandler.mm
widget/gonk/nsAppShell.cpp
widget/nsGUIEventIPC.h
--- a/dom/canvas/test/webgl-conf/checkout/deqp/temp_externs/gecko_event.js
+++ b/dom/canvas/test/webgl-conf/checkout/deqp/temp_externs/gecko_event.js
@@ -30,17 +30,16 @@
 /** @type {number} */ Event.prototype.axis;
 /** @type {number} */ Event.prototype.button;
 /** @type {boolean} */ Event.prototype.cancelBubble;
 /** @type {number} */ Event.prototype.charCode;
 /** @type {number} */ Event.prototype.clientX;
 /** @type {number} */ Event.prototype.clientY;
 /** @type {boolean} */ Event.prototype.ctrlKey;
 /** @type {EventTarget} */ Event.prototype.explicitOriginalTarget;
-/** @type {boolean} */ Event.prototype.isChar;
 /** @type {number} */ Event.prototype.keyCode;
 /** @type {number} */ Event.prototype.layerX;
 /** @type {number} */ Event.prototype.layerY;
 /** @type {boolean} */ Event.prototype.metaKey;
 /** @type {EventTarget} */ Event.prototype.originalTarget;
 /** @type {number} */ Event.prototype.pageX;
 /** @type {number} */ Event.prototype.pageY;
 /** @type {EventTarget} */ Event.prototype.relatedTarget;
--- a/dom/events/UIEvent.cpp
+++ b/dom/events/UIEvent.cpp
@@ -324,30 +324,16 @@ UIEvent::GetLayerX(int32_t* aLayerX)
 NS_IMETHODIMP
 UIEvent::GetLayerY(int32_t* aLayerY)
 {
   NS_ENSURE_ARG_POINTER(aLayerY);
   *aLayerY = GetLayerPoint().y;
   return NS_OK;
 }
 
-NS_IMETHODIMP
-UIEvent::GetIsChar(bool* aIsChar)
-{
-  *aIsChar = IsChar();
-  return NS_OK;
-}
-
-bool
-UIEvent::IsChar() const
-{
-  WidgetKeyboardEvent* keyEvent = mEvent->AsKeyboardEvent();
-  return keyEvent ? keyEvent->mIsChar : false;
-}
-
 mozilla::dom::Event*
 UIEvent::AsEvent(void)
 {
   return this;
 }
 
 NS_IMETHODIMP
 UIEvent::DuplicatePrivateData()
--- a/dom/events/UIEvent.h
+++ b/dom/events/UIEvent.h
@@ -88,18 +88,16 @@ public:
                "Mouse events should override Which()");
     return 0;
   }
 
   already_AddRefed<nsINode> GetRangeParent();
 
   int32_t RangeOffset() const;
 
-  bool IsChar() const;
-
 protected:
   ~UIEvent() {}
 
   // Internal helper functions
   nsIntPoint GetMovementPoint();
   nsIntPoint GetLayerPoint() const;
 
   nsCOMPtr<nsPIDOMWindowOuter> mView;
--- a/dom/interfaces/events/nsIDOMUIEvent.idl
+++ b/dom/interfaces/events/nsIDOMUIEvent.idl
@@ -44,12 +44,10 @@ interface nsIDOMUIEvent : nsISupports
   readonly attribute long               layerX;
   readonly attribute long               layerY;
   readonly attribute long               pageX;
   readonly attribute long               pageY;
   readonly attribute unsigned long      which;
   readonly attribute nsIDOMNode         rangeParent;
   readonly attribute long               rangeOffset;
 
-  readonly attribute boolean            isChar;
-
   [notxpcom, nostdcall] EventPtr AsEvent();
 };
--- a/dom/webidl/UIEvent.webidl
+++ b/dom/webidl/UIEvent.webidl
@@ -29,17 +29,16 @@ partial interface UIEvent {
 
   readonly attribute long          layerX;
   readonly attribute long          layerY;
   readonly attribute long          pageX;
   readonly attribute long          pageY;
   readonly attribute unsigned long which;
   readonly attribute Node?         rangeParent;
   readonly attribute long          rangeOffset;
-  readonly attribute boolean       isChar;
 };
 
 dictionary UIEventInit : EventInit
 {
   Window? view = null;
   long    detail = 0;
 };
 
--- a/widget/TextEvents.h
+++ b/widget/TextEvents.h
@@ -121,17 +121,16 @@ protected:
     , mUniqueId(0)
 #ifdef XP_MACOSX
     , mNativeModifierFlags(0)
     , mNativeKeyCode(0)
 #endif // #ifdef XP_MACOSX
     , mKeyNameIndex(KEY_NAME_INDEX_Unidentified)
     , mCodeNameIndex(CODE_NAME_INDEX_UNKNOWN)
     , mInputMethodAppState(eNotHandled)
-    , mIsChar(false)
     , mIsRepeat(false)
     , mIsComposing(false)
     , mIsReserved(false)
     , mIsSynthesizedByTIP(false)
   {
   }
 
 public:
@@ -150,17 +149,16 @@ public:
     , mUniqueId(0)
 #ifdef XP_MACOSX
     , mNativeModifierFlags(0)
     , mNativeKeyCode(0)
 #endif // #ifdef XP_MACOSX
     , mKeyNameIndex(KEY_NAME_INDEX_Unidentified)
     , mCodeNameIndex(CODE_NAME_INDEX_UNKNOWN)
     , mInputMethodAppState(eNotHandled)
-    , mIsChar(false)
     , mIsRepeat(false)
     , mIsComposing(false)
     , mIsReserved(false)
     , mIsSynthesizedByTIP(false)
   {
     // If this is a keyboard event on a plugin, it shouldn't fired on content.
     mFlags.mOnlySystemGroupDispatchInContent =
       mFlags.mNoCrossProcessBoundaryForwarding = IsKeyEventOnPlugin();
@@ -263,18 +261,16 @@ public:
   enum InputMethodAppState : InputMethodAppStateType
   {
     eNotHandled, // not yet handled by intput method app
     eHandling,   // being handled by intput method app
     eHandled     // handled by input method app
   };
   InputMethodAppState mInputMethodAppState;
 
-  // Indicates whether the event signifies a printable character
-  bool mIsChar;
   // Indicates whether the event is generated by auto repeat or not.
   // if this is keyup event, always false.
   bool mIsRepeat;
   // Indicates whether the event is generated during IME (or deadkey)
   // composition.  This is initialized by EventStateManager.  So, key event
   // dispatchers don't need to initialize this.
   bool mIsComposing;
   // Indicates if the key combination is reserved by chrome.  This is set by
@@ -387,17 +383,16 @@ public:
   {
     AssignInputEventData(aEvent, aCopyTargets);
 
     mKeyCode = aEvent.mKeyCode;
     mCharCode = aEvent.mCharCode;
     mPseudoCharCode = aEvent.mPseudoCharCode;
     mLocation = aEvent.mLocation;
     mAlternativeCharCodes = aEvent.mAlternativeCharCodes;
-    mIsChar = aEvent.mIsChar;
     mIsRepeat = aEvent.mIsRepeat;
     mIsComposing = aEvent.mIsComposing;
     mIsReserved = aEvent.mIsReserved;
     mAccessKeyForwardedToChild = aEvent.mAccessKeyForwardedToChild;
     mKeyNameIndex = aEvent.mKeyNameIndex;
     mCodeNameIndex = aEvent.mCodeNameIndex;
     mKeyValue = aEvent.mKeyValue;
     mCodeValue = aEvent.mCodeValue;
--- a/widget/cocoa/TextInputHandler.mm
+++ b/widget/cocoa/TextInputHandler.mm
@@ -937,17 +937,16 @@ TISInputSourceWrapper::InitKeyEvent(NSEv
     nsCocoaUtils::GetStringForNSString([aNativeKeyEvent charactersIgnoringModifiers], nativeCharsIgnoringModifiers);
     aKeyEvent.mNativeCharactersIgnoringModifiers.Assign(nativeCharsIgnoringModifiers);
   } else if ([aNativeKeyEvent type] == NSFlagsChanged) {
     aKeyEvent.mNativeKeyCode = [aNativeKeyEvent keyCode];
     aKeyEvent.mNativeModifierFlags = [aNativeKeyEvent modifierFlags];
   }
 
   aKeyEvent.mRefPoint = LayoutDeviceIntPoint(0, 0);
-  aKeyEvent.mIsChar = false; // XXX not used in XP level
 
   UInt32 kbType = GetKbdType();
   UInt32 nativeKeyCode = [aNativeKeyEvent keyCode];
 
   aKeyEvent.mKeyCode =
     ComputeGeckoKeyCode(nativeKeyCode, kbType, aKeyEvent.IsMeta());
 
   switch (nativeKeyCode) {
@@ -1121,18 +1120,16 @@ TISInputSourceWrapper::WillDispatchKeybo
 
   // The mCharCode was set from mKeyValue. However, for example, when Ctrl key
   // is pressed, its value should indicate an ASCII character for backward
   // compatibility rather than inputting character without the modifiers.
   // Therefore, we need to modify mCharCode value here.
   uint32_t charCode =
     insertStringForCharCode.IsEmpty() ? 0 : insertStringForCharCode[0];
   aKeyEvent.SetCharCode(charCode);
-  // this is not a special key  XXX not used in XP
-  aKeyEvent.mIsChar = (aKeyEvent.mMessage == eKeyPress);
 
   MOZ_LOG(gLog, LogLevel::Info,
     ("%p TISInputSourceWrapper::WillDispatchKeyboardEvent, "
      "aKeyEvent.mKeyCode=0x%X, aKeyEvent.mCharCode=0x%X",
      this, aKeyEvent.mKeyCode, aKeyEvent.mCharCode));
 
   TISInputSourceWrapper USLayout("com.apple.keylayout.US");
   bool isRomanKeyboardLayout = IsASCIICapable();
@@ -2312,17 +2309,16 @@ TextInputHandler::InsertText(NSAttribute
   }
 
   // Dispatch keypress event with char instead of compositionchange event
   WidgetKeyboardEvent keypressEvent(true, eKeyPress, widget);
   // XXX Why do we need to dispatch keypress event for not inputting any
   //     string?  If it wants to delete the specified range, should we
   //     dispatch an eContentCommandDelete event instead?  Because this
   //     must not be caused by a key operation, a part of IME's processing.
-  keypressEvent.mIsChar = IsPrintableChar(str.CharAt(0));
 
   // Don't set other modifiers from the current event, because here in
   // -insertText: they've already been taken into account in creating
   // the input string.
 
   if (currentKeyEvent) {
     currentKeyEvent->InitKeyEvent(this, keypressEvent);
   } else {
--- a/widget/gonk/nsAppShell.cpp
+++ b/widget/gonk/nsAppShell.cpp
@@ -297,17 +297,16 @@ KeyEventDispatcher::DispatchKeyEventInte
     if (aEventMessage == eKeyPress) {
         // XXX If the charCode is not a printable character, the charCode
         //     should be computed without Ctrl/Alt/Meta modifiers.
         event.mCharCode = static_cast<uint32_t>(mChar);
     }
     if (!event.mCharCode) {
         event.mKeyCode = mDOMKeyCode;
     }
-    event.mIsChar = !!event.mCharCode;
     event.mIsRepeat = IsRepeat();
     event.mKeyNameIndex = mDOMKeyNameIndex;
     if (mDOMPrintableKeyValue) {
         event.mKeyValue = mDOMPrintableKeyValue;
     }
     event.mCodeNameIndex = mDOMCodeNameIndex;
     event.mModifiers = getDOMModifiers(mData.metaState);
     event.mLocation = mDOMKeyLocation;
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -416,17 +416,16 @@ struct ParamTraits<mozilla::WidgetKeyboa
     WriteParam(aMsg,
                static_cast<mozilla::CodeNameIndexType>(aParam.mCodeNameIndex));
     WriteParam(aMsg, aParam.mKeyValue);
     WriteParam(aMsg, aParam.mCodeValue);
     WriteParam(aMsg, aParam.mKeyCode);
     WriteParam(aMsg, aParam.mCharCode);
     WriteParam(aMsg, aParam.mPseudoCharCode);
     WriteParam(aMsg, aParam.mAlternativeCharCodes);
-    WriteParam(aMsg, aParam.mIsChar);
     WriteParam(aMsg, aParam.mIsRepeat);
     WriteParam(aMsg, aParam.mIsReserved);
     WriteParam(aMsg, aParam.mAccessKeyForwardedToChild);
     WriteParam(aMsg, aParam.mLocation);
     WriteParam(aMsg, aParam.mUniqueId);
     WriteParam(aMsg, aParam.mIsSynthesizedByTIP);
     WriteParam(aMsg,
                static_cast<paramType::InputMethodAppStateType>
@@ -452,17 +451,16 @@ struct ParamTraits<mozilla::WidgetKeyboa
         ReadParam(aMsg, aIter, &keyNameIndex) &&
         ReadParam(aMsg, aIter, &codeNameIndex) &&
         ReadParam(aMsg, aIter, &aResult->mKeyValue) &&
         ReadParam(aMsg, aIter, &aResult->mCodeValue) &&
         ReadParam(aMsg, aIter, &aResult->mKeyCode) &&
         ReadParam(aMsg, aIter, &aResult->mCharCode) &&
         ReadParam(aMsg, aIter, &aResult->mPseudoCharCode) &&
         ReadParam(aMsg, aIter, &aResult->mAlternativeCharCodes) &&
-        ReadParam(aMsg, aIter, &aResult->mIsChar) &&
         ReadParam(aMsg, aIter, &aResult->mIsRepeat) &&
         ReadParam(aMsg, aIter, &aResult->mIsReserved) &&
         ReadParam(aMsg, aIter, &aResult->mAccessKeyForwardedToChild) &&
         ReadParam(aMsg, aIter, &aResult->mLocation) &&
         ReadParam(aMsg, aIter, &aResult->mUniqueId) &&
         ReadParam(aMsg, aIter, &aResult->mIsSynthesizedByTIP) &&
         ReadParam(aMsg, aIter, &inputMethodAppState)
 #ifdef XP_MACOSX