Bug 1131451 part 1 - Replace containerWidth with containerSize in logical-coordinate classes and APIs, frame classes, etc. r=dholbert

This commit is contained in:
Jonathan Kew 2015-07-16 10:07:57 +01:00
parent 754de9d27c
commit b9987170d7
46 changed files with 691 additions and 609 deletions

View File

@ -1466,10 +1466,11 @@ nsBidiPresUtils::RepositionRubyContentFrame(
// When ruby-align is not "start", if the content does not fill this
// frame, we need to center the children.
const nsSize dummyContainerSize;
for (nsIFrame* child : childList) {
LogicalRect rect = child->GetLogicalRect(aFrameWM, 0);
LogicalRect rect = child->GetLogicalRect(aFrameWM, dummyContainerSize);
rect.IStart(aFrameWM) += residualISize / 2;
child->SetRect(aFrameWM, rect, 0);
child->SetRect(aFrameWM, rect, dummyContainerSize);
}
}

View File

@ -5619,7 +5619,7 @@ nsLayoutUtils::GetFirstLinePosition(WritingMode aWM,
// kid might be a legend frame here, but that's ok.
if (GetFirstLinePosition(aWM, kid, &kidPosition)) {
*aResult = kidPosition +
kid->GetLogicalNormalPosition(aWM, aFrame->GetSize().width).B(aWM);
kid->GetLogicalNormalPosition(aWM, aFrame->GetSize()).B(aWM);
return true;
}
return false;
@ -5639,9 +5639,9 @@ nsLayoutUtils::GetFirstLinePosition(WritingMode aWM,
//XXX Not sure if this is the correct value to use for container
// width here. It will only be used in vertical-rl layout,
// which we don't have full support and testing for yet.
nscoord containerWidth = line->mContainerWidth;
const nsSize& containerSize = line->mContainerSize;
*aResult = kidPosition +
kid->GetLogicalNormalPosition(aWM, containerWidth).B(aWM);
kid->GetLogicalNormalPosition(aWM, containerSize).B(aWM);
return true;
}
} else {
@ -5674,16 +5674,16 @@ nsLayoutUtils::GetLastLineBaseline(WritingMode aWM,
if (line->IsBlock()) {
nsIFrame *kid = line->mFirstChild;
nscoord kidBaseline;
nscoord containerWidth = line->mContainerWidth;
const nsSize& containerSize = line->mContainerSize;
if (GetLastLineBaseline(aWM, kid, &kidBaseline)) {
// Ignore relative positioning for baseline calculations
*aResult = kidBaseline +
kid->GetLogicalNormalPosition(aWM, containerWidth).B(aWM);
kid->GetLogicalNormalPosition(aWM, containerSize).B(aWM);
return true;
} else if (kid->GetType() == nsGkAtoms::scrollFrame) {
// Use the bottom of the scroll frame.
// XXX CSS2.1 really doesn't say what to do here.
*aResult = kid->GetLogicalNormalPosition(aWM, containerWidth).B(aWM) +
*aResult = kid->GetLogicalNormalPosition(aWM, containerSize).B(aWM) +
kid->BSize(aWM);
return true;
}
@ -5711,9 +5711,9 @@ CalculateBlockContentBEnd(WritingMode aWM, nsBlockFrame* aFrame)
line != line_end; ++line) {
if (line->IsBlock()) {
nsIFrame* child = line->mFirstChild;
nscoord containerWidth = line->mContainerWidth;
const nsSize& containerSize = line->mContainerSize;
nscoord offset =
child->GetLogicalNormalPosition(aWM, containerWidth).B(aWM);
child->GetLogicalNormalPosition(aWM, containerSize).B(aWM);
contentBEnd =
std::max(contentBEnd,
nsLayoutUtils::CalculateContentBEnd(aWM, child) + offset);
@ -5753,7 +5753,7 @@ nsLayoutUtils::CalculateContentBEnd(WritingMode aWM, nsIFrame* aFrame)
nsIFrame* child = childFrames.get();
nscoord offset =
child->GetLogicalNormalPosition(aWM,
aFrame->GetSize().width).B(aWM);
aFrame->GetSize()).B(aWM);
contentBEnd = std::max(contentBEnd,
CalculateContentBEnd(aWM, child) + offset);
}

View File

@ -463,19 +463,20 @@ nsComboboxControlFrame::ReflowDropdown(nsPresContext* aPresContext,
//XXX Can this be different from the dropdown's writing mode?
// That would be odd!
// Note that we don't need to pass the true frame position or container width
// Note that we don't need to pass the true frame position or container size
// to ReflowChild or FinishReflowChild here; it will be positioned as needed
// by AbsolutelyPositionDropDown().
WritingMode outerWM = GetWritingMode();
const nsSize dummyContainerSize;
nsHTMLReflowMetrics desiredSize(aReflowState);
nsReflowStatus ignoredStatus;
ReflowChild(mDropdownFrame, aPresContext, desiredSize,
kidReflowState, outerWM, LogicalPoint(outerWM), 0,
flags, ignoredStatus);
kidReflowState, outerWM, LogicalPoint(outerWM),
dummyContainerSize, flags, ignoredStatus);
// Set the child's width and height to its desired size
FinishReflowChild(mDropdownFrame, aPresContext, desiredSize, &kidReflowState,
outerWM, LogicalPoint(outerWM), 0, flags);
outerWM, LogicalPoint(outerWM), dummyContainerSize, flags);
}
nsPoint
@ -575,16 +576,19 @@ nsComboboxControlFrame::GetAvailableDropdownSpace(WritingMode aWM,
// Normal frame geometry (eg GetOffsetTo, mRect) doesn't include transforms.
// In the special case that our transform is only a 2D translation we
// introduce this hack so that the dropdown will show up in the right place.
*aTranslation = LogicalPoint(aWM, GetCSSTransformTranslation(), 0);
// Use null container size when converting a vector from logical to physical.
const nsSize nullContainerSize;
*aTranslation = LogicalPoint(aWM, GetCSSTransformTranslation(),
nullContainerSize);
*aBefore = 0;
*aAfter = 0;
nsRect screen = nsFormControlFrame::GetUsableScreenRect(PresContext());
nscoord containerWidth = screen.width;
LogicalRect logicalScreen(aWM, screen, containerWidth);
nsSize containerSize = screen.Size();
LogicalRect logicalScreen(aWM, screen, containerSize);
if (mLastDropDownAfterScreenBCoord == nscoord_MIN) {
LogicalRect thisScreenRect(aWM, GetScreenRectInAppUnits(),
containerWidth);
containerSize);
mLastDropDownAfterScreenBCoord = thisScreenRect.BEnd(aWM) +
aTranslation->B(aWM);
mLastDropDownBeforeScreenBCoord = thisScreenRect.BEnd(aWM) +
@ -597,7 +601,7 @@ nsComboboxControlFrame::GetAvailableDropdownSpace(WritingMode aWM,
if (root) {
minBCoord = LogicalRect(aWM,
root->GetScreenRectInAppUnits(),
containerWidth).BStart(aWM);
containerSize).BStart(aWM);
if (mLastDropDownAfterScreenBCoord < minBCoord) {
// Don't allow the drop-down to be placed before the content area.
return;
@ -669,12 +673,12 @@ nsComboboxControlFrame::AbsolutelyPositionDropDown()
// Don't position the view unless the position changed since it might cause
// a call to NotifyGeometryChange() and an infinite loop here.
nscoord containerWidth = GetRect().width;
nsSize containerSize = GetSize();
const LogicalPoint currentPos =
mDropdownFrame->GetLogicalPosition(containerWidth);
mDropdownFrame->GetLogicalPosition(containerSize);
const LogicalPoint newPos = dropdownPosition + translation;
if (currentPos != newPos) {
mDropdownFrame->SetPosition(wm, newPos, containerWidth);
mDropdownFrame->SetPosition(wm, newPos, containerSize);
nsContainerFrame::PositionFrameView(mDropdownFrame);
}
return eDropDownPositionFinal;
@ -866,9 +870,8 @@ nsComboboxControlFrame::Reflow(nsPresContext* aPresContext,
// The button should occupy the same space as a scrollbar
WritingMode wm = aReflowState.GetWritingMode();
nscoord containerWidth =
aReflowState.ComputedSizeAsContainerIfConstrained().width;
LogicalRect buttonRect = mButtonFrame->GetLogicalRect(containerWidth);
nsSize containerSize = aReflowState.ComputedSizeAsContainerIfConstrained();
LogicalRect buttonRect = mButtonFrame->GetLogicalRect(containerSize);
buttonRect.IStart(wm) =
aReflowState.ComputedLogicalBorderPadding().IStartEnd(wm) +
@ -881,7 +884,7 @@ nsComboboxControlFrame::Reflow(nsPresContext* aPresContext,
buttonRect.BSize(wm) = mDisplayFrame->BSize(wm) +
this->GetLogicalUsedPadding(wm).BStartEnd(wm);
mButtonFrame->SetRect(buttonRect, containerWidth);
mButtonFrame->SetRect(buttonRect, containerSize);
if (!NS_INLINE_IS_BREAK_BEFORE(aStatus) &&
!NS_FRAME_IS_FULLY_COMPLETE(aStatus)) {

View File

@ -55,13 +55,13 @@ nsFieldSetFrame::VisualBorderRectRelativeToSelf() const
css::Side legendSide = wm.PhysicalSide(eLogicalSideBStart);
nscoord legendBorder = StyleBorder()->GetComputedBorderWidth(legendSide);
LogicalRect r(wm, LogicalPoint(wm, 0, 0), GetLogicalSize(wm));
nscoord containerWidth = r.Width(wm);
nsSize containerSize = r.Size(wm).GetPhysicalSize(wm);
if (legendBorder < mLegendRect.BSize(wm)) {
nscoord off = (mLegendRect.BSize(wm) - legendBorder) / 2;
r.BStart(wm) += off;
r.BSize(wm) -= off;
}
return r.GetPhysicalRect(wm, containerWidth);
return r.GetPhysicalRect(wm, containerSize);
}
nsIFrame*
@ -237,11 +237,11 @@ nsFieldSetFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext,
// Use the rect of the legend frame, not mLegendRect, so we draw our
// border under the legend's inline-start and -end margins.
LogicalRect legendRect(wm, legend->GetRect() + aPt, rect.width);
LogicalRect legendRect(wm, legend->GetRect() + aPt, rect.Size());
// Compute clipRect using logical coordinates, so that the legend space
// will be clipped out of the appropriate physical side depending on mode.
LogicalRect clipRect = LogicalRect(wm, rect, rect.width);
LogicalRect clipRect = LogicalRect(wm, rect, rect.Size());
DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
gfxContext* gfx = aRenderingContext.ThebesContext();
int32_t appUnitsPerDevPixel = presContext->AppUnitsPerDevPixel();
@ -251,33 +251,32 @@ nsFieldSetFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext,
clipRect.BSize(wm) = legendBorderWidth;
gfx->Save();
gfx->Clip(NSRectToSnappedRect(clipRect.GetPhysicalRect(wm, rect.width),
gfx->Clip(NSRectToSnappedRect(clipRect.GetPhysicalRect(wm, rect.Size()),
appUnitsPerDevPixel, *drawTarget));
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
aDirtyRect, rect, mStyleContext);
gfx->Restore();
// draw inline-end portion of the block-start side of the border
clipRect = LogicalRect(wm, rect, rect.width);
clipRect = LogicalRect(wm, rect, rect.Size());
clipRect.ISize(wm) = clipRect.IEnd(wm) - legendRect.IEnd(wm);
clipRect.IStart(wm) = legendRect.IEnd(wm);
clipRect.BSize(wm) = legendBorderWidth;
gfx->Save();
gfx->Clip(NSRectToSnappedRect(clipRect.GetPhysicalRect(wm, rect.width),
gfx->Clip(NSRectToSnappedRect(clipRect.GetPhysicalRect(wm, rect.Size()),
appUnitsPerDevPixel, *drawTarget));
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
aDirtyRect, rect, mStyleContext);
gfx->Restore();
// draw remainder of the border (omitting the block-start side)
clipRect = LogicalRect(wm, rect, rect.width);
clipRect = LogicalRect(wm, rect, rect.Size());
clipRect.BStart(wm) += legendBorderWidth;
clipRect.BSize(wm) =
GetLogicalRect(rect.width).BSize(wm) - (off + legendBorderWidth);
clipRect.BSize(wm) = BSize(wm) - (off + legendBorderWidth);
gfx->Save();
gfx->Clip(NSRectToSnappedRect(clipRect.GetPhysicalRect(wm, rect.width),
gfx->Clip(NSRectToSnappedRect(clipRect.GetPhysicalRect(wm, rect.Size()),
appUnitsPerDevPixel, *drawTarget));
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
aDirtyRect, rect, mStyleContext);
@ -449,8 +448,12 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
if (reflowLegend) {
nsHTMLReflowMetrics legendDesiredSize(aReflowState);
// We'll move the legend to its proper place later, so the position
// and containerSize passed here are unimportant.
const nsSize dummyContainerSize;
ReflowChild(legend, aPresContext, legendDesiredSize, *legendReflowState,
wm, LogicalPoint(wm), 0, NS_FRAME_NO_MOVE_FRAME, aStatus);
wm, LogicalPoint(wm), dummyContainerSize,
NS_FRAME_NO_MOVE_FRAME, aStatus);
#ifdef NOISY_REFLOW
printf(" returned (%d, %d)\n",
legendDesiredSize.Width(), legendDesiredSize.Height());
@ -477,10 +480,9 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
reflowInner = true;
}
// We'll move the legend to its proper place later.
FinishReflowChild(legend, aPresContext, legendDesiredSize,
legendReflowState.ptr(), wm, LogicalPoint(wm), 0,
NS_FRAME_NO_MOVE_FRAME);
legendReflowState.ptr(), wm, LogicalPoint(wm),
dummyContainerSize, NS_FRAME_NO_MOVE_FRAME);
} else if (!legend) {
mLegendRect.SetEmpty();
mLegendSpace = 0;
@ -490,8 +492,10 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
legendMargin = legend->GetLogicalUsedMargin(wm);
}
nscoord containerWidth = (wm.IsVertical() ? mLegendSpace : 0) +
border.LeftRight(wm);
// This containerSize is incomplete as yet: it does not include the size
// of the |inner| frame itself.
nsSize containerSize = (LogicalSize(wm, 0, mLegendSpace) +
border.Size(wm)).GetPhysicalSize(wm);
// reflow the content frame only if needed
if (reflowInner) {
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, inner,
@ -525,26 +529,31 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
"Margins on anonymous fieldset child not supported!");
LogicalPoint pt(wm, border.IStart(wm), border.BStart(wm) + mLegendSpace);
// We don't know the correct containerSize until we have reflowed |inner|,
// so we use a dummy value for now; FinishReflowChild will fix the position
// if necessary.
const nsSize dummyContainerSize;
ReflowChild(inner, aPresContext, kidDesiredSize, kidReflowState,
wm, pt, containerWidth, 0, aStatus);
wm, pt, dummyContainerSize, 0, aStatus);
// update the container width after reflowing the inner frame
// Update containerSize to account for size of the inner frame, so that
// FinishReflowChild can position it correctly.
containerSize += kidDesiredSize.PhysicalSize();
FinishReflowChild(inner, aPresContext, kidDesiredSize,
&kidReflowState, wm, pt,
containerWidth + kidDesiredSize.Width(), 0);
&kidReflowState, wm, pt, containerSize, 0);
NS_FRAME_TRACE_REFLOW_OUT("FieldSet::Reflow", aStatus);
}
if (inner) {
containerWidth += inner->GetSize().width;
} else if (inner) {
// |inner| didn't need to be reflowed but we do need to include its size
// in containerSize.
containerSize += inner->GetSize();
}
LogicalRect contentRect(wm);
if (inner) {
// We don't support margins on inner, so our content rect is just the
// inner's border-box. We don't care about container-width at this point,
// as we'll figure out the actual positioning later.
contentRect = inner->GetLogicalRect(wm, containerWidth);
// inner's border-box. (We don't really care about container size at this
// point, as we'll figure out the actual positioning later.)
contentRect = inner->GetLogicalRect(wm, containerSize);
}
// Our content rect must fill up the available width
@ -607,9 +616,9 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
ConvertTo(wm, legendReflowState->GetWritingMode());
nsHTMLReflowState::ApplyRelativePositioning(legend, wm, offsets,
&actualLegendPos,
containerWidth);
containerSize);
legend->SetPosition(wm, actualLegendPos, containerWidth);
legend->SetPosition(wm, actualLegendPos, containerSize);
nsContainerFrame::PositionFrameView(legend);
nsContainerFrame::PositionChildViews(legend);
}
@ -682,6 +691,6 @@ nscoord
nsFieldSetFrame::GetLogicalBaseline(WritingMode aWritingMode) const
{
nsIFrame* inner = GetInner();
return inner->BStart(aWritingMode, GetParent()->GetSize().width) +
return inner->BStart(aWritingMode, GetParent()->GetSize()) +
inner->GetLogicalBaseline(aWritingMode);
}

View File

@ -320,11 +320,12 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
childPos.B(wm) = 0; // This will be set properly later, after reflowing the
// child to determine its size.
// We just pass 0 for containerWidth here, as the child will be repositioned
// later by FinishReflowChild.
// We just pass a dummy containerSize here, as the child will be
// repositioned later by FinishReflowChild.
nsSize dummyContainerSize;
ReflowChild(aFirstKid, aPresContext,
contentsDesiredSize, contentsReflowState,
wm, childPos, 0, 0, contentsReflowStatus);
wm, childPos, dummyContainerSize, 0, contentsReflowStatus);
MOZ_ASSERT(NS_FRAME_IS_COMPLETE(contentsReflowStatus),
"We gave button-contents frame unconstrained available height, "
"so it should be complete");
@ -373,12 +374,13 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
// its focus-padding rect:
childPos.B(wm) += focusPadding.BStart(wm) + clbp.BStart(wm);
nscoord containerWidth = buttonContentBox.Width(wm) + clbp.LeftRight(wm);
nsSize containerSize =
(buttonContentBox + clbp.Size(wm)).GetPhysicalSize(wm);
// Place the child
FinishReflowChild(aFirstKid, aPresContext,
contentsDesiredSize, &contentsReflowState,
wm, childPos, containerWidth, 0);
wm, childPos, containerSize, 0);
// Make sure we have a useful 'ascent' value for the child
if (contentsDesiredSize.BlockStartAscent() ==

View File

@ -175,8 +175,12 @@ nsNumberControlFrame::Reflow(nsPresContext* aPresContext,
wrapperMargin.BStart(myWM));
nsReflowStatus childStatus;
// We initially reflow the child with a dummy containerSize; positioning
// will be fixed later.
const nsSize dummyContainerSize;
ReflowChild(outerWrapperFrame, aPresContext, wrappersDesiredSize,
wrapperReflowState, myWM, wrapperOffset, 0, 0, childStatus);
wrapperReflowState, myWM, wrapperOffset, dummyContainerSize, 0,
childStatus);
MOZ_ASSERT(NS_FRAME_IS_FULLY_COMPLETE(childStatus),
"We gave our child unconstrained available block-size, "
"so it should be complete");
@ -208,18 +212,21 @@ nsNumberControlFrame::Reflow(nsPresContext* aPresContext,
wrapperOffset.B(myWM) += std::max(0, extraSpace / 2);
// Needed in FinishReflowChild, for logical-to-physical conversion:
nscoord borderBoxWidth = myWM.IsVertical() ?
borderBoxBSize : borderBoxISize;
nsSize borderBoxSize = LogicalSize(myWM, borderBoxISize, borderBoxBSize).
GetPhysicalSize(myWM);
// Place the child
FinishReflowChild(outerWrapperFrame, aPresContext, wrappersDesiredSize,
&wrapperReflowState, myWM, wrapperOffset,
borderBoxWidth, 0);
borderBoxSize, 0);
nsSize contentBoxSize =
LogicalSize(myWM, contentBoxISize, contentBoxBSize).
GetPhysicalSize(myWM);
aDesiredSize.SetBlockStartAscent(
wrappersDesiredSize.BlockStartAscent() +
outerWrapperFrame->BStart(aReflowState.GetWritingMode(),
contentBoxISize));
contentBoxSize));
}
LogicalSize logicalDesiredSize(myWM, borderBoxISize, borderBoxBSize);

View File

@ -263,11 +263,11 @@ TextOverflow::TextOverflow(nsDisplayListBuilder* aBuilder,
nsIFrame* aBlockFrame)
: mContentArea(aBlockFrame->GetWritingMode(),
aBlockFrame->GetContentRectRelativeToSelf(),
aBlockFrame->GetRect().width)
aBlockFrame->GetSize())
, mBuilder(aBuilder)
, mBlock(aBlockFrame)
, mScrollableFrame(nsLayoutUtils::GetScrollableFrameFor(aBlockFrame))
, mBlockWidth(aBlockFrame->GetRect().width)
, mBlockSize(aBlockFrame->GetSize())
, mBlockWM(aBlockFrame->GetWritingMode())
, mAdjustForPixelSnapping(false)
{
@ -296,9 +296,12 @@ TextOverflow::TextOverflow(nsDisplayListBuilder* aBuilder,
// to pixel snapping behaviour in our scrolling code.
mAdjustForPixelSnapping = mCanHaveInlineAxisScrollbar;
}
// Use a null containerSize to convert a vector from logical to physical.
const nsSize nullContainerSize;
mContentArea.MoveBy(mBlockWM,
LogicalPoint(mBlockWM,
mScrollableFrame->GetScrollPosition(), 0));
mScrollableFrame->GetScrollPosition(),
nullContainerSize));
nsIFrame* scrollFrame = do_QueryFrame(mScrollableFrame);
scrollFrame->AddStateBits(NS_SCROLLFRAME_INVALIDATE_CONTENTS_ON_SCROLL);
}
@ -394,7 +397,7 @@ TextOverflow::AnalyzeMarkerEdges(nsIFrame* aFrame,
LogicalRect borderRect(mBlockWM,
nsRect(aFrame->GetOffsetTo(mBlock),
aFrame->GetSize()),
mBlockWidth);
mBlockSize);
nscoord istartOverlap = std::max(
aInsideMarkersArea.IStart(mBlockWM) - borderRect.IStart(mBlockWM), 0);
nscoord iendOverlap = std::max(
@ -468,9 +471,9 @@ TextOverflow::ExamineLineFrames(nsLineBox* aLine,
bool suppressIEnd = mIEnd.mStyle->mType == NS_STYLE_TEXT_OVERFLOW_CLIP;
if (mCanHaveInlineAxisScrollbar) {
LogicalPoint pos(mBlockWM, mScrollableFrame->GetScrollPosition(),
mBlockWidth);
mBlockSize);
LogicalRect scrollRange(mBlockWM, mScrollableFrame->GetScrollRange(),
mBlockWidth);
mBlockSize);
// No ellipsing when nothing to scroll to on that side (this includes
// overflow:auto that doesn't trigger a horizontal scrollbar).
if (pos.I(mBlockWM) <= scrollRange.IStart(mBlockWM)) {
@ -487,7 +490,7 @@ TextOverflow::ExamineLineFrames(nsLineBox* aLine,
InflateIStart(mBlockWM, &contentArea, scrollAdjust);
InflateIEnd(mBlockWM, &contentArea, scrollAdjust);
LogicalRect lineRect(mBlockWM, aLine->GetScrollableOverflowArea(),
mBlockWidth);
mBlockSize);
const bool istartOverflow =
!suppressIStart && lineRect.IStart(mBlockWM) < contentArea.IStart(mBlockWM);
const bool iendOverflow =
@ -760,8 +763,8 @@ TextOverflow::CreateMarkers(const nsLineBox* aLine,
aLine->BStart(), mIStart.mIntrinsicISize, aLine->BSize());
nsPoint offset = mBuilder->ToReferenceFrame(mBlock);
nsRect markerRect =
markerLogicalRect.GetPhysicalRect(mBlockWM, mBlockWidth) + offset;
ClipMarker(mContentArea.GetPhysicalRect(mBlockWM, mBlockWidth) + offset,
markerLogicalRect.GetPhysicalRect(mBlockWM, mBlockSize) + offset;
ClipMarker(mContentArea.GetPhysicalRect(mBlockWM, mBlockSize) + offset,
markerRect, clipState);
nsDisplayItem* marker = new (mBuilder)
nsDisplayTextOverflowMarker(mBuilder, mBlock, markerRect,
@ -777,8 +780,8 @@ TextOverflow::CreateMarkers(const nsLineBox* aLine,
mIEnd.mIntrinsicISize, aLine->BSize());
nsPoint offset = mBuilder->ToReferenceFrame(mBlock);
nsRect markerRect =
markerLogicalRect.GetPhysicalRect(mBlockWM, mBlockWidth) + offset;
ClipMarker(mContentArea.GetPhysicalRect(mBlockWM, mBlockWidth) + offset,
markerLogicalRect.GetPhysicalRect(mBlockWM, mBlockSize) + offset;
ClipMarker(mContentArea.GetPhysicalRect(mBlockWM, mBlockSize) + offset,
markerRect, clipState);
nsDisplayItem* marker = new (mBuilder)
nsDisplayTextOverflowMarker(mBuilder, mBlock, markerRect,

View File

@ -117,7 +117,7 @@ class TextOverflow {
return LogicalRect(mBlockWM,
aFrame->GetScrollableOverflowRect() +
aFrame->GetOffsetTo(mBlock),
mBlockWidth);
mBlockSize);
}
/**
@ -210,7 +210,7 @@ class TextOverflow {
nsIFrame* mBlock;
nsIScrollableFrame* mScrollableFrame;
nsDisplayList mMarkerList;
nscoord mBlockWidth;
nsSize mBlockSize;
WritingMode mBlockWM;
bool mCanHaveInlineAxisScrollbar;
bool mAdjustForPixelSnapping;

View File

@ -641,27 +641,28 @@ public:
{ }
// Construct from a writing mode and a physical point, within a given
// containing rectangle's width (defining the conversion between LTR
// containing rectangle's size (defining the conversion between LTR
// and RTL coordinates).
LogicalPoint(WritingMode aWritingMode,
const nsPoint& aPoint,
nscoord aContainerWidth)
const nsSize& aContainerSize)
#ifdef DEBUG
: mWritingMode(aWritingMode)
#endif
{
if (aWritingMode.IsVertical()) {
I() = aPoint.y;
B() = aWritingMode.IsVerticalLR() ? aPoint.x : aContainerWidth - aPoint.x;
B() = aWritingMode.IsVerticalLR() ? aPoint.x
: aContainerSize.width - aPoint.x;
} else {
I() = aWritingMode.IsBidiLTR() ? aPoint.x : aContainerWidth - aPoint.x;
I() = aWritingMode.IsBidiLTR() ? aPoint.x
: aContainerSize.width - aPoint.x;
B() = aPoint.y;
}
}
/**
* Read-only (const) access to the coordinates, in both logical
* and physical terms.
* Read-only (const) access to the logical coordinates.
*/
nscoord I(WritingMode aWritingMode) const // inline-axis
{
@ -674,21 +675,6 @@ public:
return mPoint.y;
}
nscoord X(WritingMode aWritingMode, nscoord aContainerWidth) const
{
CHECK_WRITING_MODE(aWritingMode);
if (aWritingMode.IsVertical()) {
return aWritingMode.IsVerticalLR() ? B() : aContainerWidth - B();
} else {
return aWritingMode.IsBidiLTR() ? I() : aContainerWidth - I();
}
}
nscoord Y(WritingMode aWritingMode) const
{
CHECK_WRITING_MODE(aWritingMode);
return aWritingMode.IsVertical() ? I() : B();
}
/**
* These non-const accessors return a reference (lvalue) that can be
* assigned to by callers.
@ -709,14 +695,16 @@ public:
* converted according to our writing mode.
*/
nsPoint GetPhysicalPoint(WritingMode aWritingMode,
nscoord aContainerWidth) const
const nsSize& aContainerSize) const
{
CHECK_WRITING_MODE(aWritingMode);
if (aWritingMode.IsVertical()) {
return nsPoint(aWritingMode.IsVerticalLR() ? B() : aContainerWidth - B(),
return nsPoint(aWritingMode.IsVerticalLR()
? B() : aContainerSize.width - B(),
I());
} else {
return nsPoint(aWritingMode.IsBidiLTR() ? I() : aContainerWidth - I(),
return nsPoint(aWritingMode.IsBidiLTR()
? I() : aContainerSize.width - I(),
B());
}
}
@ -725,13 +713,13 @@ public:
* Return the equivalent point in a different writing mode.
*/
LogicalPoint ConvertTo(WritingMode aToMode, WritingMode aFromMode,
nscoord aContainerWidth) const
const nsSize& aContainerSize) const
{
CHECK_WRITING_MODE(aFromMode);
return aToMode == aFromMode ?
*this : LogicalPoint(aToMode,
GetPhysicalPoint(aFromMode, aContainerWidth),
aContainerWidth);
GetPhysicalPoint(aFromMode, aContainerSize),
aContainerSize);
}
bool operator==(const LogicalPoint& aOther) const
@ -945,7 +933,7 @@ public:
// optimization for non-DEBUG builds where LogicalSize doesn't store
// the writing mode
return (aToMode == aFromMode || !aToMode.IsOrthogonalTo(aFromMode))
? *this : LogicalSize(aToMode, BSize(), ISize());
? *this : LogicalSize(aToMode, BSize(), ISize());
#endif
}
@ -1215,16 +1203,16 @@ public:
{
CHECK_WRITING_MODE(aWritingMode);
return aWritingMode.IsVertical()
? (aWritingMode.IsVerticalLR()
? (aWritingMode.IsBidiLTR()
? nsMargin(IStart(), BEnd(), IEnd(), BStart())
: nsMargin(IEnd(), BEnd(), IStart(), BStart()))
: (aWritingMode.IsBidiLTR()
? nsMargin(IStart(), BStart(), IEnd(), BEnd())
: nsMargin(IEnd(), BStart(), IStart(), BEnd())))
: (aWritingMode.IsBidiLTR()
? nsMargin(BStart(), IEnd(), BEnd(), IStart())
: nsMargin(BStart(), IStart(), BEnd(), IEnd()));
? (aWritingMode.IsVerticalLR()
? (aWritingMode.IsBidiLTR()
? nsMargin(IStart(), BEnd(), IEnd(), BStart())
: nsMargin(IEnd(), BEnd(), IStart(), BStart()))
: (aWritingMode.IsBidiLTR()
? nsMargin(IStart(), BStart(), IEnd(), BEnd())
: nsMargin(IEnd(), BStart(), IStart(), BEnd())))
: (aWritingMode.IsBidiLTR()
? nsMargin(BStart(), IEnd(), BEnd(), IStart())
: nsMargin(BStart(), IStart(), BEnd(), IEnd()));
}
/**
@ -1383,28 +1371,22 @@ public:
LogicalRect(WritingMode aWritingMode,
const nsRect& aRect,
nscoord aContainerWidth)
const nsSize& aContainerSize)
#ifdef DEBUG
: mWritingMode(aWritingMode)
#endif
{
if (aWritingMode.IsVertical()) {
if (aWritingMode.IsVerticalLR()) {
mRect.y = aRect.x;
} else {
mRect.y = aContainerWidth - aRect.XMost();
}
mRect.height = aRect.width;
mRect.y = aWritingMode.IsVerticalLR()
? aRect.x : aContainerSize.width - aRect.XMost();
mRect.x = aRect.y;
mRect.height = aRect.width;
mRect.width = aRect.height;
} else {
if (aWritingMode.IsBidiLTR()) {
mRect.x = aRect.x;
} else {
mRect.x = aContainerWidth - aRect.XMost();
}
mRect.width = aRect.width;
mRect.x = aWritingMode.IsBidiLTR()
? aRect.x : aContainerSize.width - aRect.XMost();
mRect.y = aRect.y;
mRect.width = aRect.width;
mRect.height = aRect.height;
}
}
@ -1472,24 +1454,26 @@ public:
/**
* Accessors for line-relative coordinates
*/
nscoord LineLeft(WritingMode aWritingMode, nscoord aContainerWidth) const
nscoord LineLeft(WritingMode aWritingMode,
const nsSize& aContainerSize) const
{
CHECK_WRITING_MODE(aWritingMode);
if (aWritingMode.IsVertical()) {
return IStart(); // sideways-left will require aContainerHeight
return IStart();
} else {
return aWritingMode.IsBidiLTR() ? IStart()
: aContainerWidth - IEnd();
: aContainerSize.width - IEnd();
}
}
nscoord LineRight(WritingMode aWritingMode, nscoord aContainerWidth) const
nscoord LineRight(WritingMode aWritingMode,
const nsSize& aContainerSize) const
{
CHECK_WRITING_MODE(aWritingMode);
if (aWritingMode.IsVertical()) {
return IEnd(); // sideways-left will require aContainerHeight
return IEnd();
} else {
return aWritingMode.IsBidiLTR() ? IEnd()
: aContainerWidth - IStart();
: aContainerSize.width - IStart();
}
}
@ -1508,10 +1492,14 @@ public:
}
}
nscoord Y(WritingMode aWritingMode) const
nscoord Y(WritingMode aWritingMode, nscoord aContainerHeight) const
{
CHECK_WRITING_MODE(aWritingMode);
return aWritingMode.IsVertical() ? mRect.X() : mRect.Y();
if (aWritingMode.IsVertical()) {
return mRect.X();
} else {
return mRect.Y();
}
}
nscoord Width(WritingMode aWritingMode) const
@ -1538,10 +1526,14 @@ public:
}
}
nscoord YMost(WritingMode aWritingMode) const
nscoord YMost(WritingMode aWritingMode, nscoord aContainerHeight) const
{
CHECK_WRITING_MODE(aWritingMode);
return aWritingMode.IsVertical() ? mRect.XMost() : mRect.YMost();
if (aWritingMode.IsVertical()) {
return mRect.XMost();
} else {
return mRect.YMost();
}
}
bool IsEmpty() const
@ -1643,19 +1635,20 @@ public:
/**
* Return an nsRect containing our physical coordinates within the given
* container width
* container size.
*/
nsRect GetPhysicalRect(WritingMode aWritingMode,
nscoord aContainerWidth) const
const nsSize& aContainerSize) const
{
CHECK_WRITING_MODE(aWritingMode);
if (aWritingMode.IsVertical()) {
return nsRect(aWritingMode.IsVerticalLR() ?
BStart() : aContainerWidth - BEnd(),
IStart(), BSize(), ISize());
return nsRect(aWritingMode.IsVerticalLR()
? BStart() : aContainerSize.width - BEnd(),
IStart(),
BSize(), ISize());
} else {
return nsRect(aWritingMode.IsBidiLTR() ?
IStart() : aContainerWidth - IEnd(),
return nsRect(aWritingMode.IsBidiLTR()
? IStart() : aContainerSize.width - IEnd(),
BStart(), ISize(), BSize());
}
}
@ -1664,12 +1657,12 @@ public:
* Return a LogicalRect representing this rect in a different writing mode
*/
LogicalRect ConvertTo(WritingMode aToMode, WritingMode aFromMode,
nscoord aContainerWidth) const
const nsSize& aContainerSize) const
{
CHECK_WRITING_MODE(aFromMode);
return aToMode == aFromMode ?
*this : LogicalRect(aToMode, GetPhysicalRect(aFromMode, aContainerWidth),
aContainerWidth);
*this : LogicalRect(aToMode, GetPhysicalRect(aFromMode, aContainerSize),
aContainerSize);
}
/**

View File

@ -408,7 +408,7 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
// Don't split if told not to (e.g. for fixed frames)
&& (aDelegatingFrame->GetType() != nsGkAtoms::inlineFrame)
//XXX we don't handle splitting frames for inline absolute containing blocks yet
&& (aKidFrame->GetLogicalRect(aContainingBlock.width).BStart(wm) <=
&& (aKidFrame->GetLogicalRect(aContainingBlock.Size()).BStart(wm) <=
aReflowState.AvailableBSize());
// Don't split things below the fold. (Ideally we shouldn't *have*
// anything totally below the fold, but we can't position frames
@ -468,8 +468,8 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
margin.BStart(outerWM),
kidSize.ISize(outerWM), kidSize.BSize(outerWM));
nsRect r =
rect.GetPhysicalRect(outerWM, logicalCBSize.Width(wm) +
border.LeftRight(outerWM));
rect.GetPhysicalRect(outerWM, logicalCBSize.GetPhysicalSize(wm) +
border.Size(outerWM).GetPhysicalSize(outerWM));
// XXX hack to correct for lack of bidi support in vertical mode
if (outerWM.IsVertical() && !outerWM.IsBidiLTR()) {
r.y = logicalCBSize.Height(wm) + border.TopBottom(outerWM) - r.YMost();

View File

@ -1244,9 +1244,9 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
// bullets that are placed next to a child block (bug 92896)
// Tall bullets won't look particularly nice here...
LogicalRect bbox = bullet->GetLogicalRect(wm, metrics.Width());
LogicalRect bbox = bullet->GetLogicalRect(wm, metrics.PhysicalSize());
bbox.BStart(wm) = position.mBaseline - metrics.BlockStartAscent();
bullet->SetRect(wm, bbox, metrics.Width());
bullet->SetRect(wm, bbox, metrics.PhysicalSize());
}
// Otherwise just leave the bullet where it is, up against our
// block-start padding.
@ -1259,12 +1259,11 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
ComputeFinalSize(*reflowState, state, aMetrics, &blockEndEdgeOfChildren);
// If the block direction is right-to-left, we need to update the bounds of
// lines that were placed relative to mContainerWidth during reflow, as
// we typically do not know the true container width (block-dir size of the
// finished paragraph/block) until we've reflowed all its children. So we
// use a "fake" mContainerWidth during reflow (see nsBlockReflowState's
// constructor) and then fix up the positions of the lines here, once the
// final block size is known.
// lines that were placed relative to mContainerSize during reflow, as
// we typically do not know the true container size until we've reflowed all
// its children. So we use a dummy mContainerSize during reflow (see
// nsBlockReflowState's constructor) and then fix up the positions of the
// lines here, once the final block size is known.
//
// Note that writing-mode:vertical-rl is the only case where the block
// logical direction progresses in a negative physical direction, and
@ -1272,12 +1271,12 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
// of the coordinate space in order to translate between the logical and
// physical origins.
if (wm.IsVerticalRL()) {
nscoord containerWidth = aMetrics.Width();
nscoord deltaX = containerWidth - state.ContainerWidth();
if (deltaX) {
nsSize containerSize = aMetrics.PhysicalSize();
nscoord deltaX = containerSize.width - state.ContainerSize().width;
if (deltaX != 0) {
for (line_iterator line = begin_lines(), end = end_lines();
line != end; line++) {
UpdateLineContainerWidth(line, containerWidth);
UpdateLineContainerSize(line, containerSize);
}
for (nsIFrame* f : mFloats) {
nsPoint physicalDelta(deltaX, 0);
@ -1933,9 +1932,9 @@ nsBlockFrame::PropagateFloatDamage(nsBlockReflowState& aState,
// Scrollable overflow should be sufficient for things that affect
// layout.
WritingMode wm = aState.mReflowState.GetWritingMode();
nscoord containerWidth = aState.ContainerWidth();
nsSize containerSize = aState.ContainerSize();
LogicalRect overflow = aLine->GetOverflowArea(eScrollableOverflow, wm,
containerWidth);
containerSize);
nscoord lineBCoordCombinedBefore = overflow.BStart(wm) + aDeltaBCoord;
nscoord lineBCoordCombinedAfter = lineBCoordCombinedBefore +
overflow.BSize(wm);
@ -2176,11 +2175,11 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState)
PropagateFloatDamage(aState, line, deltaBCoord);
}
// If the container width has changed reset the container width. If the
// If the container size has changed, reset mContainerSize. If the
// line's writing mode is not ltr, or if the line is not left-aligned, also
// mark the line dirty.
if (aState.ContainerWidth() != line->mContainerWidth) {
line->mContainerWidth = aState.ContainerWidth();
if (aState.ContainerSize() != line->mContainerSize) {
line->mContainerSize = aState.ContainerSize();
bool isLastLine = line == mLines.back() &&
!GetNextInFlow() &&
@ -2817,26 +2816,26 @@ nsBlockFrame::SlideLine(nsBlockReflowState& aState,
NS_PRECONDITION(aDeltaBCoord != 0, "why slide a line nowhere?");
// Adjust line state
aLine->SlideBy(aDeltaBCoord, aState.ContainerWidth());
aLine->SlideBy(aDeltaBCoord, aState.ContainerSize());
// Adjust the frames in the line
MoveChildFramesOfLine(aLine, aDeltaBCoord);
}
void
nsBlockFrame::UpdateLineContainerWidth(nsLineBox* aLine,
nscoord aNewContainerWidth)
nsBlockFrame::UpdateLineContainerSize(nsLineBox* aLine,
const nsSize& aNewContainerSize)
{
if (aNewContainerWidth == aLine->mContainerWidth) {
if (aNewContainerSize == aLine->mContainerSize) {
return;
}
// Adjust line state
nscoord widthDelta = aLine->UpdateContainerWidth(aNewContainerWidth);
nsSize sizeDelta = aLine->UpdateContainerSize(aNewContainerSize);
// Changing container width only matters if writing mode is vertical-rl
if (GetWritingMode().IsVerticalRL()) {
MoveChildFramesOfLine(aLine, widthDelta);
MoveChildFramesOfLine(aLine, sizeDelta.width);
}
}
@ -3682,7 +3681,7 @@ nsBlockFrame::DoReflowInlineFrames(nsBlockReflowState& aState,
WritingMode lineWM = GetWritingMode(aLine->mFirstChild);
LogicalRect lineRect =
aFloatAvailableSpace.mRect.ConvertTo(lineWM, outerWM,
aState.ContainerWidth());
aState.ContainerSize());
nscoord iStart = lineRect.IStart(lineWM);
nscoord availISize = lineRect.ISize(lineWM);
@ -6155,14 +6154,14 @@ nsBlockFrame::ReflowPushedFloats(nsBlockReflowState& aState,
void
nsBlockFrame::RecoverFloats(nsFloatManager& aFloatManager, WritingMode aWM,
nscoord aContainerWidth)
const nsSize& aContainerSize)
{
// Recover our own floats
nsIFrame* stop = nullptr; // Stop before we reach pushed floats that
// belong to our next-in-flow
for (nsIFrame* f = mFloats.FirstChild(); f && f != stop; f = f->GetNextSibling()) {
LogicalRect region = nsFloatManager::GetRegionFor(aWM, f, aContainerWidth);
aFloatManager.AddFloat(f, region, aWM, aContainerWidth);
LogicalRect region = nsFloatManager::GetRegionFor(aWM, f, aContainerSize);
aFloatManager.AddFloat(f, region, aWM, aContainerSize);
if (!stop && f->GetNextInFlow())
stop = f->GetNextInFlow();
}
@ -6170,13 +6169,13 @@ nsBlockFrame::RecoverFloats(nsFloatManager& aFloatManager, WritingMode aWM,
// Recurse into our overflow container children
for (nsIFrame* oc = GetFirstChild(kOverflowContainersList);
oc; oc = oc->GetNextSibling()) {
RecoverFloatsFor(oc, aFloatManager, aWM, aContainerWidth);
RecoverFloatsFor(oc, aFloatManager, aWM, aContainerSize);
}
// Recurse into our normal children
for (nsBlockFrame::line_iterator line = begin_lines(); line != end_lines(); ++line) {
if (line->IsBlock()) {
RecoverFloatsFor(line->mFirstChild, aFloatManager, aWM, aContainerWidth);
RecoverFloatsFor(line->mFirstChild, aFloatManager, aWM, aContainerSize);
}
}
}
@ -6185,7 +6184,7 @@ void
nsBlockFrame::RecoverFloatsFor(nsIFrame* aFrame,
nsFloatManager& aFloatManager,
WritingMode aWM,
nscoord aContainerWidth)
const nsSize& aContainerSize)
{
NS_PRECONDITION(aFrame, "null frame");
// Only blocks have floats
@ -6198,11 +6197,11 @@ nsBlockFrame::RecoverFloatsFor(nsIFrame* aFrame,
// accordingly so that we consider relatively positioned frames
// at their original position.
LogicalRect rect(aWM, block->GetNormalRect(), aContainerWidth);
nscoord lineLeft = rect.LineLeft(aWM, aContainerWidth);
LogicalRect rect(aWM, block->GetNormalRect(), aContainerSize);
nscoord lineLeft = rect.LineLeft(aWM, aContainerSize);
nscoord blockStart = rect.BStart(aWM);
aFloatManager.Translate(lineLeft, blockStart);
block->RecoverFloats(aFloatManager, aWM, aContainerWidth);
block->RecoverFloats(aFloatManager, aWM, aContainerSize);
aFloatManager.Translate(-lineLeft, -blockStart);
}
}
@ -7051,7 +7050,7 @@ nsBlockFrame::ReflowBullet(nsIFrame* aBulletFrame,
aBulletFrame->SetRect(wm, LogicalRect(wm, iStart, bStart,
aMetrics.ISize(wm),
aMetrics.BSize(wm)),
aState.ContainerWidth());
aState.ContainerSize());
aBulletFrame->DidReflow(aState.mPresContext, &aState.mReflowState,
nsDidReflowStatus::FINISHED);
}

View File

@ -413,10 +413,10 @@ protected:
void SlideLine(nsBlockReflowState& aState,
nsLineBox* aLine, nscoord aDeltaBCoord);
void UpdateLineContainerWidth(nsLineBox* aLine,
nscoord aNewContainerWidth);
void UpdateLineContainerSize(nsLineBox* aLine,
const nsSize& aNewContainerSize);
// helper for SlideLine and UpdateLineContainerWidth
// helper for SlideLine and UpdateLineContainerSize
void MoveChildFramesOfLine(nsLineBox* aLine, nscoord aDeltaBCoord);
void ComputeFinalSize(const nsHTMLReflowState& aReflowState,
@ -484,7 +484,7 @@ public:
static void RecoverFloatsFor(nsIFrame* aFrame,
nsFloatManager& aFloatManager,
mozilla::WritingMode aWM,
nscoord aContainerWidth);
const nsSize& aContainerSize);
/**
* Determine if we have any pushed floats from a previous continuation.
@ -556,7 +556,7 @@ protected:
*/
void RecoverFloats(nsFloatManager& aFloatManager,
mozilla::WritingMode aWM,
nscoord aContainerWidth);
const nsSize& aContainerSize);
/** Reflow pushed floats
*/

View File

@ -228,7 +228,7 @@ nsBlockReflowContext::ReflowBlock(const LogicalRect& aSpace,
{
mFrame = aFrameRS.frame;
mWritingMode = aState.mReflowState.GetWritingMode();
mContainerWidth = aState.ContainerWidth();
mContainerSize = aState.ContainerSize();
mSpace = aSpace;
if (!aIsAdjacentWithBStart) {
@ -280,7 +280,7 @@ nsBlockReflowContext::ReflowBlock(const LogicalRect& aSpace,
usedMargin.IStartEnd(mWritingMode),
mSpace.BSize(mWritingMode) -
usedMargin.BStartEnd(mWritingMode));
tI = space.LineLeft(mWritingMode, mContainerWidth);
tI = space.LineLeft(mWritingMode, mContainerSize);
tB = mBCoord;
if ((mFrame->GetStateBits() & NS_BLOCK_FLOAT_MGR) == 0)
@ -430,22 +430,23 @@ nsBlockReflowContext::PlaceBlock(const nsHTMLReflowState& aReflowState,
aLine->SetBounds(mWritingMode,
mICoord, mBCoord - backupContainingBlockAdvance,
mMetrics.ISize(mWritingMode), mMetrics.BSize(mWritingMode),
mContainerWidth);
mContainerSize);
WritingMode frameWM = mFrame->GetWritingMode();
LogicalPoint logPos =
LogicalPoint(mWritingMode, mICoord, mBCoord).
ConvertTo(frameWM, mWritingMode, mContainerWidth - mMetrics.Width());
ConvertTo(frameWM, mWritingMode,
mContainerSize - mMetrics.PhysicalSize());
// ApplyRelativePositioning in right-to-left writing modes needs to
// know the updated frame width
mFrame->SetSize(mWritingMode, mMetrics.Size(mWritingMode));
aReflowState.ApplyRelativePositioning(&logPos, mContainerWidth);
aReflowState.ApplyRelativePositioning(&logPos, mContainerSize);
// Now place the frame and complete the reflow process
nsContainerFrame::FinishReflowChild(mFrame, mPresContext, mMetrics,
&aReflowState, frameWM, logPos,
mContainerWidth, 0);
mContainerSize, 0);
aOverflowAreas = mMetrics.mOverflowAreas + mFrame->GetPosition();

View File

@ -83,7 +83,8 @@ protected:
nsIFrame* mFrame;
mozilla::LogicalRect mSpace;
nscoord mICoord, mBCoord, mContainerWidth;
nscoord mICoord, mBCoord;
nsSize mContainerSize;
mozilla::WritingMode mWritingMode;
nsHTMLReflowMetrics mMetrics;
nsCollapsingMargin mBStartMargin;

View File

@ -322,7 +322,7 @@ nsBlockReflowState::GetFloatAvailableSpaceWithState(
nsFlowAreaRect result =
mFloatManager->GetFlowArea(wm, aBCoord, nsFloatManager::BAND_FROM_POINT,
blockSize, mContentArea, aState,
ContainerWidth());
ContainerSize());
// Keep the inline size >= 0 for compatibility with nsSpaceManager.
if (result.mRect.ISize(wm) < 0) {
result.mRect.ISize(wm) = 0;
@ -355,7 +355,7 @@ nsBlockReflowState::GetFloatAvailableSpaceForBSize(
#endif
nsFlowAreaRect result =
mFloatManager->GetFlowArea(wm, aBCoord, nsFloatManager::WIDTH_WITHIN_HEIGHT,
aBSize, mContentArea, aState, ContainerWidth());
aBSize, mContentArea, aState, ContainerSize());
// Keep the width >= 0 for compatibility with nsSpaceManager.
if (result.mRect.ISize(wm) < 0) {
result.mRect.ISize(wm) = 0;
@ -479,7 +479,7 @@ nsBlockReflowState::RecoverFloats(nsLineList::iterator aLine,
tI, tB, mFloatManagerI, mFloatManagerB);
nsFrame::ListTag(stdout, floatFrame);
LogicalRect region = nsFloatManager::GetRegionFor(wm, floatFrame,
ContainerWidth());
ContainerSize());
printf(" aDeltaBCoord=%d region={%d,%d,%d,%d}\n",
aDeltaBCoord, region.IStart(wm), region.BStart(wm),
region.ISize(wm), region.BSize(wm));
@ -487,13 +487,13 @@ nsBlockReflowState::RecoverFloats(nsLineList::iterator aLine,
#endif
mFloatManager->AddFloat(floatFrame,
nsFloatManager::GetRegionFor(wm, floatFrame,
ContainerWidth()),
wm, ContainerWidth());
ContainerSize()),
wm, ContainerSize());
fc = fc->Next();
}
} else if (aLine->IsBlock()) {
nsBlockFrame::RecoverFloatsFor(aLine->mFirstChild, *mFloatManager, wm,
ContainerWidth());
ContainerSize());
}
}
@ -700,7 +700,7 @@ nsBlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat)
// The float's old region, so we can propagate damage.
LogicalRect oldRegion = nsFloatManager::GetRegionFor(wm, aFloat,
ContainerWidth());
ContainerSize());
// Enforce CSS2 9.5.1 rule [2], i.e., make sure that a float isn't
// ``above'' another float that preceded it in the flow.
@ -857,9 +857,10 @@ nsBlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat)
// with rtl direction. Since they don't yet (bug 1131451), we'll
// just put left floats at the top of the line and right floats at
// bottom.
floatPos.I(wm) = leftFloat
? floatAvailableSpace.mRect.Y(wm)
: floatAvailableSpace.mRect.YMost(wm) - floatMarginISize;
floatPos.I(wm) =
leftFloat ? floatAvailableSpace.mRect.Y(wm, ContainerSize().height)
: floatAvailableSpace.mRect.YMost(wm, ContainerSize().height) -
floatMarginISize;
} else if (leftFloat == wm.IsBidiLTR()) {
floatPos.I(wm) = floatAvailableSpace.mRect.IStart(wm);
}
@ -935,14 +936,14 @@ nsBlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat)
// If float is relatively positioned, factor that in as well
nsHTMLReflowState::ApplyRelativePositioning(aFloat, wm, floatOffsets,
&origin, ContainerWidth());
&origin, ContainerSize());
// Position the float and make sure and views are properly
// positioned. We need to explicitly position its child views as
// well, since we're moving the float after flowing it.
bool moved = aFloat->GetLogicalPosition(wm, ContainerWidth()) != origin;
bool moved = aFloat->GetLogicalPosition(wm, ContainerSize()) != origin;
if (moved) {
aFloat->SetPosition(wm, origin, ContainerWidth());
aFloat->SetPosition(wm, origin, ContainerSize());
nsContainerFrame::PositionFrameView(aFloat);
nsContainerFrame::PositionChildViews(aFloat);
}
@ -956,7 +957,7 @@ nsBlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat)
// calculate region
LogicalRect region =
nsFloatManager::CalculateRegionFor(wm, aFloat, floatMargin,
ContainerWidth());
ContainerSize());
// if the float split, then take up all of the vertical height
if (NS_FRAME_IS_NOT_COMPLETE(reflowStatus) &&
(NS_UNCONSTRAINEDSIZE != ContentBSize())) {
@ -964,10 +965,10 @@ nsBlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat)
ContentBSize() - floatPos.B(wm));
}
DebugOnly<nsresult> rv = mFloatManager->AddFloat(aFloat, region, wm,
ContainerWidth());
ContainerSize());
MOZ_ASSERT(NS_SUCCEEDED(rv), "bad float placement");
// store region
nsFloatManager::StoreRegionFor(wm, aFloat, region, ContainerWidth());
nsFloatManager::StoreRegionFor(wm, aFloat, region, ContainerSize());
// If the float's dimensions have changed, note the damage in the
// float manager.

View File

@ -207,8 +207,7 @@ public:
// Physical size. Use only for physical <-> logical coordinate conversion.
nsSize mContainerSize;
nscoord ContainerWidth() const { return mContainerSize.width; }
nscoord ContainerHeight() const { return mContainerSize.height; }
const nsSize& ContainerSize() const { return mContainerSize; }
// Continuation out-of-flow float frames that need to move to our
// next in flow are placed here during reflow. It's a pointer to

View File

@ -665,20 +665,20 @@ nsCanvasFrame::Reflow(nsPresContext* aPresContext,
WritingMode wm = aReflowState.GetWritingMode();
WritingMode kidWM = kidReflowState.GetWritingMode();
nscoord containerWidth = aReflowState.ComputedWidth();
nsSize containerSize = aReflowState.ComputedPhysicalSize();
LogicalMargin margin = kidReflowState.ComputedLogicalMargin();
LogicalPoint kidPt(kidWM, margin.IStart(kidWM), margin.BStart(kidWM));
kidReflowState.ApplyRelativePositioning(&kidPt, containerWidth);
kidReflowState.ApplyRelativePositioning(&kidPt, containerSize);
// Reflow the frame
ReflowChild(kidFrame, aPresContext, kidDesiredSize, kidReflowState,
kidWM, kidPt, containerWidth, 0, aStatus);
kidWM, kidPt, containerSize, 0, aStatus);
// Complete the reflow and position and size the child frame
FinishReflowChild(kidFrame, aPresContext, kidDesiredSize, &kidReflowState,
kidWM, kidPt, containerWidth, 0);
kidWM, kidPt, containerSize, 0);
if (!NS_FRAME_IS_FULLY_COMPLETE(aStatus)) {
nsIFrame* nextFrame = kidFrame->GetNextInFlow();

View File

@ -360,13 +360,13 @@ nsColumnSetFrame::ReflowColumns(nsHTMLReflowMetrics& aDesiredSize,
}
static void MoveChildTo(nsIFrame* aChild, LogicalPoint aOrigin,
WritingMode aWM, nscoord aContainerWidth)
WritingMode aWM, const nsSize& aContainerSize)
{
if (aChild->GetLogicalPosition(aWM, aContainerWidth) == aOrigin) {
if (aChild->GetLogicalPosition(aWM, aContainerSize) == aOrigin) {
return;
}
aChild->SetPosition(aWM, aOrigin, aContainerWidth);
aChild->SetPosition(aWM, aOrigin, aContainerSize);
nsContainerFrame::PlaceFrameView(aChild);
}
@ -488,10 +488,11 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize,
nsIFrame* child = mFrames.FirstChild();
LogicalPoint childOrigin(wm, borderPadding.IStart(wm),
borderPadding.BStart(wm));
// In vertical-rl mode we can't use the computed width as the
// container width because it may be NS_UNCONSTRAINEDSIZE, so we use 0
// for now and reposition the columns after reflowing them all.
nscoord containerWidth = wm.IsVerticalRL() ? 0 : aReflowState.ComputedWidth();
// In vertical-rl mode, columns will not be correctly placed if the
// reflowState's ComputedWidth() is UNCONSTRAINED (in which case we'll get
// a containerSize.width of zero here). In that case, the column positions
// will be adjusted later, after our correct contentSize is known.
nsSize containerSize = aReflowState.ComputedSizeAsContainerIfConstrained();
// For RTL, since the columns might not fill the frame exactly, we
// need to account for the slop. Otherwise we'll waste time moving the
@ -506,7 +507,8 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize,
availISize = aReflowState.ComputedISize();
}
if (availISize != NS_INTRINSICSIZE) {
childOrigin.I(wm) = containerWidth - borderPadding.Left(wm) - availISize;
childOrigin.I(wm) = containerSize.width - borderPadding.Left(wm) -
availISize;
#ifdef DEBUG_roc
printf("*** childOrigin.iCoord = %d\n", childOrigin.I(wm));
#endif
@ -567,7 +569,7 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize,
nscoord childContentBEnd = 0;
if (!reflowNext && (skipIncremental || skipResizeBSizeShrink)) {
// This child does not need to be reflowed, but we may need to move it
MoveChildTo(child, childOrigin, wm, containerWidth);
MoveChildTo(child, childOrigin, wm, containerSize);
// If this is the last frame then make sure we get the right status
nsIFrame* kidNext = child->GetNextSibling();
@ -634,7 +636,7 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize,
childOrigin.B(wm) +
kidReflowState.ComputedLogicalMargin().BStart(wm));
ReflowChild(child, PresContext(), kidDesiredSize, kidReflowState,
wm, origin, containerWidth, 0, aStatus);
wm, origin, containerSize, 0, aStatus);
reflowNext = (aStatus & NS_FRAME_REFLOW_NEXTINFLOW) != 0;
@ -649,7 +651,7 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize,
*aCarriedOutBEndMargin = kidDesiredSize.mCarriedOutBEndMargin;
FinishReflowChild(child, PresContext(), kidDesiredSize,
&kidReflowState, wm, childOrigin, containerWidth, 0);
&kidReflowState, wm, childOrigin, containerSize, 0);
childContentBEnd = nsLayoutUtils::CalculateContentBEnd(wm, child);
if (childContentBEnd > aConfig.mColMaxBSize) {
@ -801,17 +803,17 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize,
aDesiredSize.mOverflowAreas = overflowRects;
aDesiredSize.UnionOverflowAreasWithDesiredBounds();
// In vertical-rl mode, make a second pass to reposition the columns
// with the correct container width
if (wm.IsVerticalRL()) {
child = mFrames.FirstChild();
while (child) {
// Get the logical position as set before with containerWidth=0
// and reset with the correct container width (which is the block
// size in vertical modes).
child->SetPosition(wm, child->GetLogicalPosition(wm, 0),
contentSize.BSize(wm));
child = child->GetNextSibling();
// In vertical-rl mode, make a second pass if necessary to reposition the
// columns with the correct container width. (In other writing modes,
// correct containerSize was not required for column positioning so we don't
// need this fixup.)
if (wm.IsVerticalRL() && containerSize.width != contentSize.Width(wm)) {
const nsSize finalContainerSize = aDesiredSize.PhysicalSize();
for (nsIFrame* child : mFrames) {
// Get the logical position as set previously using a provisional or
// dummy containerSize, and reset with the correct container size.
child->SetPosition(wm, child->GetLogicalPosition(wm, containerSize),
finalContainerSize);
}
}

View File

@ -974,20 +974,20 @@ nsContainerFrame::ReflowChild(nsIFrame* aKidFrame,
const nsHTMLReflowState& aReflowState,
const WritingMode& aWM,
const LogicalPoint& aPos,
nscoord aContainerWidth,
const nsSize& aContainerSize,
uint32_t aFlags,
nsReflowStatus& aStatus,
nsOverflowContinuationTracker* aTracker)
{
NS_PRECONDITION(aReflowState.frame == aKidFrame, "bad reflow state");
if (aWM.IsVerticalRL() || (!aWM.IsVertical() && !aWM.IsBidiLTR())) {
NS_ASSERTION(aContainerWidth != NS_UNCONSTRAINEDSIZE,
NS_ASSERTION(aContainerSize.width != NS_UNCONSTRAINEDSIZE,
"ReflowChild with unconstrained container width!");
}
// Position the child frame and its view if requested.
if (NS_FRAME_NO_MOVE_FRAME != (aFlags & NS_FRAME_NO_MOVE_FRAME)) {
aKidFrame->SetPosition(aWM, aPos, aContainerWidth);
aKidFrame->SetPosition(aWM, aPos, aContainerSize);
}
if (0 == (aFlags & NS_FRAME_NO_MOVE_VIEW)) {
@ -1114,11 +1114,11 @@ nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame,
const nsHTMLReflowState* aReflowState,
const WritingMode& aWM,
const LogicalPoint& aPos,
nscoord aContainerWidth,
const nsSize& aContainerSize,
uint32_t aFlags)
{
if (aWM.IsVerticalRL() || (!aWM.IsVertical() && !aWM.IsBidiLTR())) {
NS_ASSERTION(aContainerWidth != NS_UNCONSTRAINEDSIZE,
NS_ASSERTION(aContainerSize.width != NS_UNCONSTRAINEDSIZE,
"FinishReflowChild with unconstrained container width!");
}
@ -1129,7 +1129,7 @@ nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame,
if (NS_FRAME_NO_MOVE_FRAME != (aFlags & NS_FRAME_NO_MOVE_FRAME)) {
aKidFrame->SetRect(aWM, LogicalRect(aWM, aPos, convertedSize),
aContainerWidth);
aContainerSize);
} else {
aKidFrame->SetSize(aWM, convertedSize);
}
@ -1261,8 +1261,8 @@ nsContainerFrame::ReflowOverflowContainerChildren(nsPresContext* aPres
NS_ASSERTION(frame->GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER,
"overflow container frame must have overflow container bit set");
WritingMode wm = frame->GetWritingMode();
nscoord containerWidth = aReflowState.AvailableSize(wm).Width(wm);
LogicalRect prevRect = prevInFlow->GetLogicalRect(wm, containerWidth);
nsSize containerSize = aReflowState.AvailableSize(wm).GetPhysicalSize(wm);
LogicalRect prevRect = prevInFlow->GetLogicalRect(wm, containerSize);
// Initialize reflow params
LogicalSize availSpace(wm, prevRect.ISize(wm),
@ -1275,11 +1275,11 @@ nsContainerFrame::ReflowOverflowContainerChildren(nsPresContext* aPres
// Reflow
LogicalPoint pos(wm, prevRect.IStart(wm), 0);
ReflowChild(frame, aPresContext, desiredSize, frameState,
wm, pos, containerWidth, aFlags, frameStatus, &tracker);
wm, pos, containerSize, aFlags, frameStatus, &tracker);
//XXXfr Do we need to override any shrinkwrap effects here?
// e.g. desiredSize.Width() = prevRect.width;
FinishReflowChild(frame, aPresContext, desiredSize, &frameState,
wm, pos, containerWidth, aFlags);
wm, pos, containerSize, aFlags);
// Handle continuations
if (!NS_FRAME_IS_FULLY_COMPLETE(frameStatus)) {
@ -1321,7 +1321,7 @@ nsContainerFrame::ReflowOverflowContainerChildren(nsPresContext* aPres
if (aReflowState.mFloatManager) {
nsBlockFrame::RecoverFloatsFor(frame, *aReflowState.mFloatManager,
aReflowState.GetWritingMode(),
aReflowState.ComputedWidth());
aReflowState.ComputedPhysicalSize());
}
}
ConsiderChildOverflow(aOverflowRects, frame);

View File

@ -241,7 +241,7 @@ public:
* If the reflow status after reflowing the child is FULLY_COMPLETE then any
* next-in-flows are deleted using DeleteNextInFlowChild().
*
* @param aContainerWidth width of the border-box of the containing frame
* @param aContainerSize size of the border-box of the containing frame
*
* Flags:
* NS_FRAME_NO_MOVE_VIEW - don't position the frame's view. Set this if you
@ -255,7 +255,7 @@ public:
const nsHTMLReflowState& aReflowState,
const mozilla::WritingMode& aWM,
const mozilla::LogicalPoint& aPos,
nscoord aContainerWidth,
const nsSize& aContainerSize,
uint32_t aFlags,
nsReflowStatus& aStatus,
nsOverflowContinuationTracker* aTracker = nullptr);
@ -270,7 +270,7 @@ public:
* - sets the view's visibility, opacity, content transparency, and clip
* - invoked the DidReflow() function
*
* @param aContainerWidth width of the border-box of the containing frame
* @param aContainerSize size of the border-box of the containing frame
*
* Flags:
* NS_FRAME_NO_MOVE_FRAME - don't move the frame. aPos is ignored in this
@ -285,7 +285,7 @@ public:
const nsHTMLReflowState* aReflowState,
const mozilla::WritingMode& aWM,
const mozilla::LogicalPoint& aPos,
nscoord aContainerWidth,
const nsSize& aContainerSize,
uint32_t aFlags);
//XXX temporary: hold on to a copy of the old physical versions of

View File

@ -3824,9 +3824,11 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
containerBP.IStart(flexWM),
containerBP.BStart(flexWM));
nscoord containerWidth = aAxisTracker.IsMainAxisHorizontal() ?
aContentBoxMainSize : contentBoxCrossSize;
containerWidth += aReflowState.ComputedPhysicalBorderPadding().LeftRight();
nsSize containerSize;
containerSize.width = aAxisTracker.IsMainAxisHorizontal() ?
aContentBoxMainSize : contentBoxCrossSize;
containerSize.width +=
aReflowState.ComputedPhysicalBorderPadding().LeftRight();
// FINAL REFLOW: Give each child frame another chance to reflow, now that
// we know its final size and position.
@ -3869,13 +3871,13 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
// position.
itemNeedsReflow = false;
MoveFlexItemToFinalPosition(aReflowState, *item, framePos,
containerWidth);
containerSize);
}
}
}
if (itemNeedsReflow) {
ReflowFlexItem(aPresContext, aAxisTracker, aReflowState,
*item, framePos, containerWidth);
*item, framePos, containerSize);
}
// If this is our first child and we haven't established a baseline for
@ -3960,7 +3962,7 @@ nsFlexContainerFrame::MoveFlexItemToFinalPosition(
const nsHTMLReflowState& aReflowState,
const FlexItem& aItem,
LogicalPoint& aFramePos,
nscoord aContainerWidth)
const nsSize& aContainerSize)
{
WritingMode outerWM = aReflowState.GetWritingMode();
@ -3976,8 +3978,8 @@ nsFlexContainerFrame::MoveFlexItemToFinalPosition(
}
nsHTMLReflowState::ApplyRelativePositioning(aItem.Frame(), outerWM,
logicalOffsets, &aFramePos,
aContainerWidth);
aItem.Frame()->SetPosition(outerWM, aFramePos, aContainerWidth);
aContainerSize);
aItem.Frame()->SetPosition(outerWM, aFramePos, aContainerSize);
PositionChildViews(aItem.Frame());
}
@ -3987,7 +3989,7 @@ nsFlexContainerFrame::ReflowFlexItem(nsPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
const FlexItem& aItem,
LogicalPoint& aFramePos,
nscoord aContainerWidth)
const nsSize& aContainerSize)
{
WritingMode outerWM = aReflowState.GetWritingMode();
WritingMode wm = aItem.Frame()->GetWritingMode();
@ -4052,7 +4054,7 @@ nsFlexContainerFrame::ReflowFlexItem(nsPresContext* aPresContext,
nsReflowStatus childReflowStatus;
ReflowChild(aItem.Frame(), aPresContext,
childDesiredSize, childReflowState,
outerWM, aFramePos, aContainerWidth,
outerWM, aFramePos, aContainerSize,
0, childReflowStatus);
// XXXdholbert Once we do pagination / splitting, we'll need to actually
@ -4067,11 +4069,11 @@ nsFlexContainerFrame::ReflowFlexItem(nsPresContext* aPresContext,
childReflowState.ComputedLogicalOffsets().ConvertTo(outerWM, wm);
nsHTMLReflowState::ApplyRelativePositioning(aItem.Frame(), outerWM,
offsets, &aFramePos,
aContainerWidth);
aContainerSize);
FinishReflowChild(aItem.Frame(), aPresContext,
childDesiredSize, &childReflowState,
outerWM, aFramePos, aContainerWidth, 0);
outerWM, aFramePos, aContainerSize, 0);
// Save the first child's ascent; it may establish container's baseline.
if (aItem.Frame() == mFrames.FirstChild()) {

View File

@ -183,13 +183,13 @@ protected:
* @param aItem The flex item whose frame should be moved.
* @param aFramePos The position where the flex item's frame should
* be placed. (pre-relative positioning)
* @param aContainerWidth The flex container's width (required by some methods
* @param aContainerSize The flex container's size (required by some methods
* that we call, to interpret aFramePos correctly).
*/
void MoveFlexItemToFinalPosition(const nsHTMLReflowState& aReflowState,
const FlexItem& aItem,
mozilla::LogicalPoint& aFramePos,
nscoord aContainerWidth);
const nsSize& aContainerSize);
/**
* Helper-function to reflow a child frame, at its final position determined
* by flex layout.
@ -200,7 +200,7 @@ protected:
* @param aItem The flex item to be reflowed.
* @param aFramePos The position where the flex item's frame should
* be placed. (pre-relative positioning)
* @param aContainerWidth The flex container's width (required by some methods
* @param aContainerSize The flex container's size (required by some methods
* that we call, to interpret aFramePos correctly).
*/
void ReflowFlexItem(nsPresContext* aPresContext,
@ -208,7 +208,7 @@ protected:
const nsHTMLReflowState& aReflowState,
const FlexItem& aItem,
mozilla::LogicalPoint& aFramePos,
nscoord aContainerWidth);
const nsSize& aContainerSize);
bool mChildrenHaveBeenReordered; // Have we ever had to reorder our kids
// to satisfy their 'order' values?

View File

@ -122,7 +122,7 @@ nsFlowAreaRect
nsFloatManager::GetFlowArea(WritingMode aWM, nscoord aBOffset,
BandInfoType aInfoType, nscoord aBSize,
LogicalRect aContentArea, SavedState* aState,
nscoord aContainerWidth) const
const nsSize& aContainerSize) const
{
CHECK_BLOCK_DIR(aWM);
NS_ASSERTION(aBSize >= 0, "unexpected max block size");
@ -169,8 +169,8 @@ nsFloatManager::GetFlowArea(WritingMode aWM, nscoord aBOffset,
blockEnd = nscoord_MAX;
}
}
nscoord lineLeft = mLineLeft + aContentArea.LineLeft(aWM, aContainerWidth);
nscoord lineRight = mLineLeft + aContentArea.LineRight(aWM, aContainerWidth);
nscoord lineLeft = mLineLeft + aContentArea.LineLeft(aWM, aContainerSize);
nscoord lineRight = mLineLeft + aContentArea.LineRight(aWM, aContainerSize);
if (lineRight < lineLeft) {
NS_WARNING("bad value");
lineRight = lineLeft;
@ -243,8 +243,8 @@ nsFloatManager::GetFlowArea(WritingMode aWM, nscoord aBOffset,
nscoord_MAX : (blockEnd - blockStart);
// convert back from LineLeft/Right to IStart
nscoord inlineStart = aWM.IsVertical() || aWM.IsBidiLTR()
? lineLeft - mLineLeft
: mLineLeft + aContainerWidth - lineRight;
? lineLeft - mLineLeft
: mLineLeft - lineRight + aContainerSize.width;
return nsFlowAreaRect(aWM, inlineStart, blockStart - mBlockStart,
lineRight - lineLeft, blockSize, haveFloats);
@ -252,14 +252,14 @@ nsFloatManager::GetFlowArea(WritingMode aWM, nscoord aBOffset,
nsresult
nsFloatManager::AddFloat(nsIFrame* aFloatFrame, const LogicalRect& aMarginRect,
WritingMode aWM, nscoord aContainerWidth)
WritingMode aWM, const nsSize& aContainerSize)
{
CHECK_BLOCK_DIR(aWM);
NS_ASSERTION(aMarginRect.ISize(aWM) >= 0, "negative inline size!");
NS_ASSERTION(aMarginRect.BSize(aWM) >= 0, "negative block size!");
FloatInfo info(aFloatFrame,
aMarginRect.LineLeft(aWM, aContainerWidth) + mLineLeft,
aMarginRect.LineLeft(aWM, aContainerSize) + mLineLeft,
aMarginRect.BStart(aWM) + mBlockStart,
aMarginRect.ISize(aWM),
aMarginRect.BSize(aWM));
@ -293,12 +293,12 @@ LogicalRect
nsFloatManager::CalculateRegionFor(WritingMode aWM,
nsIFrame* aFloat,
const LogicalMargin& aMargin,
nscoord aContainerWidth)
const nsSize& aContainerSize)
{
// We consider relatively positioned frames at their original position.
LogicalRect region(aWM, nsRect(aFloat->GetNormalPosition(),
aFloat->GetSize()),
aContainerWidth);
aContainerSize);
// Float region includes its margin
region.Inflate(aWM, aMargin);
@ -324,9 +324,9 @@ NS_DECLARE_FRAME_PROPERTY(FloatRegionProperty, DeleteValue<nsMargin>)
LogicalRect
nsFloatManager::GetRegionFor(WritingMode aWM, nsIFrame* aFloat,
nscoord aContainerWidth)
const nsSize& aContainerSize)
{
LogicalRect region = aFloat->GetLogicalRect(aWM, aContainerWidth);
LogicalRect region = aFloat->GetLogicalRect(aWM, aContainerSize);
void* storedRegion = aFloat->Properties().Get(FloatRegionProperty());
if (storedRegion) {
nsMargin margin = *static_cast<nsMargin*>(storedRegion);
@ -338,9 +338,9 @@ nsFloatManager::GetRegionFor(WritingMode aWM, nsIFrame* aFloat,
void
nsFloatManager::StoreRegionFor(WritingMode aWM, nsIFrame* aFloat,
const LogicalRect& aRegion,
nscoord aContainerWidth)
const nsSize& aContainerSize)
{
nsRect region = aRegion.GetPhysicalRect(aWM, aContainerWidth);
nsRect region = aRegion.GetPhysicalRect(aWM, aContainerSize);
nsRect rect = aFloat->GetRect();
FrameProperties props = aFloat->Properties();
if (region.IsEqualEdges(rect)) {

View File

@ -59,7 +59,7 @@ public:
*/
static mozilla::LogicalRect GetRegionFor(mozilla::WritingMode aWM,
nsIFrame* aFloatFrame,
nscoord aContainerWidth);
const nsSize& aContainerSize);
/**
* Calculate the float region for this frame using aMargin and the
* frame's mRect. The region includes the margins around the float,
@ -71,7 +71,7 @@ public:
mozilla::WritingMode aWM,
nsIFrame* aFloatFrame,
const mozilla::LogicalMargin& aMargin,
nscoord aContainerWidth);
const nsSize& aContainerSize);
/**
* Store the float region on the frame. The region is stored
* as a delta against the mRect, so repositioning the frame will
@ -80,7 +80,7 @@ public:
static void StoreRegionFor(mozilla::WritingMode aWM,
nsIFrame* aFloat,
const mozilla::LogicalRect& aRegion,
nscoord aContainerWidth);
const nsSize& aContainerSize);
// Structure that stores the current state of a frame manager for
// Save/Restore purposes.
@ -162,7 +162,8 @@ public:
nsFlowAreaRect GetFlowArea(mozilla::WritingMode aWM,
nscoord aBCoord, BandInfoType aInfoType,
nscoord aBSize, mozilla::LogicalRect aContentArea,
SavedState* aState, nscoord mContainerWidth) const;
SavedState* aState,
const nsSize& aContainerSize) const;
/**
* Add a float that comes after all floats previously added. Its
@ -174,7 +175,7 @@ public:
*/
nsresult AddFloat(nsIFrame* aFloatFrame,
const mozilla::LogicalRect& aMarginRect,
mozilla::WritingMode aWM, nscoord aContainerWidth);
mozilla::WritingMode aWM, const nsSize& aContainerSize);
/**
* Notify that we tried to place a float that could not fit at all and

View File

@ -3555,7 +3555,7 @@ static FrameTarget GetSelectionClosestFrameForLine(
nsIFrame *closestFromIStart = nullptr, *closestFromIEnd = nullptr;
nscoord closestIStart = aLine->IStart(), closestIEnd = aLine->IEnd();
WritingMode wm = aLine->mWritingMode;
LogicalPoint pt(wm, aPoint, aLine->mContainerWidth);
LogicalPoint pt(wm, aPoint, aLine->mContainerSize);
bool canSkipBr = false;
for (int32_t n = aLine->GetChildCount(); n;
--n, frame = frame->GetNextSibling()) {
@ -3567,7 +3567,7 @@ static FrameTarget GetSelectionClosestFrameForLine(
}
canSkipBr = true;
LogicalRect frameRect = LogicalRect(wm, frame->GetRect(),
aLine->mContainerWidth);
aLine->mContainerSize);
if (pt.I(wm) >= frameRect.IStart(wm)) {
if (pt.I(wm) < frameRect.IEnd(wm)) {
return GetSelectionClosestFrameForChild(frame, aPoint, aFlags);
@ -3625,7 +3625,7 @@ static FrameTarget GetSelectionClosestFrameForBlock(nsIFrame* aFrame,
nsBlockFrame::line_iterator closestLine = end;
// Convert aPoint into a LogicalPoint in the writing-mode of this block
WritingMode wm = curLine->mWritingMode;
LogicalPoint pt(wm, aPoint, curLine->mContainerWidth);
LogicalPoint pt(wm, aPoint, curLine->mContainerSize);
while (curLine != end) {
// Check to see if our point lies within the line's block-direction bounds
nscoord BCoord = pt.B(wm) - curLine->BStart();
@ -5681,14 +5681,16 @@ nsIFrame::ListGeneric(nsACString& aTo, const char* aPrefix, uint32_t aFlags) con
if (parent) {
WritingMode pWM = parent->GetWritingMode();
if (pWM.IsVertical() || !pWM.IsBidiLTR()) {
nscoord cw = parent->mRect.width;
LogicalRect lr(pWM, mRect, cw);
aTo += nsPrintfCString(" parent wm=%s-%s,width=%d,logicalRect={%d,%d,%d,%d}",
nsSize containerSize = parent->mRect.Size();
LogicalRect lr(pWM, mRect, containerSize);
aTo += nsPrintfCString(" parent wm=%s-%s, cs={%d,%d}, "
" logicalRect={%d,%d,%d,%d}",
pWM.IsVertical() ? pWM.IsVerticalLR()
? "vlr" : "vrl"
: "htb",
wm.IsBidiLTR() ? "ltr" : "rtl",
cw, lr.IStart(pWM), lr.BStart(pWM),
containerSize.width, containerSize.height,
lr.IStart(pWM), lr.BStart(pWM),
lr.ISize(pWM), lr.BSize(pWM));
}
}

View File

@ -514,11 +514,12 @@ nsHTMLScrollFrame::ReflowScrolledFrame(ScrollReflowState* aState,
mHelper.mHasVerticalScrollbar = aAssumeVScroll;
nsReflowStatus status;
// No need to pass a container-width to ReflowChild or
// No need to pass a true container-size to ReflowChild or
// FinishReflowChild, because it's only used there when positioning
// the frame (i.e. if NS_FRAME_NO_MOVE_FRAME isn't set)
const nsSize dummyContainerSize;
ReflowChild(mHelper.mScrolledFrame, presContext, *aMetrics,
kidReflowState, wm, LogicalPoint(wm), 0,
kidReflowState, wm, LogicalPoint(wm), dummyContainerSize,
NS_FRAME_NO_MOVE_FRAME, status);
mHelper.mHasHorizontalScrollbar = didHaveHorizontalScrollbar;
@ -530,7 +531,8 @@ nsHTMLScrollFrame::ReflowScrolledFrame(ScrollReflowState* aState,
// which will usually be different from the scrollport height;
// invalidating the difference will cause unnecessary repainting.
FinishReflowChild(mHelper.mScrolledFrame, presContext,
*aMetrics, &kidReflowState, wm, LogicalPoint(wm), 0,
*aMetrics, &kidReflowState, wm, LogicalPoint(wm),
dummyContainerSize,
NS_FRAME_NO_MOVE_FRAME | NS_FRAME_NO_SIZE_VIEW);
// XXX Some frames (e.g., nsPluginFrame, nsFrameFrame, nsTextFrame) don't bother

View File

@ -1246,8 +1246,9 @@ nsGridContainerFrame::ReflowChildren(GridItemCSSOrderIterator& aIter,
{
WritingMode wm = aReflowState.GetWritingMode();
const LogicalPoint gridOrigin(aContentArea.Origin(wm));
const nscoord containerWidth = aContentArea.Width(wm) +
aReflowState.ComputedPhysicalBorderPadding().LeftRight();
const nsSize containerSize =
(aContentArea.Size(wm) +
aReflowState.ComputedLogicalBorderPadding().Size(wm)).GetPhysicalSize(wm);
nsPresContext* pc = PresContext();
for (; !aIter.AtEnd(); aIter.Next()) {
nsIFrame* child = *aIter;
@ -1275,20 +1276,22 @@ nsGridContainerFrame::ReflowChildren(GridItemCSSOrderIterator& aIter,
childRS.SetComputedBSize(std::max(bSize, 0));
}
// We need the width of the child before we can correctly convert
// the writing-mode of its origin, so we reflow at (0, 0) and then
// pass the correct position to FinishReflowChild.
// the writing-mode of its origin, so we reflow at (0, 0) using a dummy
// containerSize, and then pass the correct position to FinishReflowChild.
nsHTMLReflowMetrics childSize(childRS);
nsReflowStatus childStatus;
const nsSize dummyContainerSize;
ReflowChild(child, pc, childSize, childRS, childWM, LogicalPoint(childWM),
0, 0, childStatus);
dummyContainerSize, 0, childStatus);
LogicalPoint childPos =
cb.Origin(wm).ConvertTo(childWM, wm, containerWidth - childSize.Width() -
margin.LeftRight(childWM));
cb.Origin(wm).ConvertTo(childWM, wm,
containerSize - childSize.PhysicalSize() -
margin.Size(childWM).GetPhysicalSize(childWM));
childPos.I(childWM) += margin.IStart(childWM);
childPos.B(childWM) += margin.BStart(childWM);
childRS.ApplyRelativePositioning(&childPos, containerWidth);
childRS.ApplyRelativePositioning(&childPos, containerSize);
FinishReflowChild(child, pc, childSize, &childRS, childWM, childPos,
containerWidth, 0);
containerSize, 0);
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, child);
// XXX deal with 'childStatus' not being COMPLETE
}
@ -1318,7 +1321,7 @@ nsGridContainerFrame::ReflowChildren(GridItemCSSOrderIterator& aIter,
cb = new nsRect;
child->Properties().Set(GridItemContainingBlockRect(), cb);
}
*cb = itemCB.GetPhysicalRect(wm, containerWidth);
*cb = itemCB.GetPhysicalRect(wm, containerSize);
}
// This rect isn't used at all for layout so we use it to optimize
// away the virtual GetType() call in the callee in most cases.

View File

@ -272,6 +272,11 @@ public:
nscoord& Width() { return mWritingMode.IsVertical() ? mBSize : mISize; }
nscoord& Height() { return mWritingMode.IsVertical() ? mISize : mBSize; }
nsSize PhysicalSize()
{
return Size(mWritingMode).GetPhysicalSize(mWritingMode);
}
void SetBlockStartAscent(nscoord aAscent)
{
mBlockStartAscent = aAscent;

View File

@ -1265,11 +1265,11 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsPresContext* aPresContext,
// XXXbz the placeholder is not fully reflowed yet if our containing block is
// relatively positioned...
WritingMode cbwm = cbrs->GetWritingMode();
nscoord containerWidth = containingBlock->GetStateBits() & NS_FRAME_IN_REFLOW
? cbrs->ComputedSizeAsContainerIfConstrained().width
: containingBlock->GetSize().width;
nsSize containerSize = containingBlock->GetStateBits() & NS_FRAME_IN_REFLOW
? cbrs->ComputedSizeAsContainerIfConstrained()
: containingBlock->GetSize();
LogicalPoint placeholderOffset(wm, aPlaceholderFrame->GetOffsetTo(containingBlock),
containerWidth);
containerSize);
// XXX hack to correct for lack of LogicalPoint bidi support in vertical mode
if (wm.IsVertical() && !wm.IsBidiLTR()) {
@ -1285,7 +1285,11 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsPresContext* aPresContext,
nsBlockFrame* blockFrame =
nsLayoutUtils::GetAsBlock(containingBlock->GetContentInsertionFrame());
if (blockFrame) {
LogicalPoint blockOffset(wm, blockFrame->GetOffsetTo(containingBlock), 0);
// Use a null containerSize to convert a LogicalPoint functioning as a
// vector into a physical nsPoint vector.
const nsSize nullContainerSize;
LogicalPoint blockOffset(wm, blockFrame->GetOffsetTo(containingBlock),
nullContainerSize);
bool isValid;
nsBlockInFlowLineIterator iter(blockFrame, aPlaceholderFrame, &isValid);
if (!isValid) {
@ -1301,7 +1305,7 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsPresContext* aPresContext,
// would have been inline-level or block-level
LogicalRect lineBounds =
lineBox->GetBounds().ConvertTo(wm, lineBox->mWritingMode,
lineBox->mContainerWidth);
lineBox->mContainerSize);
if (mStyleDisplay->IsOriginalDisplayInlineOutsideStyle()) {
// Use the block-start of the inline box which the placeholder lives in
// as the hypothetical box's block-start.
@ -1414,9 +1418,10 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsPresContext* aPresContext,
// scroll, and thus avoid the resulting incremental reflow bugs.
cbOffset = containingBlock->GetOffsetTo(cbrs->frame);
}
nscoord cbrsWidth = cbrs->ComputedWidth() +
cbrs->ComputedLogicalBorderPadding().LeftRight(cbwm);
LogicalPoint logCBOffs(wm, cbOffset, cbrsWidth - containerWidth);
nsSize cbrsSize =
cbrs->ComputedPhysicalSize() +
cbrs->ComputedLogicalBorderPadding().Size(cbwm).GetPhysicalSize(cbwm);
LogicalPoint logCBOffs(wm, cbOffset, cbrsSize - containerSize);
aHypotheticalBox.mIStart += logCBOffs.I(wm);
aHypotheticalBox.mIEnd += logCBOffs.I(wm);
aHypotheticalBox.mBStart += logCBOffs.B(wm);

View File

@ -436,6 +436,11 @@ struct nsHTMLReflowState : public nsCSSOffsetState {
GetWritingMode());
}
nsSize
ComputedPhysicalSize() const {
return nsSize(ComputedWidth(), ComputedHeight());
}
// XXX this will need to change when we make mComputedOffsets logical;
// we won't be able to return a reference for the physical offsets
const nsMargin& ComputedPhysicalOffsets() const { return mComputedOffsets; }
@ -850,27 +855,27 @@ public:
mozilla::WritingMode aWritingMode,
const mozilla::LogicalMargin& aComputedOffsets,
mozilla::LogicalPoint* aPosition,
nscoord aContainerWidth) {
// Subtract the width of the frame from the container width that we
const nsSize& aContainerSize) {
// Subtract the size of the frame from the container size that we
// use for converting between the logical and physical origins of
// the frame. This accounts for the fact that logical origins in RTL
// coordinate systems are at the top right of the frame instead of
// the top left.
nscoord frameWidth = aFrame->GetSize().width;
nsSize frameSize = aFrame->GetSize();
nsPoint pos = aPosition->GetPhysicalPoint(aWritingMode,
aContainerWidth - frameWidth);
aContainerSize - frameSize);
ApplyRelativePositioning(aFrame,
aComputedOffsets.GetPhysicalMargin(aWritingMode),
&pos);
*aPosition = mozilla::LogicalPoint(aWritingMode, pos,
aContainerWidth - frameWidth);
aContainerSize - frameSize);
}
void ApplyRelativePositioning(mozilla::LogicalPoint* aPosition,
nscoord aContainerWidth) const {
const nsSize& aContainerSize) const {
ApplyRelativePositioning(frame, mWritingMode,
ComputedLogicalOffsets(), aPosition,
aContainerWidth);
aContainerSize);
}
#ifdef DEBUG

View File

@ -659,39 +659,39 @@ public:
* Dimensions and position in logical coordinates in the frame's writing mode
* or another writing mode
*/
mozilla::LogicalRect GetLogicalRect(nscoord aContainerWidth) const {
return GetLogicalRect(GetWritingMode(), aContainerWidth);
mozilla::LogicalRect GetLogicalRect(const nsSize& aContainerSize) const {
return GetLogicalRect(GetWritingMode(), aContainerSize);
}
mozilla::LogicalPoint GetLogicalPosition(nscoord aContainerWidth) const {
return GetLogicalPosition(GetWritingMode(), aContainerWidth);
mozilla::LogicalPoint GetLogicalPosition(const nsSize& aContainerSize) const {
return GetLogicalPosition(GetWritingMode(), aContainerSize);
}
mozilla::LogicalSize GetLogicalSize() const {
return GetLogicalSize(GetWritingMode());
}
mozilla::LogicalRect GetLogicalRect(mozilla::WritingMode aWritingMode,
nscoord aContainerWidth) const {
return mozilla::LogicalRect(aWritingMode, GetRect(), aContainerWidth);
const nsSize& aContainerSize) const {
return mozilla::LogicalRect(aWritingMode, GetRect(), aContainerSize);
}
mozilla::LogicalPoint GetLogicalPosition(mozilla::WritingMode aWritingMode,
nscoord aContainerWidth) const {
return GetLogicalRect(aWritingMode, aContainerWidth).Origin(aWritingMode);
const nsSize& aContainerSize) const {
return GetLogicalRect(aWritingMode, aContainerSize).Origin(aWritingMode);
}
mozilla::LogicalSize GetLogicalSize(mozilla::WritingMode aWritingMode) const {
return mozilla::LogicalSize(aWritingMode, GetSize());
}
nscoord IStart(nscoord aContainerWidth) const {
return IStart(GetWritingMode(), aContainerWidth);
nscoord IStart(const nsSize& aContainerSize) const {
return IStart(GetWritingMode(), aContainerSize);
}
nscoord IStart(mozilla::WritingMode aWritingMode,
nscoord aContainerWidth) const {
return GetLogicalPosition(aWritingMode, aContainerWidth).I(aWritingMode);
const nsSize& aContainerSize) const {
return GetLogicalPosition(aWritingMode, aContainerSize).I(aWritingMode);
}
nscoord BStart(nscoord aContainerWidth) const {
return BStart(GetWritingMode(), aContainerWidth);
nscoord BStart(const nsSize& aContainerSize) const {
return BStart(GetWritingMode(), aContainerSize);
}
nscoord BStart(mozilla::WritingMode aWritingMode,
nscoord aContainerWidth) const {
return GetLogicalPosition(aWritingMode, aContainerWidth).B(aWritingMode);
const nsSize& aContainerSize) const {
return GetLogicalPosition(aWritingMode, aContainerSize).B(aWritingMode);
}
nscoord ISize() const { return ISize(GetWritingMode()); }
nscoord ISize(mozilla::WritingMode aWritingMode) const {
@ -721,8 +721,9 @@ public:
/**
* Set this frame's rect from a logical rect in its own writing direction
*/
void SetRect(const mozilla::LogicalRect& aRect, nscoord aContainerWidth) {
SetRect(GetWritingMode(), aRect, aContainerWidth);
void SetRect(const mozilla::LogicalRect& aRect,
const nsSize& aContainerSize) {
SetRect(GetWritingMode(), aRect, aContainerSize);
}
/**
* Set this frame's rect from a logical rect in a different writing direction
@ -730,8 +731,8 @@ public:
*/
void SetRect(mozilla::WritingMode aWritingMode,
const mozilla::LogicalRect& aRect,
nscoord aContainerWidth) {
SetRect(aRect.GetPhysicalRect(aWritingMode, aContainerWidth));
const nsSize& aContainerSize) {
SetRect(aRect.GetPhysicalRect(aWritingMode, aContainerSize));
}
/**
@ -771,12 +772,12 @@ public:
void SetPosition(const nsPoint& aPt) { mRect.MoveTo(aPt); }
void SetPosition(mozilla::WritingMode aWritingMode,
const mozilla::LogicalPoint& aPt,
nscoord aContainerWidth) {
// We subtract mRect.width from the container width to account for
const nsSize& aContainerSize) {
// We subtract mRect.Size() from the container size to account for
// the fact that logical origins in RTL coordinate systems are at
// the top right of the frame instead of the top left.
mRect.MoveTo(aPt.GetPhysicalPoint(aWritingMode,
aContainerWidth - mRect.width));
aContainerSize - mRect.Size()));
}
/**
@ -798,7 +799,12 @@ public:
void MovePositionBy(mozilla::WritingMode aWritingMode,
const mozilla::LogicalPoint& aTranslation)
{
MovePositionBy(aTranslation.GetPhysicalPoint(aWritingMode, 0));
// The LogicalPoint represents a vector rather than a point within a
// rectangular coordinate space, so we use a null containerSize when
// converting logical to physical.
const nsSize nullContainerSize;
MovePositionBy(aTranslation.GetPhysicalPoint(aWritingMode,
nullContainerSize));
}
/**
@ -812,14 +818,14 @@ public:
nsPoint GetNormalPosition() const;
mozilla::LogicalPoint
GetLogicalNormalPosition(mozilla::WritingMode aWritingMode,
nscoord aContainerWidth) const
const nsSize& aContainerSize) const
{
// Subtract the width of this frame from the container width to get
// Subtract the size of this frame from the container size to get
// the correct position in rtl frames where the origin is on the
// right instead of the left
return mozilla::LogicalPoint(aWritingMode,
GetNormalPosition(),
aContainerWidth - mRect.width);
aContainerSize - mRect.Size());
}
virtual nsPoint GetPositionOfChildIgnoringScrolling(nsIFrame* aChild)

View File

@ -32,7 +32,7 @@ using namespace mozilla;
nsLineBox::nsLineBox(nsIFrame* aFrame, int32_t aCount, bool aIsBlock)
: mFirstChild(aFrame)
, mContainerWidth(-1)
, mContainerSize(-1, -1)
, mBounds(WritingMode()) // mBounds will be initialized with the correct
// writing mode when it is set
// NOTE: memory is already zeroed since we allocate with AllocateByObjectID.
@ -80,7 +80,7 @@ NS_NewLineBox(nsIPresShell* aPresShell, nsLineBox* aFromLine,
{
nsLineBox* newLine = new (aPresShell) nsLineBox(aFrame, aCount, false);
newLine->NoteFramesMovedFrom(aFromLine);
newLine->mContainerWidth = aFromLine->mContainerWidth;
newLine->mContainerSize = aFromLine->mContainerSize;
return newLine;
}
@ -249,13 +249,13 @@ nsLineBox::List(FILE* out, const char* aPrefix, uint32_t aFlags) const
str += nsPrintfCString("{%d,%d,%d,%d} ",
bounds.x, bounds.y, bounds.width, bounds.height);
if (mWritingMode.IsVertical() || !mWritingMode.IsBidiLTR()) {
str += nsPrintfCString("{%s-%s: %d,%d,%d,%d; cw=%d} ",
str += nsPrintfCString("{%s-%s: %d,%d,%d,%d; cs=%d,%d} ",
mWritingMode.IsVertical()
? mWritingMode.IsVerticalLR() ? "vlr" : "vrl"
: "htb",
mWritingMode.IsBidiLTR() ? "ltr" : "rtl",
IStart(), BStart(), ISize(), BSize(),
mContainerWidth);
mContainerSize.width, mContainerSize.height);
}
if (mData &&
(!mData->mOverflowAreas.VisualOverflow().IsEqualEdges(bounds) ||
@ -737,13 +737,13 @@ nsLineIterator::FindFrameAt(int32_t aLineNumber,
nsIFrame* closestFromEnd = nullptr;
WritingMode wm = line->mWritingMode;
nscoord cw = line->mContainerWidth;
nsSize containerSize = line->mContainerSize;
LogicalPoint pos(wm, aPos, cw);
LogicalPoint pos(wm, aPos, containerSize);
int32_t n = line->GetChildCount();
while (n--) {
LogicalRect rect = frame->GetLogicalRect(wm, cw);
LogicalRect rect = frame->GetLogicalRect(wm, containerSize);
if (rect.ISize(wm) > 0) {
// If pos.I() is inside this frame - this is it
if (rect.IStart(wm) <= pos.I(wm) && rect.IEnd(wm) > pos.I(wm)) {
@ -752,12 +752,14 @@ nsLineIterator::FindFrameAt(int32_t aLineNumber,
}
if (rect.IStart(wm) < pos.I(wm)) {
if (!closestFromStart ||
rect.IEnd(wm) > closestFromStart->GetLogicalRect(wm, cw).IEnd(wm))
rect.IEnd(wm) > closestFromStart->
GetLogicalRect(wm, containerSize).IEnd(wm))
closestFromStart = frame;
}
else {
if (!closestFromEnd ||
rect.IStart(wm) < closestFromEnd->GetLogicalRect(wm, cw).IStart(wm))
rect.IStart(wm) < closestFromEnd->
GetLogicalRect(wm, containerSize).IStart(wm))
closestFromEnd = frame;
}
}
@ -779,12 +781,15 @@ nsLineIterator::FindFrameAt(int32_t aLineNumber,
*aFrameFound = closestFromStart;
}
else { // we're between two frames
nscoord delta = closestFromEnd->GetLogicalRect(wm, cw).IStart(wm) -
closestFromStart->GetLogicalRect(wm, cw).IEnd(wm);
if (pos.I(wm) < closestFromStart->GetLogicalRect(wm, cw).IEnd(wm) + delta/2)
nscoord delta =
closestFromEnd->GetLogicalRect(wm, containerSize).IStart(wm) -
closestFromStart->GetLogicalRect(wm, containerSize).IEnd(wm);
if (pos.I(wm) < closestFromStart->
GetLogicalRect(wm, containerSize).IEnd(wm) + delta/2) {
*aFrameFound = closestFromStart;
else
} else {
*aFrameFound = closestFromEnd;
}
}
return NS_OK;
}

View File

@ -448,9 +448,9 @@ public:
void SetOverflowAreas(const nsOverflowAreas& aOverflowAreas);
mozilla::LogicalRect GetOverflowArea(nsOverflowType aType,
mozilla::WritingMode aWM,
nscoord aContainerWidth)
const nsSize& aContainerSize)
{
return mozilla::LogicalRect(aWM, GetOverflowArea(aType), aContainerWidth);
return mozilla::LogicalRect(aWM, GetOverflowArea(aType), aContainerSize);
}
nsRect GetOverflowArea(nsOverflowType aType) {
return mData ? mData->mOverflowAreas.Overflow(aType) : GetPhysicalBounds();
@ -467,33 +467,36 @@ public:
nsRect GetScrollableOverflowArea()
{ return GetOverflowArea(eScrollableOverflow); }
void SlideBy(nscoord aDBCoord, nscoord aContainerWidth) {
NS_ASSERTION(aContainerWidth == mContainerWidth || mContainerWidth == -1,
"container width doesn't match");
mContainerWidth = aContainerWidth;
void SlideBy(nscoord aDBCoord, const nsSize& aContainerSize) {
NS_ASSERTION(aContainerSize == mContainerSize ||
mContainerSize == nsSize(-1, -1),
"container size doesn't match");
mContainerSize = aContainerSize;
mBounds.BStart(mWritingMode) += aDBCoord;
if (mData) {
nsPoint physicalDelta = mozilla::LogicalPoint(mWritingMode, 0, aDBCoord).
GetPhysicalPoint(mWritingMode, 0);
// Use a null containerSize to convert vector from logical to physical.
const nsSize nullContainerSize;
nsPoint physicalDelta =
mozilla::LogicalPoint(mWritingMode, 0, aDBCoord).
GetPhysicalPoint(mWritingMode, nullContainerSize);
NS_FOR_FRAME_OVERFLOW_TYPES(otype) {
mData->mOverflowAreas.Overflow(otype) += physicalDelta;
}
}
}
// Container-width for the line is changing (and therefore if writing mode
// Container-size for the line is changing (and therefore if writing mode
// was vertical-rl, the line will move physically; this is like SlideBy,
// but it is the container width instead of the line's own logical coord
// but it is the container size instead of the line's own logical coord
// that is changing.
nscoord UpdateContainerWidth(nscoord aNewContainerWidth)
nsSize UpdateContainerSize(const nsSize aNewContainerSize)
{
NS_ASSERTION(mContainerWidth != -1, "container width not set");
nscoord delta = mContainerWidth - aNewContainerWidth;
mContainerWidth = aNewContainerWidth;
NS_ASSERTION(mContainerSize != nsSize(-1, -1), "container size not set");
nsSize delta = mContainerSize - aNewContainerSize;
mContainerSize = aNewContainerSize;
// this has a physical-coordinate effect only in vertical-rl mode
if (mWritingMode.IsVerticalRL() && mData) {
nsPoint physicalDelta = mozilla::LogicalPoint(mWritingMode, 0, delta).
GetPhysicalPoint(mWritingMode, 0);
nsPoint physicalDelta(-delta.width, 0);
NS_FOR_FRAME_OVERFLOW_TYPES(otype) {
mData->mOverflowAreas.Overflow(otype) += physicalDelta;
}
@ -501,17 +504,19 @@ public:
return delta;
}
void IndentBy(nscoord aDICoord, nscoord aContainerWidth) {
NS_ASSERTION(aContainerWidth == mContainerWidth || mContainerWidth == -1,
"container width doesn't match");
mContainerWidth = aContainerWidth;
void IndentBy(nscoord aDICoord, const nsSize& aContainerSize) {
NS_ASSERTION(aContainerSize == mContainerSize ||
mContainerSize == nsSize(-1, -1),
"container size doesn't match");
mContainerSize = aContainerSize;
mBounds.IStart(mWritingMode) += aDICoord;
}
void ExpandBy(nscoord aDISize, nscoord aContainerWidth) {
NS_ASSERTION(aContainerWidth == mContainerWidth || mContainerWidth == -1,
"container width doesn't match");
mContainerWidth = aContainerWidth;
void ExpandBy(nscoord aDISize, const nsSize& aContainerSize) {
NS_ASSERTION(aContainerSize == mContainerSize ||
mContainerSize == nsSize(-1, -1),
"container size doesn't match");
mContainerSize = aContainerSize;
mBounds.ISize(mWritingMode) += aDISize;
}
@ -608,8 +613,8 @@ public:
mozilla::WritingMode mWritingMode;
// Physical width. Use only for physical <-> logical coordinate conversion.
nscoord mContainerWidth;
// Physical size. Use only for physical <-> logical coordinate conversion.
nsSize mContainerSize;
private:
mozilla::LogicalRect mBounds;
@ -622,25 +627,26 @@ public:
return nsRect(0, 0, 0, 0);
}
NS_ASSERTION(mContainerWidth != -1, "mContainerWidth not initialized");
return mBounds.GetPhysicalRect(mWritingMode, mContainerWidth);
NS_ASSERTION(mContainerSize != nsSize(-1, -1),
"mContainerSize not initialized");
return mBounds.GetPhysicalRect(mWritingMode, mContainerSize);
}
void SetBounds(mozilla::WritingMode aWritingMode,
nscoord aIStart, nscoord aBStart,
nscoord aISize, nscoord aBSize,
nscoord aContainerWidth)
const nsSize& aContainerSize)
{
mWritingMode = aWritingMode;
mContainerWidth = aContainerWidth;
mContainerSize = aContainerSize;
mBounds = mozilla::LogicalRect(aWritingMode, aIStart, aBStart,
aISize, aBSize);
}
void SetBounds(mozilla::WritingMode aWritingMode,
nsRect aRect, nscoord aContainerWidth)
nsRect aRect, const nsSize& aContainerSize)
{
mWritingMode = aWritingMode;
mContainerWidth = aContainerWidth;
mBounds = mozilla::LogicalRect(aWritingMode, aRect, aContainerWidth);
mContainerSize = aContainerSize;
mBounds = mozilla::LogicalRect(aWritingMode, aRect, aContainerSize);
}
// mFlags.mHasHashedFrames says which one to use

View File

@ -316,7 +316,7 @@ nsLineLayout::UpdateBand(WritingMode aWM,
// need to convert to our writing mode, because we might have a different
// mode from the caller due to dir: auto
LogicalRect availSpace = aNewAvailSpace.ConvertTo(lineWM, aWM,
ContainerWidth());
ContainerSize());
#ifdef REALLY_NOISY_REFLOW
printf("nsLL::UpdateBand %d, %d, %d, %d, (converted to %d, %d, %d, %d); frame=%p\n will set mImpacted to true\n",
aNewAvailSpace.x, aNewAvailSpace.y,
@ -942,7 +942,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
metrics.ISize(lineWM) = nscoord(0xdeadbeef);
metrics.BSize(lineWM) = nscoord(0xdeadbeef);
#endif
nscoord tI = pfd->mBounds.LineLeft(lineWM, ContainerWidth());
nscoord tI = pfd->mBounds.LineLeft(lineWM, ContainerSize());
nscoord tB = pfd->mBounds.BStart(lineWM);
mFloatManager->Translate(tI, tB);
@ -1071,7 +1071,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
pfd->mBounds.BSize(lineWM) = metrics.BSize(lineWM);
// Size the frame, but |RelativePositionFrames| will size the view.
aFrame->SetRect(lineWM, pfd->mBounds, ContainerWidthForSpan(psd));
aFrame->SetRect(lineWM, pfd->mBounds, ContainerSizeForSpan(psd));
// Tell the frame that we're done reflowing it
aFrame->DidReflow(mPresContext,
@ -1250,13 +1250,16 @@ nsLineLayout::SyncAnnotationBounds(PerFrameData* aRubyFrame)
for (PerFrameData* rtc = pfd->mNextAnnotation;
rtc; rtc = rtc->mNextAnnotation) {
// When the annotation container is reflowed, the width of the
// ruby container is unknown, hence zero should be used here
// as container width to get the correct logical rect.
LogicalRect rtcBounds(lineWM, rtc->mFrame->GetRect(), 0);
// ruby container is unknown so we use a dummy container size;
// in the case of RTL block direction, the final position will be
// fixed up later.
const nsSize dummyContainerSize;
LogicalRect rtcBounds(lineWM, rtc->mFrame->GetRect(),
dummyContainerSize);
rtc->mBounds = rtcBounds;
nscoord rtcWidth = rtcBounds.Width(lineWM);
nsSize rtcSize = rtcBounds.Size(lineWM).GetPhysicalSize(lineWM);
for (PerFrameData* rt = rtc->mSpan->mFirstFrame; rt; rt = rt->mNext) {
LogicalRect rtBounds = rt->mFrame->GetLogicalRect(lineWM, rtcWidth);
LogicalRect rtBounds = rt->mFrame->GetLogicalRect(lineWM, rtcSize);
MOZ_ASSERT(rt->mBounds.Size(lineWM) == rtBounds.Size(lineWM),
"Size of the annotation should not have been changed");
rt->mBounds.SetOrigin(lineWM, rtBounds.Origin(lineWM));
@ -1498,7 +1501,7 @@ nsLineLayout::AddBulletFrame(nsIFrame* aFrame,
}
// Note: block-coord value will be updated during block-direction alignment
pfd->mBounds = LogicalRect(lineWM, aFrame->GetRect(), ContainerWidth());
pfd->mBounds = LogicalRect(lineWM, aFrame->GetRect(), ContainerSize());
pfd->mOverflowAreas = aMetrics.mOverflowAreas;
}
@ -1514,7 +1517,7 @@ nsLineLayout::DumpPerSpanData(PerSpanData* psd, int32_t aIndent)
nsFrame::IndentBy(stdout, aIndent+1);
nsFrame::ListTag(stdout, pfd->mFrame);
nsRect rect = pfd->mBounds.GetPhysicalRect(psd->mWritingMode,
ContainerWidth());
ContainerSize());
printf(" %d,%d,%d,%d\n", rect.x, rect.y, rect.width, rect.height);
if (pfd->mSpan) {
DumpPerSpanData(pfd->mSpan, aIndent + 1);
@ -1603,7 +1606,7 @@ nsLineLayout::VerticalAlignLine()
for (PerFrameData* pfd = psd->mFirstFrame; pfd; pfd = pfd->mNext) {
if (pfd->mBlockDirAlign == VALIGN_OTHER) {
pfd->mBounds.BStart(lineWM) += baselineBCoord;
pfd->mFrame->SetRect(lineWM, pfd->mBounds, ContainerWidth());
pfd->mFrame->SetRect(lineWM, pfd->mBounds, ContainerSize());
}
}
PlaceTopBottomFrames(psd, -mBStartEdge, lineBSize);
@ -1614,7 +1617,7 @@ nsLineLayout::VerticalAlignLine()
mLineBox->SetBounds(lineWM,
psd->mIStart, mBStartEdge,
psd->mICoord - psd->mIStart, lineBSize,
ContainerWidth());
ContainerSize());
mLineBox->SetLogicalAscent(baselineBCoord - mBStartEdge);
#ifdef NOISY_BLOCKDIR_ALIGN
@ -1639,7 +1642,7 @@ nsLineLayout::PlaceTopBottomFrames(PerSpanData* psd,
NS_ASSERTION(0xFF != pfd->mBlockDirAlign, "umr");
#endif
WritingMode lineWM = mRootSpan->mWritingMode;
nscoord containerWidth = ContainerWidthForSpan(psd);
nsSize containerSize = ContainerSizeForSpan(psd);
switch (pfd->mBlockDirAlign) {
case VALIGN_TOP:
if (span) {
@ -1649,7 +1652,7 @@ nsLineLayout::PlaceTopBottomFrames(PerSpanData* psd,
pfd->mBounds.BStart(lineWM) =
-aDistanceFromStart + pfd->mMargin.BStart(lineWM);
}
pfd->mFrame->SetRect(lineWM, pfd->mBounds, containerWidth);
pfd->mFrame->SetRect(lineWM, pfd->mBounds, containerSize);
#ifdef NOISY_BLOCKDIR_ALIGN
printf(" ");
nsFrame::ListTag(stdout, pfd->mFrame);
@ -1669,7 +1672,7 @@ nsLineLayout::PlaceTopBottomFrames(PerSpanData* psd,
pfd->mBounds.BStart(lineWM) = -aDistanceFromStart + aLineBSize -
pfd->mMargin.BEnd(lineWM) - pfd->mBounds.BSize(lineWM);
}
pfd->mFrame->SetRect(lineWM, pfd->mBounds, containerWidth);
pfd->mFrame->SetRect(lineWM, pfd->mBounds, containerSize);
#ifdef NOISY_BLOCKDIR_ALIGN
printf(" ");
nsFrame::ListTag(stdout, pfd->mFrame);
@ -2247,7 +2250,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
#endif
}
if (psd != mRootSpan) {
frame->SetRect(lineWM, pfd->mBounds, ContainerWidthForSpan(psd));
frame->SetRect(lineWM, pfd->mBounds, ContainerSizeForSpan(psd));
}
}
pfd = pfd->mNext;
@ -2410,7 +2413,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
while (nullptr != pfd) {
pfd->mBounds.BStart(lineWM) -= minBCoord; // move all the children
// back up
pfd->mFrame->SetRect(lineWM, pfd->mBounds, ContainerWidthForSpan(psd));
pfd->mFrame->SetRect(lineWM, pfd->mBounds, ContainerSizeForSpan(psd));
pfd = pfd->mNext;
}
maxBCoord -= minBCoord; // since minBCoord is in the frame's own
@ -2488,11 +2491,11 @@ nsLineLayout::TrimTrailingWhiteSpaceIn(PerSpanData* psd,
// that are direct children of the block will be updated
// later, however, because the VerticalAlignFrames method
// will be run after this method.
nscoord containerWidth = ContainerWidthForSpan(childSpan);
nsSize containerSize = ContainerSizeForSpan(childSpan);
nsIFrame* f = pfd->mFrame;
LogicalRect r(lineWM, f->GetRect(), containerWidth);
LogicalRect r(lineWM, f->GetRect(), containerSize);
r.ISize(lineWM) -= deltaISize;
f->SetRect(lineWM, r, containerWidth);
f->SetRect(lineWM, r, containerSize);
}
// Adjust the inline end edge of the span that contains the child span
@ -2556,7 +2559,7 @@ nsLineLayout::TrimTrailingWhiteSpaceIn(PerSpanData* psd,
// The frame was already placed during psd's
// reflow. Update the frames rectangle now.
pfd->mFrame->SetRect(lineWM, pfd->mBounds,
ContainerWidthForSpan(psd));
ContainerSizeForSpan(psd));
}
// Adjust containing span's right edge
@ -2772,7 +2775,7 @@ nsLineLayout::ComputeFrameJustification(PerSpanData* aPSD,
void
nsLineLayout::AdvanceAnnotationInlineBounds(PerFrameData* aPFD,
nscoord aContainerWidth,
const nsSize& aContainerSize,
nscoord aDeltaICoord,
nscoord aDeltaISize)
{
@ -2810,7 +2813,7 @@ nsLineLayout::AdvanceAnnotationInlineBounds(PerFrameData* aPFD,
// themselves properly. We only need to expand its own size here.
aPFD->mBounds.ISize(lineWM) += aDeltaISize;
}
aPFD->mFrame->SetRect(lineWM, aPFD->mBounds, aContainerWidth);
aPFD->mFrame->SetRect(lineWM, aPFD->mBounds, aContainerSize);
}
/**
@ -2824,8 +2827,8 @@ nsLineLayout::ApplyLineJustificationToAnnotations(PerFrameData* aPFD,
{
PerFrameData* pfd = aPFD->mNextAnnotation;
while (pfd) {
nscoord containerWidth = pfd->mFrame->GetParent()->GetRect().Width();
AdvanceAnnotationInlineBounds(pfd, containerWidth,
nsSize containerSize = pfd->mFrame->GetParent()->GetSize();
AdvanceAnnotationInlineBounds(pfd, containerSize,
aDeltaICoord, aDeltaISize);
// There are two cases where an annotation frame has siblings which
@ -2837,7 +2840,7 @@ nsLineLayout::ApplyLineJustificationToAnnotations(PerFrameData* aPFD,
// need to move them so that they won't overlap other frames.
PerFrameData* sibling = pfd->mNext;
while (sibling && !sibling->mIsLinkedToBase) {
AdvanceAnnotationInlineBounds(sibling, containerWidth,
AdvanceAnnotationInlineBounds(sibling, containerSize,
aDeltaICoord + aDeltaISize, 0);
sibling = sibling->mNext;
}
@ -2895,7 +2898,7 @@ nsLineLayout::ApplyFrameJustification(PerSpanData* aPSD,
// excluded from the isize added to the annotation.
ApplyLineJustificationToAnnotations(pfd, deltaICoord, dw - gapsAtEnd);
deltaICoord += dw;
pfd->mFrame->SetRect(lineWM, pfd->mBounds, ContainerWidthForSpan(aPSD));
pfd->mFrame->SetRect(lineWM, pfd->mBounds, ContainerSizeForSpan(aPSD));
}
}
return deltaICoord;
@ -2920,7 +2923,7 @@ FindNearestRubyBaseAncestor(nsIFrame* aFrame)
*/
void
nsLineLayout::ExpandRubyBox(PerFrameData* aFrame, nscoord aReservedISize,
nscoord aContainerWidth)
const nsSize& aContainerSize)
{
WritingMode lineWM = mRootSpan->mWritingMode;
auto rubyAlign = aFrame->mFrame->StyleText()->mRubyAlign;
@ -2952,7 +2955,7 @@ nsLineLayout::ExpandRubyBox(PerFrameData* aFrame, nscoord aReservedISize,
for (PerFrameData* child = aFrame->mSpan->mFirstFrame;
child; child = child->mNext) {
child->mBounds.IStart(lineWM) += aReservedISize / 2;
child->mFrame->SetRect(lineWM, child->mBounds, aContainerWidth);
child->mFrame->SetRect(lineWM, child->mBounds, aContainerSize);
}
break;
default:
@ -2960,7 +2963,7 @@ nsLineLayout::ExpandRubyBox(PerFrameData* aFrame, nscoord aReservedISize,
}
aFrame->mBounds.ISize(lineWM) += aReservedISize;
aFrame->mFrame->SetRect(lineWM, aFrame->mBounds, aContainerWidth);
aFrame->mFrame->SetRect(lineWM, aFrame->mBounds, aContainerSize);
}
/**
@ -2970,11 +2973,11 @@ nsLineLayout::ExpandRubyBox(PerFrameData* aFrame, nscoord aReservedISize,
*/
void
nsLineLayout::ExpandRubyBoxWithAnnotations(PerFrameData* aFrame,
nscoord aContainerWidth)
const nsSize& aContainerSize)
{
nscoord reservedISize = RubyUtils::GetReservedISize(aFrame->mFrame);
if (reservedISize) {
ExpandRubyBox(aFrame, reservedISize, aContainerWidth);
ExpandRubyBox(aFrame, reservedISize, aContainerSize);
}
WritingMode lineWM = mRootSpan->mWritingMode;
@ -2992,7 +2995,7 @@ nsLineLayout::ExpandRubyBoxWithAnnotations(PerFrameData* aFrame,
MOZ_ASSERT(
rtcFrame->GetLogicalSize(lineWM) == annotation->mBounds.Size(lineWM));
rtcFrame->SetPosition(lineWM, annotation->mBounds.Origin(lineWM),
aContainerWidth);
aContainerSize);
}
nscoord reservedISize = RubyUtils::GetReservedISize(annotation->mFrame);
@ -3012,13 +3015,13 @@ nsLineLayout::ExpandRubyBoxWithAnnotations(PerFrameData* aFrame,
computeState.mLastParticipant->mJustificationAssignment.mGapsAtEnd = 1;
}
nsIFrame* parentFrame = annotation->mFrame->GetParent();
nscoord containerWidth = parentFrame->GetRect().Width();
MOZ_ASSERT(containerWidth == aContainerWidth ||
nsSize containerSize = parentFrame->GetSize();
MOZ_ASSERT(containerSize == aContainerSize ||
parentFrame->GetType() == nsGkAtoms::rubyTextContainerFrame,
"Container width should only be different when the current "
"annotation is a ruby text frame, whose parent is not same "
"as its base frame.");
ExpandRubyBox(annotation, reservedISize, containerWidth);
ExpandRubyBox(annotation, reservedISize, containerSize);
ExpandInlineRubyBoxes(annotation->mSpan);
}
}
@ -3030,10 +3033,10 @@ nsLineLayout::ExpandRubyBoxWithAnnotations(PerFrameData* aFrame,
void
nsLineLayout::ExpandInlineRubyBoxes(PerSpanData* aSpan)
{
nscoord containerWidth = ContainerWidthForSpan(aSpan);
nsSize containerSize = ContainerSizeForSpan(aSpan);
for (PerFrameData* pfd = aSpan->mFirstFrame; pfd; pfd = pfd->mNext) {
if (RubyUtils::IsExpandableRubyBox(pfd->mFrame)) {
ExpandRubyBoxWithAnnotations(pfd, containerWidth);
ExpandRubyBoxWithAnnotations(pfd, containerSize);
}
if (pfd->mSpan) {
ExpandInlineRubyBoxes(pfd->mSpan);
@ -3127,7 +3130,7 @@ nsLineLayout::TextAlignLine(nsLineBox* aLine,
// Apply the justification, and make sure to update our linebox
// width to account for it.
aLine->ExpandBy(ApplyFrameJustification(psd, applyState),
ContainerWidthForSpan(psd));
ContainerSizeForSpan(psd));
MOZ_ASSERT(applyState.mGaps.mHandled == applyState.mGaps.mCount,
"Unprocessed justification gaps");
@ -3179,14 +3182,14 @@ nsLineLayout::TextAlignLine(nsLineBox* aLine,
lineWM, mContainerSize,
psd->mIStart + mTextIndent + dx);
if (dx) {
aLine->IndentBy(dx, ContainerWidth());
aLine->IndentBy(dx, ContainerSize());
}
} else if (dx) {
for (PerFrameData* pfd = psd->mFirstFrame; pfd; pfd = pfd->mNext) {
pfd->mBounds.IStart(lineWM) += dx;
pfd->mFrame->SetRect(lineWM, pfd->mBounds, ContainerWidthForSpan(psd));
pfd->mFrame->SetRect(lineWM, pfd->mBounds, ContainerSizeForSpan(psd));
}
aLine->IndentBy(dx, ContainerWidth());
aLine->IndentBy(dx, ContainerSize());
}
}
@ -3200,13 +3203,13 @@ nsLineLayout::ApplyRelativePositioning(PerFrameData* aPFD)
nsIFrame* frame = aPFD->mFrame;
WritingMode frameWM = frame->GetWritingMode();
LogicalPoint origin = frame->GetLogicalPosition(ContainerWidth());
LogicalPoint origin = frame->GetLogicalPosition(ContainerSize());
// right and bottom are handled by
// nsHTMLReflowState::ComputeRelativeOffsets
nsHTMLReflowState::ApplyRelativePositioning(frame, frameWM,
aPFD->mOffsets, &origin,
ContainerWidth());
frame->SetPosition(frameWM, origin, ContainerWidth());
ContainerSize());
frame->SetPosition(frameWM, origin, ContainerSize());
}
// This method do relative positioning for ruby annotations.
@ -3259,7 +3262,7 @@ nsLineLayout::RelativePositionFrames(PerSpanData* psd, nsOverflowAreas& aOverflo
// children of the block starts at the upper left corner of the
// line and is sized to match the size of the line's bounding box
// (the same size as the values returned from VerticalAlignFrames)
overflowAreas.VisualOverflow() = rect.GetPhysicalRect(wm, ContainerWidth());
overflowAreas.VisualOverflow() = rect.GetPhysicalRect(wm, ContainerSize());
overflowAreas.ScrollableOverflow() = overflowAreas.VisualOverflow();
}

View File

@ -544,14 +544,15 @@ protected:
PerSpanData* mRootSpan;
PerSpanData* mCurrentSpan;
// The container width to use when converting between logical and
// The container size to use when converting between logical and
// physical coordinates for frames in this span. For the root span
// this is the width of the block cached in mContainerSize.width; for
// child spans it's the width of the root span
nscoord ContainerWidthForSpan(PerSpanData* aPSD) {
// this is the size of the block cached in mContainerSize; for
// child spans it's the size of the root span.
nsSize ContainerSizeForSpan(PerSpanData* aPSD) {
return (aPSD == mRootSpan)
? ContainerWidth()
: aPSD->mFrame->mBounds.Width(mRootSpan->mWritingMode);
? mContainerSize
: aPSD->mFrame->mBounds.Size(mRootSpan->mWritingMode).
GetPhysicalSize(mRootSpan->mWritingMode);
}
gfxBreakPriority mLastOptionalBreakPriority;
@ -587,8 +588,7 @@ protected:
// Physical size. Use only for physical <-> logical coordinate conversion.
nsSize mContainerSize;
nscoord ContainerWidth() const { return mContainerSize.width; }
nscoord ContainerHeight() const { return mContainerSize.height; }
const nsSize& ContainerSize() const { return mContainerSize; }
bool mFirstLetterStyleOK : 1;
bool mIsTopOfPage : 1;
@ -686,7 +686,7 @@ protected:
JustificationComputationState& aState);
void AdvanceAnnotationInlineBounds(PerFrameData* aPFD,
nscoord aContainerWidth,
const nsSize& aContainerSize,
nscoord aDeltaICoord,
nscoord aDeltaISize);
@ -700,10 +700,10 @@ protected:
PerSpanData* aPSD, mozilla::JustificationApplicationState& aState);
void ExpandRubyBox(PerFrameData* aFrame, nscoord aReservedISize,
nscoord aContainerWidth);
const nsSize& aContainerSize);
void ExpandRubyBoxWithAnnotations(PerFrameData* aFrame,
nscoord aContainerWidth);
const nsSize& aContainerSize);
void ExpandInlineRubyBoxes(PerSpanData* aSpan);

View File

@ -253,7 +253,9 @@ nsRubyFrame::ReflowSegment(nsPresContext* aPresContext,
}
nscoord segmentISize = baseMetrics.ISize(lineWM);
LogicalRect baseRect = aBaseContainer->GetLogicalRect(lineWM, 0);
const nsSize dummyContainerSize;
LogicalRect baseRect =
aBaseContainer->GetLogicalRect(lineWM, dummyContainerSize);
// We need to position our rtc frames on one side or the other of the
// base container's rect, using a coordinate space that's relative to
// the ruby frame. Right now, the base container's rect's block-axis
@ -318,10 +320,11 @@ nsRubyFrame::ReflowSegment(nsPresContext* aPresContext,
MOZ_ASSERT_UNREACHABLE("???");
}
}
// Container width is set to zero here. We will fix it in
// nsLineLayout after the whole line get reflowed.
// Using a dummy container-size here, so child positioning may not be
// correct. We will fix it in nsLineLayout after the whole line is
// reflowed.
FinishReflowChild(textContainer, aPresContext, textMetrics,
&textReflowState, lineWM, position, 0, 0);
&textReflowState, lineWM, position, dummyContainerSize, 0);
}
MOZ_ASSERT(baseRect.ISize(lineWM) == offsetRect.ISize(lineWM),
"Annotations should only be placed on the block directions");

View File

@ -135,11 +135,14 @@ nsRubyTextContainerFrame::Reflow(nsPresContext* aPresContext,
nscoord minBCoord = nscoord_MAX;
nscoord maxBCoord = nscoord_MIN;
// The container size is not yet known, so we use a dummy (0, 0) size.
// The block-dir position will be corrected below after containerSize
// is finalized.
const nsSize dummyContainerSize;
for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) {
nsIFrame* child = e.get();
MOZ_ASSERT(child->GetType() == nsGkAtoms::rubyTextFrame);
// The container width is still unknown yet.
LogicalRect rect = child->GetLogicalRect(lineWM, 0);
LogicalRect rect = child->GetLogicalRect(lineWM, dummyContainerSize);
LogicalMargin margin = child->GetLogicalUsedMargin(lineWM);
nscoord blockStart = rect.BStart(lineWM) - margin.BStart(lineWM);
minBCoord = std::min(minBCoord, blockStart);
@ -155,18 +158,18 @@ nsRubyTextContainerFrame::Reflow(nsPresContext* aPresContext,
minBCoord = maxBCoord = 0;
}
size.BSize(lineWM) = maxBCoord - minBCoord;
nscoord containerWidth = size.Width(lineWM);
nsSize containerSize = size.GetPhysicalSize(lineWM);
for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) {
nsIFrame* child = e.get();
// We reflowed the child with container width 0, as the true width
// We reflowed the child with a dummy container size, as the true size
// was not yet known at that time.
LogicalPoint pos = child->GetLogicalPosition(lineWM, 0);
LogicalPoint pos = child->GetLogicalPosition(lineWM, dummyContainerSize);
// Adjust block position to account for minBCoord,
// then reposition child based on the true container width.
pos.B(lineWM) -= minBCoord;
// Relative positioning hasn't happened yet.
// So MovePositionBy should not be used here.
child->SetPosition(lineWM, pos, containerWidth);
child->SetPosition(lineWM, pos, containerSize);
nsContainerFrame::PlaceFrameView(child);
}
}

View File

@ -820,10 +820,11 @@ nsMathMLmtableOuterFrame::Reflow(nsPresContext* aPresContext,
if (rowFrame) {
// translate the coordinates to be relative to us and in our writing mode
nsIFrame* frame = rowFrame;
LogicalRect frameRect(wm, frame->GetRect(), aReflowState.ComputedWidth());
blockSize = frameRect.BSize(wm);
LogicalRect rect(wm, frame->GetRect(),
aReflowState.ComputedSizeAsContainerIfConstrained());
blockSize = rect.BSize(wm);
do {
dy += frameRect.BStart(wm);
dy += rect.BStart(wm);
frame = frame->GetParent();
} while (frame != this);
}

View File

@ -596,10 +596,10 @@ void nsTableCellFrame::BlockDirAlignChild(WritingMode aWM, nscoord aMaxAscent)
nscoord bSize = BSize(aWM);
nsIFrame* firstKid = mFrames.FirstChild();
nscoord containerWidth = mRect.width;
nsSize containerSize = mRect.Size();
NS_ASSERTION(firstKid, "Frame construction error, a table cell always has "
"an inner cell frame");
LogicalRect kidRect = firstKid->GetLogicalRect(aWM, containerWidth);
LogicalRect kidRect = firstKid->GetLogicalRect(aWM, containerSize);
nscoord childBSize = kidRect.BSize(aWM);
// Vertically align the child
@ -636,7 +636,7 @@ void nsTableCellFrame::BlockDirAlignChild(WritingMode aWM, nscoord aMaxAscent)
}
firstKid->SetPosition(aWM, LogicalPoint(aWM, kidRect.IStart(aWM),
kidBStart), containerWidth);
kidBStart), containerSize);
nsHTMLReflowMetrics desiredSize(aWM);
desiredSize.SetSize(aWM, GetLogicalSize(aWM));
@ -944,8 +944,8 @@ nsTableCellFrame::Reflow(nsPresContext* aPresContext,
kidReflowState.SetBResize(true);
}
nscoord containerWidth =
aReflowState.ComputedSizeAsContainerIfConstrained().width;
nsSize containerSize =
aReflowState.ComputedSizeAsContainerIfConstrained();
LogicalPoint kidOrigin(wm, borderPadding.IStart(wm),
borderPadding.BStart(wm));
@ -954,7 +954,7 @@ nsTableCellFrame::Reflow(nsPresContext* aPresContext,
bool firstReflow = firstKid->HasAnyStateBits(NS_FRAME_FIRST_REFLOW);
ReflowChild(firstKid, aPresContext, kidSize, kidReflowState,
wm, kidOrigin, containerWidth, 0, aStatus);
wm, kidOrigin, containerSize, 0, aStatus);
if (NS_FRAME_OVERFLOW_IS_INCOMPLETE(aStatus)) {
// Don't pass OVERFLOW_INCOMPLETE through tables until they can actually handle it
//XXX should paginate overflow as overflow, but not in this patch (bug 379349)
@ -984,7 +984,7 @@ nsTableCellFrame::Reflow(nsPresContext* aPresContext,
// Place the child
FinishReflowChild(firstKid, aPresContext, kidSize, &kidReflowState,
wm, kidOrigin, containerWidth, 0);
wm, kidOrigin, containerSize, 0);
nsTableFrame::InvalidateTableFrame(firstKid, origRect, origVisualOverflow,
firstReflow);

View File

@ -1422,7 +1422,7 @@ nsTableFrame::GetLogicalSkipSides(const nsHTMLReflowState* aReflowState) const
void
nsTableFrame::SetColumnDimensions(nscoord aBSize, WritingMode aWM,
const LogicalMargin& aBorderPadding,
nscoord aContainerWidth)
const nsSize& aContainerSize)
{
const nscoord colBSize = aBSize - (aBorderPadding.BStartEnd(aWM) +
GetRowSpacing(-1) + GetRowSpacing(GetRowCount()));
@ -1454,8 +1454,8 @@ nsTableFrame::SetColumnDimensions(nscoord aBSize, WritingMode aWM,
LogicalRect colGroupRect(aWM, colGroupOrigin.I(aWM), colGroupOrigin.B(aWM),
colGroupISize, colBSize);
colGroupFrame->SetRect(aWM, colGroupRect, aContainerWidth);
nscoord colGroupWidth = colGroupFrame->GetSize().width;
colGroupFrame->SetRect(aWM, colGroupRect, aContainerSize);
nsSize colGroupSize = colGroupFrame->GetSize();
// then we can place the columns correctly within the group
colIdx = groupFirstCol;
@ -1466,7 +1466,7 @@ nsTableFrame::SetColumnDimensions(nscoord aBSize, WritingMode aWM,
nscoord colISize = fif->GetColumnISizeFromFirstInFlow(colIdx);
LogicalRect colRect(aWM, colOrigin.I(aWM), colOrigin.B(aWM),
colISize, colBSize);
colFrame->SetRect(aWM, colRect, colGroupWidth);
colFrame->SetRect(aWM, colRect, colGroupSize);
cellSpacingI = GetColSpacing(colIdx);
colOrigin.I(aWM) += colISize + cellSpacingI;
++colIdx;
@ -1879,8 +1879,8 @@ nsTableFrame::Reflow(nsPresContext* aPresContext,
ReflowTable(aDesiredSize, aReflowState, availBSize,
lastChildReflowed, aStatus);
// If ComputedWidth is unconstrained, we may need to fix child positions
// later (in vertical-rl mode) due to use of 0 as a fake containerWidth
// during ReflowChildren.
// later (in vertical-rl mode) due to use of 0 as a dummy
// containerSize.width during ReflowChildren.
fixupKidPositions = wm.IsVerticalRL() &&
aReflowState.ComputedWidth() == NS_UNCONSTRAINEDSIZE;
@ -1927,7 +1927,7 @@ nsTableFrame::Reflow(nsPresContext* aPresContext,
}
if (fixupKidPositions) {
// If we didn't already know the containerWidth (and so used zero during
// If we didn't already know the containerSize (and so used zero during
// ReflowChildren), then we need to update the block-position of our kids.
for (nsIFrame* kid : mFrames) {
kid->MovePositionBy(nsPoint(aDesiredSize.Width(), 0));
@ -1945,7 +1945,7 @@ nsTableFrame::Reflow(nsPresContext* aPresContext,
LogicalMargin borderPadding = GetChildAreaOffset(wm, &aReflowState);
SetColumnDimensions(aDesiredSize.BSize(wm), wm, borderPadding,
aDesiredSize.Width());
aDesiredSize.PhysicalSize());
if (NeedToCollapse() &&
(NS_UNCONSTRAINEDSIZE != aReflowState.AvailableISize())) {
AdjustForCollapsingRowsCols(aDesiredSize, wm, borderPadding);
@ -2897,8 +2897,8 @@ nsTableFrame::SetupHeaderFooterChild(const nsTableReflowState& aReflowState,
WritingMode wm = aFrame->GetWritingMode();
LogicalSize availSize = aReflowState.reflowState.AvailableSize(wm);
nscoord containerWidth = availSize.Width(wm);
// XXX check for containerWidth == NS_UNCONSTRAINEDSIZE
nsSize containerSize = availSize.GetPhysicalSize(wm);
// XXX check for containerSize.* == NS_UNCONSTRAINEDSIZE
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
nsHTMLReflowState kidReflowState(presContext, aReflowState.reflowState,
@ -2911,7 +2911,7 @@ nsTableFrame::SetupHeaderFooterChild(const nsTableReflowState& aReflowState,
nsReflowStatus status;
ReflowChild(aFrame, presContext, desiredSize, kidReflowState,
wm, LogicalPoint(wm, aReflowState.iCoord, aReflowState.bCoord),
containerWidth, 0, status);
containerSize, 0, status);
// The child will be reflowed again "for real" so no need to place it now
aFrame->SetRepeatable(IsRepeatable(desiredSize.Height(), pageHeight));
@ -2928,8 +2928,8 @@ nsTableFrame::PlaceRepeatedFooter(nsTableReflowState& aReflowState,
WritingMode wm = aTfoot->GetWritingMode();
LogicalSize kidAvailSize = aReflowState.availSize;
nscoord containerWidth = kidAvailSize.Width(wm);
// XXX check for containerWidth == NS_UNCONSTRAINEDSIZE
nsSize containerSize = kidAvailSize.GetPhysicalSize(wm);
// XXX check for containerSize.* == NS_UNCONSTRAINEDSIZE
kidAvailSize.BSize(wm) = aFooterHeight;
nsHTMLReflowState footerReflowState(presContext,
@ -2948,15 +2948,16 @@ nsTableFrame::PlaceRepeatedFooter(nsTableReflowState& aReflowState,
desiredSize.ClearSize();
LogicalPoint kidPosition(wm, aReflowState.iCoord, aReflowState.bCoord);
ReflowChild(aTfoot, presContext, desiredSize, footerReflowState,
wm, kidPosition, containerWidth, 0, footerStatus);
footerReflowState.ApplyRelativePositioning(&kidPosition, containerWidth);
wm, kidPosition, containerSize, 0, footerStatus);
footerReflowState.ApplyRelativePositioning(&kidPosition, containerSize);
PlaceChild(aReflowState, aTfoot,
// We subtract desiredSize.Width() from containerWidth here
// We subtract desiredSize.PhysicalSize() from containerSize here
// to account for the fact that in RTL modes, the origin is
// on the right-hand side so we're not simply converting a
// point, we're also swapping the child's origin side.
kidPosition.GetPhysicalPoint(wm, containerWidth - desiredSize.Width()),
kidPosition.GetPhysicalPoint(wm, containerSize -
desiredSize.PhysicalSize()),
desiredSize, origTfootRect, origTfootVisualOverflow);
}
@ -2976,8 +2977,8 @@ nsTableFrame::ReflowChildren(nsTableReflowState& aReflowState,
NS_WARN_IF_FALSE(wm.IsVertical() || NS_UNCONSTRAINEDSIZE !=
aReflowState.reflowState.ComputedWidth(),
"shouldn't have unconstrained width in horizontal mode");
nscoord containerWidth =
aReflowState.reflowState.ComputedSizeAsContainerIfConstrained().width;
nsSize containerSize =
aReflowState.reflowState.ComputedSizeAsContainerIfConstrained();
nsPresContext* presContext = PresContext();
// XXXldb Should we be checking constrained height instead?
@ -3096,8 +3097,8 @@ nsTableFrame::ReflowChildren(nsTableReflowState& aReflowState,
LogicalPoint kidPosition(wm, aReflowState.iCoord, aReflowState.bCoord);
ReflowChild(kidFrame, presContext, desiredSize, kidReflowState,
wm, kidPosition, containerWidth, 0, aStatus);
kidReflowState.ApplyRelativePositioning(&kidPosition, containerWidth);
wm, kidPosition, containerSize, 0, aStatus);
kidReflowState.ApplyRelativePositioning(&kidPosition, containerSize);
if (reorder) {
// reorder row groups the reflow may have changed the nextinflows
@ -3130,8 +3131,8 @@ nsTableFrame::ReflowChildren(nsTableReflowState& aReflowState,
nsIFrame* nextRowGroupFrame = rowGroups[childX + 1];
if (nextRowGroupFrame) {
PlaceChild(aReflowState, kidFrame,
kidPosition.GetPhysicalPoint(wm, containerWidth -
desiredSize.Width()),
kidPosition.GetPhysicalPoint(wm,
containerSize - desiredSize.PhysicalSize()),
desiredSize, oldKidRect, oldKidVisualOverflow);
if (allowRepeatedFooter) {
PlaceRepeatedFooter(aReflowState, tfoot, footerHeight);
@ -3161,8 +3162,8 @@ nsTableFrame::ReflowChildren(nsTableReflowState& aReflowState,
}
else { // we can't push so lets make clear how much space we need
PlaceChild(aReflowState, kidFrame,
kidPosition.GetPhysicalPoint(wm, containerWidth -
desiredSize.Width()),
kidPosition.GetPhysicalPoint(wm,
containerSize - desiredSize.PhysicalSize()),
desiredSize, oldKidRect, oldKidVisualOverflow);
aLastChildReflowed = kidFrame;
if (allowRepeatedFooter) {
@ -3187,8 +3188,8 @@ nsTableFrame::ReflowChildren(nsTableReflowState& aReflowState,
// Place the child
PlaceChild(aReflowState, kidFrame,
kidPosition.GetPhysicalPoint(wm, containerWidth -
desiredSize.Width()),
kidPosition.GetPhysicalPoint(wm, containerSize -
desiredSize.PhysicalSize()),
desiredSize, oldKidRect, oldKidVisualOverflow);
// Remember where we just were in case we end up pushing children
@ -3235,7 +3236,7 @@ nsTableFrame::ReflowChildren(nsTableReflowState& aReflowState,
}
else { // it isn't being reflowed
aReflowState.bCoord += cellSpacingB;
LogicalRect kidRect(wm, kidFrame->GetNormalRect(), containerWidth);
LogicalRect kidRect(wm, kidFrame->GetNormalRect(), containerSize);
if (kidRect.BStart(wm) != aReflowState.bCoord) {
// invalidate the old position
kidFrame->InvalidateFrameSubtree();
@ -3380,8 +3381,8 @@ nsTableFrame::DistributeBSizeToRows(const nsHTMLReflowState& aReflowState,
WritingMode wm = aReflowState.GetWritingMode();
LogicalMargin borderPadding = GetChildAreaOffset(wm, &aReflowState);
nscoord containerWidth =
aReflowState.ComputedSizeAsContainerIfConstrained().width;
nsSize containerSize =
aReflowState.ComputedSizeAsContainerIfConstrained();
RowGroupArray rowGroups;
OrderRowGroups(rowGroups);
@ -3398,14 +3399,16 @@ nsTableFrame::DistributeBSizeToRows(const nsHTMLReflowState& aReflowState,
nsTableRowGroupFrame* rgFrame = rowGroups[rgIdx];
nscoord amountUsedByRG = 0;
nscoord bOriginRow = 0;
LogicalRect rgNormalRect(wm, rgFrame->GetNormalRect(), containerWidth);
LogicalRect rgNormalRect(wm, rgFrame->GetNormalRect(), containerSize);
if (!rgFrame->HasStyleBSize()) {
nsTableRowFrame* rowFrame = rgFrame->GetFirstRow();
while (rowFrame) {
// We don't know the final width of the rowGroupFrame yet, so use zero
// as a "fake" containerWidth here; we'll adjust the row positions at
// We don't know the final width of the rowGroupFrame yet, so use 0,0
// as a dummy containerSize here; we'll adjust the row positions at
// the end, after the rowGroup size is finalized.
LogicalRect rowNormalRect(wm, rowFrame->GetNormalRect(), 0);
const nsSize dummyContainerSize;
LogicalRect rowNormalRect(wm, rowFrame->GetNormalRect(),
dummyContainerSize);
nscoord cellSpacingB = GetRowSpacing(rowFrame->GetRowIndex());
if ((amountUsed < aAmount) && rowFrame->HasPctBSize()) {
nscoord pctBSize = rowFrame->GetInitialBSize(pctBasis);
@ -3542,14 +3545,19 @@ nsTableFrame::DistributeBSizeToRows(const nsHTMLReflowState& aReflowState,
nsTableRowGroupFrame* rgFrame = rowGroups[rgIdx];
nscoord amountUsedByRG = 0;
nscoord bOriginRow = 0;
LogicalRect rgNormalRect(wm, rgFrame->GetNormalRect(), containerWidth);
LogicalRect rgNormalRect(wm, rgFrame->GetNormalRect(), containerSize);
nsRect rgVisualOverflow = rgFrame->GetVisualOverflowRect();
// see if there is an eligible row group or we distribute to all rows
if (!firstUnStyledRG || !rgFrame->HasStyleBSize() || !eligibleRows) {
for (nsTableRowFrame* rowFrame = rgFrame->GetFirstRow();
rowFrame; rowFrame = rowFrame->GetNextRow()) {
nscoord cellSpacingB = GetRowSpacing(rowFrame->GetRowIndex());
LogicalRect rowNormalRect(wm, rowFrame->GetNormalRect(), 0);
// We don't know the final width of the rowGroupFrame yet, so use 0,0
// as a dummy containerSize here; we'll adjust the row positions at
// the end, after the rowGroup size is finalized.
const nsSize dummyContainerSize;
LogicalRect rowNormalRect(wm, rowFrame->GetNormalRect(),
dummyContainerSize);
nsRect rowVisualOverflow = rowFrame->GetVisualOverflowRect();
// see if there is an eligible row or we distribute to all rows
if (!firstUnStyledRow || !rowFrame->HasStyleBSize() || !eligibleRows) {
@ -3631,11 +3639,11 @@ nsTableFrame::DistributeBSizeToRows(const nsHTMLReflowState& aReflowState,
// For vertical-rl mode, we needed to position the rows relative to the
// right-hand (block-start) side of the group; but we couldn't do that
// above, as we didn't know the rowGroupFrame's final block size yet.
// So we used a containerWidth of zero earlier, placing the rows to the
// left of the rowGroupFrame's (physical) origin. Now we move them all
// rightwards by its final width.
// So we used a dummyContainerSize of 0,0 earlier, placing the rows to
// the left of the rowGroupFrame's (physical) origin. Now we move them
// all rightwards by its final width.
if (wm.IsVerticalRL()) {
nscoord rgWidth = rgFrame->GetRect().width;
nscoord rgWidth = rgFrame->GetSize().width;
for (nsTableRowFrame* rowFrame = rgFrame->GetFirstRow();
rowFrame; rowFrame = rowFrame->GetNextRow()) {
rowFrame->InvalidateFrameSubtree();
@ -3746,18 +3754,18 @@ nsTableFrame::GetLogicalBaseline(WritingMode aWritingMode) const
RowGroupArray orderedRowGroups;
OrderRowGroups(orderedRowGroups);
nsTableRowFrame* firstRow = nullptr;
// XXX not sure if this should be the width of the containing block instead.
nscoord containerWidth = mRect.width;
// XXX not sure if this should be the size of the containing block instead.
nsSize containerSize = mRect.Size();
for (uint32_t rgIndex = 0; rgIndex < orderedRowGroups.Length(); rgIndex++) {
nsTableRowGroupFrame* rgFrame = orderedRowGroups[rgIndex];
if (rgFrame->GetRowCount()) {
firstRow = rgFrame->GetFirstRow();
nscoord rgNormalBStart =
LogicalRect(aWritingMode, rgFrame->GetNormalRect(), containerWidth)
LogicalRect(aWritingMode, rgFrame->GetNormalRect(), containerSize)
.Origin(aWritingMode).B(aWritingMode);
nscoord firstRowNormalBStart =
LogicalRect(aWritingMode, firstRow->GetNormalRect(), containerWidth)
LogicalRect(aWritingMode, firstRow->GetNormalRect(), containerSize)
.Origin(aWritingMode).B(aWritingMode);
ascent = rgNormalBStart + firstRowNormalBStart +
@ -6407,8 +6415,8 @@ BCPaintBorderIterator::BCPaintBorderIterator(nsTableFrame* aTable)
bool
BCPaintBorderIterator::SetDamageArea(const nsRect& aDirtyRect)
{
nscoord containerWidth = mTable->GetRect().width;
LogicalRect dirtyRect(mTableWM, aDirtyRect, containerWidth);
nsSize containerSize = mTable->GetSize();
LogicalRect dirtyRect(mTableWM, aDirtyRect, containerSize);
uint32_t startRowIndex, endRowIndex, startColIndex, endColIndex;
startRowIndex = endRowIndex = startColIndex = endColIndex = 0;
bool done = false;
@ -6984,7 +6992,7 @@ BCBlockDirSeg::Paint(BCPaintBorderIterator& aIter,
// Convert logical to physical sides/coordinates for DrawTableBorderSegment.
nsRect physicalRect = segRect.GetPhysicalRect(aIter.mTableWM,
aIter.mTable->GetSize().width);
aIter.mTable->GetSize());
// XXX For reversed vertical writing-modes (with direction:rtl), we need to
// invert physicalRect's y-position here, with respect to the table.
// However, it's not worth fixing the border positions here until the
@ -7191,7 +7199,7 @@ BCInlineDirSeg::Paint(BCPaintBorderIterator& aIter,
// Convert logical to physical sides/coordinates for DrawTableBorderSegment.
nsRect physicalRect = segRect.GetPhysicalRect(aIter.mTableWM,
aIter.mTable->GetSize().width);
aIter.mTable->GetSize());
uint8_t startBevelSide = aIter.mTableWM.PhysicalSide(mIStartBevelSide);
uint8_t endBevelSide = aIter.mTableWM.PhysicalSide(mIEndBevelSide);
nscoord startBevelOffset =

View File

@ -814,7 +814,7 @@ protected:
void SetColumnDimensions(nscoord aHeight, WritingMode aWM,
const LogicalMargin& aBorderPadding,
nscoord aContainerWidth);
const nsSize& aContainerSize);
int32_t CollectRows(nsIFrame* aFrame,
nsTArray<nsTableRowFrame*>& aCollection);

View File

@ -39,7 +39,7 @@ nsTableOuterFrame::GetLogicalBaseline(WritingMode aWritingMode) const
}
return kid->GetLogicalBaseline(aWritingMode) +
kid->BStart(aWritingMode, mRect.width);
kid->BStart(aWritingMode, mRect.Size());
}
nsTableOuterFrame::nsTableOuterFrame(nsStyleContext* aContext):
@ -786,15 +786,15 @@ nsTableOuterFrame::OuterDoReflowChild(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aMetrics,
nsReflowStatus& aStatus)
{
// Using zero as containerWidth here because we want consistency between
// Using zero as containerSize here because we want consistency between
// the GetLogicalPosition and ReflowChild calls, to avoid unnecessarily
// changing the frame's coordinates; but we don't yet know its final
// position anyway so the actual value is unimportant.
const nscoord zeroCWidth = 0;
const nsSize zeroCSize;
WritingMode wm = aChildRS.GetWritingMode();
// Use the current position as a best guess for placement.
LogicalPoint childPt = aChildFrame->GetLogicalPosition(wm, zeroCWidth);
LogicalPoint childPt = aChildFrame->GetLogicalPosition(wm, zeroCSize);
uint32_t flags = NS_FRAME_NO_MOVE_FRAME;
// We don't want to delete our next-in-flow's child if it's an inner table
@ -807,7 +807,7 @@ nsTableOuterFrame::OuterDoReflowChild(nsPresContext* aPresContext,
}
ReflowChild(aChildFrame, aPresContext, aMetrics, aChildRS,
wm, childPt, zeroCWidth, flags, aStatus);
wm, childPt, zeroCSize, flags, aStatus);
}
void
@ -960,14 +960,14 @@ nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
// XXX Need to recompute inner table's auto margins for the case of side
// captions. (Caption's are broken too, but that should be fixed earlier.)
// Compute the desiredSize so that we can use its Width() as containerWidth
// Compute the desiredSize so that we can use it as the containerSize
// for the FinishReflowChild calls below.
LogicalSize desiredSize(wm);
SetDesiredSize(captionSide, innerSize, captionSize,
innerMargin, captionMargin,
desiredSize.ISize(wm), desiredSize.BSize(wm), wm);
aDesiredSize.SetSize(wm, desiredSize);
nscoord containerWidth = aDesiredSize.Width();
nsSize containerSize = aDesiredSize.PhysicalSize();
// XXX It's possible for this to be NS_UNCONSTRAINEDSIZE, which will result
// in assertions from FinishReflowChild.
@ -976,8 +976,7 @@ nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
GetCaptionOrigin(captionSide, containSize, innerSize, innerMargin,
captionSize, captionMargin, captionOrigin, wm);
FinishReflowChild(mCaptionFrames.FirstChild(), aPresContext, *captionMet,
captionRS.ptr(), wm, captionOrigin, containerWidth,
0);
captionRS.ptr(), wm, captionOrigin, containerSize, 0);
captionRS.reset();
}
// XXX If the bsize is constrained then we need to check whether
@ -987,7 +986,7 @@ nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
GetInnerOrigin(captionSide, containSize, captionSize, captionMargin,
innerSize, innerMargin, innerOrigin, wm);
FinishReflowChild(InnerTableFrame(), aPresContext, innerMet, innerRS.ptr(),
wm, innerOrigin, containerWidth, 0);
wm, innerOrigin, containerSize, 0);
innerRS.reset();
nsTableFrame::InvalidateTableFrame(InnerTableFrame(), origInnerRect,

View File

@ -326,7 +326,7 @@ nsTableRowFrame::DidResize()
desiredSize.SetSize(wm, GetLogicalSize(wm));
desiredSize.SetOverflowAreasToDesiredBounds();
nscoord containerWidth = mRect.width;
nsSize containerSize = mRect.Size();
for (nsIFrame* childFrame : mFrames) {
nsTableCellFrame *cellFrame = do_QueryFrame(childFrame);
@ -336,7 +336,7 @@ nsTableRowFrame::DidResize()
// If the bsize for the cell has changed, we need to reset it;
// and in vertical-rl mode, we need to update the cell's block position
// to account for the containerWidth, which may not have been known
// to account for the containerSize, which may not have been known
// earlier, so we always apply it here.
LogicalSize cellSize = cellFrame->GetLogicalSize(wm);
if (cellSize.BSize(wm) != cellBSize || wm.IsVerticalRL()) {
@ -347,7 +347,7 @@ nsTableRowFrame::DidResize()
// Get the old position of the cell, as we want to preserve its
// inline coordinate.
LogicalPoint oldPos =
cellFrame->GetLogicalPosition(wm, containerWidth);
cellFrame->GetLogicalPosition(wm, containerSize);
// The cell should normally be aligned with the row's block-start,
// so set the B component of the position to zero:
@ -359,7 +359,7 @@ nsTableRowFrame::DidResize()
// Find out where the cell would have been without relative
// positioning.
LogicalPoint oldNormalPos =
cellFrame->GetLogicalNormalPosition(wm, containerWidth);
cellFrame->GetLogicalNormalPosition(wm, containerSize);
// The difference (if any) between oldPos and oldNormalPos reflects
// relative positioning that was applied to the cell, and which we
// need to incorporate when resetting the position.
@ -367,7 +367,7 @@ nsTableRowFrame::DidResize()
}
if (oldPos != newPos) {
cellFrame->SetPosition(wm, newPos, containerWidth);
cellFrame->SetPosition(wm, newPos, containerSize);
nsTableFrame::RePositionViews(cellFrame);
}
}
@ -432,13 +432,13 @@ nscoord nsTableRowFrame::GetRowBaseline(WritingMode aWM)
// bbbbbbbbbbbbbbbbbb
nscoord ascent = 0;
nscoord containerWidth = GetRect().width;
nsSize containerSize = GetSize();
for (nsIFrame* childFrame : mFrames) {
if (IS_TABLE_CELL(childFrame->GetType())) {
nsIFrame* firstKid = childFrame->GetFirstPrincipalChild();
ascent = std::max(ascent,
LogicalRect(aWM, firstKid->GetNormalRect(),
containerWidth).BEnd(aWM));
containerSize).BEnd(aWM));
}
}
return ascent;
@ -817,8 +817,8 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
// Reflow each of our existing cell frames
WritingMode wm = aReflowState.GetWritingMode();
nscoord containerWidth =
aReflowState.ComputedSizeAsContainerIfConstrained().width;
nsSize containerSize =
aReflowState.ComputedSizeAsContainerIfConstrained();
for (nsIFrame* kidFrame : mFrames) {
nsTableCellFrame *cellFrame = do_QueryFrame(kidFrame);
@ -878,11 +878,11 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
// Reflow the child frame
nsRect kidRect = kidFrame->GetRect();
LogicalPoint origKidNormalPosition =
kidFrame->GetLogicalNormalPosition(wm, containerWidth);
kidFrame->GetLogicalNormalPosition(wm, containerSize);
// All cells' no-relative-positioning position should be snapped to the
// row's bstart edge.
// This doesn't hold in vertical-rl mode, where we don't yet know the
// correct containerWidth for the row frame. In that case, we'll have to
// correct containerSize for the row frame. In that case, we'll have to
// fix up child positions later, after determining our desiredSize.
NS_ASSERTION(origKidNormalPosition.B(wm) == 0 || wm.IsVerticalRL(),
"unexpected kid position");
@ -929,7 +929,7 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
nsReflowStatus status;
ReflowChild(kidFrame, aPresContext, desiredSize, *kidReflowState,
wm, kidPosition, containerWidth, 0, status);
wm, kidPosition, containerSize, 0, status);
// allow the table to determine if/how the table needs to be rebalanced
// If any of the cells are not complete, then we're not complete
@ -982,7 +982,7 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
if (kidReflowState) {
// We reflowed. Apply relative positioning in the normal way.
kidReflowState->ApplyRelativePositioning(&kidPosition, containerWidth);
kidReflowState->ApplyRelativePositioning(&kidPosition, containerSize);
} else if (kidFrame->IsRelativelyPositioned()) {
// We didn't reflow. Do the positioning part of what
// MovePositionBy does internally. (This codepath should really
@ -990,20 +990,14 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
LogicalMargin computedOffsets(wm, *static_cast<nsMargin*>
(kidFrame->Properties().Get(nsIFrame::ComputedOffsetProperty())));
nsHTMLReflowState::ApplyRelativePositioning(kidFrame, wm, computedOffsets,
&kidPosition, containerWidth);
&kidPosition, containerSize);
}
// In vertical-rl writing mode, we are likely to have containerWidth 0
// because ComputedWidth() was NS_UNCONSTRAINEDSIZE. The true value
// we need is the row's bsize, but we don't know that yet. So we'll use
// the kid's (cell's) desiredSize.Width() value for now.
// In vertical-rl mode, we are likely to have containerSize.width = 0
// because ComputedWidth() was NS_UNCONSTRAINEDSIZE.
// For cases where that's wrong, we will fix up the position later.
FinishReflowChild(kidFrame, aPresContext, desiredSize, nullptr,
wm, kidPosition,
wm.IsVerticalRL() && containerWidth == 0
? desiredSize.Width()
: containerWidth,
0);
wm, kidPosition, containerSize, 0);
nsTableFrame::InvalidateTableFrame(kidFrame, kidRect, kidVisualOverflow,
firstReflow);
@ -1158,8 +1152,8 @@ nsTableRowFrame::ReflowCellFrame(nsPresContext* aPresContext,
WritingMode wm = aReflowState.GetWritingMode();
// Reflow the cell frame with the specified height. Use the existing width
nscoord containerWidth = aCellFrame->GetSize().width;
LogicalRect cellRect = aCellFrame->GetLogicalRect(wm, containerWidth);
nsSize containerSize = aCellFrame->GetSize();
LogicalRect cellRect = aCellFrame->GetLogicalRect(wm, containerSize);
nsRect cellVisualOverflow = aCellFrame->GetVisualOverflowRect();
LogicalSize cellSize = cellRect.Size(wm);
@ -1192,7 +1186,7 @@ nsTableRowFrame::ReflowCellFrame(nsPresContext* aPresContext,
}
nsTableFrame::InvalidateTableFrame(aCellFrame,
cellRect.GetPhysicalRect(wm, containerWidth),
cellRect.GetPhysicalRect(wm, containerSize),
cellVisualOverflow,
aCellFrame->
HasAnyStateBits(NS_FRAME_FIRST_REFLOW));
@ -1223,8 +1217,8 @@ nsTableRowFrame::CollapseRowIfNecessary(nscoord aRowOffset,
WritingMode wm = GetWritingMode();
nscoord parentWidth = GetParent()->GetRect().width;
LogicalRect rowRect = GetLogicalRect(wm, parentWidth);
nsSize parentSize = GetParent()->GetSize();
LogicalRect rowRect = GetLogicalRect(wm, parentSize);
nsRect oldRect = mRect;
nsRect oldVisualOverflow = GetVisualOverflowRect();
@ -1232,7 +1226,7 @@ nsTableRowFrame::CollapseRowIfNecessary(nscoord aRowOffset,
rowRect.ISize(wm) = aISize;
nsOverflowAreas overflow;
nscoord shift = 0;
nscoord containerWidth = mRect.width;
nsSize containerSize = mRect.Size();
if (aCollapseGroup || collapseRow) {
aDidCollapse = true;
@ -1243,7 +1237,7 @@ nsTableRowFrame::CollapseRowIfNecessary(nscoord aRowOffset,
cellFrame->GetRowIndex(rowIndex);
shift += tableFrame->GetRowSpacing(rowIndex);
while (cellFrame) {
LogicalRect cRect = cellFrame->GetLogicalRect(wm, containerWidth);
LogicalRect cRect = cellFrame->GetLogicalRect(wm, containerSize);
// If aRowOffset != 0, there's no point in invalidating the cells, since
// we've already invalidated our overflow area. Note that we _do_ still
// need to invalidate if our row is not moving, because the cell might
@ -1252,7 +1246,7 @@ nsTableRowFrame::CollapseRowIfNecessary(nscoord aRowOffset,
InvalidateFrame();
}
cRect.BSize(wm) = 0;
cellFrame->SetRect(wm, cRect, containerWidth);
cellFrame->SetRect(wm, cRect, containerSize);
cellFrame = cellFrame->GetNextCell();
}
} else {
@ -1326,7 +1320,7 @@ nsTableRowFrame::CollapseRowIfNecessary(nscoord aRowOffset,
nextRowVis->mVisible);
if (!collapseNextRow) {
LogicalRect nextRect = rowFrame->GetLogicalRect(wm,
containerWidth);
containerSize);
cRect.BSize(wm) +=
nextRect.BSize(wm) +
tableFrame->GetRowSpacing(rowFrame->GetRowIndex());
@ -1336,7 +1330,7 @@ nsTableRowFrame::CollapseRowIfNecessary(nscoord aRowOffset,
nsRect oldCellRect = cellFrame->GetRect();
LogicalPoint oldCellNormalPos =
cellFrame->GetLogicalNormalPosition(wm, containerWidth);
cellFrame->GetLogicalNormalPosition(wm, containerSize);
nsRect oldCellVisualOverflow = cellFrame->GetVisualOverflowRect();
@ -1352,7 +1346,7 @@ nsTableRowFrame::CollapseRowIfNecessary(nscoord aRowOffset,
// collapse the cell!
LogicalRect cellBounds(wm, 0, 0, cRect.ISize(wm), cRect.BSize(wm));
nsRect cellPhysicalBounds =
cellBounds.GetPhysicalRect(wm, containerWidth);
cellBounds.GetPhysicalRect(wm, containerSize);
nsOverflowAreas cellOverflow(cellPhysicalBounds, cellPhysicalBounds);
cellFrame->FinishAndStoreOverflow(cellOverflow,
cRect.Size(wm).GetPhysicalSize(wm));
@ -1367,7 +1361,7 @@ nsTableRowFrame::CollapseRowIfNecessary(nscoord aRowOffset,
}
}
SetRect(wm, rowRect, containerWidth);
SetRect(wm, rowRect, containerSize);
overflow.UnionAllWith(nsRect(0, 0, rowRect.Width(wm), rowRect.Height(wm)));
FinishAndStoreOverflow(overflow, rowRect.Size(wm).GetPhysicalSize(wm));

View File

@ -261,7 +261,7 @@ nsTableRowGroupFrame::PlaceChild(nsPresContext* aPresContext,
nsIFrame* aKidFrame,
WritingMode aWM,
const LogicalPoint& aKidPosition,
nscoord aContainerWidth,
const nsSize& aContainerSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsRect& aOriginalKidRect,
const nsRect& aOriginalKidVisualOverflow)
@ -270,7 +270,7 @@ nsTableRowGroupFrame::PlaceChild(nsPresContext* aPresContext,
// Place and size the child
FinishReflowChild(aKidFrame, aPresContext, aDesiredSize, nullptr,
aWM, aKidPosition, aContainerWidth, 0);
aWM, aKidPosition, aContainerSize, 0);
nsTableFrame::InvalidateTableFrame(aKidFrame, aOriginalKidRect,
aOriginalKidVisualOverflow, isFirstReflow);
@ -343,11 +343,11 @@ nsTableRowGroupFrame::ReflowChildren(nsPresContext* aPresContext,
tableFrame->IsGeometryDirty();
// in vertical-rl mode, we always need the row bsizes in order to
// get the necessary containerWidth for placing our kids
// get the necessary containerSize for placing our kids
bool needToCalcRowBSizes = reflowAllKids || wm.IsVerticalRL();
nscoord containerWidth =
aReflowState.reflowState.ComputedSizeAsContainerIfConstrained().width;
nsSize containerSize =
aReflowState.reflowState.ComputedSizeAsContainerIfConstrained();
nsIFrame *prevKidFrame = nullptr;
for (nsIFrame* kidFrame = mFrames.FirstChild(); kidFrame;
@ -367,7 +367,7 @@ nsTableRowGroupFrame::ReflowChildren(nsPresContext* aPresContext,
(aReflowState.reflowState.mFlags.mSpecialBSizeReflow &&
(isPaginated ||
kidFrame->HasAnyStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE)))) {
LogicalRect oldKidRect = kidFrame->GetLogicalRect(wm, containerWidth);
LogicalRect oldKidRect = kidFrame->GetLogicalRect(wm, containerSize);
nsRect oldKidVisualOverflow = kidFrame->GetVisualOverflowRect();
// XXXldb We used to only pass aDesiredSize.mFlags through for the
@ -402,13 +402,13 @@ nsTableRowGroupFrame::ReflowChildren(nsPresContext* aPresContext,
LogicalPoint kidPosition(wm, 0, aReflowState.bCoord);
ReflowChild(kidFrame, aPresContext, desiredSize, kidReflowState,
wm, kidPosition, containerWidth, 0, aStatus);
kidReflowState.ApplyRelativePositioning(&kidPosition, containerWidth);
wm, kidPosition, containerSize, 0, aStatus);
kidReflowState.ApplyRelativePositioning(&kidPosition, containerSize);
// Place the child
PlaceChild(aPresContext, aReflowState, kidFrame,
wm, kidPosition, containerWidth,
desiredSize, oldKidRect.GetPhysicalRect(wm, containerWidth),
wm, kidPosition, containerSize,
desiredSize, oldKidRect.GetPhysicalRect(wm, containerSize),
oldKidVisualOverflow);
aReflowState.bCoord += cellSpacingB;
@ -552,10 +552,10 @@ nsTableRowGroupFrame::CalculateRowBSizes(nsPresContext* aPresContext,
// The current row group block-size is the block-origin of the 1st row
// we are about to calculate a block-size for.
WritingMode wm = aReflowState.GetWritingMode();
nscoord containerWidth = 0; // actual value is unimportant as we're initially
// computing sizes, not physical positions
nsSize containerSize; // actual value is unimportant as we're initially
// computing sizes, not physical positions
nscoord startRowGroupBSize =
startRowFrame->GetLogicalNormalPosition(wm, containerWidth).B(wm);
startRowFrame->GetLogicalNormalPosition(wm, containerSize).B(wm);
int32_t numRows = GetRowCount() - (startRowFrame->GetRowIndex() - GetStartRowIndex());
// Collect the current bsize of each row.
@ -781,9 +781,9 @@ nsTableRowGroupFrame::CalculateRowBSizes(nsPresContext* aPresContext,
}
if (wm.IsVertical()) {
// we need the correct containerWidth below for block positioning in
// we need the correct containerSize below for block positioning in
// vertical-rl writing mode
containerWidth = rowGroupBSize;
containerSize.width = rowGroupBSize;
}
nscoord bOrigin = startRowGroupBSize;
@ -794,7 +794,7 @@ nsTableRowGroupFrame::CalculateRowBSizes(nsPresContext* aPresContext,
LogicalSize rowBoundsSize(wm, rowBounds.Size());
nsRect rowVisualOverflow = rowFrame->GetVisualOverflowRect();
nscoord deltaB =
bOrigin - rowFrame->GetLogicalNormalPosition(wm, containerWidth).B(wm);
bOrigin - rowFrame->GetLogicalNormalPosition(wm, containerSize).B(wm);
nscoord rowBSize = (rowInfo[rowIndex].bSize > 0) ? rowInfo[rowIndex].bSize : 0;
@ -835,7 +835,7 @@ nsTableRowGroupFrame::CollapseRowGroupIfNecessary(nscoord aBTotalOffset,
WritingMode aWM)
{
nsTableFrame* tableFrame = GetTableFrame();
nscoord containerWidth = tableFrame->GetRect().width;
nsSize containerSize = tableFrame->GetSize();
const nsStyleVisibility* groupVis = StyleVisibility();
bool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);
if (collapseGroup) {
@ -855,7 +855,7 @@ nsTableRowGroupFrame::CollapseRowGroupIfNecessary(nscoord aBTotalOffset,
rowFrame = rowFrame->GetNextRow();
}
LogicalRect groupRect = GetLogicalRect(aWM, containerWidth);
LogicalRect groupRect = GetLogicalRect(aWM, containerSize);
nsRect oldGroupRect = GetRect();
nsRect oldGroupVisualOverflow = GetVisualOverflowRect();
@ -873,7 +873,7 @@ nsTableRowGroupFrame::CollapseRowGroupIfNecessary(nscoord aBTotalOffset,
InvalidateFrameSubtree();
}
SetRect(aWM, groupRect, containerWidth);
SetRect(aWM, groupRect, containerSize);
overflow.UnionAllWith(nsRect(0, 0, groupRect.Width(aWM),
groupRect.Height(aWM)));
FinishAndStoreOverflow(overflow, groupRect.Size(aWM).GetPhysicalSize(aWM));
@ -889,15 +889,19 @@ void
nsTableRowGroupFrame::SlideChild(nsRowGroupReflowState& aReflowState,
nsIFrame* aKidFrame)
{
// Move the frame if we need to
// Move the frame if we need to.
WritingMode wm = aReflowState.reflowState.GetWritingMode();
LogicalPoint oldPosition = aKidFrame->GetLogicalNormalPosition(wm, 0);
const nsSize containerSize =
aReflowState.reflowState.ComputedSizeAsContainerIfConstrained();
LogicalPoint oldPosition =
aKidFrame->GetLogicalNormalPosition(wm, containerSize);
LogicalPoint newPosition = oldPosition;
newPosition.B(wm) = aReflowState.bCoord;
if (oldPosition.B(wm) != newPosition.B(wm)) {
aKidFrame->InvalidateFrameSubtree();
aReflowState.reflowState.ApplyRelativePositioning(&newPosition, 0);
aKidFrame->SetPosition(wm, newPosition, 0);
aReflowState.reflowState.ApplyRelativePositioning(&newPosition,
containerSize);
aKidFrame->SetPosition(wm, newPosition, containerSize);
nsTableFrame::RePositionViews(aKidFrame);
aKidFrame->InvalidateFrameSubtree();
}
@ -1762,8 +1766,8 @@ nsTableRowGroupFrame::FindFrameAt(int32_t aLineNumber,
nsTableCellMap* cellMap = table->GetCellMap();
WritingMode wm = table->GetWritingMode();
nscoord cw = table->GetRect().width;
LogicalPoint pos(wm, aPos, cw);
nsSize containerSize = table->GetSize();
LogicalPoint pos(wm, aPos, containerSize);
*aFrameFound = nullptr;
*aPosIsBeforeFirstFrame = true;
@ -1793,7 +1797,7 @@ nsTableRowGroupFrame::FindFrameAt(int32_t aLineNumber,
int32_t n = numCells;
nsIFrame* firstFrame = frame;
while (n--) {
LogicalRect rect = frame->GetLogicalRect(wm, cw);
LogicalRect rect = frame->GetLogicalRect(wm, containerSize);
if (rect.ISize(wm) > 0) {
// If pos.I() is inside this frame - this is it
if (rect.IStart(wm) <= pos.I(wm) && rect.IEnd(wm) > pos.I(wm)) {
@ -1802,12 +1806,14 @@ nsTableRowGroupFrame::FindFrameAt(int32_t aLineNumber,
}
if (rect.IStart(wm) < pos.I(wm)) {
if (!closestFromStart ||
rect.IEnd(wm) > closestFromStart->GetLogicalRect(wm, cw).IEnd(wm))
rect.IEnd(wm) > closestFromStart->
GetLogicalRect(wm, containerSize).IEnd(wm))
closestFromStart = frame;
}
else {
if (!closestFromEnd ||
rect.IStart(wm) < closestFromEnd->GetLogicalRect(wm, cw).IStart(wm))
rect.IStart(wm) < closestFromEnd->
GetLogicalRect(wm, containerSize).IStart(wm))
closestFromEnd = frame;
}
}
@ -1829,9 +1835,11 @@ nsTableRowGroupFrame::FindFrameAt(int32_t aLineNumber,
*aFrameFound = closestFromStart;
}
else { // we're between two frames
nscoord delta = closestFromEnd->GetLogicalRect(wm, cw).IStart(wm) -
closestFromStart->GetLogicalRect(wm, cw).IEnd(wm);
if (pos.I(wm) < closestFromStart->GetLogicalRect(wm, cw).IEnd(wm) + delta/2) {
nscoord delta =
closestFromEnd->GetLogicalRect(wm, containerSize).IStart(wm) -
closestFromStart->GetLogicalRect(wm, containerSize).IEnd(wm);
if (pos.I(wm) < closestFromStart->
GetLogicalRect(wm, containerSize).IEnd(wm) + delta/2) {
*aFrameFound = closestFromStart;
} else {
*aFrameFound = closestFromEnd;

View File

@ -355,7 +355,7 @@ protected:
nsIFrame* aKidFrame,
mozilla::WritingMode aWM,
const mozilla::LogicalPoint& aKidPosition,
nscoord aContainerWidth,
const nsSize& aContainerSize,
nsHTMLReflowMetrics& aDesiredSize,
const nsRect& aOriginalKidRect,
const nsRect& aOriginalKidVisualOverflow);

View File

@ -965,7 +965,7 @@ nsTextBoxFrame::DoLayout(nsBoxLayoutState& aBoxLayoutState)
aBoxLayoutState.GetRenderingContext());
WritingMode wm = GetWritingMode();
LogicalRect tr(wm, textRect, GetSize().width);
LogicalRect tr(wm, textRect, GetSize());
tr.IStart(wm) -= metrics.leftBearing;
tr.ISize(wm) = metrics.width;
@ -973,7 +973,7 @@ nsTextBoxFrame::DoLayout(nsBoxLayoutState& aBoxLayoutState)
tr.BStart(wm) += fontMet->MaxAscent() - metrics.ascent;
tr.BSize(wm) = metrics.ascent + metrics.descent;
textRect = tr.GetPhysicalRect(wm, GetSize().width);
textRect = tr.GetPhysicalRect(wm, GetSize());
// Our scrollable overflow is our bounds; our visual overflow may
// extend beyond that.
@ -1096,7 +1096,7 @@ nsTextBoxFrame::CalcDrawRect(nsRenderingContext &aRenderingContext)
textRect.IStart(wm) += (outerISize - textRect.ISize(wm));
}
mTextDrawRect = textRect.GetPhysicalRect(wm, GetSize().width);
mTextDrawRect = textRect.GetPhysicalRect(wm, GetSize());
}
/**