diff --git a/mozilla/gfx/thebes/src/gfxFont.cpp b/mozilla/gfx/thebes/src/gfxFont.cpp index 9c22a6dcc25..e7d8812f585 100644 --- a/mozilla/gfx/thebes/src/gfxFont.cpp +++ b/mozilla/gfx/thebes/src/gfxFont.cpp @@ -1947,6 +1947,12 @@ gfxTextRun::SortGlyphRuns() // be skipped; the last GlyphRun will cover its character range. if (i == 0 || runs[i].mFont != runs[i - 1].mFont) { mGlyphRuns.AppendElement(runs[i]); + // If two fonts have the same character offset, Sort() will have + // randomized the order. + NS_ASSERTION(i == 0 || + runs[i].mCharacterOffset != + runs[i - 1].mCharacterOffset, + "Two fonts for the same run, glyph indices may not match the font"); } } } diff --git a/mozilla/gfx/thebes/src/gfxPangoFonts.cpp b/mozilla/gfx/thebes/src/gfxPangoFonts.cpp index ab691337a42..77784b60aa8 100644 --- a/mozilla/gfx/thebes/src/gfxPangoFonts.cpp +++ b/mozilla/gfx/thebes/src/gfxPangoFonts.cpp @@ -1658,7 +1658,7 @@ gfxPangoFontGroup::CreateGlyphRunsItemizing(gfxTextRun *aTextRun, nsRefPtr font = gfxPangoFont::GetOrMakeFont(item->analysis.font); - nsresult rv = aTextRun->AddGlyphRun(font, utf16Offset, PR_TRUE); + nsresult rv = aTextRun->AddGlyphRun(font, utf16Offset); if (NS_FAILED(rv)) { NS_ERROR("AddGlyphRun Failed"); goto out; @@ -1690,8 +1690,6 @@ gfxPangoFontGroup::CreateGlyphRunsItemizing(gfxTextRun *aTextRun, } } - aTextRun->SortGlyphRuns(); - out: if (glyphString) pango_glyph_string_free(glyphString); diff --git a/mozilla/layout/reftests/text/fallback-01-ref.xhtml b/mozilla/layout/reftests/text/fallback-01-ref.xhtml new file mode 100644 index 00000000000..4894469eb69 --- /dev/null +++ b/mozilla/layout/reftests/text/fallback-01-ref.xhtml @@ -0,0 +1,19 @@ + +]> + + + + + + +

&fallback;&fallback;&first;&fallback;&first;&fallback;&first;&fallback;

+ + diff --git a/mozilla/layout/reftests/text/fallback-01.xhtml b/mozilla/layout/reftests/text/fallback-01.xhtml new file mode 100644 index 00000000000..804fb047307 --- /dev/null +++ b/mozilla/layout/reftests/text/fallback-01.xhtml @@ -0,0 +1,19 @@ + +]> + + + + + + +

&fallback;&fallback;&first;&fallback;&first;&fallback;&first;&fallback;

+ + diff --git a/mozilla/layout/reftests/text/reftest.list b/mozilla/layout/reftests/text/reftest.list index ee02069606f..2fa901b609f 100644 --- a/mozilla/layout/reftests/text/reftest.list +++ b/mozilla/layout/reftests/text/reftest.list @@ -1,3 +1,4 @@ +== fallback-01.xhtml fallback-01-ref.xhtml == long-1.html long-ref.html random == soft-hyphens-1a.html soft-hyphens-1-ref.html # bug 406299 random == soft-hyphens-1b.html soft-hyphens-1-ref.html # bug 406299