Bug 1516101 - Don't use locale-specific AppendPrintf() to print float values, r=jhorak
authorMartin Stransky <stransky@redhat.com>
Mon, 07 Jan 2019 14:43:31 +0000
changeset 509827 f4fc0e5c9d4a8fcc6e93cff2cde0362ac04b8016
parent 509826 4b9c119d25c32828cf82027ab26a4a6175058dff
child 509828 43c43fa35d2a9f4cd07548723cd3a9cdf66bf73d
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjhorak
bugs1516101
milestone66.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 1516101 - Don't use locale-specific AppendPrintf() to print float values, r=jhorak Differential Revision: https://phabricator.services.mozilla.com/D15836
widget/gtk/IMContextWrapper.cpp
--- a/widget/gtk/IMContextWrapper.cpp
+++ b/widget/gtk/IMContextWrapper.cpp
@@ -266,31 +266,38 @@ class SelectionStyleProvider final {
     nsAutoCString style(":selected{");
     // FYI: LookAndFeel always returns selection colors of GtkTextView.
     nscolor selectionForegroundColor;
     if (NS_SUCCEEDED(
             LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectForeground,
                                   &selectionForegroundColor))) {
       double alpha =
           static_cast<double>(NS_GET_A(selectionForegroundColor)) / 0xFF;
-      style.AppendPrintf("color:rgba(%u,%u,%u,%f);",
+      style.AppendPrintf("color:rgba(%u,%u,%u,",
                          NS_GET_R(selectionForegroundColor),
                          NS_GET_G(selectionForegroundColor),
-                         NS_GET_B(selectionForegroundColor), alpha);
+                         NS_GET_B(selectionForegroundColor));
+      // We can't use AppendPrintf here, because it does locale-specific
+      // formatting of floating-point values.
+      style.AppendFloat(alpha);
+      style.AppendPrintf(");");
+
     }
     nscolor selectionBackgroundColor;
     if (NS_SUCCEEDED(
             LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectBackground,
                                   &selectionBackgroundColor))) {
       double alpha =
           static_cast<double>(NS_GET_A(selectionBackgroundColor)) / 0xFF;
-      style.AppendPrintf("background-color:rgba(%u,%u,%u,%f);",
+      style.AppendPrintf("background-color:rgba(%u,%u,%u,",
                          NS_GET_R(selectionBackgroundColor),
                          NS_GET_G(selectionBackgroundColor),
-                         NS_GET_B(selectionBackgroundColor), alpha);
+                         NS_GET_B(selectionBackgroundColor));
+      style.AppendFloat(alpha);
+      style.AppendPrintf(");");
     }
     style.AppendLiteral("}");
     gtk_css_provider_load_from_data(mProvider, style.get(), -1, nullptr);
   }
 
  private:
   static SelectionStyleProvider* sInstance;
   static bool sHasShutDown;