Bug 769190 part.2 Rename nsInputEvent::IsWin() and widget::MODIFIER_(SCROLL|WIN) to nsInputEvent::IsOS() and widget::MODIFIER_(SCROLLLOCK|OS) r=smaug
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 06 Jul 2012 09:42:05 +0900
changeset 98464 c41bf7b9364cf0a8bafb1256e359b0acc34a1058
parent 98463 013bdf4143572afc93b59fab57feb810d0a448ba
child 98465 10483a67fe11c3f44b8684bab09f384edbdc6fbc
push id11493
push usermasayuki@d-toybox.com
push dateFri, 06 Jul 2012 00:42:31 +0000
treeherdermozilla-inbound@c41bf7b9364c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs769190
milestone16.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 769190 part.2 Rename nsInputEvent::IsWin() and widget::MODIFIER_(SCROLL|WIN) to nsInputEvent::IsOS() and widget::MODIFIER_(SCROLLLOCK|OS) r=smaug
content/events/src/nsDOMUIEvent.cpp
dom/base/nsDOMWindowUtils.cpp
widget/gtk2/nsGtkKeyUtils.cpp
widget/nsEvent.h
widget/nsGUIEvent.h
widget/windows/KeyboardLayout.cpp
widget/windows/KeyboardLayout.h
--- a/content/events/src/nsDOMUIEvent.cpp
+++ b/content/events/src/nsDOMUIEvent.cpp
@@ -419,20 +419,20 @@ struct nsModifierPair
 static const nsModifierPair kPairs[] = {
   { widget::MODIFIER_ALT,        NS_DOM_KEYNAME_ALT },
   { widget::MODIFIER_ALTGRAPH,   NS_DOM_KEYNAME_ALTGRAPH },
   { widget::MODIFIER_CAPSLOCK,   NS_DOM_KEYNAME_CAPSLOCK },
   { widget::MODIFIER_CONTROL,    NS_DOM_KEYNAME_CONTROL },
   { widget::MODIFIER_FN,         NS_DOM_KEYNAME_FN },
   { widget::MODIFIER_META,       NS_DOM_KEYNAME_META },
   { widget::MODIFIER_NUMLOCK,    NS_DOM_KEYNAME_NUMLOCK },
-  { widget::MODIFIER_SCROLL,     NS_DOM_KEYNAME_SCROLL },
+  { widget::MODIFIER_SCROLLLOCK, NS_DOM_KEYNAME_SCROLLLOCK },
   { widget::MODIFIER_SHIFT,      NS_DOM_KEYNAME_SHIFT },
   { widget::MODIFIER_SYMBOLLOCK, NS_DOM_KEYNAME_SYMBOLLOCK },
-  { widget::MODIFIER_WIN,        NS_DOM_KEYNAME_WIN }
+  { widget::MODIFIER_OS,         NS_DOM_KEYNAME_OS }
 };
 
 /* static */
 mozilla::widget::Modifiers
 nsDOMUIEvent::ComputeModifierState(const nsAString& aModifiersList)
 {
   if (aModifiersList.IsEmpty()) {
     return 0;
@@ -479,31 +479,31 @@ nsDOMUIEvent::GetModifierStateInternal(c
   }
   if (aKey.EqualsLiteral(NS_DOM_KEYNAME_ALT)) {
     return inputEvent->IsAlt();
   }
 
   if (aKey.EqualsLiteral(NS_DOM_KEYNAME_ALTGRAPH)) {
     return inputEvent->IsAltGraph();
   }
-  if (aKey.EqualsLiteral(NS_DOM_KEYNAME_WIN)) {
-    return inputEvent->IsWin();
+  if (aKey.EqualsLiteral(NS_DOM_KEYNAME_OS)) {
+    return inputEvent->IsOS();
   }
 
   if (aKey.EqualsLiteral(NS_DOM_KEYNAME_CAPSLOCK)) {
     return inputEvent->IsCapsLocked();
   }
   if (aKey.EqualsLiteral(NS_DOM_KEYNAME_NUMLOCK)) {
     return inputEvent->IsNumLocked();
   }
 
   if (aKey.EqualsLiteral(NS_DOM_KEYNAME_FN)) {
     return inputEvent->IsFn();
   }
-  if (aKey.EqualsLiteral(NS_DOM_KEYNAME_SCROLL)) {
+  if (aKey.EqualsLiteral(NS_DOM_KEYNAME_SCROLLLOCK)) {
     return inputEvent->IsScrollLocked();
   }
   if (aKey.EqualsLiteral(NS_DOM_KEYNAME_SYMBOLLOCK)) {
     return inputEvent->IsSymbolLocked();
   }
   return false;
 }
 
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -455,23 +455,23 @@ nsDOMWindowUtils::GetWidgetModifiers(PRI
   }
   if (aModifiers & nsIDOMWindowUtils::MODIFIER_FN) {
     result |= widget::MODIFIER_FN;
   }
   if (aModifiers & nsIDOMWindowUtils::MODIFIER_NUMLOCK) {
     result |= widget::MODIFIER_NUMLOCK;
   }
   if (aModifiers & nsIDOMWindowUtils::MODIFIER_SCROLLLOCK) {
-    result |= widget::MODIFIER_SCROLL;
+    result |= widget::MODIFIER_SCROLLLOCK;
   }
   if (aModifiers & nsIDOMWindowUtils::MODIFIER_SYMBOLLOCK) {
     result |= widget::MODIFIER_SYMBOLLOCK;
   }
   if (aModifiers & nsIDOMWindowUtils::MODIFIER_OS) {
-    result |= widget::MODIFIER_WIN;
+    result |= widget::MODIFIER_OS;
   }
   return result;
 }
 
 NS_IMETHODIMP
 nsDOMWindowUtils::SendMouseEvent(const nsAString& aType,
                                  float aX,
                                  float aY,
--- a/widget/gtk2/nsGtkKeyUtils.cpp
+++ b/widget/gtk2/nsGtkKeyUtils.cpp
@@ -531,44 +531,44 @@ KeymapWrapper::InitInputEvent(nsInputEve
     if (keymapWrapper->AreModifiersActive(CTRL, aModifierState)) {
         aInputEvent.modifiers |= MODIFIER_CONTROL;
     }
     if (keymapWrapper->AreModifiersActive(ALT, aModifierState)) {
         aInputEvent.modifiers |= MODIFIER_ALT;
     }
     if (keymapWrapper->AreModifiersActive(SUPER, aModifierState) ||
         keymapWrapper->AreModifiersActive(HYPER, aModifierState)) {
-        aInputEvent.modifiers |= MODIFIER_WIN;
+        aInputEvent.modifiers |= MODIFIER_OS;
     }
     if (keymapWrapper->AreModifiersActive(ALTGR, aModifierState)) {
         aInputEvent.modifiers |= MODIFIER_ALTGRAPH;
     }
     if (keymapWrapper->AreModifiersActive(CAPS_LOCK, aModifierState)) {
         aInputEvent.modifiers |= MODIFIER_CAPSLOCK;
     }
     if (keymapWrapper->AreModifiersActive(NUM_LOCK, aModifierState)) {
         aInputEvent.modifiers |= MODIFIER_NUMLOCK;
     }
     if (keymapWrapper->AreModifiersActive(SCROLL_LOCK, aModifierState)) {
-        aInputEvent.modifiers |= MODIFIER_SCROLL;
+        aInputEvent.modifiers |= MODIFIER_SCROLLLOCK;
     }
 
     PR_LOG(gKeymapWrapperLog, PR_LOG_DEBUG,
         ("KeymapWrapper(%p): InitInputEvent, aModifierState=0x%08X, "
          "aInputEvent.modifiers=0x%04X (Shift: %s, Control: %s, Alt: %s, "
-         "Win: %s, AltGr: %s, CapsLock: %s, NumLock: %s, ScrollLock: %s)",
+         "OS: %s, AltGr: %s, CapsLock: %s, NumLock: %s, ScrollLock: %s)",
          keymapWrapper, aModifierState, aInputEvent.modifiers,
          GetBoolName(aInputEvent.modifiers & MODIFIER_SHIFT),
          GetBoolName(aInputEvent.modifiers & MODIFIER_CONTROL),
          GetBoolName(aInputEvent.modifiers & MODIFIER_ALT),
-         GetBoolName(aInputEvent.modifiers & MODIFIER_WIN),
+         GetBoolName(aInputEvent.modifiers & MODIFIER_OS),
          GetBoolName(aInputEvent.modifiers & MODIFIER_ALTGRAPH),
          GetBoolName(aInputEvent.modifiers & MODIFIER_CAPSLOCK),
          GetBoolName(aInputEvent.modifiers & MODIFIER_NUMLOCK),
-         GetBoolName(aInputEvent.modifiers & MODIFIER_SCROLL)));
+         GetBoolName(aInputEvent.modifiers & MODIFIER_SCROLLLOCK)));
 
     switch(aInputEvent.eventStructType) {
         case NS_MOUSE_EVENT:
         case NS_MOUSE_SCROLL_EVENT:
         case NS_DRAG_EVENT:
         case NS_SIMPLE_GESTURE_EVENT:
         case NS_MOZTOUCH_EVENT:
             break;
--- a/widget/nsEvent.h
+++ b/widget/nsEvent.h
@@ -90,32 +90,32 @@ namespace widget {
 enum Modifier {
   MODIFIER_ALT        = 0x0001,
   MODIFIER_ALTGRAPH   = 0x0002,
   MODIFIER_CAPSLOCK   = 0x0004,
   MODIFIER_CONTROL    = 0x0008,
   MODIFIER_FN         = 0x0010,
   MODIFIER_META       = 0x0020,
   MODIFIER_NUMLOCK    = 0x0040,
-  MODIFIER_SCROLL     = 0x0080,
+  MODIFIER_SCROLLLOCK = 0x0080,
   MODIFIER_SHIFT      = 0x0100,
   MODIFIER_SYMBOLLOCK = 0x0200,
-  MODIFIER_WIN        = 0x0400
+  MODIFIER_OS         = 0x0400
 };
 
 typedef PRUint16 Modifiers;
 
 } // namespace widget
 } // namespace mozilla
 
 #define NS_DOM_KEYNAME_ALT        "Alt"
 #define NS_DOM_KEYNAME_ALTGRAPH   "AltGraph"
 #define NS_DOM_KEYNAME_CAPSLOCK   "CapsLock"
 #define NS_DOM_KEYNAME_CONTROL    "Control"
 #define NS_DOM_KEYNAME_FN         "Fn"
 #define NS_DOM_KEYNAME_META       "Meta"
 #define NS_DOM_KEYNAME_NUMLOCK    "NumLock"
-#define NS_DOM_KEYNAME_SCROLL     "ScrollLock"
+#define NS_DOM_KEYNAME_SCROLLLOCK "ScrollLock"
 #define NS_DOM_KEYNAME_SHIFT      "Shift"
 #define NS_DOM_KEYNAME_SYMBOLLOCK "SymbolLock"
-#define NS_DOM_KEYNAME_WIN        "OS"
+#define NS_DOM_KEYNAME_OS         "OS"
 
 #endif // nsEvent_h__
--- a/widget/nsGUIEvent.h
+++ b/widget/nsGUIEvent.h
@@ -830,20 +830,21 @@ public:
   {
     return ((modifiers & mozilla::widget::MODIFIER_ALT) != 0);
   }
   // true indicates the meta key is down (or, on Mac, the Command key)
   bool IsMeta() const
   {
     return ((modifiers & mozilla::widget::MODIFIER_META) != 0);
   }
-  // true indicates the win key is down (or, on Linux, the Super or Hyper key)
-  bool IsWin() const
+  // true indicates the win key is down on Windows. Or the Super or Hyper key
+  // is down on Linux.
+  bool IsOS() const
   {
-    return ((modifiers & mozilla::widget::MODIFIER_WIN) != 0);
+    return ((modifiers & mozilla::widget::MODIFIER_OS) != 0);
   }
   // true indicates the alt graph key is down
   // NOTE: on Mac, the option key press causes both IsAlt() and IsAltGrpah()
   //       return true.
   bool IsAltGraph() const
   {
     return ((modifiers & mozilla::widget::MODIFIER_ALTGRAPH) != 0);
   }
@@ -855,17 +856,17 @@ public:
   // true indeicates the NumLock LED is turn on.
   bool IsNumLocked() const
   {
     return ((modifiers & mozilla::widget::MODIFIER_NUMLOCK) != 0);
   }
   // true indeicates the ScrollLock LED is turn on.
   bool IsScrollLocked() const
   {
-    return ((modifiers & mozilla::widget::MODIFIER_SCROLL) != 0);
+    return ((modifiers & mozilla::widget::MODIFIER_SCROLLLOCK) != 0);
   }
 
   // true indeicates the Fn key is down, but this is not supported by native
   // key event on any platform.
   bool IsFn() const
   {
     return ((modifiers & mozilla::widget::MODIFIER_FN) != 0);
   }
--- a/widget/windows/KeyboardLayout.cpp
+++ b/widget/windows/KeyboardLayout.cpp
@@ -87,26 +87,26 @@ ModifierKeyState::Update()
   }
   if (IS_VK_DOWN(VK_CONTROL)) {
     mModifiers |= MODIFIER_CONTROL;
   }
   if (IS_VK_DOWN(VK_MENU)) {
     mModifiers |= MODIFIER_ALT;
   }
   if (IS_VK_DOWN(VK_LWIN) || IS_VK_DOWN(VK_RWIN)) {
-    mModifiers |= MODIFIER_WIN;
+    mModifiers |= MODIFIER_OS;
   }
   if (::GetKeyState(VK_CAPITAL) & 1) {
     mModifiers |= MODIFIER_CAPSLOCK;
   }
   if (::GetKeyState(VK_NUMLOCK) & 1) {
     mModifiers |= MODIFIER_NUMLOCK;
   }
   if (::GetKeyState(VK_SCROLL) & 1) {
-    mModifiers |= MODIFIER_SCROLL;
+    mModifiers |= MODIFIER_SCROLLLOCK;
   }
 
   EnsureAltGr();
 }
 
 void
 ModifierKeyState::InitInputEvent(nsInputEvent& aInputEvent) const
 {
--- a/widget/windows/KeyboardLayout.h
+++ b/widget/windows/KeyboardLayout.h
@@ -85,21 +85,24 @@ public:
   }
 
   void InitInputEvent(nsInputEvent& aInputEvent) const;
 
   bool IsShift() const { return (mModifiers & MODIFIER_SHIFT) != 0; }
   bool IsControl() const { return (mModifiers & MODIFIER_CONTROL) != 0; }
   bool IsAlt() const { return (mModifiers & MODIFIER_ALT) != 0; }
   bool IsAltGr() const { return IsControl() && IsAlt(); }
-  bool IsWin() const { return (mModifiers & MODIFIER_WIN) != 0; }
+  bool IsWin() const { return (mModifiers & MODIFIER_OS) != 0; }
 
   bool IsCapsLocked() const { return (mModifiers & MODIFIER_CAPSLOCK) != 0; }
   bool IsNumLocked() const { return (mModifiers & MODIFIER_NUMLOCK) != 0; }
-  bool IsScrollLocked() const { return (mModifiers & MODIFIER_SCROLL) != 0; }
+  bool IsScrollLocked() const
+  {
+    return (mModifiers & MODIFIER_SCROLLLOCK) != 0;
+  }
 
   Modifiers GetModifiers() const { return mModifiers; }
 
 private:
   Modifiers mModifiers;
 
   void EnsureAltGr()
   {