diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/allmakefiles.sh mozilla.lbi/allmakefiles.sh
858a859
> 	    extensions/irc/libbs/Makefile
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/build/build_number mozilla.lbi/build/build_number
1c1
< 0000000000
---
> 2000101018
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/editor/ui/composer/locale/en-US/editorOverlay.dtd mozilla.lbi/editor/ui/composer/locale/en-US/editorOverlay.dtd
233c233
< <!ENTITY dcharIso6Cmd.label ".Arabic (ISO-8859-6)">
---
> <!ENTITY dcharIso6Cmd.label "Arabic (ISO-8859-6)">
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/editor/ui/composer/locale/en-US/viewSource.dtd mozilla.lbi/editor/ui/composer/locale/en-US/viewSource.dtd
26,27c26,27
< <!ENTITY mainWindow.title "Mozilla"> 
< <!ENTITY mainWindow.titlemodifier "Mozilla"> 
---
> <!ENTITY mainWindow.title "AraZilla"> 
> <!ENTITY mainWindow.titlemodifier "AraZilla"> 
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/gfx/idl/Makefile.in mozilla.lbi/gfx/idl/Makefile.in
29c29
< MODULE		= raptor
---
> MODULE		= layout
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/gfx/public/nsDeviceContext.h mozilla.lbi/gfx/public/nsDeviceContext.h
71a72,76
> //ARAZILLA
>   NS_IMETHOD  GetAraState(int &aState);  // include Dir | hindi | ...
>   NS_IMETHOD  SetAraState(int aState);
> //!ARAZILLA
> 
118a124,125
> //ARAZILLA 
>   int		    mState; // Ara state Dir | hindi | ...
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/gfx/public/nsIDeviceContext.h mozilla.lbi/gfx/public/nsIDeviceContext.h
296a297,302
> 
> // ARAZILLA add
>   NS_IMETHOD  SetAraState(int aState) = 0;
>   NS_IMETHOD  GetAraState(int &aState) = 0;
> //!ARAZILLA 
> 
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/gfx/public/nsIRenderingContext.h mozilla.lbi/gfx/public/nsIRenderingContext.h
532c532
<    * @return error status
---
>    a @return error status
536a537,547
> #ifdef IBMBIDI  // and GTK???
> // ARAZILLA 
>   NS_IMETHOD GetWidthGlyph(const PRUnichar* aString, PRUint32 aIndex,
>                                 nscoord& aWidth, PRInt32* aFontID = nsnull)  = 0;
> 
>   NS_IMETHOD DrawStringGlyph(const PRUnichar* aString, PRUint32 aLength,
>                                   nscoord aX, nscoord aY,
>                                   PRInt32 aFontID = -1 ,
>                                   const nscoord* aSpacing = nsnull) = 0;
> #endif
> 
758a770,775
> 
> #ifdef IBMBIDI
>   NS_IMETHOD
>   SetReverseFlag(PRBool aIsVisual) = 0;
> #endif // IBMBIDI
> 
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/gfx/src/beos/nsRenderingContextBeOS.h mozilla.lbi/gfx/src/beos/nsRenderingContextBeOS.h
156a157,160
> #ifdef IBMBIDI
>   NS_IMETHOD SetReverseFlag(PRBool aIsVisual) {;}
> #endif // IBMBIDI
> 
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/gfx/src/gtk/Makefile.in mozilla.lbi/gfx/src/gtk/Makefile.in
29c29
< MODULE		= raptor
---
> MODULE		= layout
33d32
< REQUIRES	= util img xpcom raptor netlib ps
50a50
> 		nsPrintOptionsGTK.cpp \
66c66,67
< 		-lraptorgfx \
---
> 		-lgkgfx \
> 		$(MOZ_JS_LIBS) \
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/gfx/src/gtk/nsFontMetricsGTK.cpp mozilla.lbi/gfx/src/gtk/nsFontMetricsGTK.cpp
40a41,44
> //ARAZILLA 
> extern "C" int AGlyphStrUni_to_lbi8x(PRUnichar*,  char *, int ) ;
> 
> 
1619a1624,1630
> //ARAZILLA
>  gint GetWidthGlyph(const PRUnichar* aString, PRUint32 aLength); 
>  gint DrawStringGlyph(nsRenderingContextGTK* aContext,
>                          nsDrawingSurfaceGTK* aSurface, nscoord aX,
>                          nscoord aY, const PRUnichar* aString,
>                          PRUint32 aLength); 
> //!ARAZILLA
1643a1655
>   int notiso6 = strcmp(mCharSetInfo->mCharSet,"ISO-8859-6");
1645a1658
> //ARAZILLA test
1648a1662,1663
>   if(notiso6)
>       return ::gdk_text_width_glyph(mFont, (char*) buf, len); 
1652a1668,1696
> nsFontGTKNormal::GetWidthGlyph(const PRUnichar* aString, PRUint32 aLength)
> {
>   if (!mFont) {
>     LoadFont();
>     if (!mFont) {
>       return 0;
>     }
>   }
> 
>   unsigned char buf[1024];
>   int notiso6 = strcmp(mCharSetInfo->mCharSet,"ISO-8859-6");
> 
>   gint len;
>   if(notiso6)
>   {
>      len = mCharSetInfo->Convert(mCharSetInfo,
>         (XFontStruct*) GDK_FONT_XFONT(mFont), aString, aLength, (char*) buf,
>         sizeof(buf));
>   } 
>   else
>   {
>      len = AGlyphStrUni_to_lbi8x(aString,  buf,aLength);
>   }
> //printf("CALL GTK WIDTH GLYPH %s for %d char : [",mCharSetInfo->mCharSet,len);
> //int j; for(j=0;j<len;j++)printf("%02x ",buf[j]);printf("]\n");
>   return ::gdk_text_width_glyph(mFont, buf, len);
> }  
> 
> gint
1663a1708,1709
> //ARAZILLA
>   int notiso6 = strcmp(mCharSetInfo->mCharSet,"ISO-8859-6");
1668a1715,1721
> //ARAZILLA
>   if(notiso6)
>   {
>       ::gdk_draw_text_glyph(aSurface->GetDrawable(), mFont, aContext->GetGC(), aX,
>             aY + mBaselineAdjust, (char*) buf, len);
>       return ::gdk_text_width_glyph(mFont, (char*) buf, len);
>   }
1673a1727,1761
> 
> gint
> nsFontGTKNormal::DrawStringGlyph(nsRenderingContextGTK* aContext,
>                             nsDrawingSurfaceGTK* aSurface,
>                             nscoord aX, nscoord aY,
>                             const PRUnichar* aString, PRUint32 aLength)
> {
>   if (!mFont) {
>     LoadFont();
>     if (!mFont) {
>       return 0;
>     }
>   }
> 
>   char buf[1024];
>   int notiso6 = strcmp(mCharSetInfo->mCharSet,"ISO-8859-6");
>  
>   gint len;
>   if(notiso6)
>   {                                                                                                         
>       len = mCharSetInfo->Convert(mCharSetInfo,
>            (XFontStruct*) GDK_FONT_XFONT(mFont), aString, aLength, (char*) buf, sizeof(buf));
>   }
>   else
>   {
>       len = AGlyphStrUni_to_lbi8x(aString,  buf,aLength);
>   }
> 
> //printf("CALL GTK DRAW GLYPH %s for %d char : [",mCharSetInfo->mCharSet,len);
> //int j; for(j=0;j<len;j++)printf("%02x ",buf[j]);printf("]\n");
>   ::gdk_draw_text_glyph(aSurface->GetDrawable(), mFont, aContext->GetGC(), aX,
>     aY + mBaselineAdjust, (char*) buf, len);
>   return ::gdk_text_width_glyph(mFont, (char*) buf, len);
> }
> 
1724a1813,1819
> //ARAZILLA
>  gint GetWidthGlyph(const PRUnichar* aString, PRUint32 aLength); 
>  gint DrawStringGlyph(nsRenderingContextGTK* aContext,
>                          nsDrawingSurfaceGTK* aSurface, nscoord aX,
>                          nscoord aY, const PRUnichar* aString,
>                          PRUint32 aLength); 
> //!ARAZILLA
1824a1920,1933
> //ARAZILLA ADD for compil, but not yet supported...
> gint
> nsFontGTKSubstitute::GetWidthGlyph(const PRUnichar* aString, PRUint32 aLength)
> {
>    return GetWidth( aString, aLength) ;
> }
> nsFontGTKSubstitute::DrawStringGlyph(nsRenderingContextGTK* aContext,
>                                 nsDrawingSurfaceGTK* aSurface,
>                                 nscoord aX, nscoord aY,
>                                 const PRUnichar* aString, PRUint32 aLength)
> {
>    return DrawString(aContext,aSurface,aX,aY,aString,aLength);
> }
> //!ARAZILLA 
1851a1961,1967
> //ARAZILLA
>  gint GetWidthGlyph(const PRUnichar* aString, PRUint32 aLength); 
>  gint DrawStringGlyph(nsRenderingContextGTK* aContext,
>                          nsDrawingSurfaceGTK* aSurface, nscoord aX,
>                          nscoord aY, const PRUnichar* aString,
>                          PRUint32 aLength); 
> //!ARAZILLA
1905a2022,2036
> 
> //ARAZILLA ADD for compil, but not yet supported...
> gint
> nsFontGTKUserDefined::GetWidthGlyph(const PRUnichar* aString, PRUint32 aLength)
> {
>    return GetWidth( aString, aLength) ;
> }
> nsFontGTKUserDefined::DrawStringGlyph(nsRenderingContextGTK* aContext,
>                                 nsDrawingSurfaceGTK* aSurface,
>                                 nscoord aX, nscoord aY,
>                                 const PRUnichar* aString, PRUint32 aLength)
> {
>    return DrawString(aContext,aSurface,aX,aY,aString,aLength);
> }
> //!ARAZILLA 
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/gfx/src/gtk/nsFontMetricsGTK.h mozilla.lbi/gfx/src/gtk/nsFontMetricsGTK.h
74a75,82
> //ARAZILLA
>   virtual gint GetWidthGlyph(const PRUnichar* aString, PRUint32 aLength) = 0;
>   virtual gint DrawStringGlyph(nsRenderingContextGTK* aContext,
>                           nsDrawingSurfaceGTK* aSurface, nscoord aX,
>                           nscoord aY, const PRUnichar* aString,
>                           PRUint32 aLength) = 0;
> //!ARAZILLA
> 
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/gfx/src/gtk/nsRenderingContextGTK.cpp mozilla.lbi/gfx/src/gtk/nsRenderingContextGTK.cpp
48a49,97
> //ARAZILLA for test charset only.....
> extern "C" int AGetLang() ;
> extern "C" int AGlyphStrUni_to_lbi8x(PRUnichar*,  char *, int ) ;
> struct nsFontCharSetInfo
> {
>   const char*            mCharSet;
>   nsFontCharSetConverter Convert;
>   PRUint8                mSpecialUnderline;
>   PRUint32*              mMap;
>   void*     mConverter;
>   nsIAtom*               mLangGroup;
> };
> 
> // ARAZILLA This routine check if the c and the font are both Arabic
> // Otherwise, it uses Arabic ISO-6 fonts even to diplay ASCII chars...
> 
> static int FPCharIsArabic(PRUnichar c)
> {
>      return((c<0x0600 || 0x06FF<c)?0:1);
> }
> 
> static int FPCharInFontAra(nsFontGTK** font, PRUnichar c)
> {
>     nsFontCharSetInfo * CharsetInfo = (*font)->mCharSetInfo;
>     int notiso6 = 1;
>     if (CharsetInfo && CharsetInfo->mCharSet) 
>         notiso6 = strcmp(CharsetInfo->mCharSet,"ISO-8859-6");
>     if((notiso6 && (c<0x0600 || 0x06FF<c)) 
>        || (!notiso6 && c>0x0600 && c<0x06FF) )
>         return 1;
>     else
>         return 0;
> }
> static int FPAraGlyphInFontAra(nsFontGTK** font, PRUnichar c)
> {
>     nsFontCharSetInfo * CharsetInfo = (*font)->mCharSetInfo;
>     int fontiso6 = 0; 
>     if(CharsetInfo && CharsetInfo->mCharSet)
>        fontiso6 = (strcmp(CharsetInfo->mCharSet,"ISO-8859-6"))?0:1;
>     if( fontiso6 && ( ( c>=0x0600 && 0x0652>=c)
> 	             || (c>=0xFE00 && 0xFEFF>c)
> 		     || (c==0x200c) 
> 		     || (c==0x200d) ) )
>         return 1;
>     else
>         return 0;
> }
> //!ARAZILLA
> 
1187a1237
> //printf("+++++++++ GetWidth char* len=%d\n",aLength);
1189c1239,1240
<     gint rawWidth = gdk_text_width (mCurrentFont, aString, aLength);
---
> //ARAZILLA was    gint rawWidth = gdk_text_width (mCurrentFont, aString, aLength);
>     gint rawWidth = gdk_text_width_glyph (mCurrentFont, aString, aLength);
1198a1250
> //printf("+++++++++ GetWidth PRUnichar* len=%d\n",aLength);
1214a1267,1275
> //ARAZILLA  IBMBIDI
> // This allows to keep the current font if the char is available anyway in it...
> // Arabic ISO8859-6 fonts also include ASCII
> //      if(prevFont && IS_REPRESENTABLE(prevFont->mMap, c)) {
> //          currFont = prevFont;
> //          goto FoundFont;
> //      }
> //      else
> //!ARAZILLA                                                                                                               
1216c1277,1278
<         if (IS_REPRESENTABLE((*font)->mMap, c)) {
---
>         if (IS_REPRESENTABLE((*font)->mMap, c) && FPCharInFontAra(font, c)) {
> //ARAZILLA was        if (IS_REPRESENTABLE((*font)->mMap, c)) 
1249a1312,1375
> //ARAZILLA
> NS_IMETHODIMP
> nsRenderingContextGTK::GetWidthGlyph(const PRUnichar* aString, PRUint32 aIndex,
>                                 nscoord& aWidth, PRInt32* aFontID)
> {
>   if (0 ==  aIndex) {
>     aWidth = 0;
>   }
>   else {
>     g_return_val_if_fail(aString != NULL, NS_ERROR_FAILURE);
> 
>     nsFontMetricsGTK* metrics = (nsFontMetricsGTK*) mFontMetrics;
>     nsFontGTK* prevFont = nsnull;
>     gint rawWidth = 0;
>     PRUint32 start = 0;
>     PRUint32 i;
>     for (i = 0; i < aIndex; i++) {
>       PRUnichar c = aString[i];
>       nsFontGTK* currFont = nsnull;
>       nsFontGTK** font = metrics->mLoadedFonts;
>       nsFontGTK** end = &metrics->mLoadedFonts[metrics->mLoadedFontsCount];
> 
>       while (font < end) {
>         if ((IS_REPRESENTABLE((*font)->mMap, c) && FPCharInFontAra(font, c)) ||
> 		FPAraGlyphInFontAra(font, c)) {
>           currFont = *font;
> //printf("Char %04x found in %s\n", c, ((*font)->mCharSetInfo)->mCharSet);
>           goto FoundFont; // for speed -- avoid "if" statement
>         }
>         font++;
>       }
>       currFont = metrics->FindFont(c);
> FoundFont:
>       // XXX avoid this test by duplicating code -- erik
>       if (prevFont) {
>         if (currFont != prevFont) {
>             rawWidth += prevFont->GetWidthGlyph(&aString[start],(PRUint32)( i - start));
> //printf("Flush in %s %d char :[",((prevFont)->mCharSetInfo)->mCharSet,i - start);
> //int j; for(j=0;j<i-start;j++)printf("%04x ",aString[j+start]);printf("]\n");
>             prevFont = currFont;
>             start = i;
>         }
>    
>       }
>       else {
>         prevFont = currFont;
>         start = i;
>       }
>     }
> 
>     if (prevFont) {
>          rawWidth += prevFont->GetWidthGlyph(&aString[start], i - start);
> //printf("FFlush in %s %d char :[",((prevFont)->mCharSetInfo)->mCharSet,i - start);
> //int j; for(j=0;j<i-start;j++)printf("%04x ",aString[j+start]);printf("]\n");
>     }
> 
>     aWidth = NSToCoordRound(rawWidth * mP2T);
>   }
>   if (nsnull != aFontID)
>     *aFontID = 0;
> 
>   return NS_OK;
> }
> 
1270c1396,1397
< 
---
> //printf("------- DrawString char* len=%d [",aLength);
> //int i; for(i=0;i<aLength;i++)printf("%c",aString[i]);printf("]\n");
1287c1414,1415
<       ::gdk_draw_text (mSurface->GetDrawable(), mCurrentFont,
---
> //ARAZILLA was      ::gdk_draw_text (mSurface->GetDrawable(), mCurrentFont,
>       ::gdk_draw_text_glyph (mSurface->GetDrawable(), mCurrentFont,
1352a1481,1492
> // ARAZILLA 
> // 
> //int j;
> //printf("FP ContextGTK::DrawString (XY=%d %d) %d char [",x,y,aLength);
> //for(j=0;j<aLength;j++)if( aString[j] > 255)printf("U+%04x",aString[j]); else printf("%c",aString[j]);
> //printf("]\n");
> // !ARAZILLA
> //ARAZILLA
> #ifdef IBMBIDI
> int rtl = AGetLang()-1;  // XXX HACK  AGetLang ret 1 for LATIN and 2 for ARABIC
> #endif
> //!ARAZILLA
1361a1502,1510
> //ARAZILLA  IBMBIDI
> // This allows to keep the current font if the char is available anyway in it... 
> // Arabic ISO8859-6 fonts also include ASCII
> //      if(prevFont && IS_REPRESENTABLE(prevFont->mMap, c)) {
> //          currFont = prevFont;
> //          goto FoundFont;
> //      }
> //      else
> //!ARAZILLA
1363c1512,1513
<         if (IS_REPRESENTABLE((*font)->mMap, c)) {
---
>         if (IS_REPRESENTABLE((*font)->mMap, c) && FPCharInFontAra(font, c)) {
> // ARAZILLA was if (IS_REPRESENTABLE((*font)->mMap, c))
1374c1524,1525
<           if (aSpacing) {
---
> //ARAZILLA add for Spacing display (Justification) was: if (aSpacing)
>           if (aSpacing && !FPCharIsArabic(aString[start])) {
1386a1538,1542
> #ifdef IBMBIDI
>            if(rtl)
>             x += prevFont->GetWidth(&aString[start], i - start);
>            else
> #endif
1401c1557,1558
<       if (aSpacing) {
---
> //ARAZILLA add for Spacing display (Justification) was: if (aSpacing)
>      if (aSpacing && !FPCharIsArabic(aString[start])) { 
1414c1571,1612
<         prevFont->DrawString(this, mSurface, x, y, &aString[start], i - start);
---
> //printf("   Final Draw %d char from pos %d at %d %d\n",i - start, start, x, y);
> #ifdef IBMBIDI
>            if(rtl)
>             x += prevFont->GetWidth(&aString[start], i - start);
>            else
> #endif
>          x += prevFont->DrawString(this, mSurface, x, y, &aString[start], i - start);
>       }
>     }
> #ifdef IBMBIDI
> //ARAZILLA 
> //----------------------------------------------------------------
>     if (rtl)
>     {
>     start = 0;
>     for (i = 0; i < aLength; i++) {
>       PRUnichar c = aString[i];
>       nsFontGTK* currFont = nsnull;
>       nsFontGTK** font = metrics->mLoadedFonts;
>       nsFontGTK** lastFont = &metrics->mLoadedFonts[metrics->mLoadedFontsCount];
>       while (font < lastFont) {
>           if (IS_REPRESENTABLE((*font)->mMap, c) && FPCharInFontAra(font, c)) {
>           currFont = *font;
>           goto FoundFontrtl; // for speed -- avoid "if" statement
>         }
>         font++;
>       }
>       currFont = metrics->FindFont(c);
> FoundFontrtl:
>       // XXX avoid this test by duplicating code -- erik
>       if (prevFont) {
>         if (currFont != prevFont) {
>              x -= prevFont->GetWidth(&aString[start], i - start);
>              prevFont->DrawString(this, mSurface, x, y, &aString[start],
>                                       i - start); 
>           prevFont = currFont;
>           start = i;
>         }
>       }
>       else {
>         prevFont = currFont;
>         start = i;
1416a1615,1626
>     if (prevFont) {
>              x -= prevFont->GetWidth(&aString[start], i - start);
>              prevFont->DrawString(this, mSurface, x, y, &aString[start],
>                                       i - start); 
>     }
> //if(x!=ox)
> //printf("GFX WARNING X=%d ox=%x -----------------------\n",x,ox);
>     } // rtl    
> 
> //----------------------------------------------------------------
> #endif //IBMBIDI
> 
1421a1632,1740
> 
> #ifdef IBMBIDI
> //ARAZILLA ADD
> NS_IMETHODIMP
> nsRenderingContextGTK::DrawStringGlyph(const PRUnichar* aString, PRUint32 aLength,
>                                   nscoord aX, nscoord aY,
>                                   PRInt32 aFontID,
>                                   const nscoord* aSpacing)
> {
>   if (aLength && mFontMetrics) {
>     g_return_val_if_fail(mTranMatrix != NULL, NS_ERROR_FAILURE);
>     g_return_val_if_fail(mSurface != NULL, NS_ERROR_FAILURE);
>     g_return_val_if_fail(aString != NULL, NS_ERROR_FAILURE);
> 
>     nscoord x = aX;
>     nscoord y;
> 
>     UpdateGC();
> 
>     // Substract xFontStruct ascent since drawing specifies baseline
>     mFontMetrics->GetMaxAscent(y);
>     y += aY;
>     aY = y;
> 
>     mTranMatrix->TransformCoord(&x, &y);
> 
> // ARAZILLA 
> // 
> //int j;
> //printf("FP ContextGTK::DrawStringGlyph(XY=%d %d) %d char [",x,y,aLength);
> //for(j=0;j<aLength;j++)if( aString[j] > 255)printf("U+%04x",aString[j]); else printf("%c",aString[j]);
> //printf("]\n");
> // !ARAZILLA
>     nsFontMetricsGTK* metrics = (nsFontMetricsGTK*) mFontMetrics;
>     nsFontGTK* prevFont = nsnull;
>     PRUint32 start = 0;
>     PRUint32 i;
>     for (i = 0; i < aLength; i++) {
>       PRUnichar c = aString[i];
>       nsFontGTK* currFont = nsnull;
>       nsFontGTK** font = metrics->mLoadedFonts;
>       nsFontGTK** lastFont = &metrics->mLoadedFonts[metrics->mLoadedFontsCount];
>       while (font < lastFont) {
>         if ((IS_REPRESENTABLE((*font)->mMap, c) && FPCharInFontAra(font, c)) ||
>                 FPAraGlyphInFontAra(font, c)) {                                                             
> // ARAZILLA was if (IS_REPRESENTABLE((*font)->mMap, c))
>           currFont = *font;
>           goto FoundFont; // for speed -- avoid "if" statement
>         }
>         font++;
>       }
>       currFont = metrics->FindFont(c);
> FoundFont:
>       // XXX avoid this test by duplicating code -- erik
>       if (prevFont) {
>         if (currFont != prevFont) {
>           if (aSpacing) {
>             const PRUnichar* str = &aString[start];
>             const PRUnichar* end = &aString[i];
>             while (str < end) {
>               x = aX;
>               y = aY;
>               mTranMatrix->TransformCoord(&x, &y);
>               prevFont->DrawStringGlyph(this, mSurface, x, y, str, 1);
>               aX += *aSpacing++;
>               str++;
>             }
>           }
>           else {
> //printf("REND   LOOP  Draw %d char from pos %d at %d %d\n",i - start, start, x, y);
>             x += prevFont->DrawStringGlyph(this, mSurface, x, y, &aString[start],
>                                       i - start);
>           }
>           prevFont = currFont;
>           start = i;
>         }
>       }
>       else {
>         prevFont = currFont;
>         start = i;
>       }
>     }
> 
>     if (prevFont) {
>      if (aSpacing) { 
>         const PRUnichar* str = &aString[start];
>         const PRUnichar* end = &aString[i];
>         while (str < end) {
>           x = aX;
>           y = aY;
>           mTranMatrix->TransformCoord(&x, &y);
>           prevFont->DrawStringGlyph(this, mSurface, x, y, str, 1);
>           aX += *aSpacing++;
>           str++;
>         }
>       }
>       else {
> //printf("REND   Final Draw %d char from pos %d at %d %d\n",i - start, start, x, y);
>          x += prevFont->DrawStringGlyph(this, mSurface, x, y, &aString[start], i - start);
>       }
>     }
>   }
> 
>   return NS_OK;
> }
> //!ARAZILLA ADD
> #endif // IBMBIDI
> 
> 
1698a2018,2027
> //ARAZILLA  IBMBIDI
> // This allows to keep the current font if the char is available anyway in it...
> // Arabic ISO8859-6 fonts also include ASCII
> //printf("FP GetBoundingMetrics len=%d\n",aLength);
> //      if(prevFont && IS_REPRESENTABLE(prevFont->mMap, c)) {
> //          currFont = prevFont;
> //          goto FoundFont;
> //      }
> //      else
> //!ARAZILLA 
1700c2029,2030
<         if (IS_REPRESENTABLE((*font)->mMap, c)) {
---
>         if (IS_REPRESENTABLE((*font)->mMap, c) && FPCharInFontAra(font, c)) {
> //ARAZILLA was        if (IS_REPRESENTABLE((*font)->mMap, c)) 
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/gfx/src/gtk/nsRenderingContextGTK.h mozilla.lbi/gfx/src/gtk/nsRenderingContextGTK.h
143a144,151
> //ARAZILLA
>   NS_IMETHOD GetWidthGlyph(const PRUnichar *aString, PRUint32 aLength, nscoord &aWidth,
>                       PRInt32 *aFontID);
>   NS_IMETHOD DrawStringGlyph(const PRUnichar *aString, PRUint32 aLength,
>                         nscoord aX, nscoord aY,
>                         PRInt32 aFontID,
>                         const nscoord* aSpacing);
> //!ARAZILLA
169a178,181
> 
> #ifdef IBMBIDI
>   NS_IMETHOD SetReverseFlag(PRBool aIsVisual) {;}
> #endif // IBMBIDI
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/gfx/src/mac/nsRenderingContextMac.h mozilla.lbi/gfx/src/mac/nsRenderingContextMac.h
136a137,140
> #ifdef IBMBIDI
>   NS_IMETHOD SetReverseFlag(PRBool aIsVisual) {;}
> #endif // IBMBIDI
> 
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/gfx/src/motif/nsRenderingContextMotif.h mozilla.lbi/gfx/src/motif/nsRenderingContextMotif.h
170a171,174
> #ifdef IBMBIDI
>   NS_IMETHOD SetReverseFlag(PRBool aIsVisual) {;}
> #endif // IBMBIDI
> 
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/gfx/src/nsDeviceContext.cpp mozilla.lbi/gfx/src/nsDeviceContext.cpp
40a41,43
> //ARAZILLA
> extern "C" ASetLang(int);
> 
79a83,84
> //ARAZILLA
>   mState = nsnull ;  // default Dir=LATIN | Nohindi...
306a312,331
> 
> //ARAZILLA
> //  NS_IMETHOD  SetAraState(int aState);         
> //  NS_IMETHOD  GetAraState(int &aState);  // include Dir | hindi | ...
> NS_IMETHODIMP DeviceContextImpl :: SetAraState(int aState)
> {
>   if (mState != aState) {
>     mState = aState;
> printf(" DeviceContextImpl :: SetAraState = %d\n",aState);
>     ASetLang(aState?2:1);  // aState=0=LATIN aState=1=ARABIC of ArabCntx 
>   }
>   return NS_OK;
> }
> 
> NS_IMETHODIMP DeviceContextImpl :: GetAraState(int &aState) 
> {
>   aState = mState;
>   return NS_OK;
> }  
> //!ARAZILLA
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/gfx/src/os2/nsRenderingContextOS2.h mozilla.lbi/gfx/src/os2/nsRenderingContextOS2.h
180a181,183
> #ifdef IBMBIDI
>   NS_IMETHOD SetReverseFlag(PRBool aIsVisual) {;}
> #endif // IBMBIDI
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/gfx/src/photon/nsRenderingContextPh.h mozilla.lbi/gfx/src/photon/nsRenderingContextPh.h
165a166,169
> #ifdef IBMBIDI
>   NS_IMETHOD SetReverseFlag(PRBool aIsVisual) {;}
> #endif // IBMBIDI
> 
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/gfx/src/ps/nsRenderingContextPS.cpp mozilla.lbi/gfx/src/ps/nsRenderingContextPS.cpp
1041a1042,1055
> //ARAZILLA 
> NS_IMETHODIMP
> nsRenderingContextPS :: GetWidthGlyph(const PRUnichar *aString,PRUint32 aLength,nscoord &aWidth, PRInt32 *aFontID)
> {
>  
>   if (nsnull != mFontMetrics){
>     ((nsFontMetricsPS*)mFontMetrics)->GetStringWidth(aString,aWidth,aLength);
>     return NS_OK;
>   } else {
>     return NS_ERROR_FAILURE;
>   }
>  
> }                                                                                                          
> //!ARAZILLA
1153a1168,1176
> //FP add for compat for now
> NS_IMETHODIMP
> nsRenderingContextPS :: DrawStringGlyph(const PRUnichar *aString, PRUint32 aLength,
>                                     nscoord aX, nscoord aY, PRInt32 aFontID,
>                                     const nscoord* aSpacing)
> { 
> 	return DrawString(aString,aLength,aX, aY,aFontID,aSpacing);
> }
> //!ARAZILLA
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/gfx/src/ps/nsRenderingContextPS.h mozilla.lbi/gfx/src/ps/nsRenderingContextPS.h
145a146,155
> //ARAZILLA 
> #ifdef IBMBIDI
>   NS_IMETHOD GetWidthGlyph(const PRUnichar* aString, PRUint32 aLength,
>                       nscoord& aWidth, PRInt32 *aFontID);
>   NS_IMETHOD DrawStringGlyph(const PRUnichar *aString, PRUint32 aLength,
>                         nscoord aX, nscoord aY,
>                         PRInt32 aFontID,
>                         const nscoord* aSpacing);
> #endif
> //!ARAZILLA
205a216,219
> 
> #ifdef IBMBIDI
>   NS_IMETHOD SetReverseFlag(PRBool aIsVisual) {;}
> #endif // IBMBIDI
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/gfx/src/qt/nsRenderingContextQT.h mozilla.lbi/gfx/src/qt/nsRenderingContextQT.h
215a216,219
> #ifdef IBMBIDI
>   NS_IMETHOD SetReverseFlag(PRBool aIsVisual) {;}
> #endif // IBMBIDI
> 
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/gfx/src/windows/nsRenderingContextWin.cpp mozilla.lbi/gfx/src/windows/nsRenderingContextWin.cpp
48,50c48,51
< //comment this out so we won't do arabic and hebrew buggy reordering untill
< // it get fixed 
< //#define  ARABIC_HEBREW_RENDERING
---
> #define ARABIC_HEBREW_RENDERING
> #if defined (IBMBIDI) && defined (ARABIC_HEBREW_RENDERING)
> #define IS_BIDI_SYSTEM (::GetSystemMetrics(SM_MIDEASTENABLED) == PR_TRUE)
> #endif // IBMBIDI
209a211,213
> #ifdef IBMBIDI
>   mNeedReverse = PR_FALSE;
> #endif // IBMBIDI
1988c1992,1996
<                 HAS_ARABIC_PRESENTATION_FORM_B(prevFont), &bArabic ) )
---
>                 HAS_ARABIC_PRESENTATION_FORM_B(prevFont), &bArabic )
> #ifdef IBMBIDI
>                 && mNeedReverse // Lina: Arabic shaping needs special handling!!!
> #endif // IBMBIDI
>                 )
2455c2463,2467
<                 HAS_ARABIC_PRESENTATION_FORM_B(prevFont), &bArabic ) )
---
>                 HAS_ARABIC_PRESENTATION_FORM_B(prevFont), &bArabic )
> #ifdef IBMBIDI
>                 && mNeedReverse // Lina: Arabic shaping needs special handling!!!
> #endif // IBMBIDI
>                 )
2513c2525,2529
<             HAS_ARABIC_PRESENTATION_FORM_B(prevFont), &bArabic ) )
---
>             HAS_ARABIC_PRESENTATION_FORM_B(prevFont), &bArabic ) 
> #ifdef IBMBIDI
>             && mNeedReverse // Lina: Arabic needs shaping special handling!!!
> #endif // IBMBIDI
>             )
3758,3759c3774,3792
< 
< 
---
> #ifdef IBMBIDI
> /**
>  *  Indicate whether right-to-left text needs to be reversed before rendering
>  *  
>  *  @lina 03/29/2000
>  */
> nsresult nsRenderingContextWin::SetReverseFlag(PRBool aIsVisual)
> {
> #ifdef IS_BIDI_SYSTEM
>   mNeedReverse = (aIsVisual == IS_BIDI_SYSTEM);
> #endif // IS_BIDI_SYSTEM
> #if 0
> #ifdef ARABIC_HEBREW_RENDERING
>   mNeedReverse = !aIsVisual;
> #endif // ARABIC_HEBREW_RENDERING
> #endif // 0
>   return NS_OK;
> }
> #endif // IBMBIDI
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/gfx/src/windows/nsRenderingContextWin.h mozilla.lbi/gfx/src/windows/nsRenderingContextWin.h
185a186,189
> #ifdef IBMBIDI
>   NS_IMETHOD SetReverseFlag(PRBool aIsVisual);
> #endif // IBMBIDI
> 
262a267,270
> #ifdef IBMBIDI
>   PRBool           mNeedReverse;
> #endif // IBMBIDI
> 
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/gfx/src/xlib/nsRenderingContextXlib.h mozilla.lbi/gfx/src/xlib/nsRenderingContextXlib.h
197a198,201
> #ifdef IBMBIDI
>   NS_IMETHOD SetReverseFlag(PRBool aIsVisual) {;}
> #endif // IBMBIDI
> 
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/include/allxpstr.h mozilla.lbi/include/allxpstr.h
26,28c26,28
< #define MOZ_NAME_PRODUCT    "Mozilla"
< #define MOZ_NAME_BRAND      "Mozilla"
< #define MOZ_NAME_FULL       "Mozilla"
---
> #define MOZ_NAME_PRODUCT    "AraZilla"
> #define MOZ_NAME_BRAND      "AraZilla"
> #define MOZ_NAME_FULL       "AraZilla"
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/intl/uconv/src/charsetData.properties mozilla.lbi/intl/uconv/src/charsetData.properties
65a66
> windows-1256.LangGroup               = ar
94c95
< iso-8859-6.notForBrowser    = true
---
> #iso-8859-6.notForBrowser    = true
100c101
< windows-1256.notForBrowser  = true
---
> #windows-1256.notForBrowser  = true
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/intl/uconv/src/nsCharsetMenu.cpp mozilla.lbi/intl/uconv/src/nsCharsetMenu.cpp
60a61
> static const char * kURINC_BrowserMore7CharsetMenuRoot = "NC:BrowserMore7CharsetMenuRoot";
113a115
>   static nsIRDFResource * kNC_BrowserMore7CharsetMenuRoot;
308a311
> nsIRDFResource * nsCharsetMenu::kNC_BrowserMore7CharsetMenuRoot = NULL;
360a364
>   rdfServ->GetResource(kURINC_BrowserMore7CharsetMenuRoot, &kNC_BrowserMore7CharsetMenuRoot);
391a396,397
>   res = rdfUtil->MakeSeq(mInner, kNC_BrowserMore7CharsetMenuRoot, NULL);
>   if (NS_FAILED(res)) goto done;
433a440
>   NS_IF_RELEASE(kNC_BrowserMore7CharsetMenuRoot);
518a526
>   nsCOMPtr<nsIRDFContainer> container7;
526a535
>   char cs7[] = { "iso-8859-6, windows-1256, ibm-864, utf-8" };
546a556,560
> 
>   res = NewRDFContainer(mInner, kNC_BrowserMore7CharsetMenuRoot, 
>       getter_AddRefs(container7));
>   if (NS_FAILED(res)) return res;
>   AddFromStringToMenu(cs7, aRDFServ, aCCMan, NULL, container7, aDecs, NULL);
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/intl/uconv/src/nsUNIXCharset.cpp mozilla.lbi/intl/uconv/src/nsUNIXCharset.cpp
94c94,97
<    mCharset.AssignWithConversion("ISO-8859-1");
---
> //ARAZILLA
> //   mCharset.AssignWithConversion("ISO-8859-1");
>    mCharset.AssignWithConversion("ISO-8859-6");
> //!ARAZILLA
109a113,118
> 
> #ifdef DEBUG
> printf("nsUNIXCharset::GetCharset : mcharset =");
> int i ; for (i=0;i<mCharset.Length();i++)printf("%c",mCharset[i]);printf("\n");
> #endif
> 
119c128,130
<   charset.AssignWithConversion("ISO-8859-1");
---
> //ARAZILLA
> //  charset.AssignWithConversion("ISO-8859-1");
>   charset.AssignWithConversion("ISO-8859-6");
149c160,162
<     if(NS_FAILED(rv)) { charset.AssignWithConversion("ISO-8859-1"); }
---
> //ARAZILLA
> //    if(NS_FAILED(rv)) { charset.AssignWithConversion("ISO-8859-1"); }
>     if(NS_FAILED(rv)) { charset.AssignWithConversion("ISO-8859-6"); }
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/intl/uconv/ucvlatin/nsUnicodeToLangBoxArabic8.cpp mozilla.lbi/intl/uconv/ucvlatin/nsUnicodeToLangBoxArabic8.cpp
176a177,181
> 
> //ARAZILLA
>    for(i=0xfe70;i<0xfefd)
>       SET_REPRESENTABLE(aInfo, i); 
> //!ARAZILLA
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/intl/unicharutil/public/Makefile.in mozilla.lbi/intl/unicharutil/public/Makefile.in
32c32
< 		nsICaseConversion.h \
---
> 		nsICaseConversion.h nsIBiDi.h  nsIUBidiCategory.h \
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/intl/unicharutil/src/Makefile.in mozilla.lbi/intl/unicharutil/src/Makefile.in
38c38
<                 nsUcharUtilModule.cpp \
---
>                 nsUcharUtilModule.cpp nsBidiCategoryImp.cpp nsBiDiImp.cpp \
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/intl/unicharutil/src/nsUcharUtilModule.cpp mozilla.lbi/intl/unicharutil/src/nsUcharUtilModule.cpp
34a35,36
> #include "nsBidiCategoryImp.h"
> #include "nsBiDiImp.h"
69a72,74
> // Simon add
> NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiCategoryImp)
> NS_GENERIC_FACTORY_CONSTRUCTOR(nsBiDi)
87a93,97
> 		// Simon add
>   { "Unichar Bidi Utility", NS_UNICHARBIDIUTIL_CID, 
> 		NS_UNICHARBIDIUTIL_PROGID, nsBidiCategoryImpConstructor},
>   { "Bidi Reordering Engine", NS_BIDI_CID, 
> 		NS_BIDI_PROGID, nsBiDiConstructor}
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/layout/base/public/nsIFrame.h mozilla.lbi/layout/base/public/nsIFrame.h
993a994,1023
> #ifdef IBMBIDI
>   /**
>    *  retrieve and set BiDi property of this frame
>    *  @lina 5/1/2000
>    *  XXX not decided yet whether we need "next visual" property (probably, for selection)
>    *  If not needed, these 2 below may be discarded
>    */
>   NS_IMETHOD GetBidiProperty(nsIPresContext* aPresContext,
>                              nsIAtom*        aPropertyName,
>                              void**          aPropertyValue) const = 0;
>   NS_IMETHOD SetBidiProperty(nsIPresContext* aPresContext,
>                              nsIAtom*        aPropertyName,
>                              void*           aPropertyValue) const = 0;
> 
>   /**
>    *  retrieve and set embedding level of the frame
>    *  @lina 1/6/2000
>    */
>   NS_IMETHOD_(PRUint8) GetEmbeddingLevel(nsIPresContext* aPresContext) const = 0;
>   NS_IMETHOD SetEmbeddingLevel(nsIPresContext* aPresContext,
>                                PRUint8 aEmbeddingLevel) const = 0;
> 
> 
>   /**
>    * Retrieve the first renderable (not inline?) kid of this frame
>    * @lina 4/6/2000
>    */
>   NS_IMETHOD RenderableChild(nsIPresContext* aPresContext, nsIFrame** aRenderableChild) = 0;
> #endif // IBMBIDI
> 
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/layout/base/public/nsIPresContext.h mozilla.lbi/layout/base/public/nsIPresContext.h
326a327,331
> #ifdef IBMBIDI
>   NS_IMETHOD_(PRBool) IsVisualMode(void) const = 0;
>   NS_IMETHOD SetVisualMode(PRBool aIsVisual) = 0;
> #endif // IBMBIDI
> 
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/layout/base/public/nsLayoutAtomList.h mozilla.lbi/layout/base/public/nsLayoutAtomList.h
123a124,126
> #ifdef IBMBIDI
> LAYOUT_ATOM(embeddingLevel, "EmbeddingLevel")                  // PRUint8
> #endif // IBMBIDI
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/layout/base/src/nsCaret.cpp mozilla.lbi/layout/base/src/nsCaret.cpp
50a51,54
> // ARAZILLA
> #ifdef IBMBIDI
> extern "C" AGetKbd() ; 
> #endif
645d648
< 		
648a652,657
> //ARAZILLA
> #ifdef IBMBIDI
>                 if (AGetKbd()==2)
>                      caretRect.width += 20;
> #endif
> //!ARAZILLA
672a682,689
>       
> //ARAZILLA
> #ifdef IBMBIDI
>          if (AGetKbd()==2)
> 		localRC->SetColor(NS_RGB(0, 255, 255)); // we are drawing it; gray
>          else
> #endif
> //!ARAZILLA
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/layout/base/src/nsDocumentViewer.cpp mozilla.lbi/layout/base/src/nsDocumentViewer.cpp
297a298,299
> //ARAZILLA add
>   PRInt8   mDir;
339a342,344
> //ARAZILLA add
>   mDir=0;  //LTR
> 
1579a1585,1618
> //ARAZILLA Add for RTL/LTR menus
> PRInt8  ForcedDir = 0 ;   // DEFAULT to LTR
> NS_IMETHODIMP DocumentViewerImpl::SetDirection(PRUint8 aDir)
> {
>    ForcedDir = aDir;
> 
>    nsCOMPtr<nsIPresContext> presContext;
>    GetPresContext(*getter_AddRefs(presContext));
>    NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
> 
>    mDir = (aDir!=2)?aDir:0;  // instead of 0, read userpref here XXXX
> 
>    //ASetLang(mDir?2:1);     // mDir=0=LATIN mDir=1=ARABIC of ArabCntx 
>    //   if(mDir) setenv("AR_DIRECTION=arabic"); ca marche pas
>    //   else     setenv("AR_DIRECTION=latin");
> 
>    if (mDeviceContext) {
>       mDeviceContext->SetAraState((int)mDir);
>    }
> 
>    if( presContext )
>    {
>        presContext->SetDefaultDirection(mDir);
> 
>        // and now refresh
>        presContext->RemapStyleAndReflow();
>    }
> }
> NS_IMETHODIMP DocumentViewerImpl::GetDirection(PRInt8 * aDir)
> {
>    *aDir = mDir;
> }
> 
> //!ARAZILLA
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/layout/base/src/nsPresContext.cpp mozilla.lbi/layout/base/src/nsPresContext.cpp
114a115,125
> #ifdef IBMBIDI
> //ARAZILLA------------------------------------------------------------------
>   extern   PRInt8  ForcedDir;  // define in nsPresContext.cpp XXX hugly for now
>   if (ForcedDir !=2 ) 
>       mDefaultDirection = ForcedDir;
> //ARAZILLA------------------------------------------------------------------
> //ARAZILLA
> //  mDefaultDirection = NS_STYLE_DIRECTION_RTL;
> //!ARAZILLA
>   mIsVisual = PR_FALSE;
> #endif // IBMBIDI
1129a1141
> //printf("nsPresContext::GetDefaultDirection called: ret %d\n", mDefaultDirection);
1133a1146,1159
> #ifdef IBMBIDI
> PRBool
> nsPresContext::IsVisualMode() const
> {
>   return mIsVisual;
> }
> 
> NS_IMETHODIMP
> nsPresContext::SetVisualMode(PRBool aIsVisual)
> {
>   mIsVisual = aIsVisual;
>   return NS_OK;
> }
> #endif // IBMBIDI  
1137a1164
> //printf("nsPresContext::SetDefaultDirection with %d\n",aDirection);
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/layout/base/src/nsPresContext.h mozilla.lbi/layout/base/src/nsPresContext.h
145a146,149
> #ifdef IBMBIDI
>   NS_IMETHOD_(PRBool) IsVisualMode(void) const;
>   NS_IMETHOD SetVisualMode(PRBool aIsVisual);
> #endif // IBMBIDI
190a195,198
> 
> #ifdef IBMBIDI
>   PRBool                mIsVisual;
> #endif // IBMBIDI
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/layout/base/src/nsSelection.cpp mozilla.lbi/layout/base/src/nsSelection.cpp
76a77,85
> //ARAZILLA
> #include "nsIContent.h"
> #include "nsITextContent.h"
> #include "nsTextFragment.h"
> #include "nsLayoutAtoms.h"
> #include "nsHTMLIIDs.h"
> #include "nsFrame.h"
> //!ARAZILLA 
> 
1624a1634,1675
> #ifdef OLD_FULLWORD_SELECTION_IBMBIDI
> //ARAZILLA   
> // if we are on an Arabic text frame... 
>   nsCOMPtr<nsIAtom> frameType;
>   newFrame->GetFrameType(getter_AddRefs(frameType) );
>   if(frameType && frameType.get() == nsLayoutAtoms::textFrame )
>   {
>        nsresult rv;
>        nsITextContent*       textContent;
>        const nsTextFragment* fragment;
>        nsCOMPtr<nsIContent> content;
>        rv = newFrame->GetContent(getter_AddRefs(content) );
>        if (!NS_FAILED(rv) && (content) ) {
>            rv = content->QueryInterface(kITextContentIID, (void**) &textContent);
>            if (!NS_FAILED(rv) && (textContent) ) {
>                textContent->GetText(&fragment);
> 
>                if(fragment->Is2b())  // we assume 2b is Arabic (???XXX)
>                {
>                    contentOffsetEnd = fragment->GetLength() ;
> 
> //printf(" ARABIC FRAG 0 - %d \n",contentOffsetEnd);
>                    nsCOMPtr<nsIDOMNode> curNode;
>                    curNode = do_QueryInterface(newContent);
>                    PRInt8 index = GetIndexFromSelectionType(nsISelectionController::SELECTION_NORMAL);
> //printf("NSSEL:ECTION index8 = %d\n",index);
> 
>                    mDomSelections[index]->Extend(curNode, 0);
>                    mDomSelections[index]->Extend(curNode,contentOffsetEnd);
> 
> //printf(" ------------> FORCE START 0 TO %d HERE Node=%x \n",contentOffsetEnd,curNode);
> 
>                    NS_RELEASE(textContent);
>                    return rv;
>                }
> 
>                NS_RELEASE(textContent);
> //printf("TEST FRAME %d %d\n",startPos,contentOffsetEnd);
>            }
>        }
>   }
> #endif 
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/layout/base/src/nsStyleContext.cpp mozilla.lbi/layout/base/src/nsStyleContext.cpp
1020a1021,1025
> // ARAZILLA
>     extern PRInt8 ForcedDir; //define in nsPresContext.cpp XXX hugly for now   
>     if (ForcedDir != 2) // case for default
>         mDirection = ForcedDir;
> //!ARAZILLA
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/layout/html/base/src/nsBlockFrame.cpp mozilla.lbi/layout/html/base/src/nsBlockFrame.cpp
59a60,71
> #ifdef IBMBIDI
> #include "nsIServiceManager.h"
> #include "nsTextFragment.h"
> #include "nsIStyleSet.h"
> #include "nsDocument.h"
> #include "nsIBiDi.h"
> 
> static NS_DEFINE_CID(kBiDiCID, NS_BIDI_CID);
> static NS_DEFINE_IID(kIContentIID, NS_ICONTENT_IID);
> static NS_DEFINE_IID(kIDOMNodeIID, NS_IDOMNODE_IID);
> #endif // IBMBIDI
> 
1622a1635
> //printf("===========================================================  \nLY: Reflow : %d (%s) mLines=%x IsInLine=%d\n",aReflowState.reason,(aReflowState.reason==eReflowReason_Initial)?"Initial":"OTHER",mLines,(mLines)?mLines->IsInline():-1);
1631a1645,1651
> 
> #ifdef IBMBIDI
>     if ( (mLines) && (mLines->IsInline() ) ) {
>       BidiResolve(aPresContext);
>     }
> #endif // IBMBIDI
> 
4530a4551,4554
> #ifdef IBMBIDI
>     nextInFlow->SetEmbeddingLevel(aState.mPresContext,
>                                   aFrame->GetEmbeddingLevel(aState.mPresContext) );
> #endif // IBMBIDI
4718c4742,4758
< 
---
> #ifdef IBMBIDI
>   nsIFrame* nextInFlow = (aLine->mNext)
>     ? aLine->mNext->mFirstChild : nsnull;
> 
>   aLine->mVisualList.Clear();
>   aLine->InitVisualLineList(aState.mPresContext, aLine->mFirstChild, nextInFlow);
> 
>   if (!(aState.mPresContext->IsVisualMode() ) ) {
>     PRBool bidiEnabled;
>     // Set bidiEnabled to true if the line is reordered
>     aLine->Reorder(aState.mPresContext, bidiEnabled);
>     if (bidiEnabled) {
>       // Call *before* nsLineLayout::RelativePositionFrames()
>       aLine->RepositionInlineFrames(aState.mPresContext);
>     }
>   }
> #endif // IBMBIDI
6371a6412,6418
> #ifdef IBMBIDI
> #if 0
>         PRUint8 embeddingLevel;
>         kid->GetEmbeddingLevel(aPresContext, &embeddingLevel);
>         // XXX add EL check
> #endif
> #endif // IBMBIDI
7247a7295,7552
> 
> #ifdef IBMBIDI
> /**
>  *  Make BiDi engine resolve embedding levels of renderable kids of this block frame.
>  *
>  *  @param  Presentation context
>  *
>  *  @lina 05/02/2000
>  */
> nsresult
> nsBlockFrame::BidiResolve(nsIPresContext* aPresContext)
> {
>   if (!mLines) {
>     return NS_ERROR_FAILURE;
>   }
>   nsresult rv;
> 
> //printf("========-->BidiResove\n");
>   mLines->mVisualList.Clear();
>   mLines->InitVisualLineList(aPresContext, mLines->mFirstChild, nsnull);
> 
>   //XXX: Put lineBuffer in nsDocument???
>   nsAutoString lineBuffer((PRUnichar) NULL);
>   rv = mLines->CreateLineBuffer(aPresContext, lineBuffer);
>   if (NS_FAILED(rv) ) {
>     return rv;
>   }
>   if (lineBuffer.Length() < 1) {
>     return NS_OK;
>   }
> 
>   NS_WITH_SERVICE(nsIBiDi, BidiEngine, kBiDiCID, &rv);
>   if (NS_FAILED(rv) || !BidiEngine) {
>     return NS_ERROR_FAILURE;
>   }
> 
>   nsIFrame* frame;
>   PRInt32   lineOffset = 0;
>   PRInt32   logicalLimit;
>   PRInt32   runCount;
>   PRInt32   frameCount = mLines->mVisualList.Count();
>   PRUint8   embeddingLevel;
>     
>   const nsStyleDisplay* display;
>   GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&) display);
> 
>   UBiDiLevel paraLevel = (NS_STYLE_DIRECTION_RTL == display->mDirection)
>     ? UBIDI_RTL : UBIDI_LTR;
> 
> //ARAZILLA ADD Was BidiEngine->setPara(lineBuffer.GetUnicode(), -1, paraLevel, nsnull);
>   BidiEngine->setPara(lineBuffer.GetUnicode(), lineBuffer.Length(), paraLevel, nsnull);
> //!ARAZILLA
> 
>   rv = BidiEngine->countRuns(&runCount);
>   if (NS_FAILED(rv) ) {
>     return rv;
>   }
> 
> //printf("BIDI: BidiResolve len=%d counrRun=%d\n",lineBuffer.Length(),runCount);
>   if (runCount > 1) {
>     PRInt32               runLength;
>     PRInt32               fragmentLength = 0;
>     PRInt32               frameIndex = 0;
>     nsITextContent*       textContent;
>     const nsTextFragment* fragment;
> 
>     for (PRInt32 i = 0; i < runCount; i++) {
>       rv = BidiEngine->getLogicalRun(lineOffset, &logicalLimit, &embeddingLevel);
>       if (NS_FAILED(rv) ) {
>         break;
>       }
> //ARAZILLA ADD OK
> if (lineOffset == 0)  // first in the line ????
> {
>       runLength = logicalLimit - 1;
> //printf("    FIRST lineOffset=0, runLength=%d\n",runLength);
> }
> else
> //!ARAZILLA
>       runLength = logicalLimit - lineOffset ;
> //printf("   --> run %d runlen=%d (%d - %d), getLogicalRun ret lim=%d embedd=%d\n",i,runLength,logicalLimit,lineOffset,logicalLimit,embeddingLevel);
> 
>       while ( (frameIndex < frameCount) && (runLength > 0) ) {
>         frame = (nsIFrame*) (mLines->mVisualList[frameIndex++]);
> //ARAZILLA
> //printf("################### frame=%d\n",frame);
>         if(!frame) break;
> //!ARAZILLA
>         frame->SetEmbeddingLevel(aPresContext, embeddingLevel);
> 
>         nsCOMPtr<nsIAtom> frameType;
>         frame->GetFrameType(getter_AddRefs(frameType) );
>         if (frameType && nsLayoutAtoms::textFrame == frameType.get() ) {
>           nsCOMPtr<nsIContent> content;
>           rv = frame->GetContent(getter_AddRefs(content) ); 
>           if (NS_FAILED(rv) || (!content) ) {
>             break;
>           }
>           rv = content->QueryInterface(kITextContentIID, (void**) &textContent);
>           if (NS_FAILED(rv) || (!textContent) ) {
>             break;
>           }
>           textContent->GetText(&fragment);
>           NS_RELEASE(textContent);
> 
>           fragmentLength = fragment->GetLength();
>           if (runLength < fragmentLength) {
>             rv = SplitFrameTo(aPresContext, content, (nsTextFragment*) fragment,
>                              frame, frameIndex, fragmentLength, runLength);
>             if (NS_FAILED(rv) ) {
>               break;
>             }
>             ++frameCount;
>           } // if (runLength < fragmentLength)
>         } // if text frame
>         else {
> //printf("WARNING FP: NOT A TEXTFRAME %x +++++++++\n",(frameType?frameType.get():-1));
> //ARAZILLA WAS          fragmentLength = 1;
>           fragmentLength = 0;
>         }
>         runLength -= fragmentLength;
>       } // while (runLength > 0)
>       lineOffset = logicalLimit;
>     } // for
>   } // if (runCount > 1)
>   else {
>     embeddingLevel = 0;
>     if (1 == runCount) {
>       BidiEngine->getLogicalRun(lineOffset, &logicalLimit, &embeddingLevel);
>     }
>     while (--frameCount >= 0) {
>       frame = (nsIFrame*) (mLines->mVisualList[frameCount]);
>       frame->SetEmbeddingLevel(aPresContext, embeddingLevel);
>     }
>   } // runCount <= 1
> //printf("<--========BidiResove\n");
>   return rv;
> }
> 
> /**
>  * Split this frame.
>  * Create next sibling for aFrame
>  * Set rv to NS_OK if a new frame is created.
>  *
>  *  @lina 05/02/2000
>  */
> nsresult
> nsBlockFrame::SplitFrameTo(nsIPresContext* aPresContext,
>                            nsIContent*     aContent,
>                            nsTextFragment* aFragment,
>                            nsIFrame*       aFrame,
>                            PRInt32         aNewFrameIndex, // index of the frame to be created
>                            PRInt32         aFragmentLength,
>                            PRInt32         aOffset)
> {
>   if (aOffset >= aFragmentLength) {
>     return NS_ERROR_FAILURE;
>   }
>   if (!aPresContext || !aContent || !aFragment || !aFrame) {
>     return NS_ERROR_NULL_POINTER;
>   }
> //printf("BIDI SplitTO : Frame %x Inde=%d len=%d offset=%d\n",aFrame,aNewFrameIndex,aFragmentLength,aOffset);
>   nsCOMPtr<nsIAtom> frameType;
>   aFrame->GetFrameType(getter_AddRefs(frameType) );
>   if (!frameType || frameType.get() != nsLayoutAtoms::textFrame) {
>     return NS_ERROR_FAILURE;
>   }
> 
>   nsresult    rv;
>   nsIDOMNode* node = nsnull;
> 
>   rv = aContent->QueryInterface(kIDOMNodeIID, (void**) &node);
>   if (NS_FAILED(rv) || !node) {
>     return rv;
>   }
> 
>   nsIContent*     newContent = nsnull;
>   nsITextContent* newTextContent = nsnull;
>   nsIDOMNode*     newNode = nsnull;
> 
>   rv = node->CloneNode(PR_TRUE, &newNode);
> 
>   if (NS_SUCCEEDED(rv) && newNode) {
>     rv = newNode->QueryInterface(kIContentIID, (void**) &newContent );
> 
>     if (NS_SUCCEEDED(rv) && newContent) {
>       rv = newContent->QueryInterface(kITextContentIID, (void**) &newTextContent);
> 
>       if (NS_SUCCEEDED(rv) && newTextContent) {
>         nsTextFragment* newFrag;
>         newTextContent->GetText( (const nsTextFragment**) &newFrag);
> 
>         nsString left, right;
> 
>         if (aFragment->Is2b() ) {
> // M14 was left.SetString(aFragment->Get2b(), aOffset);
>             left.Assign(aFragment->Get2b(), aOffset);
> // ARAZILLA test  left = (const PRUnichar*)aFragment->Get2b();
> // ARAZILLA test  left.SetLength( (PRInt32)aOffset);
> //M14 was right.SetString(aFragment->Get2b() + aOffset, aFragmentLength - aOffset);
>             right.Assign((const PRUnichar*)(aFragment->Get2b() + aOffset),aFragmentLength - aOffset);
> //printf("BIDI SPLIT 2B left len=%d, right=%d\n",aOffset,aFragmentLength - aOffset);
> // ARAZILLA test  right = (const PRUnichar*)(aFragment->Get2b() + aOffset);
> // ARAZILLA test  right.SetLength( (PRInt32)(aFragmentLength - aOffset));
>         }
>         else {
> // M14 was left.SetString(aFragment->Get1b(), aOffset);
> // ARAZILLA 
>             left.AssignWithConversion(aFragment->Get1b(), aOffset);
> // ARAZILLA test  left = (const PRUnichar*)aFragment->Get1b();
> // ARAZILLA test  left.SetLength( (PRInt32)aOffset);
> // M14 was right.SetString((const char*)(aFragment->Get1b() + aOffset), (PRInt32)(aFragmentLength - aOffset));
>             right.AssignWithConversion((char *)(aFragment->Get1b() + aOffset), aFragmentLength - aOffset);
> //printf("BIDI SPLIT 1B left len=%d, right=%d\n",aOffset,aFragmentLength - aOffset);
> // ARAZILLA test  right = (const PRUnichar*)(aFragment->Get1b() + aOffset);
> // ARAZILLA test  right.SetLength( (PRInt32)(aFragmentLength - aOffset)); 
>         }
>         aFragment->SetTo(left.GetUnicode(), aOffset);
>         newFrag->SetTo(right.GetUnicode(), aFragmentLength - aOffset);
> 
>         nsCOMPtr<nsIContent> parentContent;
>         aContent->GetParent(*getter_AddRefs(parentContent) );
> 	if (parentContent) {
>           PRInt32 index;
>     
>           rv = parentContent->IndexOf(aContent, index);
>           if (NS_SUCCEEDED(rv) ) {
>             rv = parentContent->InsertChildAt(newContent, index + 1, PR_TRUE);
>             if (NS_SUCCEEDED(rv) ) {
>               nsIFrame* newFrame;
>               aFrame->GetNextSibling(&newFrame);
>               mLines->mVisualList.InsertElementAt( (void*) newFrame, aNewFrameIndex);
> 
>               if (newFrame) {
>                 nsCOMPtr<nsIStyleContext> styleContext;
>                 rv = aFrame->GetStyleContext(getter_AddRefs(styleContext) ); 
>                 if (NS_SUCCEEDED(rv) ) {
>                   newFrame->SetStyleContext(aPresContext, styleContext);
>                 }
>               }
>               else {
>                 rv = NS_ERROR_FAILURE;
>               } // !newFrame
>             } // InsertChildAt
> 
>           } // IndexOf
> 	}
>       } // newTextContent
>     } // newContent
>   } // newNode
>   NS_IF_RELEASE(newContent);
>   NS_IF_RELEASE(newTextContent);
>   NS_RELEASE(node);
>   NS_IF_RELEASE(newNode);
> 
>   return rv;
> }
> #endif // IBMBIDI
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/layout/html/base/src/nsBlockFrame.h mozilla.lbi/layout/html/base/src/nsBlockFrame.h
33a34,36
> #ifdef IBMBIDI
> class nsTextFragment;
> #endif // IBMBIDI
164a168,177
> #ifdef IBMBIDI
>   nsresult BidiResolve(nsIPresContext* aPresContext);
>   nsresult SplitFrameTo(nsIPresContext* aPresContext,
>                         nsIContent*     aContent,
>                         nsTextFragment* aFragment,
>                         nsIFrame*       aFrame,
>                         PRInt32         aNewFrameIndex,
>                         PRInt32         aFragmentLength,
>                         PRInt32         aOffset);
> #endif // IBMBIDI
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/layout/html/base/src/nsFirstLetterFrame.cpp mozilla.lbi/layout/html/base/src/nsFirstLetterFrame.cpp
64a65,70
> 
> #ifdef IBMBIDI
>   NS_IMETHOD RenderableChild(nsIPresContext* aPresContext,
>                              nsIFrame** aRenderableChild);
> #endif // IBMBIDI
> 
370a377,404
> 
> #ifdef IBMBIDI
> /**
>  * Retrieve the first renderable kid of this frame
>  * (if no kids, *aRenderableChild will be set to this)
>  *
>  * @lina 4/6/2000
>  */
> nsresult
> nsFirstLetterFrame::RenderableChild(nsIPresContext* aPresContext,
>                                     nsIFrame** aRenderableChild)
> {
>   NS_PRECONDITION(aRenderableChild != nsnull, "null OUT parameter pointer");
> 
>   nsresult rv = NS_OK;
> 
>   *aRenderableChild = this;
> 
>   nsIFrame* frame;
> 
>   FirstChild(aPresContext, nsnull, &frame);
>   if (frame) {
>     rv = frame->RenderableChild(aPresContext, aRenderableChild);
>   }
> 
>   return rv;
> }
> #endif // IBMBIDI
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/layout/html/base/src/nsFrame.cpp mozilla.lbi/layout/html/base/src/nsFrame.cpp
3362a3363,3439
> #ifdef IBMBIDI
> /**
>  *  retrieve BiDi property of this frame
>  *  @lina 5/1/2000
>  */
> 
> nsresult nsFrame::GetBidiProperty(nsIPresContext* aPresContext,
>                                   nsIAtom*        aPropertyName,
>                                   void**          aPropertyValue) const
> {
>   *aPropertyValue = nsnull;
> 
>   nsCOMPtr<nsIPresShell> presShell;
>   aPresContext->GetShell(getter_AddRefs(presShell) );
> 
>   if (presShell) {
>     nsCOMPtr<nsIFrameManager> frameManager;
>     presShell->GetFrameManager(getter_AddRefs(frameManager) );
>   
>     if (frameManager) {
>       frameManager->GetFrameProperty( (nsIFrame*)this, aPropertyName, 0, aPropertyValue);
>     }
>   }
>   return NS_OK;
> }
> 
> nsresult nsFrame::SetBidiProperty(nsIPresContext* aPresContext,
>                                   nsIAtom*        aPropertyName,
>                                   void*           aPropertyValue) const
> {
>   nsresult rv = NS_ERROR_FAILURE;
> 
>   nsCOMPtr<nsIPresShell> shell;
>   aPresContext->GetShell(getter_AddRefs(shell) );
>   if (shell) {
>     nsCOMPtr<nsIFrameManager> frameManager;
>     shell->GetFrameManager(getter_AddRefs(frameManager) );
>     if (frameManager) {
>       rv = frameManager->SetFrameProperty( (nsIFrame*) this, aPropertyName, aPropertyValue, nsnull);
>     }
>   }
>   return rv;
> }
> 
> PRUint8 nsFrame::GetEmbeddingLevel(nsIPresContext* aPresContext) const
> {
>   void* value;
>   GetBidiProperty(aPresContext, nsLayoutAtoms::embeddingLevel, &value);
>   return ( (PRUint8) value);
> }
> 
> /**
>  *  set embedding level of the frame
>  *  @lina 1/6/2000
>  */
> nsresult nsFrame::SetEmbeddingLevel(nsIPresContext* aPresContext,
>                                     PRUint8 aEmbeddingLevel) const
> {
>   return SetBidiProperty(aPresContext, nsLayoutAtoms::embeddingLevel, (void*) aEmbeddingLevel);
> }
> 
> 
> /**
>  * Retrieve the first renderable kid of this frame
>  *
>  * @lina 4/6/2000
>  */
> nsresult nsFrame::RenderableChild(nsIPresContext* aPresContext,
>                                   nsIFrame** aRenderableChild)
> {
>   NS_PRECONDITION(aRenderableChild != nsnull, "null OUT parameter pointer");
> 
>   *aRenderableChild = this;
> 
>   return NS_OK;
> }
> #endif // IBMBIDI
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/layout/html/base/src/nsFrame.h mozilla.lbi/layout/html/base/src/nsFrame.h
353a354,366
> #ifdef IBMBIDI
>   NS_IMETHOD GetBidiProperty(nsIPresContext* aPresContext,
>                              nsIAtom*        aPropertyName,
>                              void**          aPropertyValue) const;
>   NS_IMETHOD SetBidiProperty(nsIPresContext* aPresContext,
>                              nsIAtom*        aPropertyName,
>                              void*           aPropertyValue) const ;
>   NS_IMETHOD_(PRUint8) GetEmbeddingLevel(nsIPresContext* aPresContext) const;
>   NS_IMETHOD SetEmbeddingLevel(nsIPresContext* aPresContext,
>                                PRUint8         aEmbeddingLevel) const;
>   NS_IMETHOD RenderableChild(nsIPresContext* aPresContext,
>                              nsIFrame**      aRenderableChild);
> #endif // IBMBIDI
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/layout/html/base/src/nsInlineFrame.cpp mozilla.lbi/layout/html/base/src/nsInlineFrame.cpp
726a727,751
> #ifdef IBMBIDI
> /**
>  * Retrieve the first renderable kid of this frame
>  * (if no kids, set *aRenderableChild will to this)
>  *
>  * @lina 4/6/2000
>  */
> nsresult nsInlineFrame::RenderableChild(nsIPresContext* aPresContext,
>                                         nsIFrame** aRenderableChild)
> {
>   NS_PRECONDITION(aRenderableChild != nsnull, "null OUT parameter pointer");
> 
>   nsresult rv = NS_OK;
> 
>   *aRenderableChild = this;
> 
>   nsIFrame* frame;
>   FirstChild(aPresContext, nsnull, &frame);
>   if (frame) {
>     rv = frame->RenderableChild(aPresContext, aRenderableChild);
>   }
>   return rv;
> }
> #endif // IBMBIDI
> 
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/layout/html/base/src/nsInlineFrame.h mozilla.lbi/layout/html/base/src/nsInlineFrame.h
90a91,95
> #ifdef IBMBIDI
>   NS_IMETHOD RenderableChild(nsIPresContext* aPresContext,
>                              nsIFrame** aRenderableChild);
> #endif // IBMBIDI
> 
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/layout/html/base/src/nsLineBox.cpp mozilla.lbi/layout/html/base/src/nsLineBox.cpp
33a34,48
> #ifdef NDEBUG
> #include "nsLayoutAtoms.h"
> #endif
> 
> #ifdef IBMBIDI
> #include "nsIContent.h"
> #include "nsITextContent.h"
> #include "nsTextFragment.h"
> #include "nsIServiceManager.h"
> #include "nsIBiDi.h"
> 
> static NS_DEFINE_CID(kBiDiCID, NS_BIDI_CID);
> static NS_DEFINE_IID(kITextContentIID, NS_ITEXT_CONTENT_IID);
> #endif // IBMBIDI
> 
496a512,851
> #ifdef IBMBIDI
> /**
>  *  Initialize array of renderable frames that form this line.
>  *
>  *  @param  Presentation context, the first logical frame, frame that logically follows this line
>  *
>  *  @lina 05/02/2000
>  */
> void
> nsLineBox::InitVisualLineList(nsIPresContext* aPresContext,
>                               nsIFrame*       aCurrentFrame,
>                               nsIFrame*       aNextInFlow)
> {
>   nsIFrame* frame;
>   nsIFrame* kid;
>   nsIAtom* frameType = nsnull;
>   PRBool hasExplicitDirection; // indicates whether tag is attributed by "dir=N"
> 
>   for (frame = aCurrentFrame;
>        frame && frame != aNextInFlow;
>        frame->GetNextSibling(&frame) ) {
> //printf("BIDI: InitVisualLineList frame=%x\n",frame);
>     hasExplicitDirection = PR_FALSE;
>     // If contains explicit direction: <BDO> tag is represented by RLO/LRO, others - by RLE/LRE
> 
>     frame->GetFrameType(&frameType);
>     if (frameType) {
>     
>       if (nsLayoutAtoms::blockFrame == frameType) {
>         break;
>       }
> 
>       else if ( (nsLayoutAtoms::inlineFrame == frameType)
>           || (nsLayoutAtoms::letterFrame == frameType) ) {
>         frame->FirstChild(aPresContext, nsnull, &kid);
>         InitVisualLineList(aPresContext, kid, aNextInFlow);
>       }
>       else {
>         mVisualList.AppendElement(frame);
>       }
>       // If the element is attributed by dir, indicate direction pop (add PDF)
>     }
>   }
>   NS_IF_RELEASE(frameType);
> }
> 
> 
> /**
>  *  Create a string containing all text contents of this line.
>  *
>  *  @param   Presentation context, line buffer
>  *
>  *  @lina 05/02/2000
>  */
> nsresult
> nsLineBox::CreateLineBuffer(nsIPresContext* aPresContext,
>                             nsAutoString& aLineBuffer)
> {
>   nsIFrame* frame;
>   nsIContent* content = nsnull;
>   nsIContent* prevContent = nsnull;
>   nsITextContent* textContent = nsnull;
>   const nsTextFragment* frag;
>   PRUnichar buffer[1];
>   PRUint32 i;
>   PRUint32 count = mVisualList.Count();
>   nsresult rv = NS_OK;
> //ARAZILLA
>   PRUint32 buflen =0;
> //!ARAZILLA
> 
>   for (i = 0; i < count; i++) {
>     frame = (nsIFrame*) (mVisualList[i]);
> 
> nsIAtom* frameTypeFP = nsnull;
> frame->GetFrameType(&frameTypeFP);//ARAZILLA for trace
> //printf("BIDI CreateLineBuffer of %d frame: %d= %x type=%x\n",count,i,frame,frameTypeFP);
> 
>     rv = frame->GetContent(&content);
>     if ( (NS_FAILED(rv) ) || (!content) ) {
>       break;
>     }
> //printf(" --content = %x PrevContent=%x\n",content,prevContent);
>     if (content == prevContent) {
>       NS_RELEASE(content);
>       continue;
>     }
>     rv = content->QueryInterface(kITextContentIID, (void**) &textContent);
>     if ( (NS_FAILED(rv) ) || (!textContent) ) {
> continue;  //ARAZILLA for Bullet...
> //ARAZILLA Was      break;
>     }
> //printf(" --textContent=%x\n",textContent);
>     textContent->GetText(&frag);
>     NS_RELEASE(textContent);
> 
>     nsIAtom* frameType = nsnull;
>     frame->GetFrameType(&frameType);
> 
>     if (nsLayoutAtoms::textFrame == frameType) {
> //printf(" -- TEXTFrame  TYPE\n");
>       rv = content->QueryInterface(kITextContentIID, (void**) &textContent);
>       if ( (NS_FAILED(rv) ) || (!textContent) ) {
>         break;
>       }
>       textContent->GetText(&frag);
>       NS_RELEASE(textContent);
> 
>       if (frag) {
>         nsAutoString str;
>         if (frag->Is2b() ) {
> //M14          str.SetString(frag->Get2b(), frag->GetLength());
>             str.Assign(frag->Get2b(), frag->GetLength());
>         }
>         else {
> //M14          str.SetString(frag->Get1b(), frag->GetLength());
>             str.AssignWithConversion(frag->Get1b(), frag->GetLength());
>         }
> //ARAZILLA WAS        str.ReplaceChar("\t\n\r", ' ');
>         str.ReplaceChar("\240\t\n\r", ' ');
> //M14     aLineBuffer.Append(str, str.Length() );
>         aLineBuffer += str ;
> //ARAZILLA
>         buflen += str.Length();
> //printf(" -- Frag of len %d\n",buflen);
>       }
>     }
>     else { // not text frame
>       // See the Unicode Bidi Algorithm:
>       // "...inline objects (such as graphics) are treated as if they are ... U+FFFC"
>       *buffer = 0xFFFC;
>       aLineBuffer.Append(buffer, 1);
> //ARAZILLA
>       buflen += 1;
>     }
>     NS_IF_RELEASE(frameType);
>     prevContent = content;
>     NS_RELEASE(content);
>   }
> //ARAZILLA
> //printf("    -->End of line %d text: ",buflen);
> //int j;
> //for (j=0;j<buflen;j++)
> //(aLineBuffer[j]>0x80)?printf("[%04x]",aLineBuffer[j]):printf("%c",aLineBuffer[j]);
> //printf("\n");
> //!ARAZILLA
> 
>   // In the case rv failed, but content != nsnull
>   NS_IF_RELEASE(content);
>   NS_IF_RELEASE(textContent);
>   return rv;
> }
> 
> /**
>  *  Adjust frame positions following their visual order
>  *
>  *  XXX: TODO: Cannot we do that within nsLineLayout?
>  *  XXX: (It seems no, since we'll need to add psd->mRootSpan->mFirstVisualFrame, pfd->mNextVisual etc.,
>  *        or add some code similar to the one below, so no sense to move this code...???) 
>  *
>  *  @param  Presentation context
>  *
>  *  @lina 04/11/2000
>  */
> void
> nsLineBox::RepositionInlineFrames(nsIPresContext* aPresContext)
> {
>   nsIFrame* frame = (nsIFrame*) (mVisualList[0]);
> 
>   if (frame) {
>     nsIFrame* nextVisual;
>     nsPoint origin;
>     nsRect rect;
>     nsRect nextRect;
>     PRInt32 i;
> 
>     frame->GetRect(rect);
> //printf("BIDI : RepositionInlineFrames frame=%x, rect= xywh %d %d %d %d\n",frame,rect.x,rect.y,rect.width,rect.height);
> 
>     if (frame != mFirstChild) {
>       mFirstChild->GetOrigin(origin);
>       rect.x = origin.x;
>       frame->SetRect(aPresContext, (const nsRect &) rect);
>     }
> 
>     for (i = 1; i < mVisualList.Count(); i++) {
>       nextVisual = (nsIFrame*) (mVisualList[i]);
>       nextVisual->GetRect(nextRect);
>       nextRect.x = rect.x + rect.width;
>       nextVisual->SetRect(aPresContext, (const nsRect &) nextRect);
>       rect = nextRect;
>       frame = nextVisual;
>     } // for
> 
>     // Now adjust inline container frames.
>     // Example: LTR paragraph 
>     //                <p><b>english HEBREW</b> 123</p>
>     // should be displayed as
>     //                <p><b>english </b>123 <b>WERBEH</b></p>
> 
>     // We assume that <b></b> container's rectangle takes all the room from "english" left edge to
>     // "WERBEH" right edge.
> 
>     // XXX: Split container? (deeply - from direct block child through child textFrame)
> 
>     nsIAtom* frameType = nsnull;
>     frame = mFirstChild;
>     for (i = 0; i < GetChildCount(); i++) {
>       frame->GetFrameType(&frameType);
>       if (frameType 
>           && (nsLayoutAtoms::inlineFrame == frameType
>             || nsLayoutAtoms::letterFrame == frameType) ) {
>         PRInt32 minX = NS_UNCONSTRAINEDSIZE;
>         PRInt32 maxX = 0;
>         RepositionContainerFrame(aPresContext, frame, minX, maxX);
>       }
>       frame->GetNextSibling(&frame);
>     }
>     NS_IF_RELEASE(frameType);
>   } // if frame
> }
> 
> void
> nsLineBox::RepositionContainerFrame(nsIPresContext* aPresContext, nsIFrame* aContainer,
>                                     PRInt32& aMinX, PRInt32& aMaxX)
> {
>   nsIFrame* frame;
>   nsIFrame* firstChild;
>   nsIAtom* frameType = nsnull;
>   nsRect rect;
>   PRInt32 minX = NS_UNCONSTRAINEDSIZE;
>   PRInt32 maxX = 0;
> 
>   aContainer->FirstChild(aPresContext, nsnull, &firstChild);
> 
>   for (frame = firstChild; frame; frame->GetNextSibling(&frame) ) {
>     frame->GetFrameType(&frameType);
>     if (frameType) {
>       if ( (nsLayoutAtoms::inlineFrame == frameType)
>           || (nsLayoutAtoms::letterFrame == frameType) ) {
>         RepositionContainerFrame(aPresContext, frame, minX, maxX);
>       }
>       else {
>         frame->GetRect(rect);
>         minX = PR_MIN(minX, rect.x);
>         maxX = PR_MAX(maxX, rect.x + rect.width);
>       }
>     }
>   }
>   NS_IF_RELEASE(frameType);
> 
>   aMinX = PR_MIN(minX, aMinX);
>   aMaxX = PR_MAX(maxX, aMaxX);
> 
>   if (minX < maxX) {
>     aContainer->GetRect(rect);
>     rect.x = minX;
>     rect.width = maxX - minX;
>     aContainer->SetRect(aPresContext, (const nsRect &) rect);
>   }
> 
>   // Now adjust all the kids (kid's coordinates are relative to the parent's)
>   nsPoint origin;
> 
>   for (frame = firstChild; frame; frame->GetNextSibling(&frame) ) {
>     frame->GetOrigin(origin);
>     frame->MoveTo(aPresContext, origin.x - minX, origin.y);
>   }
> }
> 
> 
> /**
>  * Reorder this line using BiDi engine.
>  * Update visual array, following the new visual sequence.
>  * 
>  * @param presentation context, BiDi enabled
>  * @lina 05/02/2000
>  * XXX: Put all these pointers (levels, indexMap etc.) somewhere else
>  */
> nsresult
> nsLineBox::Reorder(nsIPresContext* aPresContext,
>                    PRBool&         aBidiEnabled)
> {
>   aBidiEnabled = PR_FALSE;
>   PRInt32 count = mVisualList.Count();
> 
>   if (count < 2) {
>     return NS_OK;
>   }
> 
>   PRUint8* levels = new PRUint8[count];
> 
>   if (!levels) {
>     return NS_ERROR_OUT_OF_MEMORY;
>   }
>   nsCRT::memset(levels, 0, sizeof(PRUint8) * count);
> 
>   nsIFrame* frame;
>   nsresult rv = NS_OK;
>   PRInt32 i;
> 
>   for (i = 0; i < count; i++) {
>     frame = (nsIFrame*) (mVisualList[i]);
> 
>     levels[i] = frame->GetEmbeddingLevel(aPresContext);
> //printf("BIDI Reorder: Got frame %x bidilevel=%d\n",frame,levels[i]);
>   }
>   PRInt32* indexMap = new PRInt32[count];
>     if (!indexMap) {
>       rv = NS_ERROR_OUT_OF_MEMORY;
>     }
>     else {
>       NS_WITH_SERVICE(nsIBiDi, BidiEngine, kBiDiCID, &rv);
>       if (NS_SUCCEEDED(rv) && BidiEngine) {
>       rv = BidiEngine->reorderVisual(levels, count, indexMap);
> 
>       if (NS_SUCCEEDED(rv) ) {
>         nsVoidArray newFrames(count);
> 
>         for (i = 0; i < count; i++) {
>           newFrames.ReplaceElementAt(mVisualList[indexMap[i]], i);
>           if (i != indexMap[i]) {
>             aBidiEnabled = PR_TRUE;
>           }
>         }
>         if (aBidiEnabled) {
>           mVisualList = newFrames;
>         }
>       } // NS_SUCCEEDED(rv)
>     } // BiDiEngine
>     delete[] indexMap;
>   } // indexMap
>   delete[] levels;
> 
>   if (NS_FAILED(rv) ) {
>  	  aBidiEnabled = PR_FALSE;
>  }
>   return rv;
> }
> #endif // IBMBIDI
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/layout/html/base/src/nsLineBox.h mozilla.lbi/layout/html/base/src/nsLineBox.h
316a317,332
> #ifdef IBMBIDI
>   nsresult CreateLineBuffer(nsIPresContext* aPresContext,
>                             nsAutoString&   aLineBuffer);
>   void InitVisualLineList(nsIPresContext* aPresContext,
>                           nsIFrame*       aCurrentFrame,
>                           nsIFrame*       aNextInFlow);
>   nsresult Reorder(nsIPresContext* aPresContext,
>                    PRBool&         aBidiEnabled);
>   void RepositionInlineFrames(nsIPresContext* aPresContext);
>   void RepositionContainerFrame(nsIPresContext* aPresContext,
>                                 nsIFrame*       aContainer,
>                                 PRInt32&        aMinX,
>                                 PRInt32&        aMaxX);
>   nsVoidArray mVisualList;
> #endif // IBMBIDI
> 
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/layout/html/base/src/nsLineLayout.cpp mozilla.lbi/layout/html/base/src/nsLineLayout.cpp
2356a2357,2359
> #ifdef IBMBIDI
>   if (mPresContext->IsVisualMode() )
> #endif // IBMBIDI
2659a2663,2665
> #ifdef IBMBIDI
>     if (mPresContext->IsVisualMode() ) {
> #endif // IBMBIDI
2676a2683,2685
> #ifdef IBMBIDI
>     }
> #endif // IBMBIDI
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/layout/html/base/src/nsPresShell.cpp mozilla.lbi/layout/html/base/src/nsPresShell.cpp
3365a3366,3369
> #ifdef IBMBIDI
>     aRenderingContext.SetReverseFlag(mPresContext->IsVisualMode() );
> #endif // IBMBIDI
> 
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/layout/html/base/src/nsTextFrame.cpp mozilla.lbi/layout/html/base/src/nsTextFrame.cpp
88a89,107
> // ARAZILLA
> extern "C" char AGetKbd() ; 
> extern "C" int AWStrNCtx(PRUnichar *, int) ;
> extern "C" int AWInsertPointNItoC(PRUnichar *, PRUnichar *, int, int *, int, int) ; 
> extern "C" int AWInsertPointNCtoI(PRUnichar *, PRUnichar *, int, int *, int, int) ; 
> typedef struct {
>     int start;
>     int end;
> } LBiDiSingle_range;
> 
> typedef struct {
>     LBiDiSingle_range in;
>     LBiDiSingle_range out[3];
>     int nb;
> } LBiDiattr_range;
> extern "C" int AWStrNAttr(unsigned short *, unsigned short *, LBiDiattr_range*, int) ; 
> extern "C" int AWCtxNAttr(unsigned short *, unsigned short *, LBiDiattr_range*, int) ; 
> // !ARAZILLA
> 
1796a1816
> //printf("PAINT UNICODE TEXT %d\n",textLength);
1835a1856
> //printf("PAINT UNISELECTION DETAIL 0x%x ST=%d ED=%d \n",sdptr,sdptr->mStart,sdptr->mEnd);
1837a1859,1905
> #ifdef IBMBIDI
> //ARAZILLA
>       PRUnichar CtxBuf[8096];
>       LBiDiattr_range r; 
>       if(details)
>       {
>           r.in.start=details->mStart;
>           r.in.end=details->mEnd;
>       }
>       else
>       {
>           r.in.start=r.in.end=0;
>       }
>       int buflen = textLength;
>       AWStrNAttr((unsigned short*)CtxBuf, (unsigned short*)text,buflen,(LBiDiattr_range*) & r);
> //int j;printf("CtxBuf len=%d =[ ",textLength);for(j=0;j<textLength;j++)printf("%04x ",CtxBuf[j]);printf("] %d sel\n",r.nb);
>       nscoord currentX = dx; 
>       nscoord newWidth;//temp
>       nscolor    currentFGColor = aTextStyle.mSelectionTextColor;
>       nscolor    currentBKColor = aTextStyle.mSelectionBGColor;
> 
>       // First Draw the line in Normal mode
>       aRenderingContext.SetColor(aTextStyle.mColor->mColor);
>       aRenderingContext.DrawStringGlyph((const PRUnichar*)CtxBuf, PRUint32(textLength), dx, dy);
> 
>       // Then draw Reverse parts
>       while(r.nb--)
>       {
>          currentX = dx;
>          PRUnichar *currenttext = CtxBuf ;
>          PRUint32   currentlength= r.out[r.nb].end - r.out[r.nb].start;
> 
>          aRenderingContext.GetWidthGlyph(currenttext, r.out[r.nb].start,newWidth);
> //printf(" -- SEL Loop %d AVANT dx=%d --> %d len start=%d (st=%d ed=%d)" ,r.nb,currentX,newWidth, r.out[r.nb].start, r.out[r.nb].end);
>          currentX +=newWidth;
>          aRenderingContext.GetWidthGlyph((PRUnichar*)(currenttext+r.out[r.nb].start),currentlength,newWidth);
> //printf(" Sel X=%d to width=%d len=%d\n",currentX, newWidth,currentlength);
>          aRenderingContext.SetColor(currentBKColor);
>          aRenderingContext.FillRect(currentX, dy, newWidth, mRect.height);
> 	 currentFGColor = EnsureDifferentColors(currentFGColor, currentBKColor);
>       
>          aRenderingContext.SetColor(currentFGColor);
>          aRenderingContext.DrawStringGlyph((const PRUnichar*)(currenttext+r.out[r.nb].start), currentlength, currentX, dy);
>       }
> 
> //!ARAZILLA
> #else
1846a1915
> //printf("PAINT UNI ITER dx=%d, length=%d \n", currentX, iter.CurrentLength());
1875a1945
> //printf("ITER DONE text normal len=%d at x=%d\n",textLength, dx);
1878a1949
> #endif // IBMBIDI
1972a2044,2061
> #ifdef IBMBIDI
>         PRUnichar CtxBuf[8096];
>         int indx;
>         for(indx=0;indx<textLength;indx++)
>               CtxBuf[indx]=paintBuffer.mBuffer[indx];
>         AWStrNCtx(CtxBuf, textLength);
>  
> //printf("GetPosition: UNICODE=[");
> //int j ; for(j=0;j<textLength;j++) printf("  0x%02x ",paintBuffer.mBuffer[j]);
> //printf("]\n             CTXFBUF=[");
> //for(j=0;j<textLength;j++) printf("0x%04x ",CtxBuf[j]);
> //printf("]\n");
>         aOffset = GetLengthSlowly(*aRendContext, ts,CtxBuf,textLength,adjustedX);
>  
>         PRInt32 Ctxindx;
>         AWInsertPointNCtoI(CtxBuf,paintBuffer.mBuffer,aOffset,&Ctxindx,AGetKbd(),textLength);
>         aOffset = Ctxindx + mContentOffset;
> //printf("GetPositionSlowly AWInsertPointNCtoI: Posc = %d, --> Posi=%d (len=%d)\n",aOffset,Ctxindx,textLength);
1973a2063
> #else // IBMBIDI
1981a2072
> #endif
2352a2444,2489
> #ifdef IBMBIDI
> //ARAZILLA
>       PRUnichar CtxBuf[8096];
>       LBiDiattr_range r;
>       if(details)
>       {
>           r.in.start=details->mStart;
>           r.in.end=details->mEnd;
>       }
>       else
>       {
>           r.in.start=r.in.end=0;
>       }
>       int buflen = textLength;
>       AWStrNAttr((unsigned short*)CtxBuf, (unsigned short*)text,buflen,(LBiDiattr_range*) & r);
> //int j;printf("CtxBuf len=%d =[ ",textLength);for(j=0;j<textLength;j++)printf("%04x ",CtxBuf[j]);printf("] %d sel\n",r.nb);
>       nscoord currentX = dx;
>       nscoord newWidth;//temp
>       nscolor    currentFGColor = aTextStyle.mSelectionTextColor;
>       nscolor    currentBKColor = aTextStyle.mSelectionBGColor;
>  
>       // First Draw the line in Normal mode
>       aRenderingContext.SetColor(aTextStyle.mColor->mColor);
>       aRenderingContext.DrawStringGlyph((const PRUnichar*)CtxBuf, PRUint32(textLength), dx, dy);
>  
>       // Then draw Reverse parts
>       while(r.nb--)
>       {
>          currentX = dx;
>          PRUnichar *currenttext = CtxBuf ;
>          PRUint32   currentlength= r.out[r.nb].end - r.out[r.nb].start;
>          aRenderingContext.GetWidth(currenttext, r.out[r.nb].start,newWidth);
>          currentX +=newWidth;
> //printf(" -- SEL Loop %d dx=%d widthstart=%d (st=%d ed=%d)" ,r.nb,currentX, r.out[r.nb].start, r.out[r.nb].end);
>          aRenderingContext.GetWidth((PRUnichar*)(currenttext+r.out[r.nb].start),currentlength,newWidth);
> //printf(" Sel width=%d len=%d\n",newWidth,currentlength);
>          aRenderingContext.SetColor(currentBKColor);
>          aRenderingContext.FillRect(currentX, dy, newWidth, mRect.height);
>          currentFGColor = EnsureDifferentColors(currentFGColor, currentBKColor);
>  
>          aRenderingContext.SetColor(currentFGColor);
>          aRenderingContext.DrawStringGlyph((const PRUnichar*)(currenttext+r.out[r.nb].start), currentlength, currentX, dy);
>       }
>  
> //!ARAZILLA
> #else                                                                                                                              
2393a2531
> #endif // IBMBIDI
2516a2655
> //printf("PAINTACII TEXT %d \n",textLength);
2632a2772,2806
> //ARAZILLA XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> // ICIC fait CToI
> // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> static PRBool
> BinarySearchForBiDiPosition(nsIRenderingContext* acx, 
>                         PRUnichar* aText,
>                         PRInt32    aBaseWidth,
>                         PRInt32    aBaseInx,
>                         PRInt32    aStartInx, 
>                         PRInt32    aEndInx, 
>                         PRInt32    aCursorPos, 
>                         PRInt32&   aIndex,
>                         PRInt32&   aTextWidth)
> {
>   int i;
>   PRInt32 textWidth = 0;
>   PRInt32 prevtextWidth;
>   for (i=aStartInx;i<aEndInx;i++)
>   {
>       prevtextWidth = textWidth;
>       acx->GetWidthGlyph((const PRUnichar *)aText, ( PRUint32) i,( nscoord &)textWidth,NULL ); 
>       if(textWidth >  aCursorPos-aBaseWidth)
>       {
>          int rnd = ((aCursorPos - prevtextWidth)<(textWidth - aCursorPos))?1:0;
>          aIndex = i +  aBaseInx - rnd;
>          aTextWidth = rnd?prevtextWidth:textWidth;
>          return PR_TRUE;
>       }
> 
>   }
>   return PR_FALSE;
> 
> }
> //!ARAZILLA
> 
2727a2902
> //printf("LH++ GetPosition : point X= %d, Textlen=%d \n",aPoint.x,textLength);
2771a2947,2975
> //ARAZILLA Do Contect analysys here on paintBuffer.....
> #ifdef IBMBIDI
>         PRUnichar CtxBuf[8096];
>         for(indx=0;indx<textLength;indx++)
>               CtxBuf[indx]=paintBuffer.mBuffer[indx];
>         AWStrNCtx(CtxBuf, textLength);
> 
> //printf("GetPosition: UNICODE=[");
> //int j ; for(j=0;j<textLength;j++) printf("  0x%02x ",paintBuffer.mBuffer[j]);
> //printf("]\n             CTXFBUF=[");
> //for(j=0;j<textLength;j++) printf("0x%04x ",CtxBuf[j]);
> //printf("]\n");
> 
>         PRBool found = BinarySearchForBiDiPosition(acx, CtxBuf, origin.x, 0, 0,
> 
>                                                PRInt32(textLength),
>                                                PRInt32(aPoint.x) , //go to local coordinates
>                                                indx, textWidth);
>         PRInt32 Ctxindx;
>         AWInsertPointNCtoI(CtxBuf,text,indx,&Ctxindx,AGetKbd(),textLength);
> 
>         aContentOffset = Ctxindx + mContentOffset;
>         aContentOffsetEnd = aContentOffset;
>         
> //printf("AWInsertPointNCtoI: Posc = %d, --> Posi=%d (len=%d)\n",indx,Ctxindx,textLength);
> 
> 
> #else // IBMBIDI
> 
2778a2983
> //printf(" -- Call BinarySearchForPosition found : ori=%d pointx=%d indx=%d textWidth=%d\n", origin.x,aPoint.x,indx,textWidth);
2794a3000
> //printf(" -- Ret aContentOffset = %d OffEnd=%d\n",aContentOffset,aContentOffsetEnd);
2796a3003
> #endif // IBMBIDI
2995a3203,3205
> //ARAZILLA XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> //ARAZILLA ICI FAIRE AWInsertPointItoC ()
> //ARAZILLA XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
3010a3221
> //printf("LH: GetPointFromOffset inoffset=%d, mContentOffset=%d\n",inOffset,mContentOffset);
3036a3248
> //printf(" -- -> offset=%d, textlen=%d\n",inOffset,textLength);
3039a3252,3261
> //ARAZILLA
>   PRUnichar CtxBuf[8096];
>   PRInt32 ctxOffset;
>   AWInsertPointNItoC(CtxBuf,paintBuffer.mBuffer,inOffset,&ctxOffset,AGetKbd(),textLength);
>   inOffset=ctxOffset;
> 
> //printf("AWInsertPointNItoC called: Kbd=%d inOffset=%d ctxoff=%d -->[\n",AGetKbd(),inOffset,ctxOffset);
> //int jj; for(jj=0;jj<textLength;jj++) printf("0x%04x ",CtxBuf[jj]); printf("]\n");
> //!ARAZILLA
> 
3062a3285
> //printf(" -- -> JUST width of off=%d =%d\n",ip[inOffset]-mContentOffset,width);
3067c3290,3291
<         inRendContext->GetWidth(paintBuffer.mBuffer, ip[inOffset]-mContentOffset,width);
---
>         inRendContext->GetWidthGlyph(CtxBuf, ip[inOffset]-mContentOffset,width);
> //printf(" -- -> NORM REND width of off=%d =%d\n",ip[inOffset]-mContentOffset,width);
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp mozilla.lbi/layout/html/forms/src/nsComboboxControlFrame.cpp
71a72,75
> //ARAZILLA
> extern "C" int AGetLang();
> //!ARAZILLA
> 
950a955,958
> //ARAZILLA
>   if(AGetLang() == 2)
>     kidReflowState.mComputedWidth = 0; 
> //!ARAZILLA
1013a1022,1034
> 
> //ARAZILLA
>   if(AGetLang() == 2)
>   {
>                         if (buttonRect.x > displayRect.x) // button on left
>                         {
>                                 buttonRect.x = displayRect.x;
>                                 displayRect.x += buttonRect.width;
>                                 //displayFrame->SetRect(aPresContext, displayRect);
>                                 aDisplayFrame->SetRect(aPresContext, displayRect);
>                         } // else button on right
>   }
> //!ARAZILLA
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/layout/html/forms/src/nsListControlFrame.cpp mozilla.lbi/layout/html/forms/src/nsListControlFrame.cpp
64a65,68
> //ARAZILLA
> extern "C" int AGetLang();
> //!ARAZILLA
> 
798a803,825
> //ARAZILLA
>         if (AGetLang() == 2)
>         {
>              nscoord BiDiscrolledAreaWidth = scrolledAreaDesiredSize.maxElementSize->width;
>              firstPassState.reason = eReflowReason_StyleChange;
>              float p2t;
>              aPresContext->GetScaledPixelsToTwips(&p2t);
>              if (aReflowState.mComputedWidth == NS_UNCONSTRAINEDSIZE)
>              {
>                 if (needsVerticalScrollbar) BiDiscrolledAreaWidth -= scrollbarWidth;//M15 we dont need to subtract the - (6 * p2t); // Why 6 pixels = Donno for sure...
>                 //if (!needsVerticalScrollbar) BiDiscrolledAreaWidth = scrolledAreaWidth - scrollbarWidth;
>              } else {
>                 BiDiscrolledAreaWidth = aReflowState.mComputedWidth - scrollbarWidth + (6 * p2t);
>                 if (needsVerticalScrollbar) BiDiscrolledAreaWidth -= scrollbarWidth;
>                 //else BiDiscrolledAreaWidth += scrollbarWidth;
>              }
>              //if (!needsVerticalScrollbar) BiDiscrolledAreaWidth += scrollbarWidth;
>              //if (!needsVerticalScrollbar) BiDiscrolledAreaWidth -= scrollbarWidth;
>              firstPassState.mComputedWidth  = BiDiscrolledAreaWidth;
>              firstPassState.availableWidth = BiDiscrolledAreaWidth;
>              nsScrollFrame::Reflow(aPresContext, aDesiredSize, firstPassState, aStatus);
>         } //else // LTR Bidi Preference 
> //!ARAZILLA
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/layout/html/style/src/nsCSSLoader.cpp mozilla.lbi/layout/html/style/src/nsCSSLoader.cpp
1463a1464
> #ifdef DEBUG
1465a1467
> #endif
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/mailnews/base/resources/locale/en-US/messenger.dtd mozilla.lbi/mailnews/base/resources/locale/en-US/messenger.dtd
189c189
< <!ENTITY dcharIso6Cmd.label ".Arabic (ISO-8859-6)">
---
> <!ENTITY dcharIso6Cmd.label "Arabic (ISO-8859-6)">
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/mailnews/compose/prefs/resources/locale/en-US/pref-composing_messages.dtd mozilla.lbi/mailnews/compose/prefs/resources/locale/en-US/pref-composing_messages.dtd
33a34
> <!-- LOCALIZATION NOTE (then.label): This will concatenate with the 4 strings that follow. -->
54a56
> <!-- LOCALIZATION NOTE (wrapOutMsg.label): This will concatenate with "xxx characters", using a number and (char.label). -->
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/mailnews/compose/resources/content/messengercompose.xul mozilla.lbi/mailnews/compose/resources/content/messengercompose.xul
268a269
> 			<menuitem id="ISO-8859-6" type="radio" name="charsetGroup" value="&dcharIso6Cmd.label;" oncommand="SetDocumentCharacterSet(this.id);"/>
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/mailnews/compose/resources/locale/en-US/messengercompose.dtd mozilla.lbi/mailnews/compose/resources/locale/en-US/messengercompose.dtd
65a66
> <!ENTITY dcharIso6Cmd.label "Arabic (ISO-8859-6)">
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/modules/libpref/src/init/all.js mozilla.lbi/modules/libpref/src/init/all.js
54c54
< pref("browser.startup.homepage",	   "http://www.mozilla.org/");
---
> pref("browser.startup.homepage",	   "http://www.langbox.com/");
293c293
< pref("intl.charsetmenu.mailedit",          "iso-8859-1, iso-8859-15, armscii-8, iso-8859-4, iso-8859-14, iso-8859-2, gb2312, big5, koi8-r, windows-1251, koi8-u, iso-8859-7, iso-2022-jp, euc-kr, iso-8859-10, iso-8859-3, tis-620, iso-8859-9, utf-8, viscii");
---
> pref("intl.charsetmenu.mailedit",          "iso-8859-1, iso-8859-6, windows-1256, iso-8859-15, armscii-8, iso-8859-4, iso-8859-14, iso-8859-2, gb2312, big5, koi8-r, windows-1251, koi8-u, iso-8859-7, iso-2022-jp, euc-kr, iso-8859-10, iso-8859-3, tis-620, iso-8859-9, utf-8, viscii");
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/modules/libpref/src/init/config.js mozilla.lbi/modules/libpref/src/init/config.js
26c26
< config("startup.homepage_override_url","http://www.mozilla.org/mozorg.html");
---
> config("startup.homepage_override_url","http://www.langbox.com/AraZilla/");
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/netwerk/protocol/http/src/nsHTTPResponseListener.cpp mozilla.lbi/netwerk/protocol/http/src/nsHTTPResponseListener.cpp
693a694,698
> //FA Bug www.hotmail.com see bugzilla # 48358
>          mHeaderBuffer.CompressSet(" \t", ' ');
>          mHeaderBuffer.StripChars ("\r\n");
>  
>          mResponse->ParseHeader (mHeaderBuffer);
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/profile/src/nsProfile.cpp mozilla.lbi/profile/src/nsProfile.cpp
106a107
> #ifdef DEBUG
107a109
> #endif
615a618,619
> //FA Add the Profile Manager at each start
> profileURLStr = PROFILE_MANAGER_URL;
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/themes/Makefile.in mozilla.lbi/themes/Makefile.in
29c29
< DIRS		= modern
---
> DIRS		= modern classic
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/themes/modern/communicator/bookmarks/MANIFEST mozilla.lbi/themes/modern/communicator/bookmarks/MANIFEST
9a10
> kbd-ar.gif
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/themes/modern/communicator/bookmarks/Makefile.in mozilla.lbi/themes/modern/communicator/bookmarks/Makefile.in
40a41
> 	kbd-ar.gif \
Binary files mozilla/themes/modern/global/animthrob.gif and mozilla.lbi/themes/modern/global/animthrob.gif differ
Binary files mozilla/themes/modern/global/animthrob_single.gif and mozilla.lbi/themes/modern/global/animthrob_single.gif differ
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/themes/modern/navigator/MANIFEST mozilla.lbi/themes/modern/navigator/MANIFEST
8a9
> kbd-ar.gif
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/themes/modern/navigator/Makefile.in mozilla.lbi/themes/modern/navigator/Makefile.in
40a41
> 	kbd-ar.gif \
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/themes/modern/navigator/navigator.css mozilla.lbi/themes/modern/navigator/navigator.css
102c102
<     display               : none;
---
>    display: none;
112c112
<     margin-right          : 1px;
---
>    margin-right      : 2px
119a120,124
> #kbdbutton
>   {
>     list-style-image      : url("chrome://communicator/skin/bookmarks/kbd-ar.gif");
>   }
> 
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/webshell/src/nsWebShell.cpp mozilla.lbi/webshell/src/nsWebShell.cpp
129d128
< #define NOISY_WEBSHELL_LEAKS
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/widget/src/gtk/nsClipboard.cpp mozilla.lbi/widget/src/gtk/nsClipboard.cpp
238a239
> #ifdef DEBUG_CLIPBOARD
239a241
> #endif
296a299
> #ifdef DEBUG_CLIPBOARD
297a301
> #endif
399a404,405
> //printf(" --> mSelectionData.length = %d [",mSelectionData.length);
> //int i ; for (i=0;i<mSelectionData.length;i++) printf(" 0x%04x",mSelectionData.data[i]); printf(" ]\n");
423a430
> #ifdef DEBUG_CLIPBOARD
424a432
> #endif
503a512
> #ifdef DEBUG_CLIPBOARD
504a514
> #endif /* DEBUG_CLIPBOARD */
536a547
>   g_print("nsClipboard::SelectionReceiver Len = %d\n",(aSD->length));
570c581
< 
---
> #ifdef DEBUG_CLIPBOARD
572a584
> #endif
585a598
> #ifdef DEBUG_CLIPBOARD
587a601
> #endif
626a641
> #ifdef DEBUG_CLIPBOARD
628a644
> #endif
828a845
> #ifdef DEBUG_CLIPBOARD
829a847
> #endif
865a884
> int i ; printf(" --> ["); for (i=0;i<dataLength;i++) printf(" 0x%02x",(char)*(((char*)clipboardData)+i)); printf(" ]\n");
907a927,928
> 
> //printf("GetCharset platformCharset = "); for(i=0;i<platformCharset.Length();i++) printf("%c",platformCharset[i]); printf(" ]\n");
910d930
<       
980a1001
> #ifdef DEBUG_CLIPBOARD
983a1005
> #endif
1005a1028
> #ifdef DEBUG_CLIPBOARD
1006a1030
> #endif /* DEBUG_CLIPBOARD */
1008a1033
> #ifdef DEBUG_CLIPBOARD
1009a1035
> #endif /* DEBUG_CLIPBOARD */
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/widget/src/gtk/nsGtkEventHandler.cpp mozilla.lbi/widget/src/gtk/nsGtkEventHandler.cpp
296a297,323
> //ARAZILLA Add on (must use uconv service instead...)
> #ifdef IBMBIDI
> #define ISO_HAMZA 0xc1
> #define ISO_SUKUN 0xf2
> #define UNI_HAMZA 0x0621
> #define UNI_SUKUN 0x0652
> #define ISO_COMMA 0xAC
> #define ISO_SEMI  0xBB
> #define ISO_INTER 0xFB
> #define UNI_COMMA 0x060C
> #define ISO_SPACE 0xA0
>  
> PRUint32 FP_ISO88596ToUnicode( unsigned char ch)
> {
>    PRUint32 uch;
>   if (ch >= ISO_HAMZA && ch <= ISO_SUKUN)
>     uch = ch-ISO_HAMZA+UNI_HAMZA;
>   else if ((ch == ISO_COMMA) || (ch == ISO_SEMI) || (ch == ISO_INTER))
>     uch = ch - ISO_COMMA + UNI_COMMA ;
>    else if (ch == ISO_SPACE)
>     uch = 0xA0;  // 0x20 or 0xA0=NBSP or 0xFEFF = ZWNBSP ???
>    else
>     uch = ch;
> //printf("FP_ISO88596ToUnicode [%x] -> [0x%x] -------------- \n",ch,uch);
>    return uch;
> }
> #endif //IBMBIDI                                                                                     
316a344,346
> #ifdef IBMBIDI
>   if ((!isprint(aGEK->string[0])) && ((unsigned char)aGEK->string[0] < 0x20) || ((unsigned char)aGEK->string[0] == 0x7f)) //Let Arabic ISO 
> #else
317a348
> #endif
330a362,369
> // ARAZILLA specific treatement If we have ISO 8859-6 (after ^T) then we convert it
> // to Unicode : Patch for Arabic only
> #ifdef IBMBIDI
> //printf("NNNNNNNNNNNNN state %x MOD1 %x / SHIFT %x\n",aGEK->state,GDK_MOD1_MASK, GDK_SHIFT_MASK);
>   if ((unsigned char)aGEK->string[0] > 0x80)
>      return FP_ISO88596ToUnicode((unsigned char)aGEK->string[0]);
>   else
> #endif                                                                                               
642a681,691
> //ARAZILLA patch LamAlef
> //ARAZILLA LamAlef key return 2 charcode 1-LAM and 2-Alef - We get both here
> if(event->length == 2)
> {
>    event->length=1;
>    event->string[0] = event->string[1];
>    InitKeyPressEvent(event, win, kevent);
>    win->OnKey(kevent);
> }
> // !ARAZILLA
> 
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/widget/src/gtk/nsTextAreaWidget.cpp mozilla.lbi/widget/src/gtk/nsTextAreaWidget.cpp
65a66
> printf("+++++++++ Create Native TextArea Widget here....\n");
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/widget/src/gtk/nsTextWidget.cpp mozilla.lbi/widget/src/gtk/nsTextWidget.cpp
74a75
> //printf("+++++ Create MOZBOX as nsTextWidget here...\n");
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/widget/src/gtk/nsWidget.cpp mozilla.lbi/widget/src/gtk/nsWidget.cpp
796a797
> printf("+++ nsWidget::SetCursor %x\n", aCursor);
979c980
< 
---
> printf("++++ InvalidateRegion widjet %x, rect %d %d %d %d\n",mWidget,r->x, r->y, r->width, r->height); 
1028a1030
> printf("++++ nsWidget::Update()\n");
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/widget/src/gtk/nsWindow.cpp mozilla.lbi/widget/src/gtk/nsWindow.cpp
58a59,64
> //ARAZILLA
> extern "C" int AStrCtx(char *) ;    
> extern "C" unsigned char *AGetOmapTable();
> extern "C" int ASetOmapTable (unsigned char *t);
> //!ARAZILLA
> 
1009c1015
<   printf("send NS_GOTFOCUS from nsWindow::OnFocusInSignal\n");
---
>   //printf("send NS_GOTFOCUS from nsWindow::OnFocusInSignal\n");
1576a1583,1584
> 
> #ifdef DEBUG
1578a1587
> #endif
1938c1947,1948
<       platformCharset.AssignWithConversion("ISO-8859-1");
---
> //ARAZILLA      platformCharset.AssignWithConversion("ISO-8859-1");
>       platformCharset.AssignWithConversion("ISO-8859-6");
1950a1960
> //printf("nsWindow::SetTitle : len=%d \n",len);
1955a1966,1997
> //ARAZILLA test  ctx title
>       if(getenv("AR_ARABICWM") == NULL) 
>       {
> #ifdef DEBUG
> printf("SET TITLE --->[%s]  ",platformText);
> #endif
>           unsigned char * cur_omap;
>           static unsigned char omap96[]= {
>              160, 33, 34, 35, 36, 37, 38, 39, 41, 40, 42, 43,186, 45, 46, 47,
>              176,177,178,179,180,181,182,183,184,185, 58,187, 62, 61, 60,191,
>               64,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
>              208,209,210,211,212,213,214,215,216,217,218, 93, 92, 91, 94, 95,
>              224,225,226,227,228,229,230,231,232,233,234,168,169,170,171,172,
>              173,174,175,007,007,007,007,007,007,007,007,125,124,123,126,007,
>              174,174,174,174,174,174,007,007,007,007,007,007,007,007,007,007,
>              188,189,190,219,220,221,223,222,222,222,222,007,222,222,222,007,
>              192,194,195,196,197,199,207,208,209,210,232,233,235,235,200,236,
>              236,201,236,236,202,237,237,203,238,238,204,239,239,205,240,240,
>              206,241,241,211,242,242,212,243,243,213,244,244,214,215,215,215,
>              216,216,216,245,245,217,246,246,218,247,247,225,248,248,226,249,
>              249,227,250,250,228,251,251,229,252,252,230,253,253,231,254,254,
>              234,165,166,161,162,163,164,160,192,198,007,007,007,007,007,007
>           };
>           cur_omap = AGetOmapTable();
>           ASetOmapTable(omap96);
>           AStrCtx(platformText);
>           ASetOmapTable(cur_omap);
> #ifdef DEBUG
> printf("--->[%s]\n",platformText);
> #endif
>       }
> //!ARAZILLA
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/widget/src/xpwidgets/nsBaseWidget.cpp mozilla.lbi/widget/src/xpwidgets/nsBaseWidget.cpp
716a717
> printf("nsBaseWidget::Paint ----------------\n");
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/widget/src/xpwidgets/nsTransferable.cpp mozilla.lbi/widget/src/xpwidgets/nsTransferable.cpp
99a100
> #ifdef DEBUG
100a102
> #endif
102a105
> #ifdef DEBUG
105,106c108,111
< 	    
<   } else {
---
> #endif
>   } 
> #ifdef DEBUG
>     else {
108a114
> #endif
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/xpcom/components/nsNativeComponentLoader.cpp mozilla.lbi/xpcom/components/nsNativeComponentLoader.cpp
937a938
> #ifdef DEBUG
939a941
> #endif
955a958
> #ifdef DEBUG
961a965
> #endif
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/xpfe/appshell/public/nsBuildID.h mozilla.lbi/xpfe/appshell/public/nsBuildID.h
8c8
< #define NS_BUILD_ID 0000000000
---
> #define NS_BUILD_ID 2000101018
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/xpfe/browser/public/nsIBrowserInstance.idl mozilla.lbi/xpfe/browser/public/nsIBrowserInstance.idl
62a63,64
> //ARAZILLA
>     void setDirection( in PRUint8 aDir );
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/xpfe/browser/resources/content/navigator.js mozilla.lbi/xpfe/browser/resources/content/navigator.js
607a608,614
> var new_window='';
> 
> function ArabicKeyboard()
>   {
> 	new_window=open('resource:/res/arabic_kbd/arabic_kbd.html','windowName','resizable=no,width=563,height=370');
>   }
> 
984a992,1000
> //ARAZILLA ADD
>   function BrowserChangeDirection (aDirection)
>   {
>     if (appCore != null) {
>        appCore.setDirection(aDirection);
>     }
>   }
> // !ARAZILLA ADD
> 
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/xpfe/browser/resources/content/navigator.xul mozilla.lbi/xpfe/browser/resources/content/navigator.xul
366c366,373
<     
---
>         <button class="button-toolbar" id="kbdbutton" value="&kbdButton.label;"
> 		tooltip="aTooltip" tooltiptext="&kbdButton.tooltip;"
> 		ondraggesture="return BeginDragPersonalToolbar(event);"
>              	ondragdrop="return DropPersonalToolbar(event);"
>              	ondragover="return DragOverPersonalToolbar(event);"
> 		oncommand="ArabicKeyboard(); event.preventBubble();"
>              	grippytooltip="aTooltip"
>              	grippytooltiptext="&personalBar.tooltip;"/>
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/xpfe/browser/resources/content/navigatorOverlay.xul mozilla.lbi/xpfe/browser/resources/content/navigatorOverlay.xul
67a68,73
>         <key id="key_direction_ltr" xulkey="true"
>              key="&direction_ltrCmd.commandkey;"
>              observes="Browser:Direction_ltr"/>
>         <key id="key_direction_rtl" xulkey="true"
>              key="&direction_rtlCmd.commandkey;"
>              observes="Browser:Direction_rtl"/>
112a119,127
> <!-- ARAZILLA add -->
>         <broadcaster id="Browser:Direction_ltr"
> 		     oncommand="BrowserChangeDirection(0);"/>
>         <broadcaster id="Browser:Direction_rtl"
>                      oncommand="BrowserChangeDirection(1);"/>
>         <broadcaster id="Browser:Direction_def"
>                      oncommand="BrowserChangeDirection(2);"/>
> <!-- ARAZILLA end -->
> 
326a342,350
> <!-- ARAZILLA ADD -->
>       <menuseparator />
>       <menuitem value="&direction_ltrCmd.label;"
>         observes="Browser:Direction_ltr"/> 
>       <menuitem value="&direction_rtlCmd.label;"
>         observes="Browser:Direction_rtl"/> 
>       <menuitem value="&direction_defCmd.label;"
>         observes="Browser:Direction_def"/> 
> <!-- ARAZILLA END -->
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/xpfe/browser/resources/content/viewSource.xul mozilla.lbi/xpfe/browser/resources/content/viewSource.xul
40c40
< 		<titledbutton align="right" value="Build ID: 2000020608" style="font-family:sans-serif;font-size:2.5mm;"/>
---
> 		<titledbutton align="right" value="Build ID: 2000101018" style="font-family:sans-serif;font-size:2.5mm;"/>
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/xpfe/browser/resources/locale/en-US/navigator.dtd mozilla.lbi/xpfe/browser/resources/locale/en-US/navigator.dtd
54a55,61
> <!-- ARAZILLA ADD -->
> <!ENTITY direction_ltrCmd.label "Direction Left-To-Right">
> <!ENTITY direction_ltrCmd.commandkey "L">
> <!ENTITY direction_rtlCmd.label "Direction Right-To-Left">
> <!ENTITY direction_rtlCmd.commandkey "R">
> <!ENTITY direction_defCmd.label "Default Direction">
> <!-- ARAZILLA END -->
311a319,320
> <!ENTITY  kbdButton.label             "Arabic KBD">
> <!ENTITY  kbdButton.tooltip           "Arabic Virtual Keyboard">
320c329
< <!ENTITY  buildId.label               "Build ID: 2000042708">
---
> <!ENTITY  buildId.label               "Build ID: 2000101018">
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/xpfe/browser/resources/locale/en-US/viewSource.dtd mozilla.lbi/xpfe/browser/resources/locale/en-US/viewSource.dtd
4c4
< <!ENTITY mainWindow.title "Mozilla"> 
---
> <!ENTITY mainWindow.title "AraZilla"> 
6c6
< <!ENTITY mainWindow.titlemodifier "Mozilla"> 
---
> <!ENTITY mainWindow.titlemodifier "AraZilla"> 
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/xpfe/browser/src/navigator-test1.xul mozilla.lbi/xpfe/browser/src/navigator-test1.xul
8c8
<         onload="Startup()" title="Mozilla"> 
---
>         onload="Startup()" title="AraZilla"> 
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/xpfe/browser/src/nsBrowserInstance.cpp mozilla.lbi/xpfe/browser/src/nsBrowserInstance.cpp
272a273
> #ifdef DEBUG
273a275
> #endif
293a296
> #ifdef DEBUG
294a298
> #endif
362a367
> #ifdef DEBUG
363a369
> #endif
639a646
> #ifdef DEBUG
640a648
> #endif
650a659
> #ifdef DEBUG
652a662
> #endif
690c700
<         printf("nsBrowserInstance::BackButtonPopup Error while creating history mene item\n");
---
>         if (APP_DEBUG)printf("nsBrowserInstance::BackButtonPopup Error while creating history mene item\n");
704c714
<     printf("nsBrowserInstance::ForwardButtonPopup Couldn't get a handle to SessionHistory\n");
---
>     if (APP_DEBUG)printf("nsBrowserInstance::ForwardButtonPopup Couldn't get a handle to SessionHistory\n");
717c727
<       printf("nsBrowserInstance::ForwardMenuPopup Error while clearing old history entries\n");
---
>       if (APP_DEBUG)printf("nsBrowserInstance::ForwardMenuPopup Error while clearing old history entries\n");
758c768
<         printf("nsBrowserInstance::ForwardButtonPopup Error while creating history mene item\n");
---
>         if (APP_DEBUG)printf("nsBrowserInstance::ForwardButtonPopup Error while creating history mene item\n");
1076a1087,1119
> // Add by ARAZILLA
> NS_IMETHODIMP
> nsBrowserInstance::SetDirection(PRUint8 aDir)
> {
> 
>   nsCOMPtr<nsIScriptGlobalObject> globalObj( do_QueryInterface(GetContentWindow()) );
>   if (!globalObj) {
>     return NS_ERROR_FAILURE;
>   }
> 
>   nsCOMPtr<nsIDocShell> docShell;
>   globalObj->GetDocShell(getter_AddRefs(docShell));
> 
>   if (docShell)
>   {
>     nsCOMPtr<nsIContentViewer> childCV;
>     NS_ENSURE_SUCCESS(docShell->GetContentViewer(getter_AddRefs(childCV)), NS_ERROR_FAILURE);
>     if (childCV)
>     {
>       nsCOMPtr<nsIMarkupDocumentViewer> markupCV = do_QueryInterface(childCV);
>       if (markupCV) {
>         NS_ENSURE_SUCCESS(markupCV->SetDirection(aDir), NS_ERROR_FAILURE);
>       }
>     }
>   }
>   nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(GetContentAreaDocShell()));
>   NS_ENSURE_TRUE(webNav, NS_ERROR_FAILURE);
>  
>   webNav->Reload(nsIWebNavigation::reloadNormal);                                        
>   return NS_OK;
> 
> }
> 
1451a1495
> #ifdef DEBUG
1459a1504,1505
> #endif
> 
1725c1771
<     printf("nsBrowserInstance::CreateMenuItem ERROR creating the menu item element\n");
---
>     if (APP_DEBUG)printf("nsBrowserInstance::CreateMenuItem ERROR creating the menu item element\n");
1733c1779
<     printf("nsBrowserAppCore::CreateMenuItem ERROR setting ishist handler\n");
---
>     if (APP_DEBUG)printf("nsBrowserAppCore::CreateMenuItem ERROR setting ishist handler\n");
1743c1789
<     printf("nsBrowserInstance::CreateMenuItem ERROR Setting node value for menu item ****\n");
---
>     if (APP_DEBUG)printf("nsBrowserInstance::CreateMenuItem ERROR Setting node value for menu item ****\n");
1754c1800
<     printf("nsBrowserAppCore::CreateMenuItem ERROR setting ishist handler\n");
---
>     if (APP_DEBUG)printf("nsBrowserAppCore::CreateMenuItem ERROR setting ishist handler\n");
1761c1807
<     printf("nsBrowserInstance::CreateMenuItem ERROR converting DOMElement to DOMNode *****\n");
---
>     if (APP_DEBUG)printf("nsBrowserInstance::CreateMenuItem ERROR converting DOMElement to DOMNode *****\n");
1771c1817
<        printf("nsBrowserInstance::CreateMenuItem ERROR appending menuitem to menu *****\n");
---
>        if (APP_DEBUG)printf("nsBrowserInstance::CreateMenuItem ERROR appending menuitem to menu *****\n");
1783c1829
<     printf("nsBrowserInstance::UpdateGoMenu Couldn't get a handle to Content Area DocShell\n");
---
>     if (APP_DEBUG)printf("nsBrowserInstance::UpdateGoMenu Couldn't get a handle to Content Area DocShell\n");
1793c1839
<     printf("nsBrowserInstance::UpdateGoMenu Error while clearing old history list\n");
---
>     if (APP_DEBUG)printf("nsBrowserInstance::UpdateGoMenu Error while clearing old history list\n");
1827c1873
<         printf("nsBrowserInstance::UpdateGoMenu Error while creating history mene item\n");
---
>         if (APP_DEBUG)printf("nsBrowserInstance::UpdateGoMenu Error while creating history mene item\n");
1856c1902
<         printf("nsBrowserInstance::ClearHistoryPopup, Could not get child\n");
---
>         if (APP_DEBUG)printf("nsBrowserInstance::ClearHistoryPopup, Could not get child\n");
1862c1908
<         printf("nsBrowserInstance::ClearHistorypopup Could n't get DOMElement out of DOMNode for child\n");
---
>         if (APP_DEBUG)printf("nsBrowserInstance::ClearHistorypopup Could n't get DOMElement out of DOMNode for child\n");
1879c1925
<               printf("nsBrowserInstance::ClearHistoryPopup Child %x was not removed from popuplist\n", (unsigned int) child.get());
---
>               if (APP_DEBUG)printf("nsBrowserInstance::ClearHistoryPopup Child %x was not removed from popuplist\n", (unsigned int) child.get());
1884c1930
<            printf("nsBrowserInstance::ClearHistoryPopup Child %x was not removed from popuplist\n", (unsigned int) child.get());
---
>            if (APP_DEBUG)printf("nsBrowserInstance::ClearHistoryPopup Child %x was not removed from popuplist\n", (unsigned int) child.get());
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/xpfe/components/urlbarhistory/src/nsUrlbarHistory.cpp mozilla.lbi/xpfe/components/urlbarhistory/src/nsUrlbarHistory.cpp
158a159
> #ifdef DEBUG
159a161
> #endif
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/xpfe/global/resources/content/charsetOverlay.xul mozilla.lbi/xpfe/global/resources/content/charsetOverlay.xul
76a77,87
>         <menu value="&charsetMenuMore7.label;"  datasources="rdf:charset-menu" ref="NC:BrowserMore7CharsetMenuRoot">
>             <template>
>                 <rule>
>                     <menupopup>
>                     <menuitem uri="..." value="rdf:http://home.netscape.com/NC-rdf#Name"/>
>                     </menupopup>
>                 </rule>
>             </template>
>             <menupopup>
>             </menupopup>
>         </menu>
179a191,201
>         <menu value="&charsetMenuMore7.label;"  datasources="rdf:charset-menu" ref="NC:BrowserMore7CharsetMenuRoot">
>             <template>
>                 <rule>
>                     <menupopup>
>                     <menuitem uri="..." value="rdf:http://home.netscape.com/NC-rdf#Name"/>
>                     </menupopup>
>                 </rule>
>             </template>
>             <menupopup>
>             </menupopup>
>         </menu>
288a311,321
>             <template>
>                 <rule>
>                     <menupopup>
>                     <menuitem uri="..." value="rdf:http://home.netscape.com/NC-rdf#Name"/>
>                     </menupopup>
>                 </rule>
>             </template>
>             <menupopup>
>             </menupopup>
>         </menu>
>         <menu value="&charsetMenuMore7.label;"  datasources="rdf:charset-menu" ref="NC:BrowserMore7CharsetMenuRoot">
diff --exclude=.deps --exclude=*.so --exclude=*.a --exclude=Makefile --exclude=*.o --exclude=*.org -r -b -B mozilla/xpfe/global/resources/locale/en-US/charsetOverlay.dtd mozilla.lbi/xpfe/global/resources/locale/en-US/charsetOverlay.dtd
7a8
> <!ENTITY charsetMenuMore7.label				"Arabic LBI add...">