From eb26f2878fccd8fa39e742ffe1c31d97378cd205 Mon Sep 17 00:00:00 2001 From: "roc+%cs.cmu.edu" Date: Wed, 24 Oct 2007 21:39:23 +0000 Subject: [PATCH] Bug 396321. Make gfxTextRunWordCache strip bidi control characters when it creates a text run, ensuring that platform text engines never see such characters. r=pavlov,a=vlad git-svn-id: svn://10.0.0.236/trunk@238096 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/gfx/thebes/public/Makefile.in | 4 +++- mozilla/gfx/thebes/public/gfxFont.h | 5 ++++- mozilla/gfx/thebes/test/Makefile.in | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/mozilla/gfx/thebes/public/Makefile.in b/mozilla/gfx/thebes/public/Makefile.in index 46719562b82..d41c8db30ee 100644 --- a/mozilla/gfx/thebes/public/Makefile.in +++ b/mozilla/gfx/thebes/public/Makefile.in @@ -8,7 +8,9 @@ include $(DEPTH)/config/autoconf.mk MODULE = thebes -REQUIRES = cairo +REQUIRES = cairo \ + unicharutil \ + $(NULL) EXPORTS = gfxASurface.h \ gfxAlphaRecovery.h \ diff --git a/mozilla/gfx/thebes/public/gfxFont.h b/mozilla/gfx/thebes/public/gfxFont.h index 7d95d4b102e..84cda4af571 100644 --- a/mozilla/gfx/thebes/public/gfxFont.h +++ b/mozilla/gfx/thebes/public/gfxFont.h @@ -50,6 +50,7 @@ #include "gfxRect.h" #include "nsExpirationTracker.h" #include "nsMathUtils.h" +#include "nsBidiUtils.h" class gfxContext; class gfxTextRun; @@ -1360,7 +1361,9 @@ public: static PRBool IsInvalidChar(PRUnichar ch) { if (ch >= 32) { return ch == 0x0085/*NEL*/ || - ch == 0x200B/*ZWSP*/ || ch == 0x2028/*LSEP*/ || ch == 0x2029/*PSEP*/; + ((ch & 0xFF00) == 0x2000 /* Unicode control character */ && + (ch == 0x200B/*ZWSP*/ || ch == 0x2028/*LSEP*/ || ch == 0x2029/*PSEP*/ || + IS_BIDI_CONTROL_CHAR(ch))); } // We could just blacklist all control characters, but it seems better // to only blacklist the ones we know cause problems for native font diff --git a/mozilla/gfx/thebes/test/Makefile.in b/mozilla/gfx/thebes/test/Makefile.in index f76f4d6df89..11712067434 100644 --- a/mozilla/gfx/thebes/test/Makefile.in +++ b/mozilla/gfx/thebes/test/Makefile.in @@ -51,7 +51,7 @@ REQUIRES = \ thebes \ cairo \ pref \ - thebes \ + unicharutil \ $(NULL) # All platforms