Bug 1259679 - Space key shouldn't work as a space key if it's assigned to a function key. r=masayuki
authorArata Furukawa <old.river.new@gmail.com>
Sat, 26 Mar 2016 14:06:16 +0900
changeset 290563 cdf61a196be88c8e852ec1c4ed0d9b9794e68d2c
parent 290562 d9ab9ff08b5ed22ba63c3b94683af8cb46df56a3
child 290564 82d365a9a1b49f841b843ef6c5b51ed94f929ad1
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1259679
milestone48.0a1
Bug 1259679 - Space key shouldn't work as a space key if it's assigned to a function key. r=masayuki Even if space key is pressed but it's assigned to a non-printable key, it shouldn't work as a space key because some users may assign Enter key or something to the space key. MozReview-Commit-ID: 4av1n9GPfSf
widget/WidgetEventImpl.cpp
--- a/widget/WidgetEventImpl.cpp
+++ b/widget/WidgetEventImpl.cpp
@@ -558,18 +558,20 @@ WidgetKeyboardEvent::GetShortcutKeyCandi
       ShortcutKeyCandidate key(ch, true);
       aCandidates.AppendElement(key);
     }
   }
 
   // Special case for "Space" key.  With some keyboard layouts, "Space" with
   // or without Shift key causes non-ASCII space.  For such keyboard layouts,
   // we should guarantee that the key press works as an ASCII white space key
-  // press.
-  if (mCodeNameIndex == CODE_NAME_INDEX_Space &&
+  // press.  However, if the space key is assigned to a function key, it
+  // shouldn't work as a space key.
+  if (mKeyNameIndex == KEY_NAME_INDEX_USE_STRING &&
+      mCodeNameIndex == CODE_NAME_INDEX_Space &&
       pseudoCharCode != static_cast<uint32_t>(' ')) {
     ShortcutKeyCandidate spaceKey(static_cast<uint32_t>(' '), false);
     aCandidates.AppendElement(spaceKey);
   }
 }
 
 void
 WidgetKeyboardEvent::GetAccessKeyCandidates(nsTArray<uint32_t>& aCandidates)
@@ -602,18 +604,20 @@ WidgetKeyboardEvent::GetAccessKeyCandida
       if (aCandidates.IndexOf(ch[j]) == aCandidates.NoIndex) {
         aCandidates.AppendElement(ch[j]);
       }
     }
   }
   // Special case for "Space" key.  With some keyboard layouts, "Space" with
   // or without Shift key causes non-ASCII space.  For such keyboard layouts,
   // we should guarantee that the key press works as an ASCII white space key
-  // press.
-  if (mCodeNameIndex == CODE_NAME_INDEX_Space &&
+  // press.  However, if the space key is assigned to a function key, it
+  // shouldn't work as a space key.
+  if (mKeyNameIndex == KEY_NAME_INDEX_USE_STRING &&
+      mCodeNameIndex == CODE_NAME_INDEX_Space &&
       charCode != static_cast<uint32_t>(' ')) {
     aCandidates.AppendElement(static_cast<uint32_t>(' '));
   }
   return;
 }
 
 /* static */ void
 WidgetKeyboardEvent::Shutdown()