зеркало из https://github.com/mozilla/pjs.git
Switch nsLayoutUtils inflation methods to the new setup with state on the pres context. (Bug 706609, patch 5) r=roc
This is the third of three patches to rework the way we handle getting the font inflation container and width data during reflow, which are needed so that we can sometimes honor inflation during intrinsic width calculation (which we need to do to make some form controls inflate correctly).
This commit is contained in:
Родитель
ac8b4c103a
Коммит
3ab74c44b6
|
@ -2549,7 +2549,8 @@ GetScrollableLineHeight(nsIFrame* aTargetFrame)
|
|||
// Fall back to the font height of the target frame.
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(aTargetFrame, getter_AddRefs(fm),
|
||||
nsLayoutUtils::FontSizeInflationFor(aTargetFrame));
|
||||
nsLayoutUtils::FontSizeInflationFor(aTargetFrame,
|
||||
nsLayoutUtils::eNotInReflow));
|
||||
NS_ASSERTION(fm, "FontMetrics is null!");
|
||||
if (fm)
|
||||
return fm->MaxHeight();
|
||||
|
|
|
@ -351,7 +351,7 @@ nsCaret::GetGeometryForFrame(nsIFrame* aFrame,
|
|||
nscoord ascent = 0, descent = 0;
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm),
|
||||
nsLayoutUtils::FontSizeInflationFor(aFrame));
|
||||
nsLayoutUtils::FontSizeInflationFor(aFrame, nsLayoutUtils::eNotInReflow));
|
||||
NS_ASSERTION(fm, "We should be able to get the font metrics");
|
||||
if (fm) {
|
||||
ascent = fm->MaxAscent();
|
||||
|
|
|
@ -4717,94 +4717,41 @@ ShouldInflateFontsForContainer(const nsIFrame *aFrame)
|
|||
}
|
||||
|
||||
nscoord
|
||||
nsLayoutUtils::InflationMinFontSizeFor(const nsHTMLReflowState &aReflowState)
|
||||
nsLayoutUtils::InflationMinFontSizeFor(const nsIFrame *aFrame,
|
||||
WidthDetermination aWidthDetermination)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
{
|
||||
const nsHTMLReflowState *rs = &aReflowState;
|
||||
nsIFrame *f = aReflowState.frame;
|
||||
for (; rs; rs = rs->parentReflowState, f = f->GetParent()) {
|
||||
NS_ABORT_IF_FALSE(rs->frame == f,
|
||||
"reflow state parentage must match frame parentage");
|
||||
nsIScrollableFrame *sf;
|
||||
NS_ABORT_IF_FALSE(rs->parentReflowState ||
|
||||
IsContainerForFontSizeInflation(f) ||
|
||||
// OK if NS_FRAME_IN_REFLOW is not set on
|
||||
// (non-null) parent, since its ancestors have a
|
||||
// real size. (Do we set NS_FRAME_IN_REFLOW
|
||||
// correctly for xul?)
|
||||
!(f->GetParent()->GetStateBits() &
|
||||
NS_FRAME_IN_REFLOW) ||
|
||||
// ugly exception, but ok because the
|
||||
// child is a container
|
||||
(f->GetType() == nsGkAtoms::scrollFrame &&
|
||||
(sf = do_QueryFrame(f)) &&
|
||||
(IsContainerForFontSizeInflation(
|
||||
sf->GetScrolledFrame()))),
|
||||
"must hit container at top of reflow state chain");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!FontSizeInflationEnabled(aReflowState.frame->PresContext())) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
nsIFrame *reflowRoot = nsnull;
|
||||
for (const nsHTMLReflowState *rs = &aReflowState; rs;
|
||||
reflowRoot = rs->frame, rs = rs->parentReflowState) {
|
||||
if (IsContainerForFontSizeInflation(rs->frame)) {
|
||||
if (!ShouldInflateFontsForContainer(rs->frame)) {
|
||||
return 0;
|
||||
if (aWidthDetermination == eNotInReflow) {
|
||||
// Check that neither this frame nor any of its ancestors are
|
||||
// currently being reflowed.
|
||||
// It's ok for box frames (but not arbitrary ancestors of box frames)
|
||||
// since they set their size before reflow.
|
||||
if (!(aFrame->IsBoxFrame() && IsContainerForFontSizeInflation(aFrame))) {
|
||||
for (const nsIFrame *f = aFrame; f; f = f->GetParent()) {
|
||||
NS_ABORT_IF_FALSE(!(f->GetStateBits() & NS_FRAME_IN_REFLOW),
|
||||
"must call nsHTMLReflowState& version during reflow");
|
||||
}
|
||||
|
||||
NS_ABORT_IF_FALSE(rs->ComputedWidth() != NS_INTRINSICSIZE,
|
||||
"must have a computed width");
|
||||
return MinimumFontSizeFor(aReflowState.frame->PresContext(),
|
||||
rs->ComputedWidth());
|
||||
}
|
||||
// It's ok if frames are dirty, or even if they've never been
|
||||
// reflowed, since they will be eventually and then we'll get the
|
||||
// right size.
|
||||
}
|
||||
|
||||
// We've hit the end of the reflow state chain. There are two
|
||||
// possibilities now: we're either at a reflow root or we're crossing
|
||||
// into flexbox layout. (Note that sometimes we cross into and out of
|
||||
// flexbox layout on the same frame, e.g., for nsTextControlFrame,
|
||||
// which breaks the reflow state parentage chain.)
|
||||
// This code depends on:
|
||||
// * When we cross from HTML to XUL and then on the child jump back
|
||||
// to HTML again, we link the reflow states correctly (see hack in
|
||||
// nsFrame::BoxReflow setting reflowState.parentReflowState).
|
||||
// * For any other cases, the XUL frame is a font size inflation
|
||||
// container, so we won't cross back into HTML (see the conditions
|
||||
// under which we test the assertion in
|
||||
// InflationMinFontSizeFor(const nsIFrame *).
|
||||
|
||||
return InflationMinFontSizeFor(reflowRoot->GetParent());
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsLayoutUtils::InflationMinFontSizeFor(const nsIFrame *aFrame)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
// Check that neither this frame nor any of its ancestors are
|
||||
// currently being reflowed.
|
||||
// It's ok for box frames (but not arbitrary ancestors of box frames)
|
||||
// since they set their size before reflow.
|
||||
if (!(aFrame->IsBoxFrame() && IsContainerForFontSizeInflation(aFrame))) {
|
||||
for (const nsIFrame *f = aFrame; f; f = f->GetParent()) {
|
||||
NS_ABORT_IF_FALSE(!(f->GetStateBits() & NS_FRAME_IN_REFLOW),
|
||||
"must call nsHTMLReflowState& version during reflow");
|
||||
}
|
||||
}
|
||||
// It's ok if frames are dirty, or even if they've never been
|
||||
// reflowed, since they will be eventually and then we'll get the
|
||||
// right size.
|
||||
#endif
|
||||
|
||||
if (!FontSizeInflationEnabled(aFrame->PresContext())) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (aWidthDetermination == eInReflow) {
|
||||
nsPresContext *presContext = aFrame->PresContext();
|
||||
nsIFrame *container = presContext->mCurrentInflationContainer;
|
||||
if (!container || !ShouldInflateFontsForContainer(container)) {
|
||||
return 0;
|
||||
}
|
||||
return MinimumFontSizeFor(presContext,
|
||||
presContext->mCurrentInflationContainerWidth);
|
||||
}
|
||||
|
||||
for (const nsIFrame *f = aFrame; f; f = f->GetParent()) {
|
||||
if (IsContainerForFontSizeInflation(f)) {
|
||||
if (!ShouldInflateFontsForContainer(f)) {
|
||||
|
@ -4821,93 +4768,35 @@ nsLayoutUtils::InflationMinFontSizeFor(const nsIFrame *aFrame)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* static */ nscoord
|
||||
nsLayoutUtils::InflationMinFontSizeFor(const nsIFrame *aFrame,
|
||||
nscoord aInflationContainerWidth)
|
||||
{
|
||||
if (!FontSizeInflationEnabled(aFrame->PresContext())) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (const nsIFrame *f = aFrame; f; f = f->GetParent()) {
|
||||
if (IsContainerForFontSizeInflation(f)) {
|
||||
if (!ShouldInflateFontsForContainer(f)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// The caller is (sketchily) asserting that it picked the right
|
||||
// container when passing aInflationContainerWidth. We only do
|
||||
// this for text inputs and a few other limited situations.
|
||||
return MinimumFontSizeFor(aFrame->PresContext(),
|
||||
aInflationContainerWidth);
|
||||
}
|
||||
}
|
||||
|
||||
NS_ABORT_IF_FALSE(false, "root should always be container");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
float
|
||||
nsLayoutUtils::FontSizeInflationFor(const nsHTMLReflowState &aReflowState)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
{
|
||||
const nsHTMLReflowState *rs = &aReflowState;
|
||||
const nsIFrame *f = aReflowState.frame;
|
||||
for (; rs; rs = rs->parentReflowState, f = f->GetParent()) {
|
||||
NS_ABORT_IF_FALSE(rs->frame == f,
|
||||
"reflow state parentage must match frame parentage");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!FontSizeInflationEnabled(aReflowState.frame->PresContext())) {
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
return FontSizeInflationInner(aReflowState.frame,
|
||||
InflationMinFontSizeFor(aReflowState));
|
||||
}
|
||||
|
||||
float
|
||||
nsLayoutUtils::FontSizeInflationFor(const nsIFrame *aFrame)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
// Check that neither this frame nor any of its ancestors are
|
||||
// currently being reflowed.
|
||||
// It's ok for box frames (but not arbitrary ancestors of box frames)
|
||||
// since they set their size before reflow.
|
||||
if (!(aFrame->IsBoxFrame() && IsContainerForFontSizeInflation(aFrame))) {
|
||||
for (const nsIFrame *f = aFrame; f; f = f->GetParent()) {
|
||||
NS_ABORT_IF_FALSE(!(f->GetStateBits() & NS_FRAME_IN_REFLOW),
|
||||
"must call nsHTMLReflowState& version during reflow");
|
||||
}
|
||||
}
|
||||
// It's ok if frames are dirty, or even if they've never been
|
||||
// reflowed, since they will be eventually and then we'll get the
|
||||
// right size.
|
||||
#endif
|
||||
|
||||
if (!FontSizeInflationEnabled(aFrame->PresContext())) {
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
return FontSizeInflationInner(aFrame,
|
||||
InflationMinFontSizeFor(aFrame));
|
||||
}
|
||||
|
||||
/* static */ float
|
||||
nsLayoutUtils::FontSizeInflationFor(const nsIFrame *aFrame,
|
||||
nscoord aInflationContainerWidth)
|
||||
WidthDetermination aWidthDetermination)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (aWidthDetermination == eNotInReflow) {
|
||||
// Check that neither this frame nor any of its ancestors are
|
||||
// currently being reflowed.
|
||||
// It's ok for box frames (but not arbitrary ancestors of box frames)
|
||||
// since they set their size before reflow.
|
||||
if (!(aFrame->IsBoxFrame() && IsContainerForFontSizeInflation(aFrame))) {
|
||||
for (const nsIFrame *f = aFrame; f; f = f->GetParent()) {
|
||||
NS_ABORT_IF_FALSE(!(f->GetStateBits() & NS_FRAME_IN_REFLOW),
|
||||
"must call nsHTMLReflowState& version during reflow");
|
||||
}
|
||||
}
|
||||
// It's ok if frames are dirty, or even if they've never been
|
||||
// reflowed, since they will be eventually and then we'll get the
|
||||
// right size.
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!FontSizeInflationEnabled(aFrame->PresContext())) {
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
return FontSizeInflationInner(aFrame,
|
||||
InflationMinFontSizeFor(aFrame,
|
||||
aInflationContainerWidth));
|
||||
aWidthDetermination));
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
|
|
|
@ -1517,15 +1517,14 @@ public:
|
|||
* the factor by which font sizes should be inflated; it is never
|
||||
* smaller than 1.
|
||||
*
|
||||
* There are three variants: pass a reflow state if the frame or any
|
||||
* of its ancestors are currently being reflowed and a frame
|
||||
* otherwise, or, if you know the width of the inflation container (a
|
||||
* somewhat sketchy assumption), its width.
|
||||
* The WidthDetermination parameter says how we determine the width of
|
||||
* the nearest inflation container: when not in reflow we look at the
|
||||
* frame tree; when in reflow we look at state stored on the pres
|
||||
* context.
|
||||
*/
|
||||
static float FontSizeInflationFor(const nsHTMLReflowState &aReflowState);
|
||||
static float FontSizeInflationFor(const nsIFrame *aFrame);
|
||||
enum WidthDetermination { eNotInReflow, eInReflow };
|
||||
static float FontSizeInflationFor(const nsIFrame *aFrame,
|
||||
nscoord aInflationContainerWidth);
|
||||
WidthDetermination aWidthDetermination);
|
||||
|
||||
/**
|
||||
* Perform the first half of the computation of FontSizeInflationFor
|
||||
|
@ -1540,11 +1539,9 @@ public:
|
|||
* above the minimum should always be adjusted as done by
|
||||
* FontSizeInflationInner.
|
||||
*/
|
||||
static nscoord InflationMinFontSizeFor(const nsHTMLReflowState
|
||||
&aReflowState);
|
||||
static nscoord InflationMinFontSizeFor(const nsIFrame *aFrame);
|
||||
static nscoord InflationMinFontSizeFor(const nsIFrame *aFrame,
|
||||
nscoord aInflationContainerWidth);
|
||||
WidthDetermination
|
||||
aWidthDetermination);
|
||||
|
||||
/**
|
||||
* Perform the second half of the computation done by
|
||||
|
|
|
@ -257,7 +257,8 @@ void nsListControlFrame::PaintFocus(nsRenderingContext& aRC, nsPoint aPt)
|
|||
// get it into our coordinates
|
||||
fRect.MoveBy(childframe->GetParent()->GetOffsetTo(this));
|
||||
} else {
|
||||
float inflation = nsLayoutUtils::FontSizeInflationFor(this);
|
||||
float inflation = nsLayoutUtils::FontSizeInflationFor(this,
|
||||
nsLayoutUtils::eNotInReflow);
|
||||
fRect.x = fRect.y = 0;
|
||||
fRect.width = GetScrollPortRect().width;
|
||||
fRect.height = CalcFallbackRowHeight(inflation);
|
||||
|
@ -294,13 +295,9 @@ nsListControlFrame::InvalidateFocus(const nsHTMLReflowState *aReflowState)
|
|||
// 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);
|
||||
}
|
||||
float inflation = nsLayoutUtils::FontSizeInflationFor(this,
|
||||
aReflowState ? nsLayoutUtils::eInReflow
|
||||
: nsLayoutUtils::eNotInReflow);
|
||||
nsRect invalidateArea = containerFrame->GetVisualOverflowRect();
|
||||
nsRect emptyFallbackArea(0, 0, GetScrollPortRect().width,
|
||||
CalcFallbackRowHeight(inflation));
|
||||
|
@ -374,11 +371,8 @@ GetNumberOfOptionsRecursive(nsIContent* aContent)
|
|||
// 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(const nsHTMLReflowState& aReflowState)
|
||||
nsListControlFrame::CalcHeightOfARow()
|
||||
{
|
||||
// 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
|
||||
|
@ -389,8 +383,8 @@ nsListControlFrame::CalcHeightOfARow(const nsHTMLReflowState& aReflowState)
|
|||
// Check to see if we have zero items (and optimize by checking
|
||||
// heightOfARow first)
|
||||
if (heightOfARow == 0 && GetNumberOfOptions() == 0) {
|
||||
nscoord minFontSize = nsLayoutUtils::InflationMinFontSizeFor(aReflowState);
|
||||
float inflation = nsLayoutUtils::FontSizeInflationInner(this, minFontSize);
|
||||
float inflation =
|
||||
nsLayoutUtils::FontSizeInflationInner(this, nsLayoutUtils::eInReflow);
|
||||
heightOfARow = CalcFallbackRowHeight(inflation);
|
||||
}
|
||||
|
||||
|
@ -514,7 +508,7 @@ nsListControlFrame::Reflow(nsPresContext* aPresContext,
|
|||
// 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(aReflowState);
|
||||
nscoord rowHeight = CalcHeightOfARow();
|
||||
if (rowHeight == 0) {
|
||||
// Just pick something
|
||||
mNumDisplayRows = 1;
|
||||
|
|
|
@ -248,7 +248,7 @@ public:
|
|||
* Function to calculate the height a row, for use with the "size" attribute.
|
||||
* Can't be const because GetNumberOfOptions() isn't const.
|
||||
*/
|
||||
nscoord CalcHeightOfARow(const nsHTMLReflowState& aReflowState);
|
||||
nscoord CalcHeightOfARow();
|
||||
|
||||
/**
|
||||
* Function to ask whether we're currently in what might be the
|
||||
|
|
|
@ -270,7 +270,7 @@ nsProgressFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
|
|||
nsSize aPadding, bool aShrinkWrap)
|
||||
{
|
||||
float inflation =
|
||||
nsLayoutUtils::FontSizeInflationFor(this, aCBSize.width);
|
||||
nsLayoutUtils::FontSizeInflationFor(this, nsLayoutUtils::eInReflow);
|
||||
nsRefPtr<nsFontMetrics> fontMet;
|
||||
NS_ENSURE_SUCCESS(nsLayoutUtils::GetFontMetricsForFrame(this,
|
||||
getter_AddRefs(fontMet),
|
||||
|
|
|
@ -234,7 +234,7 @@ nsSelectsAreaFrame::Reflow(nsPresContext* aPresContext,
|
|||
// 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(aReflowState);
|
||||
nscoord newHeightOfARow = list->CalcHeightOfARow();
|
||||
// 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.
|
||||
|
|
|
@ -498,14 +498,8 @@ nsTextControlFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
|
|||
nsSize aMargin, nsSize aBorder,
|
||||
nsSize aPadding, bool aShrinkWrap)
|
||||
{
|
||||
float inflation;
|
||||
if (nsLayoutUtils::IsContainerForFontSizeInflation(this)) {
|
||||
// FIXME: This won't turn out so well for the height; maybe disable
|
||||
// inflation entirely in this case?
|
||||
inflation = 1.0f;
|
||||
} else {
|
||||
inflation = nsLayoutUtils::FontSizeInflationFor(this, aCBSize.width);
|
||||
}
|
||||
float inflation =
|
||||
nsLayoutUtils::FontSizeInflationFor(this, nsLayoutUtils::eInReflow);
|
||||
nsSize autoSize;
|
||||
nsresult rv = CalcIntrinsicSize(aRenderingContext, autoSize, inflation);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -612,24 +606,8 @@ nsTextControlFrame::GetBoxAscent(nsBoxLayoutState& aState)
|
|||
// Return the baseline of the first (nominal) row, with centering for
|
||||
// single-line controls.
|
||||
|
||||
float inflation;
|
||||
if (nsLayoutUtils::IsContainerForFontSizeInflation(this)) {
|
||||
inflation =
|
||||
nsLayoutUtils::FontSizeInflationFor(this, GetContentRect().width);
|
||||
} else {
|
||||
const nsHTMLReflowState *outerReflowState = aState.OuterReflowState();
|
||||
NS_ASSERTION(outerReflowState || !mParent || mParent->IsBoxFrame() ||
|
||||
!(mParent->GetStateBits() & NS_FRAME_IN_REFLOW),
|
||||
"when a text control is reflowed by one of its ancestors "
|
||||
"and its parent is non-XUL, we should have the outer "
|
||||
"reflow state in the box layout state");
|
||||
if (outerReflowState && outerReflowState->frame == this) {
|
||||
inflation = nsLayoutUtils::FontSizeInflationFor(*outerReflowState);
|
||||
} else {
|
||||
inflation = nsLayoutUtils::FontSizeInflationInner(this,
|
||||
nsLayoutUtils::InflationMinFontSizeFor(mParent));
|
||||
}
|
||||
}
|
||||
float inflation =
|
||||
nsLayoutUtils::FontSizeInflationFor(this, nsLayoutUtils::eInReflow);
|
||||
|
||||
// First calculate the ascent wrt the client rect
|
||||
nsRect clientRect;
|
||||
|
|
|
@ -237,7 +237,7 @@ nsDisplayTextOverflowMarker::PaintTextToContext(nsRenderingContext* aCtx,
|
|||
{
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(mFrame, getter_AddRefs(fm),
|
||||
nsLayoutUtils::FontSizeInflationFor(mFrame));
|
||||
nsLayoutUtils::FontSizeInflationFor(mFrame, nsLayoutUtils::eNotInReflow));
|
||||
aCtx->SetFont(fm);
|
||||
gfxFloat y = nsLayoutUtils::GetSnappedBaselineY(mFrame, aCtx->ThebesContext(),
|
||||
mRect.y, mAscent);
|
||||
|
@ -736,7 +736,7 @@ TextOverflow::Marker::SetupString(nsIFrame* aFrame)
|
|||
aFrame->PresContext()->PresShell()->GetReferenceRenderingContext();
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm),
|
||||
nsLayoutUtils::FontSizeInflationFor(aFrame));
|
||||
nsLayoutUtils::FontSizeInflationFor(aFrame, nsLayoutUtils::eNotInReflow));
|
||||
rc->SetFont(fm);
|
||||
|
||||
mMarkerString = mStyle->mType == NS_STYLE_TEXT_OVERFLOW_ELLIPSIS ?
|
||||
|
|
|
@ -151,7 +151,7 @@ BRFrame::Reflow(nsPresContext* aPresContext,
|
|||
// here for cases where the line-height is less than 1.
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
nsLayoutUtils::FontSizeInflationFor(aReflowState));
|
||||
nsLayoutUtils::FontSizeInflationFor(this, nsLayoutUtils::eInReflow));
|
||||
aReflowState.rendContext->SetFont(fm); // FIXME: maybe not needed?
|
||||
if (fm) {
|
||||
nscoord logicalHeight = aReflowState.CalcLineHeight();
|
||||
|
|
|
@ -563,11 +563,11 @@ nsBlockFrame::GetCaretBaseline() const
|
|||
}
|
||||
}
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
nsLayoutUtils::FontSizeInflationFor(this));
|
||||
float inflation =
|
||||
nsLayoutUtils::FontSizeInflationFor(this, nsLayoutUtils::eNotInReflow);
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm), inflation);
|
||||
return nsLayoutUtils::GetCenteredFontBaseline(fm, nsHTMLReflowState::
|
||||
CalcLineHeight(GetStyleContext(), contentRect.height,
|
||||
nsLayoutUtils::FontSizeInflationFor(this))) +
|
||||
CalcLineHeight(GetStyleContext(), contentRect.height, inflation)) +
|
||||
bp.top;
|
||||
}
|
||||
|
||||
|
@ -2346,7 +2346,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState)
|
|||
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
nsLayoutUtils::FontSizeInflationFor(aState.mReflowState));
|
||||
nsLayoutUtils::FontSizeInflationFor(this, nsLayoutUtils::eInReflow));
|
||||
aState.mReflowState.rendContext->SetFont(fm); // FIXME: needed?
|
||||
|
||||
nscoord minAscent =
|
||||
|
|
|
@ -1418,7 +1418,8 @@ nsBulletFrame::Reflow(nsPresContext* aPresContext,
|
|||
DO_GLOBAL_REFLOW_COUNT("nsBulletFrame");
|
||||
DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus);
|
||||
|
||||
float inflation = nsLayoutUtils::FontSizeInflationFor(aReflowState);
|
||||
float inflation =
|
||||
nsLayoutUtils::FontSizeInflationFor(this, nsLayoutUtils::eInReflow);
|
||||
SetFontSizeInflation(inflation);
|
||||
|
||||
// Get the base size
|
||||
|
|
|
@ -7627,8 +7627,8 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState,
|
|||
// We're a frame (such as a text control frame) that jumps into
|
||||
// box reflow and then straight out of it on the child frame.
|
||||
// This means we actually have a real parent reflow state.
|
||||
// nsLayoutUtils::InflationMinFontSizeFor needs this to be linked
|
||||
// up correctly for text control frames, so do so here).
|
||||
// nsLayoutUtils::InflationMinFontSizeFor used to need this to be
|
||||
// linked up correctly for text control frames, so do so here).
|
||||
reflowState.parentReflowState = outerReflowState;
|
||||
reflowState.mCBReflowState = outerReflowState;
|
||||
} else {
|
||||
|
|
|
@ -2241,7 +2241,7 @@ nsGfxScrollFrameInner::GetLineScrollAmount() const
|
|||
{
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(mOuter, getter_AddRefs(fm),
|
||||
nsLayoutUtils::FontSizeInflationFor(mOuter));
|
||||
nsLayoutUtils::FontSizeInflationFor(mOuter, nsLayoutUtils::eNotInReflow));
|
||||
NS_ASSERTION(fm, "FontMetrics is null, assuming fontHeight == 1 appunit");
|
||||
nscoord fontHeight = 1;
|
||||
if (fm) {
|
||||
|
|
|
@ -2213,7 +2213,8 @@ nsHTMLReflowState::CalcLineHeight() const
|
|||
(mCBReflowState ? mCBReflowState->mComputedHeight : NS_AUTOHEIGHT);
|
||||
|
||||
return CalcLineHeight(frame->GetStyleContext(), blockHeight,
|
||||
nsLayoutUtils::FontSizeInflationFor(*this));
|
||||
nsLayoutUtils::FontSizeInflationFor(frame,
|
||||
nsLayoutUtils::eInReflow));
|
||||
}
|
||||
|
||||
/* static */ nscoord
|
||||
|
|
|
@ -988,7 +988,7 @@ nsImageFrame::DisplayAltText(nsPresContext* aPresContext,
|
|||
aRenderingContext.SetColor(GetStyleColor()->mColor);
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
|
||||
nsLayoutUtils::FontSizeInflationFor(this));
|
||||
nsLayoutUtils::FontSizeInflationFor(this, nsLayoutUtils::eNotInReflow));
|
||||
aRenderingContext.SetFont(fm);
|
||||
|
||||
// Format the text to display within the formatting rect
|
||||
|
|
|
@ -646,7 +646,8 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
|
|||
}
|
||||
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
float inflation = nsLayoutUtils::FontSizeInflationFor(aReflowState);
|
||||
float inflation =
|
||||
nsLayoutUtils::FontSizeInflationFor(this, nsLayoutUtils::eInReflow);
|
||||
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm), inflation);
|
||||
aReflowState.rendContext->SetFont(fm);
|
||||
|
||||
|
|
|
@ -120,7 +120,8 @@ nsLineLayout::nsLineLayout(nsPresContext* aPresContext,
|
|||
mTrimmableWidth = 0;
|
||||
|
||||
mInflationMinFontSize =
|
||||
nsLayoutUtils::InflationMinFontSizeFor(*aOuterReflowState);
|
||||
nsLayoutUtils::InflationMinFontSizeFor(aOuterReflowState->frame,
|
||||
nsLayoutUtils::eInReflow);
|
||||
|
||||
// Instead of always pre-initializing the free-lists for frames and
|
||||
// spans, we do it on demand so that situations that only use a few
|
||||
|
|
|
@ -4621,7 +4621,8 @@ nsTextFrame::UnionAdditionalOverflow(nsPresContext* aPresContext,
|
|||
GetTextDecorations(aPresContext, textDecs);
|
||||
if (textDecs.HasDecorationLines()) {
|
||||
nscoord inflationMinFontSize =
|
||||
nsLayoutUtils::InflationMinFontSizeFor(aBlockReflowState);
|
||||
nsLayoutUtils::InflationMinFontSizeFor(aBlockReflowState.frame,
|
||||
nsLayoutUtils::eInReflow);
|
||||
|
||||
const nscoord width = GetSize().width;
|
||||
const gfxFloat appUnitsPerDevUnit = aPresContext->AppUnitsPerDevPixel(),
|
||||
|
@ -5608,7 +5609,7 @@ nsTextFrame::DrawTextRunAndDecorations(
|
|||
aDirtyRect.Width() / app, aDirtyRect.Height() / app);
|
||||
|
||||
nscoord inflationMinFontSize =
|
||||
nsLayoutUtils::InflationMinFontSizeFor(this);
|
||||
nsLayoutUtils::InflationMinFontSizeFor(this, nsLayoutUtils::eNotInReflow);
|
||||
|
||||
// Underlines
|
||||
for (PRUint32 i = aDecorations.mUnderlines.Length(); i-- > 0; ) {
|
||||
|
@ -7347,9 +7348,8 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
|
|||
}
|
||||
}
|
||||
|
||||
float fontSizeInflation = nsLayoutUtils::FontSizeInflationInner(this,
|
||||
nsLayoutUtils::InflationMinFontSizeFor(
|
||||
*aLineLayout.GetLineContainerRS()));
|
||||
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this,
|
||||
nsLayoutUtils::eInReflow);
|
||||
|
||||
if (fontSizeInflation != GetFontSizeInflation()) {
|
||||
// FIXME: Ideally, if we already have a text run, we'd move it to be
|
||||
|
|
Загрузка…
Ссылка в новой задаче