Bug 966398 - Kill nsIBidiKeyboard::SetLangFromBidiLevel. r=roc
authorBlake Kaplan <mrbkap@gmail.com>
Fri, 31 Jan 2014 15:02:44 -0800
changeset 182495 4cae03e1c434bd2e8b97deb1d8965a58fb05a203
parent 182494 5cf89fb575c4eb060d90d799502082706aae745d
child 182496 0cbd147b1854a3fa5b0ca743548cec38d00ad6b3
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs966398
milestone29.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 966398 - Kill nsIBidiKeyboard::SetLangFromBidiLevel. r=roc
layout/generic/nsSelection.cpp
widget/cocoa/nsBidiKeyboard.mm
widget/gtk/nsBidiKeyboard.cpp
widget/nsIBidiKeyboard.idl
widget/os2/nsBidiKeyboard.cpp
widget/qt/nsBidiKeyboard.cpp
widget/windows/nsBidiKeyboard.cpp
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -598,22 +598,17 @@ nsFrameSelection::ConstrainFrameAndPoint
 }
 
 #ifdef IBMBIDI
 void
 nsFrameSelection::SetCaretBidiLevel(uint8_t aLevel)
 {
   // If the current level is undefined, we have just inserted new text.
   // In this case, we don't want to reset the keyboard language
-  bool afterInsert = !!(mCaretBidiLevel & BIDI_LEVEL_UNDEFINED);
   mCaretBidiLevel = aLevel;
-  
-  nsIBidiKeyboard* bidiKeyboard = nsContentUtils::GetBidiKeyboard();
-  if (bidiKeyboard && !afterInsert)
-    bidiKeyboard->SetLangFromBidiLevel(aLevel);
   return;
 }
 
 uint8_t
 nsFrameSelection::GetCaretBidiLevel() const
 {
   return mCaretBidiLevel;
 }
--- a/widget/cocoa/nsBidiKeyboard.mm
+++ b/widget/cocoa/nsBidiKeyboard.mm
@@ -30,19 +30,13 @@ NS_IMETHODIMP nsBidiKeyboard::Reset()
 }
 
 NS_IMETHODIMP nsBidiKeyboard::IsLangRTL(bool *aIsRTL)
 {
   *aIsRTL = TISInputSourceWrapper::CurrentInputSource().IsForRTLLanguage();
   return NS_OK;
 }
 
-NS_IMETHODIMP nsBidiKeyboard::SetLangFromBidiLevel(uint8_t aLevel)
-{
-  // XXX Insert platform specific code to set keyboard language
-  return NS_OK;
-}
-
 NS_IMETHODIMP nsBidiKeyboard::GetHaveBidiKeyboards(bool* aResult)
 {
   // not implemented yet
   return NS_ERROR_NOT_IMPLEMENTED;
 }
--- a/widget/gtk/nsBidiKeyboard.cpp
+++ b/widget/gtk/nsBidiKeyboard.cpp
@@ -59,20 +59,13 @@ nsBidiKeyboard::IsLangRTL(bool *aIsRTL)
     if (!mHaveBidiKeyboards)
         return NS_ERROR_FAILURE;
 
     *aIsRTL = (gdk_keymap_get_direction(gdk_keymap_get_default()) == PANGO_DIRECTION_RTL);
 
     return NS_OK;
 }
 
-NS_IMETHODIMP
-nsBidiKeyboard::SetLangFromBidiLevel(uint8_t aLevel)
-{
-    // XXX Insert platform specific code to set keyboard language
-    return NS_ERROR_NOT_IMPLEMENTED;
-}
-
 NS_IMETHODIMP nsBidiKeyboard::GetHaveBidiKeyboards(bool* aResult)
 {
   // not implemented yet
   return NS_ERROR_NOT_IMPLEMENTED;
 }
--- a/widget/nsIBidiKeyboard.idl
+++ b/widget/nsIBidiKeyboard.idl
@@ -1,38 +1,31 @@
 /* -*- 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 "nsISupports.idl"
 
-[scriptable, uuid(44d9ef13-83be-4ab9-a2a1-95d9cbd96acd)]
+[scriptable, uuid(0d53579c-8f40-4bcf-9b87-61979c09f924)]
 interface nsIBidiKeyboard : nsISupports
 {
   /**
    * Inspects the installed keyboards and resets the bidi keyboard state
    */
   void reset();
 
   /**
    * Determines if the current keyboard language is right-to-left
    * @throws NS_ERROR_FAILURE if no right-to-left keyboards are installed
    */
   boolean isLangRTL();
 
   /**
-   * Sets the keyboard language to left-to-right or right-to-left
-   * @param aLevel - if odd set the keyboard to RTL, if even set LTR 
-   * @throws NS_ERROR_FAILURE if no right-to-left keyboards are installed
-   */
-  void setLangFromBidiLevel(in uint8_t aLevel);
-
-  /**
    * Determines whether the system has at least one keyboard of each direction
    * installed.
    *
    * @throws NS_ERROR_NOT_IMPLEMENTED if the widget layer does not provide this
    * information.
    */
   readonly attribute boolean haveBidiKeyboards;
 };
--- a/widget/os2/nsBidiKeyboard.cpp
+++ b/widget/os2/nsBidiKeyboard.cpp
@@ -24,19 +24,13 @@ NS_IMETHODIMP nsBidiKeyboard::Reset()
 
 NS_IMETHODIMP nsBidiKeyboard::IsLangRTL(bool *aIsRTL)
 {
   *aIsRTL = false;
   // XXX Insert platform specific code to determine keyboard direction
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
-NS_IMETHODIMP nsBidiKeyboard::SetLangFromBidiLevel(uint8_t aLevel)
-{
-  // XXX Insert platform specific code to set keyboard language
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
 NS_IMETHODIMP nsBidiKeyboard::GetHaveBidiKeyboards(bool* aResult)
 {
   // not implemented yet
   return NS_ERROR_NOT_IMPLEMENTED;
 }
--- a/widget/qt/nsBidiKeyboard.cpp
+++ b/widget/qt/nsBidiKeyboard.cpp
@@ -39,18 +39,13 @@ NS_IMETHODIMP nsBidiKeyboard::IsLangRTL(
 
     if (layoutDir == Qt::RightToLeft) {
         *aIsRTL = true;
     }
     
     return NS_OK;
 }
 
-NS_IMETHODIMP nsBidiKeyboard::SetLangFromBidiLevel(uint8_t aLevel)
-{
-    return NS_OK;
-}
-
 NS_IMETHODIMP nsBidiKeyboard::GetHaveBidiKeyboards(bool* aResult)
 {
   // not implemented yet
   return NS_ERROR_NOT_IMPLEMENTED;
 }
--- a/widget/windows/nsBidiKeyboard.cpp
+++ b/widget/windows/nsBidiKeyboard.cpp
@@ -25,43 +25,16 @@ NS_IMETHODIMP nsBidiKeyboard::Reset()
   mInitialized = false;
   mHaveBidiKeyboards = false;
   mLTRKeyboard[0] = '\0';
   mRTLKeyboard[0] = '\0';
   mCurrentLocaleName[0] = '\0';
   return NS_OK;
 }
 
-NS_IMETHODIMP nsBidiKeyboard::SetLangFromBidiLevel(uint8_t aLevel)
-{
-  nsresult result = SetupBidiKeyboards();
-  if (NS_FAILED(result))
-    return result;
-
-  // call LoadKeyboardLayout() only if the target keyboard layout is different from the current
-  wchar_t currentLocaleName[KL_NAMELENGTH];
-  wcsncpy(currentLocaleName, char16ptr_t((aLevel & 1) ? mRTLKeyboard : mLTRKeyboard), KL_NAMELENGTH);
-  currentLocaleName[KL_NAMELENGTH-1] = '\0'; // null terminate
-
-  NS_ASSERTION(*currentLocaleName, 
-    "currentLocaleName has string length == 0");
-
-#if 0
-  /* This implementation of automatic keyboard layout switching is too buggy to be useful
-     and the feature itself is inconsistent with Windows. See Bug 162242 */
-  if (strcmp(mCurrentLocaleName, currentLocaleName)) {
-    if (!::LoadKeyboardLayout(currentLocaleName, KLF_ACTIVATE | KLF_SUBSTITUTE_OK)) {
-      return NS_ERROR_FAILURE;
-    }
-  }
-#endif
-
-  return NS_OK;
-}
-
 NS_IMETHODIMP nsBidiKeyboard::IsLangRTL(bool *aIsRTL)
 {
   *aIsRTL = false;
 
   nsresult result = SetupBidiKeyboards();
   if (NS_FAILED(result))
     return result;