From e2ff90c7bd39a6def701b45fcacdbd91183d4a4c Mon Sep 17 00:00:00 2001 From: "katakai%japan.sun.com" Date: Fri, 13 Dec 2002 08:04:51 +0000 Subject: [PATCH] bug 128572 CPU usage jumps to 100% when loading a page with wrong charset r=bstell,sr=rbs git-svn-id: svn://10.0.0.236/trunk@135231 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/gfx/src/gtk/nsFontMetricsGTK.cpp | 28 +++++++----------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/mozilla/gfx/src/gtk/nsFontMetricsGTK.cpp b/mozilla/gfx/src/gtk/nsFontMetricsGTK.cpp index 27267f8fe07..646b39b225a 100644 --- a/mozilla/gfx/src/gtk/nsFontMetricsGTK.cpp +++ b/mozilla/gfx/src/gtk/nsFontMetricsGTK.cpp @@ -5962,16 +5962,6 @@ if (gAllowDoubleByteSpecialChars) { } } - // If this is is the 'unknown' char (ie: converter could not - // convert it) there is no sense in searching any further for - // a font. This test shows up in several locations; if we did - // this test earlier in the search we would only need to do it - // once but we don't want to slow down the typical search. - if (aChar == UCS2_NOMAPPING) { - FIND_FONT_PRINTF((" ignore the 'UCS2_NOMAPPING' character")); - return nsnull; - } - // // Search all font prefs for generic // @@ -6006,16 +5996,6 @@ nsFontGTK* nsFontMetricsGTK::FindAnyFont(PRUnichar aChar) { FIND_FONT_PRINTF((" FindAnyFont")); - // If this is is the 'unknown' char (ie: converter could not - // convert it) there is no sense in searching any further for - // a font. This test shows up in several locations; if we did - // this test earlier in the search we would only need to do it - // once but we don't want to slow down the typical search. - if (aChar == UCS2_NOMAPPING) { - FIND_FONT_PRINTF((" ignore the 'UCS2_NOMAPPING' character")); - return nsnull; - } - // XXX If we get to this point, that means that we have exhausted all the // families in the lists. Maybe we should try a list of fonts that are // specific to the vendor of the X server here. Because XListFonts for the @@ -6232,6 +6212,14 @@ nsFontMetricsGTK::FindFont(PRUnichar aChar) { FIND_FONT_PRINTF(("\nFindFont(%c/0x%04x)", aChar, aChar)); + // If this is is the 'unknown' char (ie: converter could not + // convert it) there is no sense in searching any further for + // a font. Just returing mWesternFont + if (aChar == UCS2_NOMAPPING) { + FIND_FONT_PRINTF((" ignore the 'UCS2_NOMAPPING' character, return mWesternFont")); + return mWesternFont; + } + nsFontGTK* font = FindUserDefinedFont(aChar); if (!font) { font = FindStyleSheetSpecificFont(aChar);