mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 789096 patch 9: use logical coordinates in nsHTMLReflowState available size. r=jfkthame
This commit is contained in:
parent
7f2acb4d62
commit
251c4d696a
@ -408,7 +408,9 @@ RestyleManager::RecomputePosition(nsIFrame* aFrame)
|
||||
// Construct a bogus parent reflow state so that there's a usable
|
||||
// containing block reflow state.
|
||||
nsIFrame* parentFrame = aFrame->GetParent();
|
||||
nsSize parentSize = parentFrame->GetSize();
|
||||
WritingMode parentWM = parentFrame->GetWritingMode();
|
||||
WritingMode frameWM = aFrame->GetWritingMode();
|
||||
LogicalSize parentSize = parentFrame->GetLogicalSize();
|
||||
|
||||
nsFrameState savedState = parentFrame->GetStateBits();
|
||||
nsHTMLReflowState parentReflowState(aFrame->PresContext(), parentFrame,
|
||||
@ -416,17 +418,18 @@ RestyleManager::RecomputePosition(nsIFrame* aFrame)
|
||||
parentFrame->RemoveStateBits(~nsFrameState(0));
|
||||
parentFrame->AddStateBits(savedState);
|
||||
|
||||
NS_WARN_IF_FALSE(parentSize.width != NS_INTRINSICSIZE &&
|
||||
parentSize.height != NS_INTRINSICSIZE,
|
||||
NS_WARN_IF_FALSE(parentSize.ISize(parentWM) != NS_INTRINSICSIZE &&
|
||||
parentSize.BSize(parentWM) != NS_INTRINSICSIZE,
|
||||
"parentSize should be valid");
|
||||
parentReflowState.SetComputedWidth(std::max(parentSize.width, 0));
|
||||
parentReflowState.SetComputedHeight(std::max(parentSize.height, 0));
|
||||
parentReflowState.SetComputedISize(std::max(parentSize.ISize(parentWM), 0));
|
||||
parentReflowState.SetComputedBSize(std::max(parentSize.BSize(parentWM), 0));
|
||||
parentReflowState.ComputedPhysicalMargin().SizeTo(0, 0, 0, 0);
|
||||
|
||||
parentReflowState.ComputedPhysicalPadding() = parentFrame->GetUsedPadding();
|
||||
parentReflowState.ComputedPhysicalBorderPadding() =
|
||||
parentFrame->GetUsedBorderAndPadding();
|
||||
nsSize availSize(parentSize.width, NS_INTRINSICSIZE);
|
||||
LogicalSize availSize = parentSize.ConvertTo(frameWM, parentWM);
|
||||
availSize.BSize(frameWM) = NS_INTRINSICSIZE;
|
||||
|
||||
ViewportFrame* viewport = do_QueryFrame(parentFrame);
|
||||
nsSize cbSize = viewport ?
|
||||
@ -436,8 +439,8 @@ RestyleManager::RecomputePosition(nsIFrame* aFrame)
|
||||
parentReflowState.mStyleBorder->GetComputedBorder();
|
||||
cbSize -= nsSize(parentBorder.LeftRight(), parentBorder.TopBottom());
|
||||
nsHTMLReflowState reflowState(aFrame->PresContext(), parentReflowState,
|
||||
aFrame, availSize, cbSize.width,
|
||||
cbSize.height);
|
||||
aFrame, availSize,
|
||||
cbSize.width, cbSize.height);
|
||||
nsSize computedSize(reflowState.ComputedWidth(), reflowState.ComputedHeight());
|
||||
computedSize.width += reflowState.ComputedPhysicalBorderPadding().LeftRight();
|
||||
if (computedSize.height != NS_INTRINSICSIZE) {
|
||||
|
@ -8772,11 +8772,12 @@ PresShell::DoReflow(nsIFrame* target, bool aInterruptible)
|
||||
// If the target frame is the root of the frame hierarchy, then
|
||||
// use all the available space. If it's simply a `reflow root',
|
||||
// then use the target frame's size as the available space.
|
||||
nsSize size;
|
||||
WritingMode wm = target->GetWritingMode();
|
||||
LogicalSize size(wm);
|
||||
if (target == rootFrame) {
|
||||
size = mPresContext->GetVisibleArea().Size();
|
||||
size = LogicalSize(wm, mPresContext->GetVisibleArea().Size());
|
||||
} else {
|
||||
size = target->GetSize();
|
||||
size = target->GetLogicalSize();
|
||||
}
|
||||
|
||||
NS_ASSERTION(!target->GetNextInFlow() && !target->GetPrevInFlow(),
|
||||
@ -8784,27 +8785,27 @@ PresShell::DoReflow(nsIFrame* target, bool aInterruptible)
|
||||
|
||||
// Don't pass size directly to the reflow state, since a
|
||||
// constrained height implies page/column breaking.
|
||||
nsSize reflowSize(size.width, NS_UNCONSTRAINEDSIZE);
|
||||
LogicalSize reflowSize(wm, size.ISize(wm), NS_UNCONSTRAINEDSIZE);
|
||||
nsHTMLReflowState reflowState(mPresContext, target, rcx, reflowSize,
|
||||
nsHTMLReflowState::CALLER_WILL_INIT);
|
||||
|
||||
if (rootFrame == target) {
|
||||
reflowState.Init(mPresContext);
|
||||
|
||||
// When the root frame is being reflowed with unconstrained height
|
||||
// When the root frame is being reflowed with unconstrained block-size
|
||||
// (which happens when we're called from
|
||||
// nsDocumentViewer::SizeToContent), we're effectively doing a
|
||||
// vertical resize, since it changes the meaning of percentage
|
||||
// heights even if no heights actually changed. The same applies
|
||||
// when we reflow again after that computation. This is an unusual
|
||||
// case, and isn't caught by nsHTMLReflowState::InitResizeFlags.
|
||||
bool hasUnconstrainedHeight = size.height == NS_UNCONSTRAINEDSIZE;
|
||||
// resize in the block direction, since it changes the meaning of
|
||||
// percentage block-sizes even if no block-sizes actually changed.
|
||||
// The same applies when we reflow again after that computation. This is
|
||||
// an unusual case, and isn't caught by nsHTMLReflowState::InitResizeFlags.
|
||||
bool hasUnconstrainedBSize = size.BSize(wm) == NS_UNCONSTRAINEDSIZE;
|
||||
|
||||
if (hasUnconstrainedHeight || mLastRootReflowHadUnconstrainedHeight) {
|
||||
if (hasUnconstrainedBSize || mLastRootReflowHadUnconstrainedBSize) {
|
||||
reflowState.mFlags.mVResize = true;
|
||||
}
|
||||
|
||||
mLastRootReflowHadUnconstrainedHeight = hasUnconstrainedHeight;
|
||||
mLastRootReflowHadUnconstrainedBSize = hasUnconstrainedBSize;
|
||||
} else {
|
||||
// Initialize reflow state with current used border and padding,
|
||||
// in case this was set specially by the parent frame when the reflow root
|
||||
@ -8817,16 +8818,16 @@ PresShell::DoReflow(nsIFrame* target, bool aInterruptible)
|
||||
// fix the computed height
|
||||
NS_ASSERTION(reflowState.ComputedPhysicalMargin() == nsMargin(0, 0, 0, 0),
|
||||
"reflow state should not set margin for reflow roots");
|
||||
if (size.height != NS_UNCONSTRAINEDSIZE) {
|
||||
nscoord computedHeight =
|
||||
size.height - reflowState.ComputedPhysicalBorderPadding().TopBottom();
|
||||
computedHeight = std::max(computedHeight, 0);
|
||||
reflowState.SetComputedHeight(computedHeight);
|
||||
if (size.BSize(wm) != NS_UNCONSTRAINEDSIZE) {
|
||||
nscoord computedBSize =
|
||||
size.BSize(wm) - reflowState.ComputedLogicalBorderPadding().BStartEnd(wm);
|
||||
computedBSize = std::max(computedBSize, 0);
|
||||
reflowState.SetComputedBSize(computedBSize);
|
||||
}
|
||||
NS_ASSERTION(reflowState.ComputedWidth() ==
|
||||
size.width -
|
||||
reflowState.ComputedPhysicalBorderPadding().LeftRight(),
|
||||
"reflow state computed incorrect width");
|
||||
NS_ASSERTION(reflowState.ComputedISize() ==
|
||||
size.ISize(wm) -
|
||||
reflowState.ComputedLogicalBorderPadding().IStartEnd(wm),
|
||||
"reflow state computed incorrect inline size");
|
||||
|
||||
mPresContext->ReflowStarted(aInterruptible);
|
||||
mIsReflowing = true;
|
||||
@ -8840,9 +8841,11 @@ PresShell::DoReflow(nsIFrame* target, bool aInterruptible)
|
||||
// initiated at the root, then the size better not change unless its
|
||||
// height was unconstrained to start with.
|
||||
nsRect boundsRelativeToTarget = nsRect(0, 0, desiredSize.Width(), desiredSize.Height());
|
||||
NS_ASSERTION((target == rootFrame && size.height == NS_UNCONSTRAINEDSIZE) ||
|
||||
(desiredSize.Width() == size.width &&
|
||||
desiredSize.Height() == size.height),
|
||||
DebugOnly<nsSize> physicalSize = size.GetPhysicalSize(wm);
|
||||
NS_ASSERTION((target == rootFrame &&
|
||||
size.BSize(wm) == NS_UNCONSTRAINEDSIZE) ||
|
||||
(desiredSize.Width() == nsSize(physicalSize).width &&
|
||||
desiredSize.Height() == nsSize(physicalSize).height),
|
||||
"non-root frame's desired size changed during an "
|
||||
"incremental reflow");
|
||||
NS_ASSERTION(target == rootFrame ||
|
||||
@ -8867,7 +8870,7 @@ PresShell::DoReflow(nsIFrame* target, bool aInterruptible)
|
||||
target->GetView(), rcx);
|
||||
|
||||
target->DidReflow(mPresContext, nullptr, nsDidReflowStatus::FINISHED);
|
||||
if (target == rootFrame && size.height == NS_UNCONSTRAINEDSIZE) {
|
||||
if (target == rootFrame && size.BSize(wm) == NS_UNCONSTRAINEDSIZE) {
|
||||
mPresContext->SetVisibleArea(boundsRelativeToTarget);
|
||||
}
|
||||
|
||||
|
@ -822,7 +822,7 @@ protected:
|
||||
bool mIgnoreFrameDestruction : 1;
|
||||
bool mHaveShutDown : 1;
|
||||
bool mViewportOverridden : 1;
|
||||
bool mLastRootReflowHadUnconstrainedHeight : 1;
|
||||
bool mLastRootReflowHadUnconstrainedBSize : 1;
|
||||
bool mNoDelayedMouseEvents : 1;
|
||||
bool mNoDelayedKeyEvents : 1;
|
||||
|
||||
|
@ -416,7 +416,9 @@ nsComboboxControlFrame::ReflowDropdown(nsPresContext* aPresContext,
|
||||
// XXXbz this will, for small-height dropdowns, have extra space on the right
|
||||
// edge for the scrollbar we don't show... but that's the best we can do here
|
||||
// for now.
|
||||
nsSize availSize(aReflowState.AvailableWidth(), NS_UNCONSTRAINEDSIZE);
|
||||
WritingMode wm = mDropdownFrame->GetWritingMode();
|
||||
LogicalSize availSize = aReflowState.AvailableSize(wm);
|
||||
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
|
||||
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, mDropdownFrame,
|
||||
availSize);
|
||||
|
||||
|
@ -367,20 +367,24 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
|
||||
// need logic here to push and pull overflow frames.
|
||||
// Since we're not applying our padding in this frame, we need to add it here
|
||||
// to compute the available width for our children.
|
||||
nsSize availSize(aReflowState.ComputedWidth() + aReflowState.ComputedPhysicalPadding().LeftRight(),
|
||||
NS_UNCONSTRAINEDSIZE);
|
||||
WritingMode innerWM = inner ? inner->GetWritingMode() : GetWritingMode();
|
||||
WritingMode legendWM = legend ? legend->GetWritingMode() : GetWritingMode();
|
||||
LogicalSize innerAvailSize = aReflowState.ComputedSizeWithPadding(innerWM);
|
||||
LogicalSize legendAvailSize = aReflowState.ComputedSizeWithPadding(legendWM);
|
||||
innerAvailSize.BSize(innerWM) = legendAvailSize.BSize(legendWM) =
|
||||
NS_UNCONSTRAINEDSIZE;
|
||||
NS_ASSERTION(!inner ||
|
||||
nsLayoutUtils::IntrinsicForContainer(aReflowState.rendContext,
|
||||
inner,
|
||||
nsLayoutUtils::MIN_WIDTH) <=
|
||||
availSize.width,
|
||||
"Bogus availSize.width; should be bigger");
|
||||
innerAvailSize.ISize(innerWM),
|
||||
"Bogus availSize.ISize; should be bigger");
|
||||
NS_ASSERTION(!legend ||
|
||||
nsLayoutUtils::IntrinsicForContainer(aReflowState.rendContext,
|
||||
legend,
|
||||
nsLayoutUtils::MIN_WIDTH) <=
|
||||
availSize.width,
|
||||
"Bogus availSize.width; should be bigger");
|
||||
legendAvailSize.ISize(legendWM),
|
||||
"Bogus availSize.ISize; should be bigger");
|
||||
|
||||
// get our border and padding
|
||||
nsMargin border = aReflowState.ComputedPhysicalBorderPadding() - aReflowState.ComputedPhysicalPadding();
|
||||
@ -391,7 +395,8 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
|
||||
// reflow the legend only if needed
|
||||
Maybe<nsHTMLReflowState> legendReflowState;
|
||||
if (legend) {
|
||||
legendReflowState.construct(aPresContext, aReflowState, legend, availSize);
|
||||
legendReflowState.construct(aPresContext, aReflowState, legend,
|
||||
legendAvailSize);
|
||||
}
|
||||
if (reflowLegend) {
|
||||
nsHTMLReflowMetrics legendDesiredSize(aReflowState);
|
||||
@ -437,7 +442,8 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
|
||||
// reflow the content frame only if needed
|
||||
if (reflowInner) {
|
||||
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, inner,
|
||||
availSize, -1, -1, nsHTMLReflowState::CALLER_WILL_INIT);
|
||||
innerAvailSize, -1, -1,
|
||||
nsHTMLReflowState::CALLER_WILL_INIT);
|
||||
// Override computed padding, in case it's percentage padding
|
||||
kidReflowState.Init(aPresContext, -1, -1, nullptr,
|
||||
&aReflowState.ComputedPhysicalPadding());
|
||||
@ -473,22 +479,25 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
|
||||
NS_FRAME_TRACE_REFLOW_OUT("FieldSet::Reflow", aStatus);
|
||||
}
|
||||
|
||||
nsRect contentRect;
|
||||
LogicalRect contentRect(innerWM);
|
||||
if (inner) {
|
||||
// We don't support margins on inner, so our content rect is just the
|
||||
// inner's border-box.
|
||||
contentRect = inner->GetRect();
|
||||
contentRect = inner->GetLogicalRect(aReflowState.ComputedWidth());
|
||||
}
|
||||
|
||||
// Our content rect must fill up the available width
|
||||
if (availSize.width > contentRect.width) {
|
||||
contentRect.width = availSize.width;
|
||||
if (innerAvailSize.ISize(innerWM) > contentRect.ISize(innerWM)) {
|
||||
contentRect.ISize(innerWM) = innerAvailSize.ISize(innerWM);
|
||||
}
|
||||
|
||||
//XXX temporary!
|
||||
nsRect physicalContentRect =
|
||||
contentRect.GetPhysicalRect(innerWM, aReflowState.ComputedWidth());
|
||||
if (legend) {
|
||||
// the legend is postioned horizontally within the inner's content rect
|
||||
// (so that padding on the fieldset affects the legend position).
|
||||
nsRect innerContentRect = contentRect;
|
||||
nsRect innerContentRect = physicalContentRect;
|
||||
innerContentRect.Deflate(aReflowState.ComputedPhysicalPadding());
|
||||
// if the inner content rect is larger than the legend, we can align the legend
|
||||
if (innerContentRect.width > mLegendRect.width) {
|
||||
@ -511,7 +520,8 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
|
||||
// otherwise make place for the legend
|
||||
mLegendRect.x = innerContentRect.x;
|
||||
innerContentRect.width = mLegendRect.width;
|
||||
contentRect.width = mLegendRect.width + aReflowState.ComputedPhysicalPadding().LeftRight();
|
||||
physicalContentRect.width = mLegendRect.width +
|
||||
aReflowState.ComputedPhysicalPadding().LeftRight();
|
||||
}
|
||||
|
||||
// place the legend
|
||||
@ -527,7 +537,7 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
|
||||
// Return our size and our result.
|
||||
aDesiredSize.Height() = mLegendSpace + border.TopBottom() +
|
||||
(inner ? inner->GetRect().height : 0);
|
||||
aDesiredSize.Width() = contentRect.width + border.LeftRight();
|
||||
aDesiredSize.Width() = physicalContentRect.width + border.LeftRight();
|
||||
aDesiredSize.SetOverflowAreasToDesiredBounds();
|
||||
if (legend)
|
||||
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, legend);
|
||||
|
@ -244,12 +244,14 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
|
||||
// which occupies part of the button's content-box area:
|
||||
const nsMargin focusPadding = mRenderer.GetAddedButtonBorderAndPadding();
|
||||
|
||||
nsSize availSize(aButtonReflowState.ComputedWidth(), NS_INTRINSICSIZE);
|
||||
WritingMode wm = aFirstKid->GetWritingMode();
|
||||
LogicalSize availSize = aButtonReflowState.ComputedSize(GetWritingMode());
|
||||
availSize.BSize(wm) = NS_INTRINSICSIZE;
|
||||
|
||||
// Indent the child inside us by the focus border. We must do this separate
|
||||
// from the regular border.
|
||||
availSize.width -= focusPadding.LeftRight();
|
||||
|
||||
availSize.ISize(wm) -= LogicalMargin(wm, focusPadding).IStartEnd(wm);
|
||||
|
||||
// See whether out availSize's width is big enough. If it's smaller than our
|
||||
// intrinsic min width, that means that the kid wouldn't really fit; for a
|
||||
// better look in such cases we adjust the available width and our left
|
||||
@ -262,15 +264,15 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
|
||||
nscoord extraleft = extrawidth / 2;
|
||||
nscoord extraright = extrawidth - extraleft;
|
||||
NS_ASSERTION(extraright >=0, "How'd that happen?");
|
||||
|
||||
|
||||
// Do not allow the extras to be bigger than the relevant padding
|
||||
extraleft = std::min(extraleft, aButtonReflowState.ComputedPhysicalPadding().left);
|
||||
extraright = std::min(extraright, aButtonReflowState.ComputedPhysicalPadding().right);
|
||||
xoffset -= extraleft;
|
||||
availSize.width += extraleft + extraright;
|
||||
availSize.SetWidth(wm, availSize.Width(wm) + extraleft + extraright);
|
||||
}
|
||||
availSize.width = std::max(availSize.width,0);
|
||||
|
||||
availSize.SetWidth(wm, std::max(availSize.Width(wm), 0));
|
||||
|
||||
// Give child a clone of the button's reflow state, with height/width reduced
|
||||
// by focusPadding, so that descendants with height:100% don't protrude.
|
||||
nsHTMLReflowState adjustedButtonReflowState =
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "nsThemeConstants.h"
|
||||
#include <algorithm>
|
||||
|
||||
using namespace mozilla;
|
||||
using mozilla::dom::Element;
|
||||
using mozilla::dom::HTMLMeterElement;
|
||||
|
||||
@ -134,9 +135,11 @@ nsMeterFrame::ReflowBarFrame(nsIFrame* aBarFrame,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
bool vertical = StyleDisplay()->mOrient == NS_STYLE_ORIENT_VERTICAL;
|
||||
nsHTMLReflowState reflowState(aPresContext, aReflowState, aBarFrame,
|
||||
nsSize(aReflowState.ComputedWidth(),
|
||||
NS_UNCONSTRAINEDSIZE));
|
||||
WritingMode wm = aBarFrame->GetWritingMode();
|
||||
LogicalSize availSize = aReflowState.ComputedSize(wm);
|
||||
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
|
||||
nsHTMLReflowState reflowState(aPresContext, aReflowState,
|
||||
aBarFrame, availSize);
|
||||
nscoord size = vertical ? aReflowState.ComputedHeight()
|
||||
: aReflowState.ComputedWidth();
|
||||
nscoord xoffset = aReflowState.ComputedPhysicalBorderPadding().left;
|
||||
|
@ -137,10 +137,12 @@ nsNumberControlFrame::Reflow(nsPresContext* aPresContext,
|
||||
|
||||
nsHTMLReflowMetrics wrappersDesiredSize(aReflowState);
|
||||
|
||||
WritingMode wm = outerWrapperFrame->GetWritingMode();
|
||||
LogicalSize availSize = aReflowState.ComputedSize(wm);
|
||||
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
|
||||
|
||||
nsHTMLReflowState wrapperReflowState(aPresContext, aReflowState,
|
||||
outerWrapperFrame,
|
||||
nsSize(contentBoxWidth,
|
||||
NS_UNCONSTRAINEDSIZE));
|
||||
outerWrapperFrame, availSize);
|
||||
|
||||
// offsets of wrapper frame
|
||||
nscoord xoffset = aReflowState.ComputedPhysicalBorderPadding().left +
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "nsThemeConstants.h"
|
||||
#include <algorithm>
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
nsIFrame*
|
||||
@ -139,9 +140,11 @@ nsProgressFrame::ReflowBarFrame(nsIFrame* aBarFrame,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
bool vertical = StyleDisplay()->mOrient == NS_STYLE_ORIENT_VERTICAL;
|
||||
nsHTMLReflowState reflowState(aPresContext, aReflowState, aBarFrame,
|
||||
nsSize(aReflowState.ComputedWidth(),
|
||||
NS_UNCONSTRAINEDSIZE));
|
||||
WritingMode wm = aBarFrame->GetWritingMode();
|
||||
LogicalSize availSize = aReflowState.ComputedSize(wm);
|
||||
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
|
||||
nsHTMLReflowState reflowState(aPresContext, aReflowState,
|
||||
aBarFrame, availSize);
|
||||
nscoord size = vertical ? aReflowState.ComputedHeight()
|
||||
: aReflowState.ComputedWidth();
|
||||
nscoord xoffset = aReflowState.ComputedPhysicalBorderPadding().left;
|
||||
|
@ -343,9 +343,11 @@ nsRangeFrame::ReflowAnonymousContent(nsPresContext* aPresContext,
|
||||
// of the track's border box on the center of the nsRangeFrame's content
|
||||
// box.
|
||||
|
||||
nsHTMLReflowState trackReflowState(aPresContext, aReflowState, trackFrame,
|
||||
nsSize(aReflowState.ComputedWidth(),
|
||||
NS_UNCONSTRAINEDSIZE));
|
||||
WritingMode wm = trackFrame->GetWritingMode();
|
||||
LogicalSize availSize = aReflowState.ComputedSize(wm);
|
||||
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
|
||||
nsHTMLReflowState trackReflowState(aPresContext, aReflowState,
|
||||
trackFrame, availSize);
|
||||
|
||||
// Find the x/y position of the track frame such that it will be positioned
|
||||
// as described above. These coordinates are with respect to the
|
||||
@ -376,9 +378,11 @@ nsRangeFrame::ReflowAnonymousContent(nsPresContext* aPresContext,
|
||||
nsIFrame* thumbFrame = mThumbDiv->GetPrimaryFrame();
|
||||
|
||||
if (thumbFrame) { // display:none?
|
||||
nsHTMLReflowState thumbReflowState(aPresContext, aReflowState, thumbFrame,
|
||||
nsSize(aReflowState.ComputedWidth(),
|
||||
NS_UNCONSTRAINEDSIZE));
|
||||
WritingMode wm = thumbFrame->GetWritingMode();
|
||||
LogicalSize availSize = aReflowState.ComputedSize(wm);
|
||||
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
|
||||
nsHTMLReflowState thumbReflowState(aPresContext, aReflowState,
|
||||
thumbFrame, availSize);
|
||||
|
||||
// Where we position the thumb depends on its size, so we first reflow
|
||||
// the thumb at {0,0} to obtain its size, then position it afterwards.
|
||||
@ -398,10 +402,11 @@ nsRangeFrame::ReflowAnonymousContent(nsPresContext* aPresContext,
|
||||
nsIFrame* rangeProgressFrame = mProgressDiv->GetPrimaryFrame();
|
||||
|
||||
if (rangeProgressFrame) { // display:none?
|
||||
WritingMode wm = rangeProgressFrame->GetWritingMode();
|
||||
LogicalSize availSize = aReflowState.ComputedSize(wm);
|
||||
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
|
||||
nsHTMLReflowState progressReflowState(aPresContext, aReflowState,
|
||||
rangeProgressFrame,
|
||||
nsSize(aReflowState.ComputedWidth(),
|
||||
NS_UNCONSTRAINEDSIZE));
|
||||
rangeProgressFrame, availSize);
|
||||
|
||||
// We first reflow the range-progress frame at {0,0} to obtain its
|
||||
// unadjusted dimensions, then we adjust it to so that the appropriate edge
|
||||
|
@ -521,12 +521,13 @@ nsTextControlFrame::ReflowTextControlChild(nsIFrame* aKid,
|
||||
nsHTMLReflowMetrics& aParentDesiredSize)
|
||||
{
|
||||
// compute available size and frame offsets for child
|
||||
nsSize availSize(aReflowState.ComputedWidth() +
|
||||
aReflowState.ComputedPhysicalPadding().LeftRight(),
|
||||
NS_UNCONSTRAINEDSIZE);
|
||||
WritingMode wm = aKid->GetWritingMode();
|
||||
LogicalSize availSize = aReflowState.ComputedSizeWithPadding(wm);
|
||||
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
|
||||
|
||||
nsHTMLReflowState kidReflowState(aPresContext, aReflowState,
|
||||
aKid, availSize, -1, -1, nsHTMLReflowState::CALLER_WILL_INIT);
|
||||
aKid, availSize, -1, -1,
|
||||
nsHTMLReflowState::CALLER_WILL_INIT);
|
||||
// Override padding with our computed padding in case we got it from theming or percentage
|
||||
kidReflowState.Init(aPresContext, -1, -1, nullptr, &aReflowState.ComputedPhysicalPadding());
|
||||
|
||||
|
@ -34,6 +34,8 @@ static void PrettyUC(nscoord aSize, char* aBuf)
|
||||
}
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
void
|
||||
nsAbsoluteContainingBlock::SetInitialChildList(nsIFrame* aDelegatingFrame,
|
||||
ChildListID aListID,
|
||||
@ -367,17 +369,20 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
|
||||
AutoNoisyIndenter indent(nsBlockFrame::gNoisy);
|
||||
#endif // DEBUG
|
||||
|
||||
nscoord availWidth = aContainingBlock.width;
|
||||
if (availWidth == -1) {
|
||||
NS_ASSERTION(aReflowState.ComputedWidth() != NS_UNCONSTRAINEDSIZE,
|
||||
"Must have a useful width _somewhere_");
|
||||
availWidth =
|
||||
aReflowState.ComputedWidth() + aReflowState.ComputedPhysicalPadding().LeftRight();
|
||||
WritingMode wm = aKidFrame->GetWritingMode();
|
||||
nscoord availISize = LogicalSize(wm, aContainingBlock.Size()).ISize(wm);
|
||||
if (availISize == -1) {
|
||||
NS_ASSERTION(aReflowState.ComputedSize(wm).ISize(wm) !=
|
||||
NS_UNCONSTRAINEDSIZE,
|
||||
"Must have a useful inline-size _somewhere_");
|
||||
availISize =
|
||||
aReflowState.ComputedSizeWithPadding(wm).ISize(wm);
|
||||
}
|
||||
|
||||
nsHTMLReflowMetrics kidDesiredSize(aReflowState);
|
||||
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, aKidFrame,
|
||||
nsSize(availWidth, NS_UNCONSTRAINEDSIZE),
|
||||
LogicalSize(wm, availISize,
|
||||
NS_UNCONSTRAINEDSIZE),
|
||||
aContainingBlock.width,
|
||||
aContainingBlock.height);
|
||||
|
||||
|
@ -3034,10 +3034,9 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
||||
// on the childs available space.
|
||||
// XXX building a complete nsHTMLReflowState just to get the margin-top
|
||||
// seems like a waste. And we do this for almost every block!
|
||||
nsSize availSpace =
|
||||
LogicalSize(aState.mReflowState.GetWritingMode(),
|
||||
aState.ContentISize(), NS_UNCONSTRAINEDSIZE).
|
||||
GetPhysicalSize(aState.mReflowState.GetWritingMode());
|
||||
WritingMode wm = frame->GetWritingMode();
|
||||
LogicalSize availSpace = aState.ContentSize(wm);
|
||||
availSpace.BSize(wm) = NS_UNCONSTRAINEDSIZE;
|
||||
nsHTMLReflowState reflowState(aState.mPresContext, aState.mReflowState,
|
||||
frame, availSpace);
|
||||
|
||||
@ -3179,8 +3178,9 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
||||
// Reflow the block into the available space
|
||||
// construct the html reflow state for the block. ReflowBlock
|
||||
// will initialize it
|
||||
nsHTMLReflowState blockHtmlRS(aState.mPresContext, aState.mReflowState, frame,
|
||||
availSpace.Size());
|
||||
nsHTMLReflowState
|
||||
blockHtmlRS(aState.mPresContext, aState.mReflowState, frame,
|
||||
LogicalSize(frame->GetWritingMode(), availSpace.Size()));
|
||||
blockHtmlRS.mFlags.mHasClearance = aLine->HasClearance();
|
||||
|
||||
nsFloatManager::SavedState floatManagerState;
|
||||
@ -3219,7 +3219,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
||||
#if defined(REFLOW_STATUS_COVERAGE)
|
||||
RecordReflowStatus(true, frameReflowStatus);
|
||||
#endif
|
||||
|
||||
|
||||
if (NS_INLINE_IS_BREAK_BEFORE(frameReflowStatus)) {
|
||||
// None of the child block fits.
|
||||
*aKeepReflowGoing = false;
|
||||
@ -3232,7 +3232,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
||||
}
|
||||
else {
|
||||
// Note: line-break-after a block is a nop
|
||||
|
||||
|
||||
// Try to place the child block.
|
||||
// Don't force the block to fit if we have positive clearance, because
|
||||
// pushing it to the next page would give it more room.
|
||||
@ -5769,8 +5769,10 @@ nsBlockFrame::ComputeFloatWidth(nsBlockReflowState& aState,
|
||||
nsRect availSpace = AdjustFloatAvailableSpace(aState, aFloatAvailableSpace,
|
||||
aFloat);
|
||||
|
||||
nsHTMLReflowState floatRS(aState.mPresContext, aState.mReflowState, aFloat,
|
||||
availSpace.Size());
|
||||
WritingMode wm = aFloat->GetWritingMode();
|
||||
nsHTMLReflowState floatRS(aState.mPresContext, aState.mReflowState, aFloat,
|
||||
LogicalSize(wm, availSpace.Size()));
|
||||
|
||||
return floatRS.ComputedWidth() + floatRS.ComputedPhysicalBorderPadding().LeftRight() +
|
||||
floatRS.ComputedPhysicalMargin().LeftRight();
|
||||
}
|
||||
@ -5797,9 +5799,10 @@ nsBlockFrame::ReflowFloat(nsBlockReflowState& aState,
|
||||
);
|
||||
#endif
|
||||
|
||||
nsHTMLReflowState floatRS(aState.mPresContext, aState.mReflowState, aFloat,
|
||||
nsSize(aAdjustedAvailableSpace.width,
|
||||
aAdjustedAvailableSpace.height));
|
||||
nsHTMLReflowState
|
||||
floatRS(aState.mPresContext, aState.mReflowState, aFloat,
|
||||
LogicalSize(aFloat->GetWritingMode(),
|
||||
aAdjustedAvailableSpace.Size()));
|
||||
|
||||
// Normally the mIsTopOfPage state is copied from the parent reflow
|
||||
// state. However, when reflowing a float, if we've placed other
|
||||
@ -6797,10 +6800,11 @@ nsBlockFrame::ReflowBullet(nsIFrame* aBulletFrame,
|
||||
const nsHTMLReflowState &rs = aState.mReflowState;
|
||||
|
||||
// Reflow the bullet now
|
||||
nsSize availSize;
|
||||
// Make up a width since it doesn't really matter (XXX).
|
||||
availSize.width = aState.ContentISize();
|
||||
availSize.height = NS_UNCONSTRAINEDSIZE;
|
||||
WritingMode bulletWM = aBulletFrame->GetWritingMode();
|
||||
LogicalSize availSize(bulletWM);
|
||||
// Make up an inline-size since it doesn't really matter (XXX).
|
||||
availSize.ISize(bulletWM) = aState.ContentISize();
|
||||
availSize.BSize(bulletWM) = NS_UNCONSTRAINEDSIZE;
|
||||
|
||||
// Get the reason right.
|
||||
// XXXwaterson Should this look just like the logic in
|
||||
@ -6840,7 +6844,6 @@ nsBlockFrame::ReflowBullet(nsIFrame* aBulletFrame,
|
||||
LogicalRect logicalFAS(wm, floatAvailSpace, containerWidth);
|
||||
// Get the bullet's margin, converted to our writing mode so that we can
|
||||
// combine it with other logical values here.
|
||||
WritingMode bulletWM = reflowState.GetWritingMode();
|
||||
LogicalMargin bulletMargin =
|
||||
reflowState.ComputedLogicalMargin().ConvertTo(wm, bulletWM);
|
||||
nscoord iStart = logicalFAS.IStart(wm) -
|
||||
@ -7029,7 +7032,8 @@ nsBlockFrame::WidthToClearPastFloats(nsBlockReflowState& aState,
|
||||
// All we really need here is the result of ComputeSize, and we
|
||||
// could *almost* get that from an nsCSSOffsetState, except for the
|
||||
// last argument.
|
||||
nsSize availSpace(availWidth, NS_UNCONSTRAINEDSIZE);
|
||||
LogicalSize availSpace(aFrame->GetWritingMode(),
|
||||
nsSize(availWidth, NS_UNCONSTRAINEDSIZE));
|
||||
nsHTMLReflowState reflowState(aState.mPresContext, aState.mReflowState,
|
||||
aFrame, availSpace);
|
||||
result.borderBoxWidth = reflowState.ComputedWidth() +
|
||||
|
@ -144,13 +144,13 @@ nsBlockReflowContext::ComputeCollapsedBStartMargin(const nsHTMLReflowState& aRS,
|
||||
if (frame != aRS.frame) {
|
||||
NS_ASSERTION(frame->GetParent() == aRS.frame,
|
||||
"Can only drill through one level of block wrapper");
|
||||
nsSize availSpace(aRS.ComputedWidth(), aRS.ComputedHeight());
|
||||
LogicalSize availSpace = aRS.ComputedSize(frame->GetWritingMode());
|
||||
outerReflowState = new nsHTMLReflowState(prescontext,
|
||||
aRS, frame, availSpace);
|
||||
}
|
||||
{
|
||||
nsSize availSpace(outerReflowState->ComputedWidth(),
|
||||
outerReflowState->ComputedHeight());
|
||||
LogicalSize availSpace =
|
||||
outerReflowState->ComputedSize(kid->GetWritingMode());
|
||||
nsHTMLReflowState innerReflowState(prescontext,
|
||||
*outerReflowState, kid,
|
||||
availSpace);
|
||||
|
@ -198,6 +198,10 @@ public:
|
||||
nscoord ContentBEnd() const {
|
||||
return mContentArea.BEnd(mReflowState.GetWritingMode());
|
||||
}
|
||||
mozilla::LogicalSize ContentSize(mozilla::WritingMode aWM) const {
|
||||
mozilla::WritingMode wm = mReflowState.GetWritingMode();
|
||||
return mContentArea.Size(wm).ConvertTo(aWM, wm);
|
||||
}
|
||||
nscoord mContainerWidth;
|
||||
|
||||
// Continuation out-of-flow float frames that need to move to our
|
||||
|
@ -539,9 +539,9 @@ nsCanvasFrame::Reflow(nsPresContext* aPresContext,
|
||||
nsIFrame* kidFrame = mFrames.FirstChild();
|
||||
bool kidDirty = (kidFrame->GetStateBits() & NS_FRAME_IS_DIRTY) != 0;
|
||||
|
||||
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, kidFrame,
|
||||
nsSize(aReflowState.AvailableWidth(),
|
||||
aReflowState.AvailableHeight()));
|
||||
nsHTMLReflowState
|
||||
kidReflowState(aPresContext, aReflowState, kidFrame,
|
||||
aReflowState.AvailableSize(kidFrame->GetWritingMode()));
|
||||
|
||||
if (aReflowState.mFlags.mVResize &&
|
||||
(kidFrame->GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_HEIGHT)) {
|
||||
|
@ -517,18 +517,20 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize,
|
||||
columnCount, (void*)child, skipIncremental, skipResizeHeightShrink, aStatus);
|
||||
#endif
|
||||
} else {
|
||||
nsSize availSize(aConfig.mColWidth, aConfig.mColMaxHeight);
|
||||
|
||||
nsSize physicalSize(aConfig.mColWidth, aConfig.mColMaxHeight);
|
||||
|
||||
if (aUnboundedLastColumn && columnCount == aConfig.mBalanceColCount - 1) {
|
||||
availSize.height = GetAvailableContentHeight(aReflowState);
|
||||
physicalSize.height = GetAvailableContentHeight(aReflowState);
|
||||
}
|
||||
LogicalSize availSize(wm, physicalSize);
|
||||
LogicalSize computedSize = aReflowState.ComputedSize(wm);
|
||||
|
||||
if (reflowNext)
|
||||
child->AddStateBits(NS_FRAME_IS_DIRTY);
|
||||
|
||||
nsHTMLReflowState kidReflowState(PresContext(), aReflowState, child,
|
||||
availSize, availSize.width,
|
||||
aReflowState.ComputedHeight());
|
||||
availSize, availSize.ISize(wm),
|
||||
computedSize.BSize(wm));
|
||||
kidReflowState.mFlags.mIsTopOfPage = true;
|
||||
kidReflowState.mFlags.mTableIsSplittable = false;
|
||||
kidReflowState.mFlags.mIsColumnBalancing = aConfig.mBalanceColCount < INT32_MAX;
|
||||
@ -539,7 +541,7 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize,
|
||||
|
||||
#ifdef DEBUG_roc
|
||||
printf("*** Reflowing child #%d %p: availHeight=%d\n",
|
||||
columnCount, (void*)child,availSize.height);
|
||||
columnCount, (void*)child,availSize.BSize(wm));
|
||||
#endif
|
||||
|
||||
// Note if the column's next in flow is not being changed by this incremental reflow.
|
||||
@ -549,7 +551,7 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize,
|
||||
!(child->GetNextSibling()->GetStateBits() & NS_FRAME_IS_DIRTY)) {
|
||||
kidReflowState.mFlags.mNextInFlowUntouched = true;
|
||||
}
|
||||
|
||||
|
||||
nsHTMLReflowMetrics kidDesiredSize(wm, aDesiredSize.mFlags);
|
||||
|
||||
// XXX it would be cool to consult the float manager for the
|
||||
@ -584,7 +586,7 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize,
|
||||
if (childContentBEnd > aConfig.mColMaxHeight) {
|
||||
allFit = false;
|
||||
}
|
||||
if (childContentBEnd > availSize.height) {
|
||||
if (childContentBEnd > availSize.BSize(wm)) {
|
||||
aColData.mMaxOverflowingHeight = std::max(childContentBEnd,
|
||||
aColData.mMaxOverflowingHeight);
|
||||
}
|
||||
|
@ -1113,7 +1113,9 @@ nsContainerFrame::ReflowOverflowContainerChildren(nsPresContext* aPres
|
||||
nsRect prevRect = prevInFlow->GetRect();
|
||||
|
||||
// Initialize reflow params
|
||||
nsSize availSpace(prevRect.width, aReflowState.AvailableHeight());
|
||||
WritingMode wm = frame->GetWritingMode();
|
||||
LogicalSize availSpace(wm, LogicalSize(wm, prevRect.Size()).ISize(wm),
|
||||
aReflowState.AvailableSize(wm).BSize(wm));
|
||||
nsHTMLReflowMetrics desiredSize(aReflowState);
|
||||
nsHTMLReflowState frameState(aPresContext, aReflowState,
|
||||
frame, availSpace);
|
||||
|
@ -169,15 +169,14 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
|
||||
nsIFrame* kid = mFrames.FirstChild();
|
||||
|
||||
// Setup reflow state for our child
|
||||
nsSize availSize(aReflowState.AvailableWidth(), aReflowState.AvailableHeight());
|
||||
const nsMargin& bp = aReflowState.ComputedPhysicalBorderPadding();
|
||||
nscoord lr = bp.left + bp.right;
|
||||
nscoord tb = bp.top + bp.bottom;
|
||||
NS_ASSERTION(availSize.width != NS_UNCONSTRAINEDSIZE,
|
||||
"should no longer use unconstrained widths");
|
||||
availSize.width -= lr;
|
||||
if (NS_UNCONSTRAINEDSIZE != availSize.height) {
|
||||
availSize.height -= tb;
|
||||
WritingMode wm = aReflowState.GetWritingMode();
|
||||
LogicalSize availSize = aReflowState.AvailableSize();
|
||||
const LogicalMargin& bp = aReflowState.ComputedLogicalBorderPadding();
|
||||
NS_ASSERTION(availSize.ISize(wm) != NS_UNCONSTRAINEDSIZE,
|
||||
"should no longer use unconstrained inline size");
|
||||
availSize.ISize(wm) -= bp.IStartEnd(wm);
|
||||
if (NS_UNCONSTRAINEDSIZE != availSize.BSize(wm)) {
|
||||
availSize.BSize(wm) -= bp.BStartEnd(wm);
|
||||
}
|
||||
|
||||
// Reflow the child
|
||||
@ -185,12 +184,14 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
|
||||
// When there is no lineLayout provided, we provide our own. The
|
||||
// only time that the first-letter-frame is not reflowing in a
|
||||
// line context is when its floating.
|
||||
nsHTMLReflowState rs(aPresContext, aReflowState, kid, availSize);
|
||||
WritingMode kidWritingMode = GetWritingMode(kid);
|
||||
LogicalSize kidAvailSize = availSize.ConvertTo(kidWritingMode, wm);
|
||||
nsHTMLReflowState rs(aPresContext, aReflowState, kid, kidAvailSize);
|
||||
nsLineLayout ll(aPresContext, nullptr, &aReflowState, nullptr);
|
||||
|
||||
ll.BeginLineReflow(bp.left, bp.top, availSize.width, NS_UNCONSTRAINEDSIZE,
|
||||
false, true,
|
||||
ll.LineContainerFrame()->GetWritingMode(kid),
|
||||
ll.BeginLineReflow(bp.IStart(wm), bp.BStart(wm),
|
||||
availSize.ISize(wm), NS_UNCONSTRAINEDSIZE,
|
||||
false, true, kidWritingMode,
|
||||
aReflowState.AvailableWidth());
|
||||
rs.mLineLayout = ≪
|
||||
ll.SetInFirstLetter(true);
|
||||
@ -213,20 +214,25 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
|
||||
|
||||
ll->SetInFirstLetter(
|
||||
mStyleContext->GetPseudo() == nsCSSPseudoElements::firstLetter);
|
||||
ll->BeginSpan(this, &aReflowState, bp.left, availSize.width, &mBaseline);
|
||||
ll->BeginSpan(this, &aReflowState, bp.IStart(wm),
|
||||
availSize.ISize(wm), &mBaseline);
|
||||
ll->ReflowFrame(kid, aReflowStatus, &aMetrics, pushedFrame);
|
||||
ll->EndSpan(this);
|
||||
ll->SetInFirstLetter(false);
|
||||
}
|
||||
|
||||
// Place and size the child and update the output metrics
|
||||
kid->SetRect(nsRect(bp.left, bp.top, aMetrics.Width(), aMetrics.Height()));
|
||||
LogicalSize convertedSize(wm, nsSize(aMetrics.Width(), aMetrics.Height()));
|
||||
kid->SetRect(nsRect(bp.IStart(wm), bp.BStart(wm),
|
||||
convertedSize.ISize(wm), convertedSize.BSize(wm)));
|
||||
kid->FinishAndStoreOverflow(&aMetrics);
|
||||
kid->DidReflow(aPresContext, nullptr, nsDidReflowStatus::FINISHED);
|
||||
|
||||
aMetrics.Width() += lr;
|
||||
aMetrics.Height() += tb;
|
||||
aMetrics.SetBlockStartAscent(aMetrics.BlockStartAscent() + bp.top);
|
||||
convertedSize.ISize(wm) += bp.IStartEnd(wm);
|
||||
convertedSize.BSize(wm) += bp.BStartEnd(wm);
|
||||
aMetrics.SetSize(wm, convertedSize);
|
||||
aMetrics.SetBlockStartAscent(aMetrics.BlockStartAscent() +
|
||||
bp.BStart(wm));
|
||||
|
||||
// Ensure that the overflow rect contains the child textframe's overflow rect.
|
||||
// Note that if this is floating, the overline/underline drawable area is in
|
||||
|
@ -959,9 +959,9 @@ nsFlexContainerFrame::GenerateFlexItemForChild(
|
||||
// Create temporary reflow state just for sizing -- to get hypothetical
|
||||
// main-size and the computed values of min / max main-size property.
|
||||
// (This reflow state will _not_ be used for reflow.)
|
||||
nsHTMLReflowState childRS(aPresContext, aParentReflowState, aChildFrame,
|
||||
nsSize(aParentReflowState.ComputedWidth(),
|
||||
aParentReflowState.ComputedHeight()));
|
||||
nsHTMLReflowState
|
||||
childRS(aPresContext, aParentReflowState, aChildFrame,
|
||||
aParentReflowState.ComputedSize(aChildFrame->GetWritingMode()));
|
||||
|
||||
// FLEX GROW & SHRINK WEIGHTS
|
||||
// --------------------------
|
||||
@ -1380,11 +1380,12 @@ nsFlexContainerFrame::
|
||||
const nsHTMLReflowState& aParentReflowState)
|
||||
{
|
||||
// Set up a reflow state for measuring the flex item's auto-height:
|
||||
WritingMode wm = aFlexItem.Frame()->GetWritingMode();
|
||||
LogicalSize availSize = aParentReflowState.ComputedSize(wm);
|
||||
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
|
||||
nsHTMLReflowState
|
||||
childRSForMeasuringHeight(aPresContext, aParentReflowState,
|
||||
aFlexItem.Frame(),
|
||||
nsSize(aParentReflowState.ComputedWidth(),
|
||||
NS_UNCONSTRAINEDSIZE),
|
||||
aFlexItem.Frame(), availSize,
|
||||
-1, -1, nsHTMLReflowState::CALLER_WILL_INIT);
|
||||
childRSForMeasuringHeight.mFlags.mIsFlexContainerMeasuringHeight = true;
|
||||
childRSForMeasuringHeight.Init(aPresContext);
|
||||
@ -3498,10 +3499,11 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
|
||||
// (If the item's already been stretched, or it's a strut, then it
|
||||
// already knows its cross size. Don't bother trying to recalculate it.)
|
||||
if (!item->IsStretched() && !item->IsStrut()) {
|
||||
WritingMode wm = item->Frame()->GetWritingMode();
|
||||
LogicalSize availSize = aReflowState.ComputedSize(wm);
|
||||
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
|
||||
nsHTMLReflowState childReflowState(aPresContext, aReflowState,
|
||||
item->Frame(),
|
||||
nsSize(aReflowState.ComputedWidth(),
|
||||
NS_UNCONSTRAINEDSIZE));
|
||||
item->Frame(), availSize);
|
||||
// Override computed main-size
|
||||
if (IsAxisHorizontal(aAxisTracker.GetMainAxis())) {
|
||||
childReflowState.SetComputedWidth(item->GetMainSize());
|
||||
@ -3618,10 +3620,11 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
|
||||
// (i.e. its frame rect), instead of the container's content-box:
|
||||
physicalPosn += containerContentBoxOrigin;
|
||||
|
||||
WritingMode wm = item->Frame()->GetWritingMode();
|
||||
LogicalSize availSize = aReflowState.ComputedSize(wm);
|
||||
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
|
||||
nsHTMLReflowState childReflowState(aPresContext, aReflowState,
|
||||
item->Frame(),
|
||||
nsSize(aReflowState.ComputedWidth(),
|
||||
NS_UNCONSTRAINEDSIZE));
|
||||
item->Frame(), availSize);
|
||||
|
||||
// Keep track of whether we've overriden the child's computed height
|
||||
// and/or width, so we can set its resize flags accordingly.
|
||||
|
@ -155,8 +155,10 @@ ComputeDescendantWidth(const nsHTMLReflowState& aAncestorReflowState,
|
||||
for (uint32_t i = 0; i < len; ++i) {
|
||||
const nsHTMLReflowState &parentReflowState =
|
||||
(i == 0) ? aAncestorReflowState : reflowStates[i - 1];
|
||||
nsSize availSize(parentReflowState.ComputedWidth(), NS_UNCONSTRAINEDSIZE);
|
||||
nsIFrame *frame = frames[len - i - 1];
|
||||
WritingMode wm = frame->GetWritingMode();
|
||||
LogicalSize availSize = parentReflowState.ComputedSize(wm);
|
||||
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
|
||||
NS_ABORT_IF_FALSE(frame->GetParent()->FirstInFlow() ==
|
||||
parentReflowState.frame->FirstInFlow(),
|
||||
"bad logic in this function");
|
||||
|
@ -8144,9 +8144,11 @@ nsFrame::DoLayout(nsBoxLayoutState& aState)
|
||||
|
||||
if (HasAbsolutelyPositionedChildren()) {
|
||||
// Set up a |reflowState| to pass into ReflowAbsoluteFrames
|
||||
WritingMode wm = GetWritingMode();
|
||||
nsHTMLReflowState reflowState(aState.PresContext(), this,
|
||||
aState.GetRenderingContext(),
|
||||
nsSize(size.width, NS_UNCONSTRAINEDSIZE),
|
||||
LogicalSize(wm, GetLogicalSize().ISize(wm),
|
||||
NS_UNCONSTRAINEDSIZE),
|
||||
nsHTMLReflowState::DUMMY_PARENT_REFLOW_STATE);
|
||||
|
||||
AddStateBits(NS_FRAME_IN_REFLOW);
|
||||
@ -8244,10 +8246,11 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState,
|
||||
|
||||
nsIFrame *parentFrame = GetParent();
|
||||
nsFrameState savedState = parentFrame->GetStateBits();
|
||||
nsHTMLReflowState parentReflowState(aPresContext, parentFrame,
|
||||
aRenderingContext,
|
||||
parentSize,
|
||||
nsHTMLReflowState::DUMMY_PARENT_REFLOW_STATE);
|
||||
nsHTMLReflowState
|
||||
parentReflowState(aPresContext, parentFrame, aRenderingContext,
|
||||
LogicalSize(parentFrame->GetWritingMode(),
|
||||
parentSize),
|
||||
nsHTMLReflowState::DUMMY_PARENT_REFLOW_STATE);
|
||||
parentFrame->RemoveStateBits(~nsFrameState(0));
|
||||
parentFrame->AddStateBits(savedState);
|
||||
|
||||
@ -8282,9 +8285,11 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState,
|
||||
|
||||
// XXX Is it OK that this reflow state has only one ancestor?
|
||||
// (It used to have a bogus parent, skipping all the boxes).
|
||||
nsSize availSize(aWidth, NS_INTRINSICSIZE);
|
||||
WritingMode wm = GetWritingMode();
|
||||
LogicalSize logicalSize(wm, nsSize(aWidth, aHeight));
|
||||
logicalSize.BSize(wm) = NS_INTRINSICSIZE;
|
||||
nsHTMLReflowState reflowState(aPresContext, *parentRS, this,
|
||||
availSize, -1, -1,
|
||||
logicalSize, -1, -1,
|
||||
nsHTMLReflowState::DUMMY_PARENT_REFLOW_STATE);
|
||||
|
||||
// XXX_jwir3: This is somewhat fishy. If this is actually changing the value
|
||||
@ -8315,6 +8320,7 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState,
|
||||
computedHeight = std::max(computedHeight, 0);
|
||||
reflowState.SetComputedHeight(computedHeight);
|
||||
} else {
|
||||
nsSize availSize = logicalSize.GetPhysicalSize(wm);
|
||||
reflowState.SetComputedHeight(
|
||||
ComputeSize(aRenderingContext, availSize, availSize.width,
|
||||
nsSize(reflowState.ComputedPhysicalMargin().LeftRight(),
|
||||
|
@ -736,7 +736,8 @@ nsHTMLFramesetFrame::ReflowPlaceChild(nsIFrame* aChild,
|
||||
nsIntPoint* aCellIndex)
|
||||
{
|
||||
// reflow the child
|
||||
nsHTMLReflowState reflowState(aPresContext, aReflowState, aChild, aSize);
|
||||
nsHTMLReflowState reflowState(aPresContext, aReflowState, aChild,
|
||||
LogicalSize(aChild->GetWritingMode(), aSize));
|
||||
reflowState.SetComputedWidth(std::max(0, aSize.width - reflowState.ComputedPhysicalBorderPadding().LeftRight()));
|
||||
reflowState.SetComputedHeight(std::max(0, aSize.height - reflowState.ComputedPhysicalBorderPadding().TopBottom()));
|
||||
nsHTMLReflowMetrics metrics(aReflowState);
|
||||
|
@ -427,10 +427,12 @@ nsHTMLScrollFrame::ReflowScrolledFrame(ScrollReflowState* aState,
|
||||
nsPresContext* presContext = PresContext();
|
||||
|
||||
// Pass false for aInit so we can pass in the correct padding.
|
||||
nsHTMLReflowState kidReflowState(presContext, aState->mReflowState,
|
||||
mHelper.mScrolledFrame,
|
||||
nsSize(availWidth, NS_UNCONSTRAINEDSIZE),
|
||||
-1, -1, nsHTMLReflowState::CALLER_WILL_INIT);
|
||||
nsHTMLReflowState
|
||||
kidReflowState(presContext, aState->mReflowState,
|
||||
mHelper.mScrolledFrame,
|
||||
LogicalSize(mHelper.mScrolledFrame->GetWritingMode(),
|
||||
nsSize(availWidth, NS_UNCONSTRAINEDSIZE)),
|
||||
-1, -1, nsHTMLReflowState::CALLER_WILL_INIT);
|
||||
kidReflowState.Init(presContext, -1, -1, nullptr,
|
||||
&padding);
|
||||
kidReflowState.mFlags.mAssumingHScrollbar = aAssumeHScroll;
|
||||
|
@ -207,8 +207,10 @@ nsHTMLCanvasFrame::Reflow(nsPresContext* aPresContext,
|
||||
|
||||
// Reflow the single anon block child.
|
||||
nsReflowStatus childStatus;
|
||||
nsSize availSize(aReflowState.ComputedWidth(), NS_UNCONSTRAINEDSIZE);
|
||||
nsIFrame* childFrame = mFrames.FirstChild();
|
||||
WritingMode wm = childFrame->GetWritingMode();
|
||||
LogicalSize availSize = aReflowState.ComputedSize(wm);
|
||||
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
|
||||
NS_ASSERTION(!childFrame->GetNextSibling(), "HTML canvas should have 1 kid");
|
||||
nsHTMLReflowMetrics childDesiredSize(aReflowState.GetWritingMode(), aMetrics.mFlags);
|
||||
nsHTMLReflowState childReflowState(aPresContext, aReflowState, childFrame,
|
||||
|
@ -56,7 +56,7 @@ static eNormalLineHeightControl sNormalLineHeightControl = eUninitialized;
|
||||
nsHTMLReflowState::nsHTMLReflowState(nsPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsRenderingContext* aRenderingContext,
|
||||
const nsSize& aAvailableSpace,
|
||||
const LogicalSize& aAvailableSpace,
|
||||
uint32_t aFlags)
|
||||
: nsCSSOffsetState(aFrame, aRenderingContext)
|
||||
, mBlockDelta(0)
|
||||
@ -67,8 +67,8 @@ nsHTMLReflowState::nsHTMLReflowState(nsPresContext* aPresContext,
|
||||
MOZ_ASSERT(aFrame, "no frame");
|
||||
MOZ_ASSERT(aPresContext == aFrame->PresContext(), "wrong pres context");
|
||||
parentReflowState = nullptr;
|
||||
AvailableWidth() = aAvailableSpace.width;
|
||||
AvailableHeight() = aAvailableSpace.height;
|
||||
AvailableISize() = aAvailableSpace.ISize(mWritingMode);
|
||||
AvailableBSize() = aAvailableSpace.BSize(mWritingMode);
|
||||
mFloatManager = nullptr;
|
||||
mLineLayout = nullptr;
|
||||
memset(&mFlags, 0, sizeof(mFlags));
|
||||
@ -159,7 +159,7 @@ nsCSSOffsetState::nsCSSOffsetState(nsIFrame *aFrame,
|
||||
nsHTMLReflowState::nsHTMLReflowState(nsPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aParentReflowState,
|
||||
nsIFrame* aFrame,
|
||||
const nsSize& aAvailableSpace,
|
||||
const LogicalSize& aAvailableSpace,
|
||||
nscoord aContainingBlockWidth,
|
||||
nscoord aContainingBlockHeight,
|
||||
uint32_t aFlags)
|
||||
@ -187,8 +187,8 @@ nsHTMLReflowState::nsHTMLReflowState(nsPresContext* aPresContext,
|
||||
frame->AddStateBits(parentReflowState->frame->GetStateBits() &
|
||||
NS_FRAME_IS_DIRTY);
|
||||
|
||||
AvailableWidth() = aAvailableSpace.width;
|
||||
AvailableHeight() = aAvailableSpace.height;
|
||||
AvailableISize() = aAvailableSpace.ISize(mWritingMode);
|
||||
AvailableBSize() = aAvailableSpace.BSize(mWritingMode);
|
||||
|
||||
mFloatManager = aParentReflowState.mFloatManager;
|
||||
if (frame->IsFrameOfType(nsIFrame::eLineParticipant))
|
||||
|
@ -327,6 +327,77 @@ struct nsHTMLReflowState : public nsCSSOffsetState {
|
||||
nscoord& ComputedMaxBSize()
|
||||
{ return mWritingMode.IsVertical() ? mComputedMaxWidth : mComputedMaxHeight; }
|
||||
|
||||
mozilla::LogicalSize AvailableSize() const {
|
||||
return mozilla::LogicalSize(mWritingMode,
|
||||
AvailableISize(), AvailableBSize());
|
||||
}
|
||||
mozilla::LogicalSize ComputedSize() const {
|
||||
return mozilla::LogicalSize(mWritingMode,
|
||||
ComputedISize(), ComputedBSize());
|
||||
}
|
||||
mozilla::LogicalSize ComputedMinSize() const {
|
||||
return mozilla::LogicalSize(mWritingMode,
|
||||
ComputedMinISize(), ComputedMinBSize());
|
||||
}
|
||||
mozilla::LogicalSize ComputedMaxSize() const {
|
||||
return mozilla::LogicalSize(mWritingMode,
|
||||
ComputedMaxISize(), ComputedMaxBSize());
|
||||
}
|
||||
|
||||
mozilla::LogicalSize AvailableSize(mozilla::WritingMode aWM) const
|
||||
{ return AvailableSize().ConvertTo(aWM, mWritingMode); }
|
||||
mozilla::LogicalSize ComputedSize(mozilla::WritingMode aWM) const
|
||||
{ return ComputedSize().ConvertTo(aWM, mWritingMode); }
|
||||
mozilla::LogicalSize ComputedMinSize(mozilla::WritingMode aWM) const
|
||||
{ return ComputedMinSize().ConvertTo(aWM, mWritingMode); }
|
||||
mozilla::LogicalSize ComputedMaxSize(mozilla::WritingMode aWM) const
|
||||
{ return ComputedMaxSize().ConvertTo(aWM, mWritingMode); }
|
||||
|
||||
mozilla::LogicalSize ComputedSizeWithPadding() const {
|
||||
mozilla::WritingMode wm = GetWritingMode();
|
||||
return mozilla::LogicalSize(wm,
|
||||
ComputedISize() +
|
||||
ComputedLogicalPadding().IStartEnd(wm),
|
||||
ComputedBSize() +
|
||||
ComputedLogicalPadding().BStartEnd(wm));
|
||||
}
|
||||
|
||||
mozilla::LogicalSize ComputedSizeWithPadding(mozilla::WritingMode aWM) const {
|
||||
return ComputedSizeWithPadding().ConvertTo(aWM, GetWritingMode());
|
||||
}
|
||||
|
||||
mozilla::LogicalSize ComputedSizeWithBorderPadding() const {
|
||||
mozilla::WritingMode wm = GetWritingMode();
|
||||
return mozilla::LogicalSize(wm,
|
||||
ComputedISize() +
|
||||
ComputedLogicalBorderPadding().IStartEnd(wm),
|
||||
ComputedBSize() +
|
||||
ComputedLogicalBorderPadding().BStartEnd(wm));
|
||||
}
|
||||
|
||||
mozilla::LogicalSize
|
||||
ComputedSizeWithBorderPadding(mozilla::WritingMode aWM) const {
|
||||
return ComputedSizeWithBorderPadding().ConvertTo(aWM, GetWritingMode());
|
||||
}
|
||||
|
||||
mozilla::LogicalSize
|
||||
ComputedSizeWithMarginBorderPadding() const {
|
||||
mozilla::WritingMode wm = GetWritingMode();
|
||||
return mozilla::LogicalSize(wm,
|
||||
ComputedISize() +
|
||||
ComputedLogicalMargin().IStartEnd(wm) +
|
||||
ComputedLogicalBorderPadding().IStartEnd(wm),
|
||||
ComputedBSize() +
|
||||
ComputedLogicalMargin().BStartEnd(wm) +
|
||||
ComputedLogicalBorderPadding().BStartEnd(wm));
|
||||
}
|
||||
|
||||
mozilla::LogicalSize
|
||||
ComputedSizeWithMarginBorderPadding(mozilla::WritingMode aWM) const {
|
||||
return ComputedSizeWithMarginBorderPadding().ConvertTo(aWM,
|
||||
GetWritingMode());
|
||||
}
|
||||
|
||||
// XXX this will need to change when we make mComputedOffsets logical;
|
||||
// we won't be able to return a reference for the physical offsets
|
||||
const nsMargin& ComputedPhysicalOffsets() const { return mComputedOffsets; }
|
||||
@ -473,11 +544,11 @@ public:
|
||||
* @param aFlags A set of flags used for additional boolean parameters (see
|
||||
* below).
|
||||
*/
|
||||
nsHTMLReflowState(nsPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsRenderingContext* aRenderingContext,
|
||||
const nsSize& aAvailableSpace,
|
||||
uint32_t aFlags = 0);
|
||||
nsHTMLReflowState(nsPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsRenderingContext* aRenderingContext,
|
||||
const mozilla::LogicalSize& aAvailableSpace,
|
||||
uint32_t aFlags = 0);
|
||||
|
||||
/**
|
||||
* Initialize a reflow state for a child frame's reflow. Some parts of the
|
||||
@ -498,13 +569,13 @@ public:
|
||||
* @param aFlags A set of flags used for additional boolean parameters (see
|
||||
* below).
|
||||
*/
|
||||
nsHTMLReflowState(nsPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aParentReflowState,
|
||||
nsIFrame* aFrame,
|
||||
const nsSize& aAvailableSpace,
|
||||
nscoord aContainingBlockWidth = -1,
|
||||
nscoord aContainingBlockHeight = -1,
|
||||
uint32_t aFlags = 0);
|
||||
nsHTMLReflowState(nsPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aParentReflowState,
|
||||
nsIFrame* aFrame,
|
||||
const mozilla::LogicalSize& aAvailableSpace,
|
||||
nscoord aContainingBlockWidth = -1,
|
||||
nscoord aContainingBlockHeight = -1,
|
||||
uint32_t aFlags = 0);
|
||||
|
||||
// Values for |aFlags| passed to constructor
|
||||
enum {
|
||||
@ -520,8 +591,8 @@ public:
|
||||
// This method initializes various data members. It is automatically
|
||||
// called by the various constructors
|
||||
void Init(nsPresContext* aPresContext,
|
||||
nscoord aContainingBlockWidth = -1,
|
||||
nscoord aContainingBlockHeight = -1,
|
||||
nscoord aContainingBlockISize = -1,
|
||||
nscoord aContainingBlockBSize = -1,
|
||||
const nsMargin* aBorder = nullptr,
|
||||
const nsMargin* aPadding = nullptr);
|
||||
/**
|
||||
@ -612,6 +683,22 @@ public:
|
||||
// This method doesn't apply min/max computed heights to the value passed in.
|
||||
void SetComputedHeight(nscoord aComputedHeight);
|
||||
|
||||
void SetComputedISize(nscoord aComputedISize) {
|
||||
if (mWritingMode.IsVertical()) {
|
||||
SetComputedHeight(aComputedISize);
|
||||
} else {
|
||||
SetComputedWidth(aComputedISize);
|
||||
}
|
||||
}
|
||||
|
||||
void SetComputedBSize(nscoord aComputedBSize) {
|
||||
if (mWritingMode.IsVertical()) {
|
||||
SetComputedWidth(aComputedBSize);
|
||||
} else {
|
||||
SetComputedHeight(aComputedBSize);
|
||||
}
|
||||
}
|
||||
|
||||
void SetComputedHeightWithoutResettingResizeFlags(nscoord aComputedHeight) {
|
||||
// Viewport frames reset the computed height on a copy of their reflow
|
||||
// state when reflowing fixed-pos kids. In that case we actually don't
|
||||
|
@ -788,10 +788,8 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
|
||||
// Compute the available size for the frame. This available width
|
||||
// includes room for the side margins.
|
||||
// For now, set the available block-size to unconstrained always.
|
||||
nsSize availSize =
|
||||
LogicalSize(mBlockReflowState->GetWritingMode(),
|
||||
mBlockReflowState->ComputedISize(), NS_UNCONSTRAINEDSIZE).
|
||||
GetPhysicalSize(mBlockReflowState->GetWritingMode());
|
||||
LogicalSize availSize = mBlockReflowState->ComputedSize(frameWM);
|
||||
availSize.BSize(frameWM) = NS_UNCONSTRAINEDSIZE;
|
||||
reflowStateHolder.construct(mPresContext, *psd->mReflowState,
|
||||
aFrame, availSize);
|
||||
nsHTMLReflowState& reflowState = reflowStateHolder.ref();
|
||||
|
@ -9,6 +9,9 @@
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsSimplePageSequenceFrame.h"
|
||||
|
||||
using mozilla::LogicalSize;
|
||||
using mozilla::WritingMode;
|
||||
|
||||
nsPageContentFrame*
|
||||
NS_NewPageContentFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
{
|
||||
@ -47,8 +50,11 @@ nsPageContentFrame::Reflow(nsPresContext* aPresContext,
|
||||
// XXX Pay attention to the page's border and padding...
|
||||
if (mFrames.NotEmpty()) {
|
||||
nsIFrame* frame = mFrames.FirstChild();
|
||||
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, frame, maxSize);
|
||||
kidReflowState.SetComputedHeight(maxSize.height);
|
||||
WritingMode wm = frame->GetWritingMode();
|
||||
LogicalSize logicalSize(wm, maxSize);
|
||||
nsHTMLReflowState kidReflowState(aPresContext, aReflowState,
|
||||
frame, logicalSize);
|
||||
kidReflowState.SetComputedBSize(logicalSize.BSize(wm));
|
||||
|
||||
// Reflow the page content area
|
||||
ReflowChild(frame, aPresContext, aDesiredSize, kidReflowState, 0, 0, 0, aStatus);
|
||||
|
@ -88,7 +88,9 @@ nsPageFrame::Reflow(nsPresContext* aPresContext,
|
||||
return;
|
||||
}
|
||||
|
||||
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, frame, maxSize);
|
||||
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, frame,
|
||||
LogicalSize(frame->GetWritingMode(),
|
||||
maxSize));
|
||||
kidReflowState.mFlags.mIsTopOfPage = true;
|
||||
kidReflowState.mFlags.mTableIsSplittable = true;
|
||||
|
||||
|
@ -208,7 +208,8 @@ nsSimplePageSequenceFrame::Reflow(nsPresContext* aPresContext,
|
||||
|
||||
// Reflow the page
|
||||
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, kidFrame,
|
||||
pageSize);
|
||||
LogicalSize(kidFrame->GetWritingMode(),
|
||||
pageSize));
|
||||
nsReflowStatus status;
|
||||
|
||||
kidReflowState.SetComputedWidth(kidReflowState.AvailableWidth());
|
||||
|
@ -271,8 +271,8 @@ nsVideoFrame::Reflow(nsPresContext* aPresContext,
|
||||
// Reflow the poster frame.
|
||||
nsImageFrame* imageFrame = static_cast<nsImageFrame*>(child);
|
||||
nsHTMLReflowMetrics kidDesiredSize(aReflowState);
|
||||
nsSize availableSize = nsSize(aReflowState.AvailableWidth(),
|
||||
aReflowState.AvailableHeight());
|
||||
WritingMode wm = imageFrame->GetWritingMode();
|
||||
LogicalSize availableSize = aReflowState.AvailableSize(wm);
|
||||
nsHTMLReflowState kidReflowState(aPresContext,
|
||||
aReflowState,
|
||||
imageFrame,
|
||||
@ -326,8 +326,8 @@ nsVideoFrame::Reflow(nsPresContext* aPresContext,
|
||||
} else if (child->GetContent() == mCaptionDiv) {
|
||||
// Reflow to caption div
|
||||
nsHTMLReflowMetrics kidDesiredSize(aReflowState);
|
||||
nsSize availableSize = nsSize(aReflowState.AvailableWidth(),
|
||||
aReflowState.AvailableHeight());
|
||||
WritingMode wm = child->GetWritingMode();
|
||||
LogicalSize availableSize = aReflowState.AvailableSize(wm);
|
||||
nsHTMLReflowState kidReflowState(aPresContext,
|
||||
aReflowState,
|
||||
child,
|
||||
|
@ -205,8 +205,8 @@ ViewportFrame::Reflow(nsPresContext* aPresContext,
|
||||
// Reflow our one-and-only principal child frame
|
||||
nsIFrame* kidFrame = mFrames.FirstChild();
|
||||
nsHTMLReflowMetrics kidDesiredSize(aReflowState);
|
||||
nsSize availableSpace(aReflowState.AvailableWidth(),
|
||||
aReflowState.AvailableHeight());
|
||||
WritingMode wm = kidFrame->GetWritingMode();
|
||||
LogicalSize availableSpace = aReflowState.AvailableSize(wm);
|
||||
nsHTMLReflowState kidReflowState(aPresContext, aReflowState,
|
||||
kidFrame, availableSpace);
|
||||
|
||||
|
@ -885,11 +885,13 @@ nsMathMLContainerFrame::Reflow(nsPresContext* aPresContext,
|
||||
// Asking each child to cache its bounding metrics
|
||||
|
||||
nsReflowStatus childStatus;
|
||||
nsSize availSize(aReflowState.ComputedWidth(), NS_UNCONSTRAINEDSIZE);
|
||||
nsIFrame* childFrame = mFrames.FirstChild();
|
||||
while (childFrame) {
|
||||
nsHTMLReflowMetrics childDesiredSize(aReflowState, // ???
|
||||
aDesiredSize.mFlags);
|
||||
WritingMode wm = childFrame->GetWritingMode();
|
||||
LogicalSize availSize = aReflowState.ComputedSize(wm);
|
||||
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
|
||||
nsHTMLReflowState childReflowState(aPresContext, aReflowState,
|
||||
childFrame, availSize);
|
||||
ReflowChild(childFrame, aPresContext, childDesiredSize,
|
||||
|
@ -6,6 +6,8 @@
|
||||
#include "nsMathMLSelectedFrame.h"
|
||||
#include "nsDisplayList.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
nsMathMLSelectedFrame::~nsMathMLSelectedFrame()
|
||||
{
|
||||
}
|
||||
@ -109,7 +111,9 @@ nsMathMLSelectedFrame::Reflow(nsPresContext* aPresContext,
|
||||
mBoundingMetrics = nsBoundingMetrics();
|
||||
nsIFrame* childFrame = GetSelectedFrame();
|
||||
if (childFrame) {
|
||||
nsSize availSize(aReflowState.ComputedWidth(), NS_UNCONSTRAINEDSIZE);
|
||||
WritingMode wm = childFrame->GetWritingMode();
|
||||
LogicalSize availSize = aReflowState.ComputedSize(wm);
|
||||
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
|
||||
nsHTMLReflowState childReflowState(aPresContext, aReflowState,
|
||||
childFrame, availSize);
|
||||
ReflowChild(childFrame, aPresContext, aDesiredSize,
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include "RestyleManager.h"
|
||||
#include <algorithm>
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
nsIFrame*
|
||||
NS_NewMathMLTokenFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
{
|
||||
@ -129,13 +131,15 @@ nsMathMLTokenFrame::Reflow(nsPresContext* aPresContext,
|
||||
aDesiredSize.SetBlockStartAscent(0);
|
||||
aDesiredSize.mBoundingMetrics = nsBoundingMetrics();
|
||||
|
||||
nsSize availSize(aReflowState.ComputedWidth(), NS_UNCONSTRAINEDSIZE);
|
||||
nsIFrame* childFrame = GetFirstPrincipalChild();
|
||||
while (childFrame) {
|
||||
// ask our children to compute their bounding metrics
|
||||
nsHTMLReflowMetrics childDesiredSize(aReflowState.GetWritingMode(),
|
||||
aDesiredSize.mFlags
|
||||
| NS_REFLOW_CALC_BOUNDING_METRICS);
|
||||
WritingMode wm = childFrame->GetWritingMode();
|
||||
LogicalSize availSize = aReflowState.ComputedSize(wm);
|
||||
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
|
||||
nsHTMLReflowState childReflowState(aPresContext, aReflowState,
|
||||
childFrame, availSize);
|
||||
ReflowChild(childFrame, aPresContext, childDesiredSize,
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include "nsMathMLChar.h"
|
||||
#include <algorithm>
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
//
|
||||
// <mfenced> -- surround content with a pair of fences
|
||||
//
|
||||
@ -216,7 +218,6 @@ nsMathMLmfencedFrame::Reflow(nsPresContext* aPresContext,
|
||||
// refactored to use nsMathMLContainerFrame::Reflow() at some stage.
|
||||
|
||||
nsReflowStatus childStatus;
|
||||
nsSize availSize(aReflowState.ComputedWidth(), NS_UNCONSTRAINEDSIZE);
|
||||
nsIFrame* firstChild = GetFirstPrincipalChild();
|
||||
nsIFrame* childFrame = firstChild;
|
||||
nscoord ascent = 0, descent = 0;
|
||||
@ -231,6 +232,9 @@ nsMathMLmfencedFrame::Reflow(nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics childDesiredSize(aReflowState,
|
||||
aDesiredSize.mFlags
|
||||
| NS_REFLOW_CALC_BOUNDING_METRICS);
|
||||
WritingMode wm = childFrame->GetWritingMode();
|
||||
LogicalSize availSize = aReflowState.ComputedSize(wm);
|
||||
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
|
||||
nsHTMLReflowState childReflowState(aPresContext, aReflowState,
|
||||
childFrame, availSize);
|
||||
ReflowChild(childFrame, aPresContext, childDesiredSize,
|
||||
@ -239,8 +243,8 @@ nsMathMLmfencedFrame::Reflow(nsPresContext* aPresContext,
|
||||
SaveReflowAndBoundingMetricsFor(childFrame, childDesiredSize,
|
||||
childDesiredSize.mBoundingMetrics);
|
||||
|
||||
mozilla::WritingMode wm = aReflowState.GetWritingMode();
|
||||
nscoord childDescent = childDesiredSize.BSize(wm) -
|
||||
mozilla::WritingMode outerWM = aReflowState.GetWritingMode();
|
||||
nscoord childDescent = childDesiredSize.BSize(outerWM) -
|
||||
childDesiredSize.BlockStartAscent();
|
||||
if (descent < childDescent)
|
||||
descent = childDescent;
|
||||
|
@ -8,6 +8,8 @@
|
||||
#include "nsRenderingContext.h"
|
||||
#include <algorithm>
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
//
|
||||
// <mroot> -- form a radical - implementation
|
||||
//
|
||||
@ -162,7 +164,6 @@ nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus)
|
||||
{
|
||||
nsSize availSize(aReflowState.ComputedWidth(), NS_UNCONSTRAINEDSIZE);
|
||||
nsReflowStatus childStatus;
|
||||
|
||||
aDesiredSize.Width() = aDesiredSize.Height() = 0;
|
||||
@ -185,6 +186,9 @@ nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics childDesiredSize(aReflowState,
|
||||
aDesiredSize.mFlags
|
||||
| NS_REFLOW_CALC_BOUNDING_METRICS);
|
||||
WritingMode wm = childFrame->GetWritingMode();
|
||||
LogicalSize availSize = aReflowState.ComputedSize(wm);
|
||||
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
|
||||
nsHTMLReflowState childReflowState(aPresContext, aReflowState,
|
||||
childFrame, availSize);
|
||||
ReflowChild(childFrame, aPresContext,
|
||||
|
@ -5206,10 +5206,12 @@ SVGTextFrame::DoReflow()
|
||||
|
||||
mState |= NS_STATE_SVG_TEXT_IN_REFLOW;
|
||||
|
||||
nscoord width = kid->GetPrefWidth(renderingContext);
|
||||
//XXX GetPrefWidth will become GetInlineSize
|
||||
nscoord inlineSize = kid->GetPrefWidth(renderingContext);
|
||||
nsHTMLReflowState reflowState(presContext, kid,
|
||||
renderingContext,
|
||||
nsSize(width, NS_UNCONSTRAINEDSIZE));
|
||||
LogicalSize(kid->GetWritingMode(),
|
||||
inlineSize, NS_UNCONSTRAINEDSIZE));
|
||||
nsHTMLReflowMetrics desiredSize(reflowState);
|
||||
nsReflowStatus status;
|
||||
|
||||
|
@ -551,9 +551,11 @@ nsSVGForeignObjectFrame::DoReflow()
|
||||
|
||||
mInReflow = true;
|
||||
|
||||
WritingMode wm = kid->GetWritingMode();
|
||||
nsHTMLReflowState reflowState(presContext, kid,
|
||||
renderingContext,
|
||||
nsSize(mRect.width, NS_UNCONSTRAINEDSIZE));
|
||||
LogicalSize(wm, GetLogicalSize(wm).ISize(wm),
|
||||
NS_UNCONSTRAINEDSIZE));
|
||||
nsHTMLReflowMetrics desiredSize(reflowState);
|
||||
nsReflowStatus status;
|
||||
|
||||
|
@ -908,7 +908,8 @@ nsTableCellFrame::Reflow(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, firstKid,
|
||||
availSize);
|
||||
LogicalSize(firstKid->GetWritingMode(),
|
||||
availSize));
|
||||
|
||||
// Don't be a percent height observer if we're in the middle of
|
||||
// special-height reflow, in case we get an accidental NotifyPercentHeight()
|
||||
|
@ -372,7 +372,7 @@ nsTableColGroupFrame::Reflow(nsPresContext* aPresContext,
|
||||
// Give the child frame a chance to reflow, even though we know it'll have 0 size
|
||||
nsHTMLReflowMetrics kidSize(aReflowState);
|
||||
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, kidFrame,
|
||||
nsSize(0,0));
|
||||
LogicalSize(kidFrame->GetWritingMode()));
|
||||
|
||||
nsReflowStatus status;
|
||||
ReflowChild(kidFrame, aPresContext, kidSize, kidReflowState, 0, 0, 0, status);
|
||||
@ -522,3 +522,4 @@ void nsTableColGroupFrame::Dump(int32_t aIndent)
|
||||
delete [] indent;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1927,9 +1927,11 @@ nsTableFrame::FixupPositionedTableParts(nsPresContext* aPresContext,
|
||||
// XXX(seth): Note that the dummy reflow state doesn't have a correct
|
||||
// chain of parent reflow states. It also doesn't necessarily have a
|
||||
// correct containing block.
|
||||
WritingMode wm = positionedPart->GetWritingMode();
|
||||
LogicalSize availSize(wm, size);
|
||||
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
|
||||
nsHTMLReflowState reflowState(aPresContext, positionedPart,
|
||||
aReflowState.rendContext,
|
||||
nsSize(size.width, NS_UNCONSTRAINEDSIZE),
|
||||
aReflowState.rendContext, availSize,
|
||||
nsHTMLReflowState::DUMMY_PARENT_REFLOW_STATE);
|
||||
nsReflowStatus reflowStatus = NS_FRAME_COMPLETE;
|
||||
|
||||
@ -2794,10 +2796,12 @@ nsTableFrame::SetupHeaderFooterChild(const nsTableReflowState& aReflowState,
|
||||
nsPresContext* presContext = PresContext();
|
||||
nscoord pageHeight = presContext->GetPageSize().height;
|
||||
|
||||
// Reflow the child with unconstrainted height
|
||||
// Reflow the child with unconstrained height
|
||||
WritingMode wm = aFrame->GetWritingMode();
|
||||
LogicalSize availSize = aReflowState.reflowState.AvailableSize(wm);
|
||||
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
|
||||
nsHTMLReflowState kidReflowState(presContext, aReflowState.reflowState,
|
||||
aFrame,
|
||||
nsSize(aReflowState.availSize.width, NS_UNCONSTRAINEDSIZE),
|
||||
aFrame, availSize,
|
||||
-1, -1, nsHTMLReflowState::CALLER_WILL_INIT);
|
||||
InitChildReflowState(kidReflowState);
|
||||
kidReflowState.mFlags.mIsTopOfPage = true;
|
||||
@ -2819,12 +2823,12 @@ nsTableFrame::PlaceRepeatedFooter(nsTableReflowState& aReflowState,
|
||||
nscoord aFooterHeight)
|
||||
{
|
||||
nsPresContext* presContext = PresContext();
|
||||
nsSize kidAvailSize(aReflowState.availSize);
|
||||
kidAvailSize.height = aFooterHeight;
|
||||
WritingMode wm = aTfoot->GetWritingMode();
|
||||
LogicalSize kidAvailSize(wm, aReflowState.availSize);
|
||||
kidAvailSize.BSize(wm) = aFooterHeight;
|
||||
nsHTMLReflowState footerReflowState(presContext,
|
||||
aReflowState.reflowState,
|
||||
aTfoot,
|
||||
kidAvailSize,
|
||||
aTfoot, kidAvailSize,
|
||||
-1, -1,
|
||||
nsHTMLReflowState::CALLER_WILL_INIT);
|
||||
InitChildReflowState(footerReflowState);
|
||||
@ -2946,7 +2950,9 @@ nsTableFrame::ReflowChildren(nsTableReflowState& aReflowState,
|
||||
|
||||
// Reflow the child into the available space
|
||||
nsHTMLReflowState kidReflowState(presContext, aReflowState.reflowState,
|
||||
kidFrame, kidAvailSize,
|
||||
kidFrame,
|
||||
LogicalSize(kidFrame->GetWritingMode(),
|
||||
kidAvailSize),
|
||||
-1, -1,
|
||||
nsHTMLReflowState::CALLER_WILL_INIT);
|
||||
InitChildReflowState(kidReflowState);
|
||||
@ -3138,8 +3144,9 @@ nsTableFrame::ReflowColGroups(nsRenderingContext *aRenderingContext)
|
||||
kidFrame = kidFrame->GetNextSibling()) {
|
||||
if (NS_SUBTREE_DIRTY(kidFrame)) {
|
||||
// The column groups don't care about dimensions or reflow states.
|
||||
nsHTMLReflowState kidReflowState(presContext, kidFrame,
|
||||
aRenderingContext, nsSize(0,0));
|
||||
nsHTMLReflowState
|
||||
kidReflowState(presContext, kidFrame, aRenderingContext,
|
||||
LogicalSize(kidFrame->GetWritingMode()));
|
||||
nsReflowStatus cgStatus;
|
||||
ReflowChild(kidFrame, presContext, kidMet, kidReflowState, 0, 0, 0,
|
||||
cgStatus);
|
||||
|
@ -356,20 +356,21 @@ void
|
||||
nsTableOuterFrame::GetChildMargin(nsPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aOuterRS,
|
||||
nsIFrame* aChildFrame,
|
||||
nscoord aAvailWidth,
|
||||
nsMargin& aMargin)
|
||||
nscoord aAvailISize,
|
||||
LogicalMargin& aMargin)
|
||||
{
|
||||
// construct a reflow state to compute margin and padding. Auto margins
|
||||
// will not be computed at this time.
|
||||
|
||||
// create and init the child reflow state
|
||||
// XXX We really shouldn't construct a reflow state to do this.
|
||||
nsHTMLReflowState childRS(aPresContext, aOuterRS, aChildFrame,
|
||||
nsSize(aAvailWidth, aOuterRS.AvailableHeight()),
|
||||
WritingMode wm = aChildFrame->GetWritingMode();
|
||||
LogicalSize availSize(wm, aAvailISize, aOuterRS.AvailableSize(wm).BSize(wm));
|
||||
nsHTMLReflowState childRS(aPresContext, aOuterRS, aChildFrame, availSize,
|
||||
-1, -1, nsHTMLReflowState::CALLER_WILL_INIT);
|
||||
InitChildReflowState(*aPresContext, childRS);
|
||||
|
||||
aMargin = childRS.ComputedPhysicalMargin();
|
||||
aMargin = childRS.ComputedLogicalMargin();
|
||||
}
|
||||
|
||||
static nsSize
|
||||
@ -783,26 +784,30 @@ nsTableOuterFrame::OuterBeginReflowChild(nsPresContext* aPresContext,
|
||||
nsIFrame* aChildFrame,
|
||||
const nsHTMLReflowState& aOuterRS,
|
||||
void* aChildRSSpace,
|
||||
nscoord aAvailWidth)
|
||||
{
|
||||
nscoord aAvailISize)
|
||||
{
|
||||
// work around pixel rounding errors, round down to ensure we don't exceed the avail height in
|
||||
nscoord availHeight = aOuterRS.AvailableHeight();
|
||||
if (NS_UNCONSTRAINEDSIZE != availHeight) {
|
||||
WritingMode wm = aChildFrame->GetWritingMode();
|
||||
LogicalSize outerSize = aOuterRS.AvailableSize(wm);
|
||||
nscoord availBSize = outerSize.BSize(wm);
|
||||
if (NS_UNCONSTRAINEDSIZE != availBSize) {
|
||||
if (mCaptionFrames.FirstChild() == aChildFrame) {
|
||||
availHeight = NS_UNCONSTRAINEDSIZE;
|
||||
availBSize = NS_UNCONSTRAINEDSIZE;
|
||||
} else {
|
||||
nsMargin margin;
|
||||
LogicalMargin margin(wm);
|
||||
GetChildMargin(aPresContext, aOuterRS, aChildFrame,
|
||||
aOuterRS.AvailableWidth(), margin);
|
||||
|
||||
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != margin.top, "No unconstrainedsize arithmetic, please");
|
||||
availHeight -= margin.top;
|
||||
|
||||
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != margin.bottom, "No unconstrainedsize arithmetic, please");
|
||||
availHeight -= margin.bottom;
|
||||
outerSize.ISize(wm), margin);
|
||||
|
||||
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != margin.BStart(wm),
|
||||
"No unconstrainedsize arithmetic, please");
|
||||
availBSize -= margin.BStart(wm);
|
||||
|
||||
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != margin.BEnd(wm),
|
||||
"No unconstrainedsize arithmetic, please");
|
||||
availBSize -= margin.BEnd(wm);
|
||||
}
|
||||
}
|
||||
nsSize availSize(aAvailWidth, availHeight);
|
||||
LogicalSize availSize(wm, aAvailISize, availBSize);
|
||||
// create and init the child reflow state, using placement new on
|
||||
// stack space allocated by the caller, so that the caller can destroy
|
||||
// it
|
||||
@ -910,22 +915,24 @@ nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
// ComputeAutoSize has to match this logic.
|
||||
WritingMode wm;
|
||||
if (captionSide == NO_SIDE) {
|
||||
// We don't have a caption.
|
||||
wm = InnerTableFrame()->GetWritingMode();
|
||||
OuterBeginReflowChild(aPresContext, InnerTableFrame(), aOuterRS,
|
||||
innerRSSpace, aOuterRS.ComputedWidth());
|
||||
innerRSSpace, aOuterRS.ComputedSize(wm).ISize(wm));
|
||||
} else if (captionSide == NS_STYLE_CAPTION_SIDE_LEFT ||
|
||||
captionSide == NS_STYLE_CAPTION_SIDE_RIGHT) {
|
||||
// nsTableCaptionFrame::ComputeAutoSize takes care of making side
|
||||
// captions small. Compute the caption's size first, and tell the
|
||||
// table to fit in what's left.
|
||||
wm = mCaptionFrames.FirstChild()->GetWritingMode();
|
||||
OuterBeginReflowChild(aPresContext, mCaptionFrames.FirstChild(), aOuterRS,
|
||||
captionRSSpace, aOuterRS.ComputedWidth());
|
||||
nscoord innerAvailWidth = aOuterRS.ComputedWidth() -
|
||||
(captionRS->ComputedWidth() + captionRS->ComputedPhysicalMargin().LeftRight() +
|
||||
captionRS->ComputedPhysicalBorderPadding().LeftRight());
|
||||
captionRSSpace, aOuterRS.ComputedSize(wm).ISize(wm));
|
||||
nscoord innerAvailISize = aOuterRS.ComputedSize(wm).ISize(wm) -
|
||||
captionRS->ComputedSizeWithMarginBorderPadding(wm).ISize(wm);
|
||||
OuterBeginReflowChild(aPresContext, InnerTableFrame(), aOuterRS,
|
||||
innerRSSpace, innerAvailWidth);
|
||||
innerRSSpace, innerAvailISize);
|
||||
|
||||
} else if (captionSide == NS_STYLE_CAPTION_SIDE_TOP ||
|
||||
captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM) {
|
||||
@ -937,15 +944,16 @@ nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
|
||||
// table box inside it
|
||||
// We don't actually make our anonymous box that width (if we did,
|
||||
// it would break 'auto' margins), but this effectively does that.
|
||||
wm = InnerTableFrame()->GetWritingMode();
|
||||
OuterBeginReflowChild(aPresContext, InnerTableFrame(), aOuterRS,
|
||||
innerRSSpace, aOuterRS.ComputedWidth());
|
||||
innerRSSpace, aOuterRS.ComputedSize(wm).ISize(wm));
|
||||
// It's good that CSS 2.1 says not to include margins, since we
|
||||
// can't, since they already been converted so they exactly
|
||||
// fill the available width (ignoring the margin on one side if
|
||||
// neither are auto). (We take advantage of that later when we call
|
||||
// GetCaptionOrigin, though.)
|
||||
nscoord innerBorderWidth = innerRS->ComputedWidth() +
|
||||
innerRS->ComputedPhysicalBorderPadding().LeftRight();
|
||||
nscoord innerBorderWidth =
|
||||
innerRS->ComputedSizeWithBorderPadding(wm).ISize(wm);
|
||||
OuterBeginReflowChild(aPresContext, mCaptionFrames.FirstChild(), aOuterRS,
|
||||
captionRSSpace, innerBorderWidth);
|
||||
} else {
|
||||
@ -953,10 +961,12 @@ nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
|
||||
captionSide == NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE,
|
||||
"unexpected caption-side");
|
||||
// Size the table and the caption independently.
|
||||
wm = mCaptionFrames.FirstChild()->GetWritingMode();
|
||||
OuterBeginReflowChild(aPresContext, mCaptionFrames.FirstChild(), aOuterRS,
|
||||
captionRSSpace, aOuterRS.ComputedWidth());
|
||||
captionRSSpace, aOuterRS.ComputedSize(wm).ISize(wm));
|
||||
wm = InnerTableFrame()->GetWritingMode();
|
||||
OuterBeginReflowChild(aPresContext, InnerTableFrame(), aOuterRS,
|
||||
innerRSSpace, aOuterRS.ComputedWidth());
|
||||
innerRSSpace, aOuterRS.ComputedSize(wm).ISize(wm));
|
||||
}
|
||||
|
||||
// First reflow the caption.
|
||||
|
@ -250,7 +250,7 @@ protected:
|
||||
nsIFrame* aChildFrame,
|
||||
const nsHTMLReflowState& aOuterRS,
|
||||
void* aChildRSSpace,
|
||||
nscoord aAvailWidth);
|
||||
nscoord aAvailISize);
|
||||
|
||||
void OuterDoReflowChild(nsPresContext* aPresContext,
|
||||
nsIFrame* aChildFrame,
|
||||
@ -270,7 +270,7 @@ protected:
|
||||
const nsHTMLReflowState& aOuterRS,
|
||||
nsIFrame* aChildFrame,
|
||||
nscoord aAvailableWidth,
|
||||
nsMargin& aMargin);
|
||||
mozilla::LogicalMargin& aMargin);
|
||||
|
||||
virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ struct nsTableCellReflowState : public nsHTMLReflowState
|
||||
nsTableCellReflowState(nsPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aParentReflowState,
|
||||
nsIFrame* aFrame,
|
||||
const nsSize& aAvailableSpace,
|
||||
const LogicalSize& aAvailableSpace,
|
||||
uint32_t aFlags = 0)
|
||||
: nsHTMLReflowState(aPresContext, aParentReflowState, aFrame,
|
||||
aAvailableSpace, -1, -1, aFlags)
|
||||
@ -809,9 +809,10 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
|
||||
NS_NOTREACHED("yikes, a non-row child");
|
||||
|
||||
// it's an unknown frame type, give it a generic reflow and ignore the results
|
||||
nsTableCellReflowState kidReflowState(aPresContext, aReflowState,
|
||||
kidFrame, nsSize(0,0),
|
||||
nsHTMLReflowState::CALLER_WILL_INIT);
|
||||
nsTableCellReflowState
|
||||
kidReflowState(aPresContext, aReflowState, kidFrame,
|
||||
LogicalSize(kidFrame->GetWritingMode(), 0, 0),
|
||||
nsHTMLReflowState::CALLER_WILL_INIT);
|
||||
InitChildReflowState(*aPresContext, nsSize(0,0), false, kidReflowState);
|
||||
nsHTMLReflowMetrics desiredSize(aReflowState);
|
||||
nsReflowStatus status;
|
||||
@ -889,9 +890,11 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
|
||||
nsSize kidAvailSize(availCellWidth, aReflowState.AvailableHeight());
|
||||
|
||||
// Reflow the child
|
||||
nsTableCellReflowState kidReflowState(aPresContext, aReflowState,
|
||||
kidFrame, kidAvailSize,
|
||||
nsHTMLReflowState::CALLER_WILL_INIT);
|
||||
nsTableCellReflowState
|
||||
kidReflowState(aPresContext, aReflowState, kidFrame,
|
||||
LogicalSize(kidFrame->GetWritingMode(),
|
||||
kidAvailSize),
|
||||
nsHTMLReflowState::CALLER_WILL_INIT);
|
||||
InitChildReflowState(*aPresContext, kidAvailSize, borderCollapse,
|
||||
kidReflowState);
|
||||
|
||||
@ -1080,9 +1083,11 @@ nsTableRowFrame::ReflowCellFrame(nsPresContext* aPresContext,
|
||||
nsSize availSize(cellRect.width, aAvailableHeight);
|
||||
nsTableFrame* tableFrame = nsTableFrame::GetTableFrame(this);
|
||||
bool borderCollapse = tableFrame->IsBorderCollapse();
|
||||
nsTableCellReflowState cellReflowState(aPresContext, aReflowState,
|
||||
aCellFrame, availSize,
|
||||
nsHTMLReflowState::CALLER_WILL_INIT);
|
||||
nsTableCellReflowState
|
||||
cellReflowState(aPresContext, aReflowState, aCellFrame,
|
||||
LogicalSize(aCellFrame->GetWritingMode(),
|
||||
availSize),
|
||||
nsHTMLReflowState::CALLER_WILL_INIT);
|
||||
InitChildReflowState(*aPresContext, availSize, borderCollapse, cellReflowState);
|
||||
cellReflowState.mFlags.mIsTopOfPage = aIsTopOfPage;
|
||||
|
||||
|
@ -382,7 +382,9 @@ nsTableRowGroupFrame::ReflowChildren(nsPresContext* aPresContext,
|
||||
// Reflow the child into the available space, giving it as much height as
|
||||
// it wants. We'll deal with splitting later after we've computed the row
|
||||
// heights, taking into account cells with row spans...
|
||||
nsSize kidAvailSize(aReflowState.availSize.width, NS_UNCONSTRAINEDSIZE);
|
||||
WritingMode wm = kidFrame->GetWritingMode();
|
||||
LogicalSize kidAvailSize(wm, aReflowState.availSize);
|
||||
kidAvailSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
|
||||
nsHTMLReflowState kidReflowState(aPresContext, aReflowState.reflowState,
|
||||
kidFrame, kidAvailSize,
|
||||
-1, -1,
|
||||
@ -945,8 +947,9 @@ nsTableRowGroupFrame::SplitSpanningCells(nsPresContext& aPresContext,
|
||||
// don't let the available height exceed what
|
||||
// CalculateRowHeights set for it
|
||||
rowAvailSize.height = std::min(rowAvailSize.height, rowRect.height);
|
||||
nsHTMLReflowState rowReflowState(&aPresContext, aReflowState,
|
||||
row, rowAvailSize,
|
||||
nsHTMLReflowState rowReflowState(&aPresContext, aReflowState, row,
|
||||
LogicalSize(row->GetWritingMode(),
|
||||
rowAvailSize),
|
||||
-1, -1,
|
||||
nsHTMLReflowState::CALLER_WILL_INIT);
|
||||
InitChildReflowState(aPresContext, borderCollapse, rowReflowState);
|
||||
@ -1080,8 +1083,9 @@ nsTableRowGroupFrame::SplitRowGroup(nsPresContext* aPresContext,
|
||||
// don't let the available height exceed what CalculateRowHeights set for it
|
||||
availSize.height = std::min(availSize.height, rowRect.height);
|
||||
|
||||
nsHTMLReflowState rowReflowState(aPresContext, aReflowState,
|
||||
rowFrame, availSize,
|
||||
nsHTMLReflowState rowReflowState(aPresContext, aReflowState, rowFrame,
|
||||
LogicalSize(rowFrame->GetWritingMode(),
|
||||
availSize),
|
||||
-1, -1,
|
||||
nsHTMLReflowState::CALLER_WILL_INIT);
|
||||
|
||||
|
@ -905,9 +905,11 @@ nsBoxFrame::DoLayout(nsBoxLayoutState& aState)
|
||||
|
||||
if (HasAbsolutelyPositionedChildren()) {
|
||||
// Set up a |reflowState| to pass into ReflowAbsoluteFrames
|
||||
WritingMode wm = GetWritingMode();
|
||||
nsHTMLReflowState reflowState(aState.PresContext(), this,
|
||||
aState.GetRenderingContext(),
|
||||
nsSize(mRect.width, NS_UNCONSTRAINEDSIZE));
|
||||
LogicalSize(wm, GetLogicalSize().ISize(wm),
|
||||
NS_UNCONSTRAINEDSIZE));
|
||||
|
||||
// Set up a |desiredSize| to pass into ReflowAbsoluteFrames
|
||||
nsHTMLReflowMetrics desiredSize(reflowState);
|
||||
|
Loading…
Reference in New Issue
Block a user