mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 1138495 - pt 1 - Rename NS_FRAME_IN_CONSTRAINED_HEIGHT flag to NS_FRAME_IN_CONSTRAINED_BSIZE, and set it appropriately according to writing mode. r=smontagu
This commit is contained in:
parent
59208520d6
commit
f5b4780e94
@ -7304,14 +7304,14 @@ ShouldInflateFontsForContainer(const nsIFrame *aFrame)
|
||||
// We only want to inflate fonts for text that is in a place
|
||||
// with room to expand. The question is what the best heuristic for
|
||||
// that is...
|
||||
// For now, we're going to use NS_FRAME_IN_CONSTRAINED_HEIGHT, which
|
||||
// For now, we're going to use NS_FRAME_IN_CONSTRAINED_BSIZE, which
|
||||
// indicates whether the frame is inside something with a constrained
|
||||
// height (propagating down the tree), but the propagation stops when
|
||||
// we hit overflow-y: scroll or auto.
|
||||
// block-size (propagating down the tree), but the propagation stops when
|
||||
// we hit overflow-y [or -x, for vertical mode]: scroll or auto.
|
||||
const nsStyleText* styleText = aFrame->StyleText();
|
||||
|
||||
return styleText->mTextSizeAdjust != NS_STYLE_TEXT_SIZE_ADJUST_NONE &&
|
||||
!(aFrame->GetStateBits() & NS_FRAME_IN_CONSTRAINED_HEIGHT) &&
|
||||
!(aFrame->GetStateBits() & NS_FRAME_IN_CONSTRAINED_BSIZE) &&
|
||||
// We also want to disable font inflation for containers that have
|
||||
// preformatted text.
|
||||
// MathML cells need special treatment. See bug 1002526 comment 56.
|
||||
|
@ -187,10 +187,10 @@ FRAME_STATE_BIT(Generic, 37, NS_FRAME_HAS_ABSPOS_CHILDREN)
|
||||
// A display item for this frame has been painted as part of a PaintedLayer.
|
||||
FRAME_STATE_BIT(Generic, 38, NS_FRAME_PAINTED_THEBES)
|
||||
|
||||
// Frame is or is a descendant of something with a fixed height, unless that
|
||||
// ancestor is a body or html element, and has no closer ancestor that is
|
||||
// Frame is or is a descendant of something with a fixed block-size, unless
|
||||
// that ancestor is a body or html element, and has no closer ancestor that is
|
||||
// overflow:auto or overflow:scroll.
|
||||
FRAME_STATE_BIT(Generic, 39, NS_FRAME_IN_CONSTRAINED_HEIGHT)
|
||||
FRAME_STATE_BIT(Generic, 39, NS_FRAME_IN_CONSTRAINED_BSIZE)
|
||||
|
||||
// This is only set during painting
|
||||
FRAME_STATE_BIT(Generic, 40, NS_FRAME_FORCE_DISPLAY_LIST_DESCEND_INTO)
|
||||
|
@ -379,52 +379,62 @@ nsHTMLReflowState::Init(nsPresContext* aPresContext,
|
||||
|
||||
nsIFrame *parent = frame->GetParent();
|
||||
if (parent &&
|
||||
(parent->GetStateBits() & NS_FRAME_IN_CONSTRAINED_HEIGHT) &&
|
||||
(parent->GetStateBits() & NS_FRAME_IN_CONSTRAINED_BSIZE) &&
|
||||
!(parent->GetType() == nsGkAtoms::scrollFrame &&
|
||||
parent->StyleDisplay()->mOverflowY != NS_STYLE_OVERFLOW_HIDDEN)) {
|
||||
frame->AddStateBits(NS_FRAME_IN_CONSTRAINED_HEIGHT);
|
||||
frame->AddStateBits(NS_FRAME_IN_CONSTRAINED_BSIZE);
|
||||
} else if (type == nsGkAtoms::svgForeignObjectFrame) {
|
||||
// An SVG foreignObject frame is inherently constrained height.
|
||||
frame->AddStateBits(NS_FRAME_IN_CONSTRAINED_HEIGHT);
|
||||
} else if ((mStylePosition->mHeight.GetUnit() != eStyleUnit_Auto ||
|
||||
mStylePosition->mMaxHeight.GetUnit() != eStyleUnit_None) &&
|
||||
// Don't set NS_FRAME_IN_CONSTRAINED_HEIGHT on body or html
|
||||
// elements.
|
||||
(frame->GetContent() &&
|
||||
!(frame->GetContent()->IsAnyOfHTMLElements(nsGkAtoms::body,
|
||||
nsGkAtoms::html)))) {
|
||||
// An SVG foreignObject frame is inherently constrained block-size.
|
||||
frame->AddStateBits(NS_FRAME_IN_CONSTRAINED_BSIZE);
|
||||
} else {
|
||||
const bool vertical = mWritingMode.IsVertical();
|
||||
const nsStyleCoord& bSizeCoord =
|
||||
vertical ? mStylePosition->mWidth : mStylePosition->mHeight;
|
||||
const nsStyleCoord& maxBSizeCoord =
|
||||
vertical ? mStylePosition->mMaxWidth : mStylePosition->mMaxHeight;
|
||||
if ((bSizeCoord.GetUnit() != eStyleUnit_Auto ||
|
||||
maxBSizeCoord.GetUnit() != eStyleUnit_None) &&
|
||||
// Don't set NS_FRAME_IN_CONSTRAINED_BSIZE on body or html elements.
|
||||
(frame->GetContent() &&
|
||||
!(frame->GetContent()->IsAnyOfHTMLElements(nsGkAtoms::body,
|
||||
nsGkAtoms::html)))) {
|
||||
|
||||
// If our height was specified as a percentage, then this could
|
||||
// actually resolve to 'auto', based on:
|
||||
// http://www.w3.org/TR/CSS21/visudet.html#the-height-property
|
||||
nsIFrame* containingBlk = frame;
|
||||
while (containingBlk) {
|
||||
const nsStylePosition* stylePos = containingBlk->StylePosition();
|
||||
if ((stylePos->mHeight.IsCoordPercentCalcUnit() &&
|
||||
!stylePos->mHeight.HasPercent()) ||
|
||||
(stylePos->mMaxHeight.IsCoordPercentCalcUnit() &&
|
||||
!stylePos->mMaxHeight.HasPercent())) {
|
||||
frame->AddStateBits(NS_FRAME_IN_CONSTRAINED_HEIGHT);
|
||||
break;
|
||||
} else if ((stylePos->mHeight.IsCoordPercentCalcUnit() &&
|
||||
stylePos->mHeight.HasPercent()) ||
|
||||
(stylePos->mMaxHeight.IsCoordPercentCalcUnit() &&
|
||||
stylePos->mMaxHeight.HasPercent())) {
|
||||
if (!(containingBlk = containingBlk->GetContainingBlock())) {
|
||||
// If we've reached the top of the tree, then we don't have
|
||||
// a constrained height.
|
||||
frame->RemoveStateBits(NS_FRAME_IN_CONSTRAINED_HEIGHT);
|
||||
// If our block-size was specified as a percentage, then this could
|
||||
// actually resolve to 'auto', based on:
|
||||
// http://www.w3.org/TR/CSS21/visudet.html#the-height-property
|
||||
nsIFrame* containingBlk = frame;
|
||||
while (containingBlk) {
|
||||
const nsStylePosition* stylePos = containingBlk->StylePosition();
|
||||
const nsStyleCoord& bSizeCoord =
|
||||
vertical ? stylePos->mWidth : stylePos->mHeight;
|
||||
const nsStyleCoord& maxBSizeCoord =
|
||||
vertical ? stylePos->mMaxWidth : stylePos->mMaxHeight;
|
||||
if ((bSizeCoord.IsCoordPercentCalcUnit() &&
|
||||
!bSizeCoord.HasPercent()) ||
|
||||
(maxBSizeCoord.IsCoordPercentCalcUnit() &&
|
||||
!maxBSizeCoord.HasPercent())) {
|
||||
frame->AddStateBits(NS_FRAME_IN_CONSTRAINED_BSIZE);
|
||||
break;
|
||||
} else if ((bSizeCoord.IsCoordPercentCalcUnit() &&
|
||||
bSizeCoord.HasPercent()) ||
|
||||
(maxBSizeCoord.IsCoordPercentCalcUnit() &&
|
||||
maxBSizeCoord.HasPercent())) {
|
||||
if (!(containingBlk = containingBlk->GetContainingBlock())) {
|
||||
// If we've reached the top of the tree, then we don't have
|
||||
// a constrained block-size.
|
||||
frame->RemoveStateBits(NS_FRAME_IN_CONSTRAINED_BSIZE);
|
||||
break;
|
||||
}
|
||||
|
||||
continue;
|
||||
} else {
|
||||
frame->RemoveStateBits(NS_FRAME_IN_CONSTRAINED_BSIZE);
|
||||
break;
|
||||
}
|
||||
|
||||
continue;
|
||||
} else {
|
||||
frame->RemoveStateBits(NS_FRAME_IN_CONSTRAINED_HEIGHT);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
frame->RemoveStateBits(NS_FRAME_IN_CONSTRAINED_BSIZE);
|
||||
}
|
||||
} else {
|
||||
frame->RemoveStateBits(NS_FRAME_IN_CONSTRAINED_HEIGHT);
|
||||
}
|
||||
|
||||
NS_WARN_IF_FALSE((mFrameType == NS_CSS_FRAME_TYPE_INLINE &&
|
||||
|
@ -207,10 +207,10 @@ nsLineLayout::BeginLineReflow(nscoord aICoord, nscoord aBCoord,
|
||||
psd->mIEnd = aICoord + aISize;
|
||||
mContainerSize = aContainerSize;
|
||||
|
||||
// If we're in a constrained height frame, then we don't allow a
|
||||
// If we're in a constrained block-size frame, then we don't allow a
|
||||
// max line box width to take effect.
|
||||
if (!(LineContainerFrame()->GetStateBits() &
|
||||
NS_FRAME_IN_CONSTRAINED_HEIGHT)) {
|
||||
NS_FRAME_IN_CONSTRAINED_BSIZE)) {
|
||||
|
||||
// If the available size is greater than the maximum line box width (if
|
||||
// specified), then we need to adjust the line box width to be at the max
|
||||
|
Loading…
Reference in New Issue
Block a user