author | L. David Baron <dbaron@dbaron.org> |
Wed, 23 Nov 2011 18:48:23 -0800 | |
changeset 80694 | ccabd715b23255359a0d936120162ba788c53982 |
parent 80693 | ff09e8e9bd8a308c6d82fa960679d83f1d9e24ca |
child 80695 | eb173d230150f0421944633e108b7dc00a8eb9a8 |
push id | 21522 |
push user | dbaron@mozilla.com |
push date | Thu, 24 Nov 2011 02:50:31 +0000 |
treeherder | mozilla-central@cf764be32bc3 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | roc |
bugs | 627842 |
milestone | 11.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -2539,17 +2539,18 @@ GetScrollableLineHeight(nsIFrame* aTarge for (nsIFrame* f = aTargetFrame; f; f = GetParentFrameToScroll(f)) { nsIScrollableFrame* sf = f->GetScrollTargetFrame(); if (sf) return sf->GetLineScrollAmount().height; } // Fall back to the font height of the target frame. nsRefPtr<nsFontMetrics> fm; - nsLayoutUtils::GetFontMetricsForFrame(aTargetFrame, getter_AddRefs(fm)); + nsLayoutUtils::GetFontMetricsForFrame(aTargetFrame, getter_AddRefs(fm), + nsLayoutUtils::FontSizeInflationFor(aTargetFrame)); NS_ASSERTION(fm, "FontMetrics is null!"); if (fm) return fm->MaxHeight(); return 0; } void nsEventStateManager::SendLineScrollEvent(nsIFrame* aTargetFrame,
--- a/layout/base/nsCaret.cpp +++ b/layout/base/nsCaret.cpp @@ -345,17 +345,18 @@ nsCaret::GetGeometryForFrame(nsIFrame* a if (NS_FAILED(rv)) return rv; nsIFrame *frame = aFrame->GetContentInsertionFrame(); NS_ASSERTION(frame, "We should not be in the middle of reflow"); nscoord baseline = frame->GetCaretBaseline(); nscoord ascent = 0, descent = 0; nsRefPtr<nsFontMetrics> fm; - nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm)); + nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm), + nsLayoutUtils::FontSizeInflationFor(aFrame)); NS_ASSERTION(fm, "We should be able to get the font metrics"); if (fm) { ascent = fm->MaxAscent(); descent = fm->MaxDescent(); } nscoord height = ascent + descent; framePos.y = baseline - ascent; Metrics caretMetrics = ComputeMetrics(aFrame, aFrameOffset, height);
--- a/layout/forms/nsListControlFrame.cpp +++ b/layout/forms/nsListControlFrame.cpp @@ -252,19 +252,20 @@ void nsListControlFrame::PaintFocus(nsRe nsRect fRect; if (childframe) { // get the child rect fRect = childframe->GetRect(); // get it into our coordinates fRect.MoveBy(childframe->GetParent()->GetOffsetTo(this)); } else { + float inflation = nsLayoutUtils::FontSizeInflationFor(this); fRect.x = fRect.y = 0; fRect.width = GetScrollPortRect().width; - fRect.height = CalcFallbackRowHeight(); + fRect.height = CalcFallbackRowHeight(inflation); fRect.MoveBy(containerFrame->GetOffsetTo(this)); } fRect += aPt; bool lastItemIsSelected = false; if (focusedContent) { nsCOMPtr<nsIDOMHTMLOptionElement> domOpt = do_QueryInterface(focusedContent); @@ -278,28 +279,36 @@ void nsListControlFrame::PaintFocus(nsRe LookAndFeel::GetColor(lastItemIsSelected ? LookAndFeel::eColorID_WidgetSelectForeground : LookAndFeel::eColorID_WidgetSelectBackground); nsCSSRendering::PaintFocus(presContext, aRC, fRect, color); } void -nsListControlFrame::InvalidateFocus() +nsListControlFrame::InvalidateFocus(const nsHTMLReflowState *aReflowState) { if (mFocused != this) return; nsIFrame* containerFrame = GetOptionsContainer(); if (containerFrame) { // Invalidating from the containerFrame because that's where our focus // is drawn. // The origin of the scrollport is the origin of containerFrame. + float inflation; + if (aReflowState) { + NS_ABORT_IF_FALSE(aReflowState->frame == this, "wrong reflow state"); + inflation = nsLayoutUtils::FontSizeInflationFor(*aReflowState); + } else { + inflation = nsLayoutUtils::FontSizeInflationFor(this); + } nsRect invalidateArea = containerFrame->GetVisualOverflowRect(); - nsRect emptyFallbackArea(0, 0, GetScrollPortRect().width, CalcFallbackRowHeight()); + nsRect emptyFallbackArea(0, 0, GetScrollPortRect().width, + CalcFallbackRowHeight(inflation)); invalidateArea.UnionRect(invalidateArea, emptyFallbackArea); containerFrame->Invalidate(invalidateArea); } } NS_QUERYFRAME_HEAD(nsListControlFrame) NS_QUERYFRAME_ENTRY(nsIFormControlFrame) NS_QUERYFRAME_ENTRY(nsIListControlFrame) @@ -360,29 +369,34 @@ GetNumberOfOptionsRecursive(nsIContent* } return optionCount; } //----------------------------------------------------------------- // Main Reflow for ListBox/Dropdown //----------------------------------------------------------------- +// Note that it doesn't much matter *which* reflow state aReflowState +// is (as long as it's in the right block); we intentionally pass +// whatever reflow state is most convenient. nscoord -nsListControlFrame::CalcHeightOfARow() +nsListControlFrame::CalcHeightOfARow(const nsHTMLReflowState& aReflowState) { // Calculate the height of a single row in the listbox or dropdown list by // using the tallest thing in the subtree, since there may be option groups // in addition to option elements, either of which may be visible or // invisible, may use different fonts, etc. PRInt32 heightOfARow = GetMaxOptionHeight(GetOptionsContainer()); // Check to see if we have zero items (and optimize by checking // heightOfARow first) if (heightOfARow == 0 && GetNumberOfOptions() == 0) { - heightOfARow = CalcFallbackRowHeight(); + nscoord minFontSize = nsLayoutUtils::InflationMinFontSizeFor(aReflowState); + float inflation = nsLayoutUtils::FontSizeInflationInner(this, minFontSize); + heightOfARow = CalcFallbackRowHeight(inflation); } return heightOfARow; } nscoord nsListControlFrame::GetPrefWidth(nsRenderingContext *aRenderingContext) { @@ -495,17 +509,17 @@ nsListControlFrame::Reflow(nsPresContext NS_ASSERTION(!IsScrollbarUpdateSuppressed(), "Shouldn't be suppressing if we don't need a second pass!"); if (!autoHeight) { // Update our mNumDisplayRows based on our new row height now that we // know it. Note that if autoHeight and we landed in this code then we // already set mNumDisplayRows in CalcIntrinsicHeight. Also note that we // can't use HeightOfARow() here because that just uses a cached value // that we didn't compute. - nscoord rowHeight = CalcHeightOfARow(); + nscoord rowHeight = CalcHeightOfARow(aReflowState); if (rowHeight == 0) { // Just pick something mNumDisplayRows = 1; } else { mNumDisplayRows = NS_MAX(1, state.ComputedHeight() / rowHeight); } } @@ -1162,17 +1176,18 @@ nsListControlFrame::GetSkipSides() const void nsListControlFrame::OnContentReset() { ResetList(true); } void -nsListControlFrame::ResetList(bool aAllowScrolling) +nsListControlFrame::ResetList(bool aAllowScrolling, + const nsHTMLReflowState *aReflowState) { // if all the frames aren't here // don't bother reseting if (!mIsAllFramesHere) { return; } if (aAllowScrolling) { @@ -1186,17 +1201,17 @@ nsListControlFrame::ResetList(bool aAllo if (selectElement) { selectElement->GetSelectedIndex(&indexToSelect); ScrollToIndex(indexToSelect); } } mStartSelectionIndex = kNothingSelected; mEndSelectionIndex = kNothingSelected; - InvalidateFocus(); + InvalidateFocus(aReflowState); // Combobox will redisplay itself with the OnOptionSelected event } void nsListControlFrame::SetFocus(bool aOn, bool aRepaint) { InvalidateFocus(); @@ -1739,17 +1754,17 @@ nsListControlFrame::DidReflow(nsPresCont // scroll history state AND the list contents have not changed // since we loaded all the children AND nothing else forced us // to scroll by calling ResetList(true). The latter two conditions // are folded into mPostChildrenLoadedReset. // // The idea is that we want scroll history restoration to trump ResetList // scrolling to the selected element, when the ResetList was probably only // caused by content loading normally. - ResetList(!DidHistoryRestore() || mPostChildrenLoadedReset); + ResetList(!DidHistoryRestore() || mPostChildrenLoadedReset, aReflowState); } mHasPendingInterruptAtStartOfReflow = false; return rv; } nsIAtom* nsListControlFrame::GetType() const @@ -1808,22 +1823,23 @@ nsListControlFrame::IsLeftButton(nsIDOME if (NS_SUCCEEDED(mouseEvent->GetButton(&whichButton))) { return whichButton != 0?false:true; } } return false; } nscoord -nsListControlFrame::CalcFallbackRowHeight() +nsListControlFrame::CalcFallbackRowHeight(float aFontSizeInflation) { nscoord rowHeight = 0; nsRefPtr<nsFontMetrics> fontMet; - nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet)); + nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet), + aFontSizeInflation); if (fontMet) { rowHeight = fontMet->MaxHeight(); } return rowHeight; } nscoord
--- a/layout/forms/nsListControlFrame.h +++ b/layout/forms/nsListControlFrame.h @@ -234,24 +234,26 @@ public: * frame */ void PaintFocus(nsRenderingContext& aRC, nsPoint aPt); /** * If this frame IsFocused(), invalidates an area that includes anything * that PaintFocus will or could have painted --- basically the whole * GetOptionsContainer, plus some extra stuff if there are no options. This * must be called every time mEndSelectionIndex changes. + * + * Pass non-null aReflowState if during reflow. */ - void InvalidateFocus(); + void InvalidateFocus(const nsHTMLReflowState* aReflowState = nsnull); /** * Function to calculate the height a row, for use with the "size" attribute. * Can't be const because GetNumberOfOptions() isn't const. */ - nscoord CalcHeightOfARow(); + nscoord CalcHeightOfARow(const nsHTMLReflowState& aReflowState); /** * Function to ask whether we're currently in what might be the * first pass of a two-pass reflow. */ bool MightNeedSecondPass() const { return mMightNeedSecondPass; } @@ -327,18 +329,21 @@ protected: */ void UpdateInListState(nsIDOMEvent* aEvent); void AdjustIndexForDisabledOpt(PRInt32 aStartIndex, PRInt32 &anNewIndex, PRInt32 aNumOptions, PRInt32 aDoAdjustInc, PRInt32 aDoAdjustIncNext); /** * Resets the select back to it's original default values; * those values as determined by the original HTML + * + * Pass non-null aReflowState if during reflow. */ - virtual void ResetList(bool aAllowScrolling); + virtual void ResetList(bool aAllowScrolling, + const nsHTMLReflowState* aReflowState = nsnull); nsListControlFrame(nsIPresShell* aShell, nsIDocument* aDocument, nsStyleContext* aContext); virtual ~nsListControlFrame(); // Utility methods nsresult GetSizeAttribute(PRInt32 *aSize); nsIContent* GetOptionFromContent(nsIContent *aContent); @@ -368,17 +373,17 @@ protected: */ bool IsContentSelectedByIndex(PRInt32 aIndex) const; bool CheckIfAllFramesHere(); PRInt32 GetIndexFromContent(nsIContent *aContent); bool IsLeftButton(nsIDOMEvent* aMouseEvent); // guess at a row height based on our own style. - nscoord CalcFallbackRowHeight(); + nscoord CalcFallbackRowHeight(float aFontSizeInflation); // CalcIntrinsicHeight computes our intrinsic height (taking the "size" // attribute into account). This should only be called in non-dropdown mode. nscoord CalcIntrinsicHeight(nscoord aHeightOfARow, PRInt32 aNumberOfOptions); // Dropped down stuff void SetComboboxItem(PRInt32 aIndex);
--- a/layout/forms/nsProgressFrame.cpp +++ b/layout/forms/nsProgressFrame.cpp @@ -257,19 +257,22 @@ nsProgressFrame::AttributeChanged(PRInt3 } nsSize nsProgressFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext, nsSize aCBSize, nscoord aAvailableWidth, nsSize aMargin, nsSize aBorder, nsSize aPadding, bool aShrinkWrap) { + float inflation = + nsLayoutUtils::FontSizeInflationFor(this, aCBSize.width); nsRefPtr<nsFontMetrics> fontMet; NS_ENSURE_SUCCESS(nsLayoutUtils::GetFontMetricsForFrame(this, - getter_AddRefs(fontMet)), + getter_AddRefs(fontMet), + inflation), nsSize(0, 0)); nsSize autoSize; autoSize.height = autoSize.width = fontMet->Font().size; // 1em if (GetStyleDisplay()->mOrient == NS_STYLE_ORIENT_VERTICAL) { autoSize.height *= 10; // 10em } else {
--- a/layout/forms/nsSelectsAreaFrame.cpp +++ b/layout/forms/nsSelectsAreaFrame.cpp @@ -229,17 +229,17 @@ nsSelectsAreaFrame::Reflow(nsPresContext nsresult rv = nsBlockFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus); NS_ENSURE_SUCCESS(rv, rv); // Check whether we need to suppress scrolbar updates. We want to do that if // we're in a possible first pass and our height of a row has changed. if (list->MightNeedSecondPass()) { - nscoord newHeightOfARow = list->CalcHeightOfARow(); + nscoord newHeightOfARow = list->CalcHeightOfARow(aReflowState); // We'll need a second pass if our height of a row changed. For // comboboxes, we'll also need it if our height changed. If we're going // to do a second pass, suppress scrollbar updates for this pass. if (newHeightOfARow != mHeightOfARow || (isInDropdownMode && (oldHeight != aDesiredSize.height || oldHeight != GetSize().height))) { mHeightOfARow = newHeightOfARow; list->SetSuppressScrollbarUpdate(true);
--- a/layout/generic/TextOverflow.cpp +++ b/layout/generic/TextOverflow.cpp @@ -239,17 +239,18 @@ nsDisplayTextOverflowMarker::Paint(nsDis PaintTextToContext(aCtx, nsPoint(0, 0)); } void nsDisplayTextOverflowMarker::PaintTextToContext(nsRenderingContext* aCtx, nsPoint aOffsetFromRect) { nsRefPtr<nsFontMetrics> fm; - nsLayoutUtils::GetFontMetricsForFrame(mFrame, getter_AddRefs(fm)); + nsLayoutUtils::GetFontMetricsForFrame(mFrame, getter_AddRefs(fm), + nsLayoutUtils::FontSizeInflationFor(mFrame)); aCtx->SetFont(fm); gfxFloat y = nsLayoutUtils::GetSnappedBaselineY(mFrame, aCtx->ThebesContext(), mRect.y, mAscent); nsPoint baselinePt(mRect.x, NSToCoordFloor(y)); nsLayoutUtils::DrawString(mFrame, aCtx, mString.get(), mString.Length(), baselinePt + aOffsetFromRect); } @@ -652,17 +653,18 @@ void TextOverflow::Marker::SetupString(nsIFrame* aFrame) { if (mInitialized) { return; } nsRefPtr<nsRenderingContext> rc = aFrame->PresContext()->PresShell()->GetReferenceRenderingContext(); nsRefPtr<nsFontMetrics> fm; - nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm)); + nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm), + nsLayoutUtils::FontSizeInflationFor(aFrame)); rc->SetFont(fm); mMarkerString = mStyle->mType == NS_STYLE_TEXT_OVERFLOW_ELLIPSIS ? GetEllipsis(fm) : mStyle->mString; mWidth = nsLayoutUtils::GetStringWidth(aFrame, rc, mMarkerString.get(), mMarkerString.Length()); mInitialized = true; }
--- a/layout/generic/nsBRFrame.cpp +++ b/layout/generic/nsBRFrame.cpp @@ -52,18 +52,16 @@ #include "nsAccessibilityService.h" #endif //FOR SELECTION #include "nsIContent.h" #include "nsFrameSelection.h" //END INCLUDES FOR SELECTION -#define BR_USING_CENTERED_FONT_BASELINE NS_FRAME_STATE_BIT(63) - class BRFrame : public nsFrame { public: NS_DECL_FRAMEARENA_HELPERS friend nsIFrame* NS_NewBRFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); virtual ContentOffsets CalcContentOffsetsFromFramePoint(nsPoint aPoint); @@ -94,16 +92,18 @@ public: #ifdef ACCESSIBILITY virtual already_AddRefed<nsAccessible> CreateAccessible(); #endif protected: BRFrame(nsStyleContext* aContext) : nsFrame(aContext) {} virtual ~BRFrame(); + + nscoord mAscent; }; nsIFrame* NS_NewBRFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) { return new (aPresShell) BRFrame(aContext); } @@ -121,17 +121,16 @@ BRFrame::Reflow(nsPresContext* aPresCont { DO_GLOBAL_REFLOW_COUNT("BRFrame"); DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus); aMetrics.height = 0; // BR frames with height 0 are ignored in quirks // mode by nsLineLayout::VerticalAlignFrames . // However, it's not always 0. See below. aMetrics.width = 0; aMetrics.ascent = 0; - RemoveStateBits(BR_USING_CENTERED_FONT_BASELINE); // Only when the BR is operating in a line-layout situation will it // behave like a BR. nsLineLayout* ll = aReflowState.mLineLayout; if (ll) { // Note that the compatibility mode check excludes AlmostStandards // mode, since this is the inline box model. See bug 161691. if ( ll->LineIsEmpty() || @@ -146,24 +145,24 @@ BRFrame::Reflow(nsPresContext* aPresCont // quirks-mode fix that doesn't apply the block's min // line-height makes this necessary to make BR cause a line // of the full line-height // We also do this in strict mode because BR should act like a // normal inline frame. That line-height is used is important // here for cases where the line-height is less than 1. nsRefPtr<nsFontMetrics> fm; - nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm)); + nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm), + nsLayoutUtils::FontSizeInflationFor(aReflowState)); aReflowState.rendContext->SetFont(fm); // FIXME: maybe not needed? if (fm) { nscoord logicalHeight = aReflowState.CalcLineHeight(); aMetrics.height = logicalHeight; aMetrics.ascent = nsLayoutUtils::GetCenteredFontBaseline(fm, logicalHeight); - AddStateBits(BR_USING_CENTERED_FONT_BASELINE); } else { aMetrics.ascent = aMetrics.height = 0; } // XXX temporary until I figure out a better solution; see the // code in nsLineLayout::VerticalAlignFrames that zaps minY/maxY // if the width is zero. @@ -184,16 +183,18 @@ BRFrame::Reflow(nsPresContext* aPresCont ll->SetLineEndsInBR(true); } else { aStatus = NS_FRAME_COMPLETE; } aMetrics.SetOverflowAreasToDesiredBounds(); + mAscent = aMetrics.ascent; + NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics); return NS_OK; } /* virtual */ void BRFrame::AddInlineMinWidth(nsRenderingContext *aRenderingContext, nsIFrame::InlineMinWidthData *aData) { @@ -227,28 +228,17 @@ nsIAtom* BRFrame::GetType() const { return nsGkAtoms::brFrame; } nscoord BRFrame::GetBaseline() const { - nscoord ascent = 0; - nsRefPtr<nsFontMetrics> fm; - nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm)); - if (fm) { - nscoord logicalHeight = GetRect().height; - if (GetStateBits() & BR_USING_CENTERED_FONT_BASELINE) { - ascent = nsLayoutUtils::GetCenteredFontBaseline(fm, logicalHeight); - } else { - ascent = fm->MaxAscent() + GetUsedBorderAndPadding().top; - } - } - return NS_MIN(mRect.height, ascent); + return mAscent; } nsIFrame::ContentOffsets BRFrame::CalcContentOffsetsFromFramePoint(nsPoint aPoint) { ContentOffsets offsets; offsets.content = mContent->GetParent(); if (offsets.content) { offsets.offset = offsets.content->IndexOf(mContent);
--- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -558,17 +558,18 @@ nsBlockFrame::GetCaretBaseline() const if (!mLines.empty()) { const_line_iterator line = begin_lines(); const nsLineBox* firstLine = line; if (firstLine->GetChildCount()) { return bp.top + firstLine->mFirstChild->GetCaretBaseline(); } } nsRefPtr<nsFontMetrics> fm; - nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm)); + nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm), + nsLayoutUtils::FontSizeInflationFor(this)); return nsLayoutUtils::GetCenteredFontBaseline(fm, nsHTMLReflowState:: CalcLineHeight(GetStyleContext(), contentRect.height, nsLayoutUtils::FontSizeInflationFor(this))) + bp.top; } ///////////////////////////////////////////////////////////////////////////// // Child frame enumeration @@ -2328,17 +2329,18 @@ nsBlockFrame::ReflowDirtyLines(nsBlockRe // we end up with *some* height. if (metrics.ascent == nsHTMLReflowMetrics::ASK_FOR_BASELINE && !nsLayoutUtils::GetFirstLineBaseline(mBullet, &metrics.ascent)) { metrics.ascent = metrics.height; } nsRefPtr<nsFontMetrics> fm; - nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm)); + nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm), + nsLayoutUtils::FontSizeInflationFor(aState.mReflowState)); aState.mReflowState.rendContext->SetFont(fm); // FIXME: needed? nscoord minAscent = nsLayoutUtils::GetCenteredFontBaseline(fm, aState.mMinLineHeight); nscoord minDescent = aState.mMinLineHeight - minAscent; aState.mY += NS_MAX(minAscent, metrics.ascent) + NS_MAX(minDescent, metrics.height - metrics.ascent);
--- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -2194,17 +2194,18 @@ nsGfxScrollFrameInner::ScrollBy(nsIntPoi NSAppUnitsToIntPixels(NS_ABS(clampAmount.y), appUnitsPerDevPixel)); } } nsSize nsGfxScrollFrameInner::GetLineScrollAmount() const { nsRefPtr<nsFontMetrics> fm; - nsLayoutUtils::GetFontMetricsForFrame(mOuter, getter_AddRefs(fm)); + nsLayoutUtils::GetFontMetricsForFrame(mOuter, getter_AddRefs(fm), + nsLayoutUtils::FontSizeInflationFor(mOuter)); NS_ASSERTION(fm, "FontMetrics is null, assuming fontHeight == 1 appunit"); nscoord fontHeight = 1; if (fm) { fontHeight = fm->MaxHeight(); } return nsSize(fontHeight, fontHeight); }
--- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -981,17 +981,18 @@ void nsImageFrame::DisplayAltText(nsPresContext* aPresContext, nsRenderingContext& aRenderingContext, const nsString& aAltText, const nsRect& aRect) { // Set font and color aRenderingContext.SetColor(GetStyleColor()->mColor); nsRefPtr<nsFontMetrics> fm; - nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm)); + nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm), + nsLayoutUtils::FontSizeInflationFor(this)); aRenderingContext.SetFont(fm); // Format the text to display within the formatting rect nscoord maxAscent = fm->MaxAscent(); nscoord maxDescent = fm->MaxDescent(); nscoord height = fm->MaxHeight();
--- a/layout/generic/nsTextFrameThebes.cpp +++ b/layout/generic/nsTextFrameThebes.cpp @@ -5737,17 +5737,18 @@ nsTextFrame::CombineSelectionUnderlineRe nsRect& aRect) { if (aRect.IsEmpty()) return false; nsRect givenRect = aRect; nsRefPtr<nsFontMetrics> fm; - nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm)); + nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm), + GetFontSizeInflation()); gfxFontGroup* fontGroup = fm->GetThebesFontGroup(); gfxFont* firstFont = fontGroup->GetFontAt(0); if (!firstFont) return false; // OOM const gfxFont::Metrics& metrics = firstFont->GetMetrics(); gfxFloat underlineOffset = fontGroup->GetUnderlineOffset(); gfxFloat ascent = aPresContext->AppUnitsToGfxUnits(mAscent); gfxFloat descentLimit =