Bug 1186017 part.2 Rename GetBoolName() in IMContextWrapper.cpp to ToChar() r=kerlt
authorMasayuki Nakano <masayuki@d-toybox.com>
Mon, 27 Jul 2015 08:23:04 +0900
changeset 254622 58e46bf71dd1009a9b601cd784879d9eb2786b25
parent 254621 3e83a54b7fd2efeee87199c971775bbd0c3ec9ac
child 254623 9bccb566456beb1b1877f04ac94dd548ebb70531
push id29108
push userryanvm@gmail.com
push dateMon, 27 Jul 2015 14:12:01 +0000
treeherdermozilla-central@27ae736ef960 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskerlt
bugs1186017
milestone42.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 1186017 part.2 Rename GetBoolName() in IMContextWrapper.cpp to ToChar() r=kerlt
widget/gtk/IMContextWrapper.cpp
widget/gtk/moz.build
--- a/widget/gtk/IMContextWrapper.cpp
+++ b/widget/gtk/IMContextWrapper.cpp
@@ -16,20 +16,20 @@
 #include "mozilla/TextEvents.h"
 #include "WritingModes.h"
 
 namespace mozilla {
 namespace widget {
 
 PRLogModuleInfo* gGtkIMLog = nullptr;
 
-static const char*
-GetBoolName(bool aBool)
+static inline const char*
+ToChar(bool aBool)
 {
-  return aBool ? "true" : "false";
+    return aBool ? "true" : "false";
 }
 
 static const char*
 GetRangeTypeName(uint32_t aRangeType)
 {
     switch (aRangeType) {
         case NS_TEXTRANGE_RAWINPUT:
             return "NS_TEXTRANGE_RAWINPUT";
@@ -330,17 +330,17 @@ IMContextWrapper::OnBlurWindow(nsWindow*
 {
     if (MOZ_UNLIKELY(IsDestroyed())) {
         return;
     }
 
     MOZ_LOG(gGtkIMLog, LogLevel::Info,
         ("GTKIM: %p OnBlurWindow(aWindow=%p), mLastFocusedWindow=%p, "
          "mIsIMFocused=%s",
-         this, aWindow, mLastFocusedWindow, GetBoolName(mIsIMFocused)));
+         this, aWindow, mLastFocusedWindow, ToChar(mIsIMFocused)));
 
     if (!mIsIMFocused || mLastFocusedWindow != aWindow) {
         return;
     }
 
     Blur();
 }
 
@@ -355,17 +355,17 @@ IMContextWrapper::OnKeyEvent(nsWindow* a
         MOZ_UNLIKELY(IsDestroyed())) {
         return false;
     }
 
     MOZ_LOG(gGtkIMLog, LogLevel::Info,
         ("GTKIM: %p OnKeyEvent(aCaller=%p, aKeyDownEventWasSent=%s), "
          "mCompositionState=%s, current context=%p, active context=%p, "
          "aEvent(%p): { type=%s, keyval=%s, unicode=0x%X }",
-         this, aCaller, GetBoolName(aKeyDownEventWasSent),
+         this, aCaller, ToChar(aKeyDownEventWasSent),
          GetCompositionStateName(), GetCurrentContext(), GetActiveContext(),
          aEvent, GetEventType(aEvent), gdk_keyval_name(aEvent->keyval),
          gdk_keyval_to_unicode(aEvent->keyval)));
 
     if (aCaller != mLastFocusedWindow) {
         MOZ_LOG(gGtkIMLog, LogLevel::Error,
             ("GTKIM: %p   OnKeyEvent(), FAILED, the caller isn't focused "
              "window, mLastFocusedWindow=%p",
@@ -424,42 +424,42 @@ IMContextWrapper::OnKeyEvent(nsWindow* a
             // shouldn't dispatch any keyup event during composition.
             filterThisEvent = true;
         }
     }
 
     MOZ_LOG(gGtkIMLog, LogLevel::Debug,
         ("GTKIM: %p   OnKeyEvent(), succeeded, filterThisEvent=%s "
          "(isFiltered=%s, mFilterKeyEvent=%s), mCompositionState=%s",
-         this, GetBoolName(filterThisEvent), GetBoolName(isFiltered),
-         GetBoolName(mFilterKeyEvent), GetCompositionStateName()));
+         this, ToChar(filterThisEvent), ToChar(isFiltered),
+         ToChar(mFilterKeyEvent), GetCompositionStateName()));
 
     return filterThisEvent;
 }
 
 void
 IMContextWrapper::OnFocusChangeInGecko(bool aFocus)
 {
     MOZ_LOG(gGtkIMLog, LogLevel::Info,
         ("GTKIM: %p OnFocusChangeInGecko(aFocus=%s), "
          "mCompositionState=%s, mIsIMFocused=%s",
-         this, GetBoolName(aFocus), GetCompositionStateName(),
-         GetBoolName(mIsIMFocused)));
+         this, ToChar(aFocus), GetCompositionStateName(),
+         ToChar(mIsIMFocused)));
 
     // We shouldn't carry over the removed string to another editor.
     mSelectedString.Truncate();
     mSelection.Clear();
 }
 
 void
 IMContextWrapper::ResetIME()
 {
     MOZ_LOG(gGtkIMLog, LogLevel::Info,
         ("GTKIM: %p ResetIME(), mCompositionState=%s, mIsIMFocused=%s",
-         this, GetCompositionStateName(), GetBoolName(mIsIMFocused)));
+         this, GetCompositionStateName(), ToChar(mIsIMFocused)));
 
     GtkIMContext* activeContext = GetActiveContext();
     if (MOZ_UNLIKELY(!activeContext)) {
         MOZ_LOG(gGtkIMLog, LogLevel::Error,
             ("GTKIM: %p   ResetIME(), FAILED, there are no context",
              this));
         return;
     }
@@ -481,17 +481,17 @@ IMContextWrapper::ResetIME()
     GetCompositionString(activeContext, compositionString);
 
     MOZ_LOG(gGtkIMLog, LogLevel::Debug,
         ("GTKIM: %p   ResetIME() called gtk_im_context_reset(), "
          "activeContext=%p, mCompositionState=%s, compositionString=%s, "
          "mIsIMFocused=%s",
          this, activeContext, GetCompositionStateName(),
          NS_ConvertUTF16toUTF8(compositionString).get(),
-         GetBoolName(mIsIMFocused)));
+         ToChar(mIsIMFocused)));
 
     // XXX IIIMF (ATOK X3 which is one of the Language Engine of it is still
     //     used in Japan!) sends only "preedit_changed" signal with empty
     //     composition string synchronously.  Therefore, if composition string
     //     is now empty string, we should assume that the IME won't send
     //     "commit" signal.
     if (IsComposing() && compositionString.IsEmpty()) {
         // WARNING: The widget might have been gone after this.
@@ -759,17 +759,17 @@ IMContextWrapper::Focus()
     }
 }
 
 void
 IMContextWrapper::Blur()
 {
     MOZ_LOG(gGtkIMLog, LogLevel::Info,
         ("GTKIM: %p Blur(), mIsIMFocused=%s",
-         this, GetBoolName(mIsIMFocused)));
+         this, ToChar(mIsIMFocused)));
 
     if (!mIsIMFocused) {
         return;
     }
 
     GtkIMContext* currentContext = GetCurrentContext();
     if (!currentContext) {
         MOZ_LOG(gGtkIMLog, LogLevel::Error,
@@ -797,21 +797,21 @@ IMContextWrapper::OnSelectionChange(nsWi
 
     MOZ_LOG(gGtkIMLog, LogLevel::Info,
         ("GTKIM: %p OnSelectionChange(aCaller=0x%p, aIMENotification={ "
          "mSelectionChangeData={ mOffset=%u, Length()=%u, mReversed=%s, "
          "mWritingMode=%s, mCausedByComposition=%s, mCausedBySelectionEvent=%s "
          "} }), mCompositionState=%s, mIsDeletingSurrounding=%s",
          this, aCaller, selectionChangeData.mOffset,
          selectionChangeData.Length(),
-         GetBoolName(selectionChangeData.mReversed),
+         ToChar(selectionChangeData.mReversed),
          GetWritingModeName(selectionChangeData.GetWritingMode()).get(),
-         GetBoolName(selectionChangeData.mCausedByComposition),
-         GetBoolName(selectionChangeData.mCausedBySelectionEvent),
-         GetCompositionStateName(), GetBoolName(mIsDeletingSurrounding)));
+         ToChar(selectionChangeData.mCausedByComposition),
+         ToChar(selectionChangeData.mCausedBySelectionEvent),
+         GetCompositionStateName(), ToChar(mIsDeletingSurrounding)));
 
     if (aCaller != mLastFocusedWindow) {
         MOZ_LOG(gGtkIMLog, LogLevel::Error,
             ("GTKIM: %p   OnSelectionChange(), FAILED, "
              "the caller isn't focused window, mLastFocusedWindow=%p",
              this, mLastFocusedWindow));
         return;
     }
@@ -1069,17 +1069,17 @@ IMContextWrapper::OnCommitCompositionNat
     const gchar emptyStr = 0;
     const gchar *commitString = aUTF8Char ? aUTF8Char : &emptyStr;
 
     MOZ_LOG(gGtkIMLog, LogLevel::Info,
         ("GTKIM: %p OnCommitCompositionNative(aContext=%p), "
          "current context=%p, active context=%p, commitString=\"%s\", "
          "mProcessingKeyEvent=%p, IsComposingOn(aContext)=%s",
          this, aContext, GetCurrentContext(), GetActiveContext(), commitString,
-         mProcessingKeyEvent, GetBoolName(IsComposingOn(aContext))));
+         mProcessingKeyEvent, ToChar(IsComposingOn(aContext))));
 
     // See bug 472635, we should do nothing if IM context doesn't match.
     if (!IsValidContext(aContext)) {
         MOZ_LOG(gGtkIMLog, LogLevel::Error,
             ("GTKIM: %p   OnCommitCompositionNative(), FAILED, "
              "given context doesn't match",
              this));
         return;
--- a/widget/gtk/moz.build
+++ b/widget/gtk/moz.build
@@ -9,37 +9,37 @@ if CONFIG['MOZ_ENABLE_GTK3']:
 
 EXPORTS += [
     'mozcontainer.h',
     'nsGTKToolkit.h',
     'nsIImageToPixbuf.h',
 ]
 
 UNIFIED_SOURCES += [
+    'IMContextWrapper.cpp',
     'mozcontainer.c',
     'NativeKeyBindings.cpp',
     'nsAppShell.cpp',
     'nsBidiKeyboard.cpp',
     'nsColorPicker.cpp',
     'nsFilePicker.cpp',
+    'nsGtkKeyUtils.cpp',
     'nsImageToPixbuf.cpp',
     'nsLookAndFeel.cpp',
     'nsNativeThemeGTK.cpp',
     'nsScreenGtk.cpp',
     'nsScreenManagerGtk.cpp',
     'nsSound.cpp',
     'nsToolkit.cpp',
     'nsWidgetFactory.cpp',
     'WakeLockListener.cpp',
     'WidgetTraceEvent.cpp',
 ]
 
 SOURCES += [
-    'IMContextWrapper.cpp', # methods for logging conflict with other files
-    'nsGtkKeyUtils.cpp', # methods for logging conflict with other files
     'nsWindow.cpp', # conflicts with X11 headers
 ]
 
 if CONFIG['MOZ_X11']:
     UNIFIED_SOURCES += [
         'nsIdleServiceGTK.cpp',
     ]