diff --git a/dom/canvas/CanvasRenderingContext2D.cpp b/dom/canvas/CanvasRenderingContext2D.cpp index 532d5c38371b..f35f2207366d 100644 --- a/dom/canvas/CanvasRenderingContext2D.cpp +++ b/dom/canvas/CanvasRenderingContext2D.cpp @@ -3499,13 +3499,9 @@ struct MOZ_STACK_CLASS CanvasBidiProcessor : public nsBidiPresUtils::BidiProcess virtual nscoord GetWidth() { - gfxTextRun::Metrics textRunMetrics = mTextRun->MeasureText(0, - mTextRun->GetLength(), - mDoMeasureBoundingBox ? - gfxFont::TIGHT_INK_EXTENTS : - gfxFont::LOOSE_INK_EXTENTS, - mDrawTarget, - nullptr); + gfxTextRun::Metrics textRunMetrics = mTextRun->MeasureText( + mDoMeasureBoundingBox ? gfxFont::TIGHT_INK_EXTENTS + : gfxFont::LOOSE_INK_EXTENTS, mDrawTarget); // this only measures the height; the total width is gotten from the // the return value of ProcessText. @@ -3535,13 +3531,10 @@ struct MOZ_STACK_CLASS CanvasBidiProcessor : public nsBidiPresUtils::BidiProcess // glyph string on OS X and DWrite where textrun widths may // involve fractional pixels. gfxTextRun::Metrics textRunMetrics = - mTextRun->MeasureText(0, - mTextRun->GetLength(), - mDoMeasureBoundingBox ? - gfxFont::TIGHT_INK_EXTENTS : - gfxFont::LOOSE_INK_EXTENTS, - mDrawTarget, - nullptr); + mTextRun->MeasureText(mDoMeasureBoundingBox ? + gfxFont::TIGHT_INK_EXTENTS : + gfxFont::LOOSE_INK_EXTENTS, + mDrawTarget); inlineCoord += textRunMetrics.mAdvanceWidth; // old code was: // point.x += width * mAppUnitsPerDevPixel; diff --git a/gfx/thebes/gfxTextRun.cpp b/gfx/thebes/gfxTextRun.cpp index 993b23f1fbff..e012295ba73c 100644 --- a/gfx/thebes/gfxTextRun.cpp +++ b/gfx/thebes/gfxTextRun.cpp @@ -2071,8 +2071,7 @@ gfxFontGroup::GetHyphenWidth(gfxTextRun::PropertyProvider *aProvider) nsAutoPtr hyphRun(MakeHyphenTextRun(dt, aProvider->GetAppUnitsPerDevUnit())); - mHyphenWidth = hyphRun.get() ? - hyphRun->GetAdvanceWidth(0, hyphRun->GetLength(), nullptr) : 0; + mHyphenWidth = hyphRun.get() ? hyphRun->GetAdvanceWidth() : 0; } } return mHyphenWidth; diff --git a/gfx/thebes/gfxTextRun.h b/gfx/thebes/gfxTextRun.h index ea576acc5de2..7831c6fac6bd 100644 --- a/gfx/thebes/gfxTextRun.h +++ b/gfx/thebes/gfxTextRun.h @@ -270,6 +270,13 @@ public: DrawTarget* aDrawTargetForTightBoundingBox, PropertyProvider* aProvider); + Metrics MeasureText(gfxFont::BoundingBoxType aBoundingBoxType, + DrawTarget* aDrawTargetForTightBoundingBox, + PropertyProvider* aProvider = nullptr) { + return MeasureText(0, GetLength(), aBoundingBoxType, + aDrawTargetForTightBoundingBox, aProvider); + } + /** * Computes just the advance width for a substring. * Uses GetSpacing from aBreakProvider. @@ -281,6 +288,10 @@ public: PropertyProvider *aProvider, PropertyProvider::Spacing* aSpacing = nullptr); + gfxFloat GetAdvanceWidth() { + return GetAdvanceWidth(0, GetLength(), nullptr); + } + /** * Clear all stored line breaks for the given range (both before and after), * and then set the line-break state before aStart to aBreakBefore and diff --git a/layout/generic/TextOverflow.cpp b/layout/generic/TextOverflow.cpp index 62e64a93456b..490e4f4600b0 100644 --- a/layout/generic/TextOverflow.cpp +++ b/layout/generic/TextOverflow.cpp @@ -803,7 +803,7 @@ TextOverflow::Marker::SetupString(nsIFrame* aFrame) if (mStyle->mType == NS_STYLE_TEXT_OVERFLOW_ELLIPSIS) { gfxTextRun* textRun = GetEllipsisTextRun(aFrame); if (textRun) { - mISize = textRun->GetAdvanceWidth(0, textRun->GetLength(), nullptr); + mISize = textRun->GetAdvanceWidth(); } else { mISize = 0; } diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index 4993dfab0e28..ecf79665e11a 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -5189,8 +5189,7 @@ nsTextFrame::UpdateTextEmphasis(WritingMode aWM, PropertyProvider& aProvider) EmphasisMarkInfo* info = new EmphasisMarkInfo; info->textRun = GenerateTextRunForEmphasisMarks(this, fm, aWM, styleText); - info->advance = - info->textRun->GetAdvanceWidth(0, info->textRun->GetLength(), nullptr); + info->advance = info->textRun->GetAdvanceWidth(); // Calculate the baseline offset LogicalSide side = styleText->TextEmphasisSide(aWM); @@ -5844,8 +5843,7 @@ AddHyphenToMetrics(nsTextFrame* aTextFrame, gfxTextRun* aBaseTextRun, return; gfxTextRun::Metrics hyphenMetrics = - hyphenTextRun->MeasureText(0, hyphenTextRun->GetLength(), aBoundingBoxType, - aDrawTarget, nullptr); + hyphenTextRun->MeasureText(aBoundingBoxType, aDrawTarget); if (aTextFrame->GetWritingMode().IsLineInverted()) { hyphenMetrics.mBoundingBox.y = -hyphenMetrics.mBoundingBox.YMost(); } @@ -6629,7 +6627,7 @@ nsTextFrame::DrawTextRun(gfxContext* const aCtx, // For right-to-left text runs, the soft-hyphen is positioned at the left // of the text, minus its own width gfxFloat hyphenBaselineX = aTextBaselinePt.x + mTextRun->GetDirection() * aAdvanceWidth - - (mTextRun->IsRightToLeft() ? hyphenTextRun->GetAdvanceWidth(0, hyphenTextRun->GetLength(), nullptr) : 0); + (mTextRun->IsRightToLeft() ? hyphenTextRun->GetAdvanceWidth() : 0); ::DrawTextRun(hyphenTextRun.get(), aCtx, gfxPoint(hyphenBaselineX, aTextBaselinePt.y), 0, hyphenTextRun->GetLength(), diff --git a/layout/mathml/nsMathMLChar.cpp b/layout/mathml/nsMathMLChar.cpp index b4c9488d84b4..5be9554aba58 100644 --- a/layout/mathml/nsMathMLChar.cpp +++ b/layout/mathml/nsMathMLChar.cpp @@ -1021,9 +1021,7 @@ static nsBoundingMetrics MeasureTextRun(DrawTarget* aDrawTarget, gfxTextRun* aTextRun) { gfxTextRun::Metrics metrics = - aTextRun->MeasureText(0, aTextRun->GetLength(), - gfxFont::TIGHT_HINTED_OUTLINE_EXTENTS, - aDrawTarget, nullptr); + aTextRun->MeasureText(gfxFont::TIGHT_HINTED_OUTLINE_EXTENTS, aDrawTarget); nsBoundingMetrics bm; bm.leftBearing = NSToCoordFloor(metrics.mBoundingBox.X()); diff --git a/layout/svg/SVGTextFrame.cpp b/layout/svg/SVGTextFrame.cpp index c22be2c17b7e..63066dd9a8a6 100644 --- a/layout/svg/SVGTextFrame.cpp +++ b/layout/svg/SVGTextFrame.cpp @@ -342,8 +342,7 @@ GetBaselinePosition(nsTextFrame* aFrame, { WritingMode writingMode = aFrame->GetWritingMode(); gfxTextRun::Metrics metrics = - aTextRun->MeasureText(0, aTextRun->GetLength(), gfxFont::LOOSE_INK_EXTENTS, - nullptr, nullptr); + aTextRun->MeasureText(gfxFont::LOOSE_INK_EXTENTS, nullptr); switch (aDominantBaseline) { case NS_STYLE_DOMINANT_BASELINE_HANGING: