Bug 675556 - Switch from PRPackedBool to PRUint8 in nsILineBreaker, r=roc
authorMichael Wu <mwu@mozilla.com>
Mon, 01 Aug 2011 18:20:52 -0700
changeset 73638 4319081f6be52fcd00cece76a8cf0264b78bad3e
parent 73637 e72269b36c6f0a9b55b7bf9ade4b7adacc516030
child 73639 74f0c17ba7b36c304bcb109d1a8285eeda44c065
push id900
push usermwu@mozilla.com
push dateTue, 02 Aug 2011 01:21:21 +0000
treeherdermozilla-inbound@d11aaaf51059 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs675556
milestone8.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 675556 - Switch from PRPackedBool to PRUint8 in nsILineBreaker, r=roc
intl/lwbrk/public/nsILineBreaker.h
intl/lwbrk/src/nsCarbonBreaker.cpp
intl/lwbrk/src/nsComplexBreaker.h
intl/lwbrk/src/nsJISx4501LineBreaker.cpp
intl/lwbrk/src/nsJISx4501LineBreaker.h
intl/lwbrk/src/nsPangoBreaker.cpp
intl/lwbrk/src/nsRuleBreaker.cpp
intl/lwbrk/src/nsUniscribeBreaker.cpp
layout/generic/nsTextRunTransformations.cpp
layout/generic/nsTextRunTransformations.h
--- a/intl/lwbrk/public/nsILineBreaker.h
+++ b/intl/lwbrk/public/nsILineBreaker.h
@@ -60,19 +60,19 @@ public:
 
   // Call this on a word with whitespace at either end. We will apply JISx4501
   // rules to find breaks inside the word. aBreakBefore is set to the break-
   // before status of each character; aBreakBefore[0] will always be false
   // because we never return a break before the first character.
   // aLength is the length of the aText array and also the length of the aBreakBefore
   // output array.
   virtual void GetJISx4051Breaks(const PRUnichar* aText, PRUint32 aLength,
-                                 PRPackedBool* aBreakBefore) = 0;
+                                 PRUint8* aBreakBefore) = 0;
   virtual void GetJISx4051Breaks(const PRUint8* aText, PRUint32 aLength,
-                                 PRPackedBool* aBreakBefore) = 0;
+                                 PRUint8* aBreakBefore) = 0;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsILineBreaker, NS_ILINEBREAKER_IID)
 
 static inline PRBool
 NS_IsSpace(PRUnichar u)
 {
   return u == 0x0020 ||                  // SPACE
--- a/intl/lwbrk/src/nsCarbonBreaker.cpp
+++ b/intl/lwbrk/src/nsCarbonBreaker.cpp
@@ -37,22 +37,22 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsComplexBreaker.h"
 #include <Carbon/Carbon.h>
 
 void
 NS_GetComplexLineBreaks(const PRUnichar* aText, PRUint32 aLength,
-                        PRPackedBool* aBreakBefore)
+                        PRUint8* aBreakBefore)
 {
   NS_ASSERTION(aText, "aText shouldn't be null");
   TextBreakLocatorRef breakLocator;
 
-  memset(aBreakBefore, PR_FALSE, aLength * sizeof(PRPackedBool));
+  memset(aBreakBefore, PR_FALSE, aLength * sizeof(PRUint8));
 
   OSStatus status = UCCreateTextBreakLocator(NULL, 0, kUCTextBreakLineMask, &breakLocator);
 
   if (status != noErr)
     return;
      
   for (UniCharArrayOffset position = 0; position < aLength;) {
     UniCharArrayOffset offset;
--- a/intl/lwbrk/src/nsComplexBreaker.h
+++ b/intl/lwbrk/src/nsComplexBreaker.h
@@ -42,11 +42,11 @@
 
 /**
  * Find line break opportunities in aText[] of aLength characters,
  * filling boolean values indicating line break opportunities for
  * corresponding charactersin aBreakBefore[] on return.
  */
 void
 NS_GetComplexLineBreaks(const PRUnichar* aText, PRUint32 aLength,
-                        PRPackedBool* aBreakBefore);
+                        PRUint8* aBreakBefore);
 
 #endif  /* nsComplexBreaker_h__ */
--- a/intl/lwbrk/src/nsJISx4501LineBreaker.cpp
+++ b/intl/lwbrk/src/nsJISx4501LineBreaker.cpp
@@ -781,17 +781,17 @@ nsJISx4051LineBreaker::WordMove(const PR
   }
   for (end = aPos + 1; end < PRInt32(aLen) && !NS_IsSpace(aText[end]); ++end) {
     if (IS_CJK_CHAR(aText[end]) || NS_NeedsPlatformNativeHandling(aText[end])) {
       textNeedsJISx4051 = PR_TRUE;
     }
   }
 
   PRInt32 ret;
-  nsAutoTArray<PRPackedBool, 2000> breakState;
+  nsAutoTArray<PRUint8, 2000> breakState;
   if (!textNeedsJISx4051 || !breakState.AppendElements(end - begin)) {
     // No complex text character, do not try to do complex line break.
     // (This is required for serializers. See Bug #344816.)
     // Also fall back to this when out of memory.
     if (aDirection < 0) {
       ret = (begin == PRInt32(aPos)) ? begin - 1 : begin;
     } else {
       ret = end;
@@ -828,17 +828,17 @@ nsJISx4051LineBreaker::Prev(const PRUnic
                "Bad position passed to nsJISx4051LineBreaker::Prev");
 
   PRInt32 prevPos = WordMove(aText, aLen, aPos, -1);
   return prevPos > 0 ? prevPos : NS_LINEBREAKER_NEED_MORE_TEXT;
 }
 
 void
 nsJISx4051LineBreaker::GetJISx4051Breaks(const PRUnichar* aChars, PRUint32 aLength,
-                                         PRPackedBool* aBreakBefore)
+                                         PRUint8* aBreakBefore)
 {
   PRUint32 cur;
   PRInt8 lastClass = CLASS_NONE;
   ContextState state(aChars, aLength);
 
   for (cur = 0; cur < aLength; ++cur, state.AdvanceIndex()) {
     PRUnichar ch = aChars[cur];
     PRInt8 cl;
@@ -885,17 +885,17 @@ nsJISx4051LineBreaker::GetJISx4051Breaks
 
       cur = end - 1;
     }
   }
 }
 
 void
 nsJISx4051LineBreaker::GetJISx4051Breaks(const PRUint8* aChars, PRUint32 aLength,
-                                         PRPackedBool* aBreakBefore)
+                                         PRUint8* aBreakBefore)
 {
   PRUint32 cur;
   PRInt8 lastClass = CLASS_NONE;
   ContextState state(aChars, aLength);
 
   for (cur = 0; cur < aLength; ++cur, state.AdvanceIndex()) {
     PRUnichar ch = aChars[cur];
     PRInt8 cl;
--- a/intl/lwbrk/src/nsJISx4501LineBreaker.h
+++ b/intl/lwbrk/src/nsJISx4501LineBreaker.h
@@ -48,18 +48,18 @@ public:
   nsJISx4051LineBreaker();
   virtual ~nsJISx4051LineBreaker();
 
   PRInt32 Next( const PRUnichar* aText, PRUint32 aLen, PRUint32 aPos);
 
   PRInt32 Prev( const PRUnichar* aText, PRUint32 aLen, PRUint32 aPos);
 
   virtual void GetJISx4051Breaks(const PRUnichar* aText, PRUint32 aLength,
-                                 PRPackedBool* aBreakBefore);
+                                 PRUint8* aBreakBefore);
   virtual void GetJISx4051Breaks(const PRUint8* aText, PRUint32 aLength,
-                                 PRPackedBool* aBreakBefore);
+                                 PRUint8* aBreakBefore);
 
 private:
   PRInt32 WordMove(const PRUnichar* aText, PRUint32 aLen, PRUint32 aPos,
                    PRInt8 aDirection);
 };
 
 #endif  /* nsJISx4501LineBreaker_h__ */
--- a/intl/lwbrk/src/nsPangoBreaker.cpp
+++ b/intl/lwbrk/src/nsPangoBreaker.cpp
@@ -40,21 +40,21 @@
 
 #include <pango/pango-break.h>
 #include "nsUTF8Utils.h"
 #include "nsString.h"
 #include "nsTArray.h"
 
 void
 NS_GetComplexLineBreaks(const PRUnichar* aText, PRUint32 aLength,
-                        PRPackedBool* aBreakBefore)
+                        PRUint8* aBreakBefore)
 {
   NS_ASSERTION(aText, "aText shouldn't be null");
 
-  memset(aBreakBefore, PR_FALSE, aLength * sizeof(PRPackedBool));
+  memset(aBreakBefore, PR_FALSE, aLength * sizeof(PRUint8));
 
   nsAutoTArray<PangoLogAttr, 2000> attrBuffer;
   if (!attrBuffer.AppendElements(aLength + 1))
     return;
 
   NS_ConvertUTF16toUTF8 aUTF8(aText, aLength);
 
   const gchar* p = aUTF8.Data();
--- a/intl/lwbrk/src/nsRuleBreaker.cpp
+++ b/intl/lwbrk/src/nsRuleBreaker.cpp
@@ -38,16 +38,16 @@
 
 #include "nsComplexBreaker.h"
 
 #define TH_UNICODE
 #include "rulebrk.h"
 
 void
 NS_GetComplexLineBreaks(const PRUnichar* aText, PRUint32 aLength,
-                        PRPackedBool* aBreakBefore)
+                        PRUint8* aBreakBefore)
 {
   NS_ASSERTION(aText, "aText shouldn't be null");
 
   for (PRUint32 i = 0; i < aLength; i++)
     aBreakBefore[i] = (0 == TrbWordBreakPos(aText, i, aText + i, aLength - i));
 }
 
--- a/intl/lwbrk/src/nsUniscribeBreaker.cpp
+++ b/intl/lwbrk/src/nsUniscribeBreaker.cpp
@@ -46,17 +46,17 @@
 #include <usp10.h>
 
 #include "nsUTF8Utils.h"
 #include "nsString.h"
 #include "nsTArray.h"
 
 void
 NS_GetComplexLineBreaks(const PRUnichar* aText, PRUint32 aLength,
-                        PRPackedBool* aBreakBefore)
+                        PRUint8* aBreakBefore)
 {
   NS_ASSERTION(aText, "aText shouldn't be null"); 
 
   int outItems = 0;
   HRESULT result;
   nsAutoTArray<SCRIPT_ITEM, 64> items;
 
   memset(aBreakBefore, PR_FALSE, aLength);
--- a/layout/generic/nsTextRunTransformations.cpp
+++ b/layout/generic/nsTextRunTransformations.cpp
@@ -83,17 +83,17 @@ nsTransformedTextRun::SetCapitalization(
     memset(mCapitalize.Elements(), 0, GetLength()*sizeof(PRPackedBool));
   }
   memcpy(mCapitalize.Elements() + aStart, aCapitalization, aLength*sizeof(PRPackedBool));
   mNeedsRebuild = PR_TRUE;
 }
 
 PRBool
 nsTransformedTextRun::SetPotentialLineBreaks(PRUint32 aStart, PRUint32 aLength,
-                                             PRPackedBool* aBreakBefore,
+                                             PRUint8* aBreakBefore,
                                              gfxContext* aRefContext)
 {
   PRBool changed = gfxTextRun::SetPotentialLineBreaks(aStart, aLength,
       aBreakBefore, aRefContext);
   if (changed) {
     mNeedsRebuild = PR_TRUE;
   }
   return changed;
@@ -259,17 +259,17 @@ nsFontVariantTextRunFactory::RebuildText
 
   nsCaseTransformTextRunFactory uppercaseFactory(nsnull, PR_TRUE);
 
   aTextRun->ResetGlyphRuns();
 
   PRUint32 runStart = 0;
   PRBool runIsLowercase = PR_FALSE;
   nsAutoTArray<nsStyleContext*,50> styleArray;
-  nsAutoTArray<PRPackedBool,50> canBreakBeforeArray;
+  nsAutoTArray<PRUint8,50> canBreakBeforeArray;
 
   PRUint32 i;
   for (i = 0; i <= length; ++i) {
     PRBool isLowercase = PR_FALSE;
     if (i < length) {
       // Characters that aren't the start of a cluster are ignored here. They
       // get added to whatever lowercase/non-lowercase run we're in.
       if (!inner->IsClusterStart(i)) {
@@ -333,17 +333,17 @@ nsCaseTransformTextRunFactory::RebuildTe
 {
   PRUint32 length = aTextRun->GetLength();
   const PRUnichar* str = aTextRun->GetTextUnicode();
   nsRefPtr<nsStyleContext>* styles = aTextRun->mStyles.Elements();
 
   nsAutoString convertedString;
   nsAutoTArray<PRPackedBool,50> charsToMergeArray;
   nsAutoTArray<nsStyleContext*,50> styleArray;
-  nsAutoTArray<PRPackedBool,50> canBreakBeforeArray;
+  nsAutoTArray<PRUint8,50> canBreakBeforeArray;
   PRUint32 extraCharsCount = 0;
 
   PRUint32 i;
   for (i = 0; i < length; ++i) {
     PRUnichar ch = str[i];
 
     charsToMergeArray.AppendElement(PR_FALSE);
     styleArray.AppendElement(styles[i]);
--- a/layout/generic/nsTextRunTransformations.h
+++ b/layout/generic/nsTextRunTransformations.h
@@ -112,17 +112,17 @@ public:
       delete mFactory;
     }
   }
   
   void SetCapitalization(PRUint32 aStart, PRUint32 aLength,
                          PRPackedBool* aCapitalization,
                          gfxContext* aRefContext);
   virtual PRBool SetPotentialLineBreaks(PRUint32 aStart, PRUint32 aLength,
-                                        PRPackedBool* aBreakBefore,
+                                        PRUint8* aBreakBefore,
                                         gfxContext* aRefContext);
   /**
    * Called after SetCapitalization and SetPotentialLineBreaks
    * are done and before we request any data from the textrun. Also always
    * called after a Create.
    */
   void FinishSettingProperties(gfxContext* aRefContext)
   {