b=403484 backing-out the previous patch, caused by testing failure.
authormasayuki@d-toybox.com
Thu, 15 Nov 2007 03:02:47 -0800
changeset 8034 1b7d5cf84d19bf097aece224b027a7f0772d594b
parent 8033 e9163f548dc3a6f9842009037f44b9badedef023
child 8035 234ce586bc78b52a029f70a8e3f95bc07eac3490
push id1
push userbsmedberg@mozilla.com
push dateThu, 20 Mar 2008 16:49:24 +0000
treeherdermozilla-central@61007906a1f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs403484
milestone1.9b2pre
b=403484 backing-out the previous patch, caused by testing failure.
content/base/public/nsContentUtils.h
content/base/src/nsContentUtils.cpp
layout/xul/base/src/nsTextBoxFrame.cpp
layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
modules/libpref/src/init/all.js
toolkit/locales/en-US/chrome/global-platform/mac/intl.properties
toolkit/locales/en-US/chrome/global-platform/unix/intl.properties
toolkit/locales/en-US/chrome/global-platform/win/intl.properties
--- a/content/base/public/nsContentUtils.h
+++ b/content/base/public/nsContentUtils.h
@@ -1110,18 +1110,16 @@ public:
                           PRBool aClick, PRBool aIsUserTriggered);
 
   /**
    * Return true if aContent or one of its ancestors in the
    * bindingParent chain is native anonymous.
    */
   static PRBool IsNativeAnonymous(nsIContent* aContent);
 
-  static const nsAdoptingString& GetLocalizedEllipsis();
-
 
 private:
 
   static PRBool InitializeEventTable();
 
   static nsresult doReparentContentWrapper(nsIContent *aChild,
                                            JSContext *cx,
                                            JSObject *aOldGlobal,
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -3716,26 +3716,13 @@ nsContentUtils::IsNativeAnonymous(nsICon
                  "Native anonymous node with wrong binding parent");
     aContent = bindingParent;
   }
 
   return PR_FALSE;
 }
 
 /* static */
-const nsAdoptingString&
-nsContentUtils::GetLocalizedEllipsis()
-{
-  static nsAdoptingString sEllipsis;
-  if (sEllipsis.IsEmpty()) {
-    sEllipsis = GetLocalizedStringPref("intl.ellipsis");
-    if (sEllipsis.IsEmpty())
-      sEllipsis.Assign(PRUnichar(0x2026));
-  }
-  return sEllipsis;
-}
-
-/* static */
 void
 nsAutoGCRoot::Shutdown()
 {
   NS_IF_RELEASE(sJSRuntimeService);
 }
--- a/layout/xul/base/src/nsTextBoxFrame.cpp
+++ b/layout/xul/base/src/nsTextBoxFrame.cpp
@@ -72,16 +72,19 @@
 #include "nsCSSRendering.h"
 #include "nsIReflowCallback.h"
 
 #ifdef IBMBIDI
 #include "nsBidiUtils.h"
 #include "nsBidiPresUtils.h"
 #endif // IBMBIDI
 
+// horizontal ellipsis (U+2026)
+#define ELLIPSIS PRUnichar(0x2026)
+
 #define CROP_LEFT   "left"
 #define CROP_RIGHT  "right"
 #define CROP_CENTER "center"
 #define CROP_START  "start"
 #define CROP_END    "end"
 
 #define NS_STATE_NEED_LAYOUT 0x01000000
 
@@ -619,25 +622,24 @@ nsTextBoxFrame::CalculateTitleForWidth(n
             mState |= NS_FRAME_IS_BIDI;
             break;
           }
         }
 #endif // IBMBIDI
         return;  // fits, done.
     }
 
-    const nsAdoptingString& kEllipsis = nsContentUtils::GetLocalizedEllipsis();
     // start with an ellipsis
-    mCroppedTitle.Assign(kEllipsis);
+    mCroppedTitle.Assign(ELLIPSIS);
 
     // see if the width is even smaller than the ellipsis
     // if so, clear the text (XXX set as many '.' as we can?).
     nscoord ellipsisWidth;
     aRenderingContext.SetTextRunRTL(PR_FALSE);
-    aRenderingContext.GetWidth(kEllipsis, ellipsisWidth);
+    aRenderingContext.GetWidth(ELLIPSIS, ellipsisWidth);
 
     if (ellipsisWidth > aWidth) {
         mCroppedTitle.SetLength(0);
         mTitleWidth = aWidth;
         return;
     }
 
     // if the ellipsis fits perfectly, no use in trying to insert
@@ -766,27 +768,29 @@ nsTextBoxFrame::CalculateTitleForWidth(n
 #endif
                 }
 
                 // look at the next two characters
                 leftPos++;
                 rightPos--;
             }
 
-            mCroppedTitle = leftString + kEllipsis + rightString;
+            // form the new cropped string
+            nsAutoString ellipsisString;
+            ellipsisString.Assign(ELLIPSIS);
+
+            mCroppedTitle = leftString + ellipsisString + rightString;
         }
         break;
     }
 
     mTitleWidth = nsLayoutUtils::GetStringWidth(this, &aRenderingContext,
                                                 mCroppedTitle.get(), mCroppedTitle.Length());
 }
 
-#define OLD_ELLIPSIS NS_LITERAL_STRING("...")
-
 // the following block is to append the accesskey to mTitle if there is an accesskey
 // but the mTitle doesn't have the character
 void
 nsTextBoxFrame::UpdateAccessTitle()
 {
     /*
      * Note that if you change appending access key label spec,
      * you need to maintain same logic in following methods. See bug 324159.
@@ -810,29 +814,17 @@ nsTextBoxFrame::UpdateAccessTitle()
     ToUpperCase(accessKeyLabel);
     accessKeyLabel += ')';
 
     if (mTitle.IsEmpty()) {
         mTitle = accessKeyLabel;
         return;
     }
 
-    const nsAdoptingString& kEllipsis = nsContentUtils::GetLocalizedEllipsis();
-    PRInt32 offset = mTitle.RFind(kEllipsis);
-    if (offset == kNotFound) {
-        // Try to check with our old ellipsis (for old addons)
-        if (!kEllipsis.Equals(OLD_ELLIPSIS))
-            offset = mTitle.RFind(OLD_ELLIPSIS);
-        if (offset == kNotFound) {
-            // Try to check with our default ellipsis (for non-localized addons)
-            nsAutoString defaultEllipsis(PRUnichar(0x2026));
-            if (!kEllipsis.Equals(defaultEllipsis))
-                offset = mTitle.RFind(defaultEllipsis);
-        }
-    }
+    PRInt32 offset = mTitle.RFind("...");
     if (offset == kNotFound) {
         offset = (PRInt32)mTitle.Length();
         if (mTitle.Last() == PRUnichar(':'))
             offset--;
     }
 
     if (InsertSeparatorBeforeAccessKey() && offset > 0 &&
         !NS_IS_SPACE(mTitle[offset - 1])) {
--- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
+++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
@@ -101,16 +101,19 @@
 #include "nsEventDispatcher.h"
 #include "nsDisplayList.h"
 #include "nsTreeBoxObject.h"
 
 #ifdef IBMBIDI
 #include "nsBidiPresUtils.h"
 #endif
 
+// horizontal ellipsis (U+2026)
+#define ELLIPSIS PRUnichar(0x2026)
+
 static NS_DEFINE_CID(kWidgetCID, NS_CHILD_CID);
 
 // Enumeration function that cancels all the image requests in our cache
 PR_STATIC_CALLBACK(PLDHashOperator)
 CancelImageRequest(const nsAString& aKey,
                    nsTreeImageCacheEntry aEntry, void* aData)
 {
   aEntry.request->Cancel(NS_BINDING_ABORTED);
@@ -1335,26 +1338,25 @@ nsTreeBodyFrame::AdjustForCellText(nsAut
         }
       }
     }
   }
 
   if (width > maxWidth) {
     // See if the width is even smaller than the ellipsis
     // If so, clear the text completely.
-    const nsAdoptingString& kEllipsis = nsContentUtils::GetLocalizedEllipsis();
     nscoord ellipsisWidth;
     aRenderingContext.SetTextRunRTL(PR_FALSE);
-    aRenderingContext.GetWidth(kEllipsis, ellipsisWidth);
+    aRenderingContext.GetWidth(ELLIPSIS, ellipsisWidth);
 
     width = maxWidth;
     if (ellipsisWidth > width)
       aText.SetLength(0);
     else if (ellipsisWidth == width)
-      aText.Assign(kEllipsis);
+      aText.Assign(ELLIPSIS);
     else {
       // We will be drawing an ellipsis, thank you very much.
       // Subtract out the required width of the ellipsis.
       // This is the total remaining width we have to play with.
       width -= ellipsisWidth;
 
       // Now we crop.
       switch (aColumn->GetCropStyle()) {
@@ -1369,17 +1371,17 @@ nsTreeBodyFrame::AdjustForCellText(nsAut
             PRUnichar ch = aText[i];
             // XXX this is horrible and doesn't handle clusters
             aRenderingContext.GetWidth(ch,cwidth);
             if (twidth + cwidth > width)
               break;
             twidth += cwidth;
           }
           aText.Truncate(i);
-          aText.Append(kEllipsis);
+          aText.Append(ELLIPSIS);
         }
         break;
 
         case 2: {
           // Crop left.
           nscoord cwidth;
           nscoord twidth = 0;
           int length = aText.Length();
@@ -1389,17 +1391,17 @@ nsTreeBodyFrame::AdjustForCellText(nsAut
             aRenderingContext.GetWidth(ch,cwidth);
             if (twidth + cwidth > width)
               break;
             twidth += cwidth;
           }
 
           nsAutoString copy;
           aText.Right(copy, length-1-i);
-          aText.Assign(kEllipsis);
+          aText.Assign(ELLIPSIS);
           aText += copy;
         }
         break;
 
         case 1:
         {
           // Crop center.
           nsAutoString leftStr, rightStr;
@@ -1418,17 +1420,17 @@ nsTreeBodyFrame::AdjustForCellText(nsAut
             aRenderingContext.GetWidth(ch, cwidth);
             twidth += cwidth;
             if (twidth > width)
               break;
             rightStr.Insert(ch, 0);
             --rightPos;
           }
           aText = leftStr;
-          aText.Append(kEllipsis);
+          aText.Append(ELLIPSIS);
           aText += rightStr;
         }
         break;
       }
     }
   }
   else {
     switch (aColumn->GetTextAlignment()) {
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -813,17 +813,16 @@ pref("intl.charsetmenu.browser.unicode",
 pref("intl.charsetmenu.mailedit",           "chrome://navigator/locale/navigator.properties");
 pref("intl.charsetmenu.browser.cache",      "");
 pref("intl.charsetmenu.mailview.cache",     "");
 pref("intl.charsetmenu.composer.cache",     "");
 pref("intl.charsetmenu.browser.cache.size", 5);
 pref("intl.charset.detector",               "chrome://navigator/locale/navigator.properties");
 pref("intl.charset.default",                "chrome://navigator-platform/locale/navigator.properties");
 pref("intl.content.langcode",               "chrome://communicator-region/locale/region.properties");
-pref("intl.ellipsis",                       "chrome://global-platform/locale/intl.properties");
 pref("intl.locale.matchOS",                 false);
 // fallback charset list for Unicode conversion (converting from Unicode)
 // currently used for mail send only to handle symbol characters (e.g Euro, trademark, smartquotes)
 // for ISO-8859-1
 pref("intl.fallbackCharsetList.ISO-8859-1", "windows-1252");
 pref("font.language.group",                 "chrome://navigator/locale/navigator.properties");
 
 pref("images.dither", "auto");
--- a/toolkit/locales/en-US/chrome/global-platform/mac/intl.properties
+++ b/toolkit/locales/en-US/chrome/global-platform/mac/intl.properties
@@ -1,5 +1,2 @@
 # moved from navigator/locale/navigator.properties
 intl.charset.default=ISO-8859-1
-# LOCALIZATION NOTE (intl.ellipsis): Use the unicode ellipsis char, \u2026,
-# or use "..." unless \u2026 doesn't suit traditions in your locale.
-intl.ellipsis=…
--- a/toolkit/locales/en-US/chrome/global-platform/unix/intl.properties
+++ b/toolkit/locales/en-US/chrome/global-platform/unix/intl.properties
@@ -1,5 +1,2 @@
 # moved from navigator/locale/navigator.properties
 intl.charset.default=ISO-8859-1
-# LOCALIZATION NOTE (intl.ellipsis): Use the unicode ellipsis char, \u2026,
-# or use "..." unless \u2026 doesn't suit traditions in your locale.
-intl.ellipsis=…
--- a/toolkit/locales/en-US/chrome/global-platform/win/intl.properties
+++ b/toolkit/locales/en-US/chrome/global-platform/win/intl.properties
@@ -1,5 +1,2 @@
 # moved from navigator/locale/navigator.properties
 intl.charset.default=ISO-8859-1
-# LOCALIZATION NOTE (intl.ellipsis): Use the unicode ellipsis char, \u2026,
-# or use "..." unless \u2026 doesn't suit traditions in your locale.
-intl.ellipsis=…