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
Родитель 76e21c1574
Коммит 4e6c40d7ea
46 изменённых файлов: 691 добавлений и 609 удалений

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -659,39 +659,39 @@ public:
* Dimensions and position in logical coordinates in the frame's writing mode * Dimensions and position in logical coordinates in the frame's writing mode
* or another writing mode * or another writing mode
*/ */
mozilla::LogicalRect GetLogicalRect(nscoord aContainerWidth) const { mozilla::LogicalRect GetLogicalRect(const nsSize& aContainerSize) const {
return GetLogicalRect(GetWritingMode(), aContainerWidth); return GetLogicalRect(GetWritingMode(), aContainerSize);
} }
mozilla::LogicalPoint GetLogicalPosition(nscoord aContainerWidth) const { mozilla::LogicalPoint GetLogicalPosition(const nsSize& aContainerSize) const {
return GetLogicalPosition(GetWritingMode(), aContainerWidth); return GetLogicalPosition(GetWritingMode(), aContainerSize);
} }
mozilla::LogicalSize GetLogicalSize() const { mozilla::LogicalSize GetLogicalSize() const {
return GetLogicalSize(GetWritingMode()); return GetLogicalSize(GetWritingMode());
} }
mozilla::LogicalRect GetLogicalRect(mozilla::WritingMode aWritingMode, mozilla::LogicalRect GetLogicalRect(mozilla::WritingMode aWritingMode,
nscoord aContainerWidth) const { const nsSize& aContainerSize) const {
return mozilla::LogicalRect(aWritingMode, GetRect(), aContainerWidth); return mozilla::LogicalRect(aWritingMode, GetRect(), aContainerSize);
} }
mozilla::LogicalPoint GetLogicalPosition(mozilla::WritingMode aWritingMode, mozilla::LogicalPoint GetLogicalPosition(mozilla::WritingMode aWritingMode,
nscoord aContainerWidth) const { const nsSize& aContainerSize) const {
return GetLogicalRect(aWritingMode, aContainerWidth).Origin(aWritingMode); return GetLogicalRect(aWritingMode, aContainerSize).Origin(aWritingMode);
} }
mozilla::LogicalSize GetLogicalSize(mozilla::WritingMode aWritingMode) const { mozilla::LogicalSize GetLogicalSize(mozilla::WritingMode aWritingMode) const {
return mozilla::LogicalSize(aWritingMode, GetSize()); return mozilla::LogicalSize(aWritingMode, GetSize());
} }
nscoord IStart(nscoord aContainerWidth) const { nscoord IStart(const nsSize& aContainerSize) const {
return IStart(GetWritingMode(), aContainerWidth); return IStart(GetWritingMode(), aContainerSize);
} }
nscoord IStart(mozilla::WritingMode aWritingMode, nscoord IStart(mozilla::WritingMode aWritingMode,
nscoord aContainerWidth) const { const nsSize& aContainerSize) const {
return GetLogicalPosition(aWritingMode, aContainerWidth).I(aWritingMode); return GetLogicalPosition(aWritingMode, aContainerSize).I(aWritingMode);
} }
nscoord BStart(nscoord aContainerWidth) const { nscoord BStart(const nsSize& aContainerSize) const {
return BStart(GetWritingMode(), aContainerWidth); return BStart(GetWritingMode(), aContainerSize);
} }
nscoord BStart(mozilla::WritingMode aWritingMode, nscoord BStart(mozilla::WritingMode aWritingMode,
nscoord aContainerWidth) const { const nsSize& aContainerSize) const {
return GetLogicalPosition(aWritingMode, aContainerWidth).B(aWritingMode); return GetLogicalPosition(aWritingMode, aContainerSize).B(aWritingMode);
} }
nscoord ISize() const { return ISize(GetWritingMode()); } nscoord ISize() const { return ISize(GetWritingMode()); }
nscoord ISize(mozilla::WritingMode aWritingMode) const { 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 * Set this frame's rect from a logical rect in its own writing direction
*/ */
void SetRect(const mozilla::LogicalRect& aRect, nscoord aContainerWidth) { void SetRect(const mozilla::LogicalRect& aRect,
SetRect(GetWritingMode(), aRect, aContainerWidth); const nsSize& aContainerSize) {
SetRect(GetWritingMode(), aRect, aContainerSize);
} }
/** /**
* Set this frame's rect from a logical rect in a different writing direction * Set this frame's rect from a logical rect in a different writing direction
@ -730,8 +731,8 @@ public:
*/ */
void SetRect(mozilla::WritingMode aWritingMode, void SetRect(mozilla::WritingMode aWritingMode,
const mozilla::LogicalRect& aRect, const mozilla::LogicalRect& aRect,
nscoord aContainerWidth) { const nsSize& aContainerSize) {
SetRect(aRect.GetPhysicalRect(aWritingMode, aContainerWidth)); SetRect(aRect.GetPhysicalRect(aWritingMode, aContainerSize));
} }
/** /**
@ -771,12 +772,12 @@ public:
void SetPosition(const nsPoint& aPt) { mRect.MoveTo(aPt); } void SetPosition(const nsPoint& aPt) { mRect.MoveTo(aPt); }
void SetPosition(mozilla::WritingMode aWritingMode, void SetPosition(mozilla::WritingMode aWritingMode,
const mozilla::LogicalPoint& aPt, const mozilla::LogicalPoint& aPt,
nscoord aContainerWidth) { const nsSize& aContainerSize) {
// We subtract mRect.width from the container width to account for // We subtract mRect.Size() from the container size to account for
// the fact that logical origins in RTL coordinate systems are at // the fact that logical origins in RTL coordinate systems are at
// the top right of the frame instead of the top left. // the top right of the frame instead of the top left.
mRect.MoveTo(aPt.GetPhysicalPoint(aWritingMode, mRect.MoveTo(aPt.GetPhysicalPoint(aWritingMode,
aContainerWidth - mRect.width)); aContainerSize - mRect.Size()));
} }
/** /**
@ -798,7 +799,12 @@ public:
void MovePositionBy(mozilla::WritingMode aWritingMode, void MovePositionBy(mozilla::WritingMode aWritingMode,
const mozilla::LogicalPoint& aTranslation) 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; nsPoint GetNormalPosition() const;
mozilla::LogicalPoint mozilla::LogicalPoint
GetLogicalNormalPosition(mozilla::WritingMode aWritingMode, 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 // the correct position in rtl frames where the origin is on the
// right instead of the left // right instead of the left
return mozilla::LogicalPoint(aWritingMode, return mozilla::LogicalPoint(aWritingMode,
GetNormalPosition(), GetNormalPosition(),
aContainerWidth - mRect.width); aContainerSize - mRect.Size());
} }
virtual nsPoint GetPositionOfChildIgnoringScrolling(nsIFrame* aChild) virtual nsPoint GetPositionOfChildIgnoringScrolling(nsIFrame* aChild)

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -253,7 +253,9 @@ nsRubyFrame::ReflowSegment(nsPresContext* aPresContext,
} }
nscoord segmentISize = baseMetrics.ISize(lineWM); 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 // 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 // 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 // the ruby frame. Right now, the base container's rect's block-axis
@ -318,10 +320,11 @@ nsRubyFrame::ReflowSegment(nsPresContext* aPresContext,
MOZ_ASSERT_UNREACHABLE("???"); MOZ_ASSERT_UNREACHABLE("???");
} }
} }
// Container width is set to zero here. We will fix it in // Using a dummy container-size here, so child positioning may not be
// nsLineLayout after the whole line get reflowed. // correct. We will fix it in nsLineLayout after the whole line is
// reflowed.
FinishReflowChild(textContainer, aPresContext, textMetrics, FinishReflowChild(textContainer, aPresContext, textMetrics,
&textReflowState, lineWM, position, 0, 0); &textReflowState, lineWM, position, dummyContainerSize, 0);
} }
MOZ_ASSERT(baseRect.ISize(lineWM) == offsetRect.ISize(lineWM), MOZ_ASSERT(baseRect.ISize(lineWM) == offsetRect.ISize(lineWM),
"Annotations should only be placed on the block directions"); "Annotations should only be placed on the block directions");

Просмотреть файл

@ -135,11 +135,14 @@ nsRubyTextContainerFrame::Reflow(nsPresContext* aPresContext,
nscoord minBCoord = nscoord_MAX; nscoord minBCoord = nscoord_MAX;
nscoord maxBCoord = nscoord_MIN; 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()) { for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) {
nsIFrame* child = e.get(); nsIFrame* child = e.get();
MOZ_ASSERT(child->GetType() == nsGkAtoms::rubyTextFrame); MOZ_ASSERT(child->GetType() == nsGkAtoms::rubyTextFrame);
// The container width is still unknown yet. LogicalRect rect = child->GetLogicalRect(lineWM, dummyContainerSize);
LogicalRect rect = child->GetLogicalRect(lineWM, 0);
LogicalMargin margin = child->GetLogicalUsedMargin(lineWM); LogicalMargin margin = child->GetLogicalUsedMargin(lineWM);
nscoord blockStart = rect.BStart(lineWM) - margin.BStart(lineWM); nscoord blockStart = rect.BStart(lineWM) - margin.BStart(lineWM);
minBCoord = std::min(minBCoord, blockStart); minBCoord = std::min(minBCoord, blockStart);
@ -155,18 +158,18 @@ nsRubyTextContainerFrame::Reflow(nsPresContext* aPresContext,
minBCoord = maxBCoord = 0; minBCoord = maxBCoord = 0;
} }
size.BSize(lineWM) = maxBCoord - minBCoord; size.BSize(lineWM) = maxBCoord - minBCoord;
nscoord containerWidth = size.Width(lineWM); nsSize containerSize = size.GetPhysicalSize(lineWM);
for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) { for (nsFrameList::Enumerator e(mFrames); !e.AtEnd(); e.Next()) {
nsIFrame* child = e.get(); 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. // 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, // Adjust block position to account for minBCoord,
// then reposition child based on the true container width. // then reposition child based on the true container width.
pos.B(lineWM) -= minBCoord; pos.B(lineWM) -= minBCoord;
// Relative positioning hasn't happened yet. // Relative positioning hasn't happened yet.
// So MovePositionBy should not be used here. // So MovePositionBy should not be used here.
child->SetPosition(lineWM, pos, containerWidth); child->SetPosition(lineWM, pos, containerSize);
nsContainerFrame::PlaceFrameView(child); nsContainerFrame::PlaceFrameView(child);
} }
} }

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -39,7 +39,7 @@ nsTableOuterFrame::GetLogicalBaseline(WritingMode aWritingMode) const
} }
return kid->GetLogicalBaseline(aWritingMode) + return kid->GetLogicalBaseline(aWritingMode) +
kid->BStart(aWritingMode, mRect.width); kid->BStart(aWritingMode, mRect.Size());
} }
nsTableOuterFrame::nsTableOuterFrame(nsStyleContext* aContext): nsTableOuterFrame::nsTableOuterFrame(nsStyleContext* aContext):
@ -786,15 +786,15 @@ nsTableOuterFrame::OuterDoReflowChild(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aMetrics, nsHTMLReflowMetrics& aMetrics,
nsReflowStatus& aStatus) 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 // the GetLogicalPosition and ReflowChild calls, to avoid unnecessarily
// changing the frame's coordinates; but we don't yet know its final // changing the frame's coordinates; but we don't yet know its final
// position anyway so the actual value is unimportant. // position anyway so the actual value is unimportant.
const nscoord zeroCWidth = 0; const nsSize zeroCSize;
WritingMode wm = aChildRS.GetWritingMode(); WritingMode wm = aChildRS.GetWritingMode();
// Use the current position as a best guess for placement. // 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; 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 // 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, ReflowChild(aChildFrame, aPresContext, aMetrics, aChildRS,
wm, childPt, zeroCWidth, flags, aStatus); wm, childPt, zeroCSize, flags, aStatus);
} }
void void
@ -960,14 +960,14 @@ nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
// XXX Need to recompute inner table's auto margins for the case of side // 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.) // 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. // for the FinishReflowChild calls below.
LogicalSize desiredSize(wm); LogicalSize desiredSize(wm);
SetDesiredSize(captionSide, innerSize, captionSize, SetDesiredSize(captionSide, innerSize, captionSize,
innerMargin, captionMargin, innerMargin, captionMargin,
desiredSize.ISize(wm), desiredSize.BSize(wm), wm); desiredSize.ISize(wm), desiredSize.BSize(wm), wm);
aDesiredSize.SetSize(wm, desiredSize); 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 // XXX It's possible for this to be NS_UNCONSTRAINEDSIZE, which will result
// in assertions from FinishReflowChild. // in assertions from FinishReflowChild.
@ -976,8 +976,7 @@ nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
GetCaptionOrigin(captionSide, containSize, innerSize, innerMargin, GetCaptionOrigin(captionSide, containSize, innerSize, innerMargin,
captionSize, captionMargin, captionOrigin, wm); captionSize, captionMargin, captionOrigin, wm);
FinishReflowChild(mCaptionFrames.FirstChild(), aPresContext, *captionMet, FinishReflowChild(mCaptionFrames.FirstChild(), aPresContext, *captionMet,
captionRS.ptr(), wm, captionOrigin, containerWidth, captionRS.ptr(), wm, captionOrigin, containerSize, 0);
0);
captionRS.reset(); captionRS.reset();
} }
// XXX If the bsize is constrained then we need to check whether // 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, GetInnerOrigin(captionSide, containSize, captionSize, captionMargin,
innerSize, innerMargin, innerOrigin, wm); innerSize, innerMargin, innerOrigin, wm);
FinishReflowChild(InnerTableFrame(), aPresContext, innerMet, innerRS.ptr(), FinishReflowChild(InnerTableFrame(), aPresContext, innerMet, innerRS.ptr(),
wm, innerOrigin, containerWidth, 0); wm, innerOrigin, containerSize, 0);
innerRS.reset(); innerRS.reset();
nsTableFrame::InvalidateTableFrame(InnerTableFrame(), origInnerRect, nsTableFrame::InvalidateTableFrame(InnerTableFrame(), origInnerRect,

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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