Backed out changeset 6a5e056b7fb9 (bug 1403690)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Mon, 23 Oct 2017 18:21:04 +0200
changeset 438440 888af9141ff82c22805a59e1e85425528ab20565
parent 438439 6ca4d18dede7c3536417e7c01e5fd6acfe4e2a3e
child 438441 9c19645d8078c70eb7d054ecf30fdfa00adfd186
push id8114
push userjlorenzo@mozilla.com
push dateThu, 02 Nov 2017 16:33:21 +0000
treeherdermozilla-beta@73e0d89a540f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1403690
milestone58.0a1
backs out6a5e056b7fb9ce08fd29387060705571d605bf64
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
Backed out changeset 6a5e056b7fb9 (bug 1403690)
widget/android/nsLookAndFeel.cpp
widget/android/nsLookAndFeel.h
--- a/widget/android/nsLookAndFeel.cpp
+++ b/widget/android/nsLookAndFeel.cpp
@@ -37,21 +37,26 @@ nsLookAndFeel::~nsLookAndFeel()
 #define DARK_GRAY_COLOR        NS_RGB(0x40,0x40,0x40)
 #define GRAY_COLOR             NS_RGB(0x80,0x80,0x80)
 #define LIGHT_GRAY_COLOR       NS_RGB(0xa0,0xa0,0xa0)
 #define RED_COLOR              NS_RGB(0xff,0x00,0x00)
 
 nsresult
 nsLookAndFeel::GetSystemColors()
 {
+    if (mInitializedSystemColors)
+        return NS_OK;
+
     if (!AndroidBridge::Bridge())
         return NS_ERROR_FAILURE;
 
     AndroidBridge::Bridge()->GetSystemColors(&mSystemColors);
 
+    mInitializedSystemColors = true;
+
     return NS_OK;
 }
 
 nsresult
 nsLookAndFeel::CallRemoteGetSystemColors()
 {
     // An array has to be used to get data from remote process
     InfallibleTArray<uint32_t> colors;
@@ -66,45 +71,32 @@ nsLookAndFeel::CallRemoteGetSystemColors
 
     if (colors.Length() < colorsCount)
         colorsCount = colors.Length();
 
     // Array elements correspond to the members of mSystemColors structure,
     // so just copy the memory block
     memcpy(&mSystemColors, colors.Elements(), sizeof(nscolor) * colorsCount);
 
-    return NS_OK;
-}
-
-void
-nsLookAndFeel::NativeInit()
-{
-    EnsureInit();
-}
+    mInitializedSystemColors = true;
 
-/* virtual */
-void
-nsLookAndFeel::RefreshImpl()
-{
-    nsXPLookAndFeel::RefreshImpl();
-
-    mInitializedSystemColors = false;
-    mInitializedShowPassword = false;
+    return NS_OK;
 }
 
 nsresult
 nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor)
 {
     nsresult rv = NS_OK;
 
-    EnsureInit();
     if (!mInitializedSystemColors) {
-        // Failure to initialize colors is an error condition. Return black.
-        aColor = 0;
-        return NS_ERROR_FAILURE;
+        if (XRE_IsParentProcess())
+            rv = GetSystemColors();
+        else
+            rv = CallRemoteGetSystemColors();
+        NS_ENSURE_SUCCESS(rv, rv);
     }
 
     // XXX we'll want to use context.obtainStyledAttributes on the java side to
     // get all of these; see TextView.java for a good exmaple.
 
     switch (aID) {
         // These colors don't seem to be used for anything anymore in Mozilla
         // (except here at least TextSelectBackground and TextSelectForeground)
@@ -346,16 +338,17 @@ nsLookAndFeel::NativeGetColor(ColorID aI
         aColor = 0;
         rv = NS_ERROR_FAILURE;
         break;
     }
 
     return rv;
 }
 
+
 nsresult
 nsLookAndFeel::GetIntImpl(IntID aID, int32_t &aResult)
 {
     nsresult rv = nsXPLookAndFeel::GetIntImpl(aID, aResult);
     if (NS_SUCCEEDED(rv))
         return rv;
 
     rv = NS_OK;
@@ -471,17 +464,24 @@ nsLookAndFeel::GetFontImpl(FontID aID, n
     aFontStyle.systemFont = true;
     return true;
 }
 
 /*virtual*/
 bool
 nsLookAndFeel::GetEchoPasswordImpl()
 {
-    EnsureInit();
+    if (!mInitializedShowPassword) {
+        if (XRE_IsParentProcess()) {
+            mShowPassword = java::GeckoAppShell::GetShowPasswordSetting();
+        } else {
+            ContentChild::GetSingleton()->SendGetShowPasswordSetting(&mShowPassword);
+        }
+        mInitializedShowPassword = true;
+    }
     return mShowPassword;
 }
 
 uint32_t
 nsLookAndFeel::GetPasswordMaskDelayImpl()
 {
   // This value is hard-coded in Android OS's PasswordTransformationMethod.java
   return 1500;
@@ -489,31 +489,8 @@ nsLookAndFeel::GetPasswordMaskDelayImpl(
 
 /* virtual */
 char16_t
 nsLookAndFeel::GetPasswordCharacterImpl()
 {
   // This value is hard-coded in Android OS's PasswordTransformationMethod.java
   return UNICODE_BULLET;
 }
-
-void
-nsLookAndFeel::EnsureInit()
-{
-    if (!mInitializedSystemColors) {
-        nsresult rv;
-        if (XRE_IsParentProcess()) {
-            rv = GetSystemColors();
-        } else {
-            rv = CallRemoteGetSystemColors();
-        }
-        mInitializedSystemColors = NS_SUCCESS(rv);
-    }
-
-    if (!mInitializedShowPassword) {
-        if (XRE_IsParentProcess()) {
-            mShowPassword = java::GeckoAppShell::GetShowPasswordSetting();
-        } else {
-            ContentChild::GetSingleton()->SendGetShowPasswordSetting(&mShowPassword);
-        }
-        mInitializedShowPassword = true;
-    }
-}
--- a/widget/android/nsLookAndFeel.h
+++ b/widget/android/nsLookAndFeel.h
@@ -9,32 +9,29 @@
 #include "AndroidBridge.h"
 
 class nsLookAndFeel final : public nsXPLookAndFeel
 {
 public:
     nsLookAndFeel();
     virtual ~nsLookAndFeel();
 
-    virtual void NativeInit() final;
-    virtual void RefreshImpl();
     virtual nsresult NativeGetColor(ColorID aID, nscolor &aResult);
+    virtual void NativeInit() final {};
     virtual nsresult GetIntImpl(IntID aID, int32_t &aResult);
     virtual nsresult GetFloatImpl(FloatID aID, float &aResult);
     virtual bool GetFontImpl(FontID aID, nsString& aName, gfxFontStyle& aStyle,
                              float aDevPixPerCSSPixel);
     virtual bool GetEchoPasswordImpl();
     virtual uint32_t GetPasswordMaskDelayImpl();
     virtual char16_t GetPasswordCharacterImpl();
 
 protected:
     static bool mInitializedSystemColors;
     static mozilla::AndroidSystemColors mSystemColors;
     static bool mInitializedShowPassword;
     static bool mShowPassword;
 
     nsresult GetSystemColors();
     nsresult CallRemoteGetSystemColors();
-
-    void EnsureInit();
 };
 
 #endif