Bug 772327 - Password mask timer is too short on Android. r=blassy
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Fri, 13 Jul 2012 11:26:20 +0900
changeset 104433 b303b2565fe644a6629ffd26ad9e27d2c4ef694d
parent 104432 88bd50014db3695ec23d4d1d555fa5ee4b1165c8
child 104434 0f987ac28e8c0ba440e1bd9c1280a0bbe44834e8
push id191
push userlsblakk@mozilla.com
push dateFri, 05 Oct 2012 17:12:53 +0000
treeherdermozilla-release@ddb22ac6c03b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassy
bugs772327
milestone16.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 772327 - Password mask timer is too short on Android. r=blassy
editor/libeditor/text/nsTextEditRules.cpp
widget/LookAndFeel.h
widget/android/nsLookAndFeel.cpp
widget/android/nsLookAndFeel.h
widget/xpwidgets/nsXPLookAndFeel.cpp
widget/xpwidgets/nsXPLookAndFeel.h
--- a/editor/libeditor/text/nsTextEditRules.cpp
+++ b/editor/libeditor/text/nsTextEditRules.cpp
@@ -643,17 +643,18 @@ nsTextEditRules::WillInsertText(nsEditor
       {
         mTimer->Cancel();
       }
       else
       {
         mTimer = do_CreateInstance("@mozilla.org/timer;1", &res);
         NS_ENSURE_SUCCESS(res, res);
       }
-      mTimer->InitWithCallback(this, 600, nsITimer::TYPE_ONE_SHOT);
+      mTimer->InitWithCallback(this, LookAndFeel::GetPasswordMaskDelay(),
+                               nsITimer::TYPE_ONE_SHOT);
     } 
     else 
     {
       FillBufWithPWChars(outString, outString->Length());
     }
   }
 
   // get the (collapsed) selection location
--- a/widget/LookAndFeel.h
+++ b/widget/LookAndFeel.h
@@ -501,16 +501,22 @@ public:
   /**
    * If the latest character in password field shouldn't be hidden by the
    * result of GetPasswordCharacter(), GetEchoPassword() returns TRUE.
    * Otherwise, FALSE.
    */
   static bool GetEchoPassword();
 
   /**
+   * The millisecond to mask password value.
+   * This value is only valid when GetEchoPassword() returns true.
+   */
+  static PRUint32 GetPasswordMaskDelay();
+
+  /**
    * When system look and feel is changed, Refresh() must be called.  Then,
    * cached data would be released.
    */
   static void Refresh();
 };
 
 } // namespace mozilla
 
--- a/widget/android/nsLookAndFeel.cpp
+++ b/widget/android/nsLookAndFeel.cpp
@@ -467,8 +467,15 @@ nsLookAndFeel::GetEchoPasswordImpl()
                 NS_ASSERTION(AndroidBridge::Bridge() != nsnull, "AndroidBridge is not available!");
         } else {
             ContentChild::GetSingleton()->SendGetShowPasswordSetting(&mShowPassword);
         }
         mInitializedShowPassword = true;
     }
     return mShowPassword;
 }
+
+PRUint32
+nsLookAndFeel::GetPasswordMaskDelayImpl()
+{
+  // This value is hard-coded in PasswordTransformationMethod.java
+  return 1500;
+}
--- a/widget/android/nsLookAndFeel.h
+++ b/widget/android/nsLookAndFeel.h
@@ -14,16 +14,17 @@ public:
     nsLookAndFeel();
     virtual ~nsLookAndFeel();
 
     virtual nsresult NativeGetColor(ColorID aID, nscolor &aResult);
     virtual nsresult GetIntImpl(IntID aID, PRInt32 &aResult);
     virtual nsresult GetFloatImpl(FloatID aID, float &aResult);
     virtual bool GetFontImpl(FontID aID, nsString& aName, gfxFontStyle& aStyle);
     virtual bool GetEchoPasswordImpl();
+    virtual PRUint32 GetPasswordMaskDelayImpl();
 
 protected:
     static bool mInitializedSystemColors;
     static mozilla::AndroidSystemColors mSystemColors;
     static bool mInitializedShowPassword;
     static bool mShowPassword;
 
     nsresult GetSystemColors();
--- a/widget/xpwidgets/nsXPLookAndFeel.cpp
+++ b/widget/xpwidgets/nsXPLookAndFeel.cpp
@@ -724,15 +724,22 @@ LookAndFeel::GetPasswordCharacter()
 // static
 bool
 LookAndFeel::GetEchoPassword()
 {
   return nsLookAndFeel::GetInstance()->GetEchoPasswordImpl();
 }
 
 // static
+PRUint32
+LookAndFeel::GetPasswordMaskDelay()
+{
+  return nsLookAndFeel::GetInstance()->GetPasswordMaskDelayImpl();
+}
+
+// static
 void
 LookAndFeel::Refresh()
 {
   nsLookAndFeel::GetInstance()->RefreshImpl();
 }
 
 } // namespace mozilla
--- a/widget/xpwidgets/nsXPLookAndFeel.h
+++ b/widget/xpwidgets/nsXPLookAndFeel.h
@@ -68,16 +68,21 @@ public:
     return PRUnichar('*');
   }
 
   virtual bool GetEchoPasswordImpl()
   {
     return false;
   }
 
+  virtual PRUint32 GetPasswordMaskDelayImpl()
+  {
+    return 600;
+  }
+
 protected:
   nsXPLookAndFeel();
 
   static void IntPrefChanged(nsLookAndFeelIntPref *data);
   static void FloatPrefChanged(nsLookAndFeelFloatPref *data);
   static void ColorPrefChanged(unsigned int index, const char *prefName);
   void InitFromPref(nsLookAndFeelIntPref* aPref);
   void InitFromPref(nsLookAndFeelFloatPref* aPref);