From f55e9aee2a250853b9632976c3903feed8b82c2b Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Fri, 16 Jan 2009 21:17:46 +1300 Subject: [PATCH] Bug 472909. Need to call FinishSettingProperties on nsTranformedTextRuns that we create as parts of other transformed textruns. r=smontagu --HG-- extra : rebase_source : 38adef908b1ec8d6fcc97b1b6cb42690733ae752 --- layout/generic/nsTextRunTransformations.cpp | 14 ++++++++++---- layout/generic/nsTextRunTransformations.h | 16 ++++++++-------- layout/reftests/text-transform/reftest.list | 1 + .../text-transform/small-caps-1-ref.html | 4 ++++ layout/reftests/text-transform/small-caps-1.html | 4 ++++ 5 files changed, 27 insertions(+), 12 deletions(-) create mode 100644 layout/reftests/text-transform/small-caps-1-ref.html create mode 100644 layout/reftests/text-transform/small-caps-1.html diff --git a/layout/generic/nsTextRunTransformations.cpp b/layout/generic/nsTextRunTransformations.cpp index 53023e4cc6e1..f0b5fb1cdd13 100644 --- a/layout/generic/nsTextRunTransformations.cpp +++ b/layout/generic/nsTextRunTransformations.cpp @@ -88,7 +88,7 @@ nsTransformedTextRun::SetPotentialLineBreaks(PRUint32 aStart, PRUint32 aLength, return changed; } -gfxTextRun* +nsTransformedTextRun* nsTransformingTextRunFactory::MakeTextRun(const PRUnichar* aString, PRUint32 aLength, const gfxTextRunFactory::Parameters* aParams, gfxFontGroup* aFontGroup, PRUint32 aFlags, @@ -98,7 +98,7 @@ nsTransformingTextRunFactory::MakeTextRun(const PRUnichar* aString, PRUint32 aLe aString, aLength, aFlags, aStyles, aOwnsFactory); } -gfxTextRun* +nsTransformedTextRun* nsTransformingTextRunFactory::MakeTextRun(const PRUint8* aString, PRUint32 aLength, const gfxTextRunFactory::Parameters* aParams, gfxFontGroup* aFontGroup, PRUint32 aFlags, @@ -279,7 +279,7 @@ nsFontVariantTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun, } if ((i == length || runIsLowercase != isLowercase) && runStart < i) { - nsAutoPtr transformedChild; + nsAutoPtr transformedChild; gfxTextRunCache::AutoTextRun cachedChild; gfxTextRun* child; @@ -301,6 +301,9 @@ nsFontVariantTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun, "lost some break-before values?"); child->SetPotentialLineBreaks(0, canBreakBeforeArray.Length(), canBreakBeforeArray.Elements(), aRefContext); + if (transformedChild) { + transformedChild->FinishSettingProperties(aRefContext); + } aTextRun->CopyGlyphDataFrom(child, 0, child->GetLength(), runStart, PR_FALSE); runStart = i; @@ -388,7 +391,7 @@ nsCaseTransformTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun, GetParametersForInner(aTextRun, &flags, aRefContext); gfxFontGroup* fontGroup = aTextRun->GetFontGroup(); - nsAutoPtr transformedChild; + nsAutoPtr transformedChild; gfxTextRunCache::AutoTextRun cachedChild; gfxTextRun* child; @@ -411,6 +414,9 @@ nsCaseTransformTextRunFactory::RebuildTextRun(nsTransformedTextRun* aTextRun, "Dropped characters or break-before values somewhere!"); child->SetPotentialLineBreaks(0, canBreakBeforeArray.Length(), canBreakBeforeArray.Elements(), aRefContext); + if (transformedChild) { + transformedChild->FinishSettingProperties(aRefContext); + } if (extraCharsCount > 0) { // Now merge multiple characters into one multi-glyph character as required diff --git a/layout/generic/nsTextRunTransformations.h b/layout/generic/nsTextRunTransformations.h index cd9baa21ab52..8c6fba86d27c 100644 --- a/layout/generic/nsTextRunTransformations.h +++ b/layout/generic/nsTextRunTransformations.h @@ -48,14 +48,14 @@ public: virtual ~nsTransformingTextRunFactory() {} // Default 8-bit path just transforms to Unicode and takes that path - gfxTextRun* MakeTextRun(const PRUint8* aString, PRUint32 aLength, - const gfxFontGroup::Parameters* aParams, - gfxFontGroup* aFontGroup, PRUint32 aFlags, - nsStyleContext** aStyles, PRBool aOwnsFactory = PR_TRUE); - gfxTextRun* MakeTextRun(const PRUnichar* aString, PRUint32 aLength, - const gfxFontGroup::Parameters* aParams, - gfxFontGroup* aFontGroup, PRUint32 aFlags, - nsStyleContext** aStyles, PRBool aOwnsFactory = PR_TRUE); + nsTransformedTextRun* MakeTextRun(const PRUint8* aString, PRUint32 aLength, + const gfxFontGroup::Parameters* aParams, + gfxFontGroup* aFontGroup, PRUint32 aFlags, + nsStyleContext** aStyles, PRBool aOwnsFactory = PR_TRUE); + nsTransformedTextRun* MakeTextRun(const PRUnichar* aString, PRUint32 aLength, + const gfxFontGroup::Parameters* aParams, + gfxFontGroup* aFontGroup, PRUint32 aFlags, + nsStyleContext** aStyles, PRBool aOwnsFactory = PR_TRUE); virtual void RebuildTextRun(nsTransformedTextRun* aTextRun, gfxContext* aRefContext) = 0; }; diff --git a/layout/reftests/text-transform/reftest.list b/layout/reftests/text-transform/reftest.list index 9548d5da2c75..3d3414f8cf35 100644 --- a/layout/reftests/text-transform/reftest.list +++ b/layout/reftests/text-transform/reftest.list @@ -2,5 +2,6 @@ == capitalize-2.html capitalize-ref.html == capitalize-3.html capitalize-3-ref.html == lowercase-1.html lowercase-ref.html +== small-caps-1.html small-caps-1-ref.html == uppercase-1.html uppercase-ref.html == uppercase-szlig-1.html uppercase-szlig-ref.html diff --git a/layout/reftests/text-transform/small-caps-1-ref.html b/layout/reftests/text-transform/small-caps-1-ref.html new file mode 100644 index 000000000000..e342a3d2a230 --- /dev/null +++ b/layout/reftests/text-transform/small-caps-1-ref.html @@ -0,0 +1,4 @@ + + +AA + diff --git a/layout/reftests/text-transform/small-caps-1.html b/layout/reftests/text-transform/small-caps-1.html new file mode 100644 index 000000000000..51e804b796ec --- /dev/null +++ b/layout/reftests/text-transform/small-caps-1.html @@ -0,0 +1,4 @@ + + +Aa +