本文整理汇总了C++中ReflowOutput类的典型用法代码示例。如果您正苦于以下问题:C++ ReflowOutput类的具体用法?C++ ReflowOutput怎么用?C++ ReflowOutput使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ReflowOutput类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: childReflowInput
// Only reflow the selected child ...
void
nsMathMLSelectedFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
mPresentationData.flags &= ~NS_MATHML_ERROR;
aStatus.Reset();
aDesiredSize.ClearSize();
aDesiredSize.SetBlockStartAscent(0);
mBoundingMetrics = nsBoundingMetrics();
nsIFrame* childFrame = GetSelectedFrame();
if (childFrame) {
WritingMode wm = childFrame->GetWritingMode();
LogicalSize availSize = aReflowInput.ComputedSize(wm);
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
ReflowInput childReflowInput(aPresContext, aReflowInput,
childFrame, availSize);
ReflowChild(childFrame, aPresContext, aDesiredSize,
childReflowInput, aStatus);
SaveReflowAndBoundingMetricsFor(childFrame, aDesiredSize,
aDesiredSize.mBoundingMetrics);
mBoundingMetrics = aDesiredSize.mBoundingMetrics;
}
FinalizeReflow(aReflowInput.mRenderingContext->GetDrawTarget(), aDesiredSize);
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
示例2: MarkInReflow
void
nsProgressFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsProgressFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
NS_ASSERTION(mBarDiv, "Progress bar div must exist!");
NS_ASSERTION(!GetPrevContinuation(),
"nsProgressFrame should not have continuations; if it does we "
"need to call RegUnregAccessKey only for the first.");
if (mState & NS_FRAME_FIRST_REFLOW) {
nsFormControlFrame::RegUnRegAccessKey(this, true);
}
nsIFrame* barFrame = mBarDiv->GetPrimaryFrame();
NS_ASSERTION(barFrame, "The progress frame should have a child with a frame!");
ReflowBarFrame(barFrame, aPresContext, aReflowInput, aStatus);
aDesiredSize.SetSize(aReflowInput.GetWritingMode(),
aReflowInput.ComputedSizeWithBorderPadding());
aDesiredSize.SetOverflowAreasToDesiredBounds();
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, barFrame);
FinishAndStoreOverflow(&aDesiredSize);
aStatus = NS_FRAME_COMPLETE;
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
示例3: ReflowError
// Only place the selected child ...
/* virtual */ nsresult
nsMathMLSelectedFrame::Place(DrawTarget* aDrawTarget,
bool aPlaceOrigin,
ReflowOutput& aDesiredSize)
{
nsIFrame* childFrame = GetSelectedFrame();
if (mInvalidMarkup) {
return ReflowError(aDrawTarget, aDesiredSize);
}
aDesiredSize.ClearSize();
aDesiredSize.SetBlockStartAscent(0);
mBoundingMetrics = nsBoundingMetrics();
if (childFrame) {
GetReflowAndBoundingMetricsFor(childFrame, aDesiredSize, mBoundingMetrics);
if (aPlaceOrigin) {
FinishReflowChild(childFrame, PresContext(), aDesiredSize, nullptr, 0, 0, 0);
}
mReference.x = 0;
mReference.y = aDesiredSize.BlockStartAscent();
}
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
return NS_OK;
}
示例4: finalSize
void
nsSVGForeignObjectFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MOZ_ASSERT(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY),
"Should not have been called");
// Only InvalidateAndScheduleBoundsUpdate marks us with NS_FRAME_IS_DIRTY,
// so if that bit is still set we still have a resize pending. If we hit
// this assertion, then we should get the presShell to skip reflow roots
// that have a dirty parent since a reflow is going to come via the
// reflow root's parent anyway.
NS_ASSERTION(!(GetStateBits() & NS_FRAME_IS_DIRTY),
"Reflowing while a resize is pending is wasteful");
// ReflowSVG makes sure mRect is up to date before we're called.
NS_ASSERTION(!aReflowInput.mParentReflowInput,
"should only get reflow from being reflow root");
NS_ASSERTION(aReflowInput.ComputedWidth() == GetSize().width &&
aReflowInput.ComputedHeight() == GetSize().height,
"reflow roots should be reflowed at existing size and "
"svg.css should ensure we have no padding/border/margin");
DoReflow();
WritingMode wm = aReflowInput.GetWritingMode();
LogicalSize finalSize(wm, aReflowInput.ComputedISize(),
aReflowInput.ComputedBSize());
aDesiredSize.SetSize(wm, finalSize);
aDesiredSize.SetOverflowAreasToDesiredBounds();
aStatus = NS_FRAME_COMPLETE;
}
示例5: DebugCheckChildSize
static
void DebugCheckChildSize(nsIFrame* aChild,
ReflowOutput& aMet)
{
WritingMode wm = aMet.GetWritingMode();
if ((aMet.ISize(wm) < 0) || (aMet.ISize(wm) > PROBABLY_TOO_LARGE)) {
printf("WARNING: cell content %p has large inline size %d \n",
static_cast<void*>(aChild), int32_t(aMet.ISize(wm)));
}
}
示例6: if
void
nsMathMLmpaddedFrame::UpdateValue(int32_t aSign,
int32_t aPseudoUnit,
const nsCSSValue& aCSSValue,
const ReflowOutput& aDesiredSize,
nscoord& aValueToUpdate,
float aFontSizeInflation) const
{
nsCSSUnit unit = aCSSValue.GetUnit();
if (NS_MATHML_SIGN_INVALID != aSign && eCSSUnit_Null != unit) {
nscoord scaler = 0, amount = 0;
if (eCSSUnit_Percent == unit || eCSSUnit_Number == unit) {
switch(aPseudoUnit) {
case NS_MATHML_PSEUDO_UNIT_WIDTH:
scaler = aDesiredSize.Width();
break;
case NS_MATHML_PSEUDO_UNIT_HEIGHT:
scaler = aDesiredSize.BlockStartAscent();
break;
case NS_MATHML_PSEUDO_UNIT_DEPTH:
scaler = aDesiredSize.Height() - aDesiredSize.BlockStartAscent();
break;
default:
// if we ever reach here, it would mean something is wrong
// somewhere with the setup and/or the caller
NS_ERROR("Unexpected Pseudo Unit");
return;
}
}
if (eCSSUnit_Number == unit)
amount = NSToCoordRound(float(scaler) * aCSSValue.GetFloatValue());
else if (eCSSUnit_Percent == unit)
amount = NSToCoordRound(float(scaler) * aCSSValue.GetPercentValue());
else
amount = CalcLength(PresContext(), mStyleContext, aCSSValue,
aFontSizeInflation);
if (NS_MATHML_SIGN_PLUS == aSign)
aValueToUpdate += amount;
else if (NS_MATHML_SIGN_MINUS == aSign)
aValueToUpdate -= amount;
else
aValueToUpdate = amount;
}
}
示例7: nscoord
void
nsSimplePageSequenceFrame::SetDesiredSize(ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nscoord aWidth,
nscoord aHeight)
{
// Aim to fill the whole size of the document, not only so we
// can act as a background in print preview but also handle overflow
// in child page frames correctly.
// Use availableWidth so we don't cause a needless horizontal scrollbar.
aDesiredSize.Width() = std::max(aReflowInput.AvailableWidth(),
nscoord(aWidth * PresContext()->GetPrintPreviewScale()));
aDesiredSize.Height() = std::max(aReflowInput.ComputedHeight(),
nscoord(aHeight * PresContext()->GetPrintPreviewScale()));
}
示例8: ReflowError
/* virtual */ void
nsMathMLmrootFrame::GetIntrinsicISizeMetrics(nsRenderingContext* aRenderingContext, ReflowOutput& aDesiredSize)
{
nsIFrame* baseFrame = mFrames.FirstChild();
nsIFrame* indexFrame = nullptr;
if (baseFrame)
indexFrame = baseFrame->GetNextSibling();
if (!indexFrame || indexFrame->GetNextSibling()) {
ReflowError(aRenderingContext->GetDrawTarget(), aDesiredSize);
return;
}
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
nscoord baseWidth =
nsLayoutUtils::IntrinsicForContainer(aRenderingContext, baseFrame,
nsLayoutUtils::PREF_ISIZE);
nscoord indexWidth =
nsLayoutUtils::IntrinsicForContainer(aRenderingContext, indexFrame,
nsLayoutUtils::PREF_ISIZE);
nscoord sqrWidth = mSqrChar.GetMaxWidth(PresContext(),
aRenderingContext->GetDrawTarget(),
fontSizeInflation);
nscoord dxSqr;
RefPtr<nsFontMetrics> fm =
nsLayoutUtils::GetFontMetricsForFrame(this, fontSizeInflation);
GetRadicalXOffsets(indexWidth, sqrWidth, fm, nullptr, &dxSqr);
nscoord width = dxSqr + sqrWidth + baseWidth;
aDesiredSize.Width() = width;
aDesiredSize.mBoundingMetrics.width = width;
aDesiredSize.mBoundingMetrics.leftBearing = 0;
aDesiredSize.mBoundingMetrics.rightBearing = width;
}
示例9: MarkInReflow
void
nsTableColGroupFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsTableColGroupFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
NS_ASSERTION(nullptr!=mContent, "bad state -- null content for frame");
const nsStyleVisibility* groupVis = StyleVisibility();
bool collapseGroup = (NS_STYLE_VISIBILITY_COLLAPSE == groupVis->mVisible);
if (collapseGroup) {
GetTableFrame()->SetNeedToCollapse(true);
}
// for every content child that (is a column thingy and does not already have a frame)
// create a frame and adjust it's style
for (nsIFrame *kidFrame = mFrames.FirstChild(); kidFrame;
kidFrame = kidFrame->GetNextSibling()) {
// Give the child frame a chance to reflow, even though we know it'll have 0 size
ReflowOutput kidSize(aReflowInput);
ReflowInput kidReflowInput(aPresContext, aReflowInput, kidFrame,
LogicalSize(kidFrame->GetWritingMode()));
nsReflowStatus status;
ReflowChild(kidFrame, aPresContext, kidSize, kidReflowInput, 0, 0, 0, status);
FinishReflowChild(kidFrame, aPresContext, kidSize, nullptr, 0, 0, 0);
}
aDesiredSize.ClearSize();
aStatus.Reset();
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
示例10: ConsiderChildOverflow
void
nsTableWrapperFrame::UpdateOverflowAreas(ReflowOutput& aMet)
{
aMet.SetOverflowAreasToDesiredBounds();
ConsiderChildOverflow(aMet.mOverflowAreas, InnerTableFrame());
if (mCaptionFrames.NotEmpty()) {
ConsiderChildOverflow(aMet.mOverflowAreas, mCaptionFrames.FirstChild());
}
}
示例11: PresContext
void
nsSimplePageSequenceFrame::SetDesiredSize(ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nscoord aWidth,
nscoord aHeight)
{
// Aim to fill the whole size of the document, not only so we
// can act as a background in print preview but also handle overflow
// in child page frames correctly.
// Use availableISize so we don't cause a needless horizontal scrollbar.
WritingMode wm = aReflowInput.GetWritingMode();
nscoord scaledWidth = aWidth * PresContext()->GetPrintPreviewScale();
nscoord scaledHeight = aHeight * PresContext()->GetPrintPreviewScale();
nscoord scaledISize = (wm.IsVertical() ? scaledHeight : scaledWidth);
nscoord scaledBSize = (wm.IsVertical() ? scaledWidth : scaledHeight);
aDesiredSize.ISize(wm) = std::max(scaledISize, aReflowInput.AvailableISize());
aDesiredSize.BSize(wm) = std::max(scaledBSize, aReflowInput.ComputedBSize());
}
示例12:
/* virtual */ void
nsRubyTextFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
// Even if we want to hide this frame, we have to reflow it first.
// If we leave it dirty, changes to its content will never be
// propagated to the ancestors, then it won't be displayed even if
// the content is no longer the same, until next reflow triggered by
// some other change. In general, we always reflow all the frames we
// created. There might be other problems if we don't do that.
nsRubyContentFrame::Reflow(aPresContext, aDesiredSize, aReflowInput, aStatus);
if (IsAutoHidden()) {
// Reset the ISize. The BSize is not changed so that it won't
// affect vertical positioning in unexpected way.
WritingMode lineWM = aReflowInput.mLineLayout->GetWritingMode();
aDesiredSize.ISize(lineWM) = 0;
aDesiredSize.SetOverflowAreasToDesiredBounds();
}
}
示例13: while
void
nsPlaceholderFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
#ifdef DEBUG
// We should be getting reflowed before our out-of-flow.
// If this is our first reflow, and our out-of-flow has already received its
// first reflow (before us), complain.
// XXXdholbert This "look for a previous continuation or IB-split sibling"
// code could use nsLayoutUtils::GetPrevContinuationOrIBSplitSibling(), if
// we ever add a function like that. (We currently have a "Next" version.)
if ((GetStateBits() & NS_FRAME_FIRST_REFLOW) &&
!(mOutOfFlowFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
// Unfortunately, this can currently happen when the placeholder is in a
// later continuation or later IB-split sibling than its out-of-flow (as
// is the case in some of our existing unit tests). So for now, in that
// case, we'll warn instead of asserting.
bool isInContinuationOrIBSplit = false;
nsIFrame* ancestor = this;
while ((ancestor = ancestor->GetParent())) {
if (ancestor->GetPrevContinuation() ||
ancestor->Properties().Get(IBSplitPrevSibling())) {
isInContinuationOrIBSplit = true;
break;
}
}
if (isInContinuationOrIBSplit) {
NS_WARNING("Out-of-flow frame got reflowed before its placeholder");
} else {
NS_ERROR("Out-of-flow frame got reflowed before its placeholder");
}
}
#endif
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsPlaceholderFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
aDesiredSize.ClearSize();
aStatus = NS_FRAME_COMPLETE;
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
示例14: MarkInReflow
/* virtual */ void
nsBackdropFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsBackdropFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
// Note that this frame is a child of the viewport frame.
WritingMode wm = aReflowInput.GetWritingMode();
LogicalMargin borderPadding = aReflowInput.ComputedLogicalBorderPadding();
nscoord isize = aReflowInput.ComputedISize() + borderPadding.IStartEnd(wm);
nscoord bsize = aReflowInput.ComputedBSize() + borderPadding.BStartEnd(wm);
aDesiredSize.SetSize(wm, LogicalSize(wm, isize, bsize));
aStatus = NS_FRAME_COMPLETE;
}
示例15: baseSize
/* virtual */ nsresult
nsMathMLmencloseFrame::PlaceInternal(DrawTarget* aDrawTarget,
bool aPlaceOrigin,
ReflowOutput& aDesiredSize,
bool aWidthOnly)
{
///////////////
// Measure the size of our content using the base class to format like an
// inferred mrow.
ReflowOutput baseSize(aDesiredSize.GetWritingMode());
nsresult rv =
nsMathMLContainerFrame::Place(aDrawTarget, false, baseSize);
if (NS_MATHML_HAS_ERROR(mPresentationData.flags) || NS_FAILED(rv)) {
DidReflowChildren(PrincipalChildList().FirstChild());
return rv;
}
nsBoundingMetrics bmBase = baseSize.mBoundingMetrics;
nscoord dx_left = 0, dx_right = 0;
nsBoundingMetrics bmLongdivChar, bmRadicalChar;
nscoord radicalAscent = 0, radicalDescent = 0;
nscoord longdivAscent = 0, longdivDescent = 0;
nscoord psi = 0;
nscoord leading = 0;
///////////////
// Thickness of bars and font metrics
nscoord onePixel = nsPresContext::CSSPixelsToAppUnits(1);
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
RefPtr<nsFontMetrics> fm =
nsLayoutUtils::GetFontMetricsForFrame(this, fontSizeInflation);
GetRuleThickness(aDrawTarget, fm, mRuleThickness);
if (mRuleThickness < onePixel) {
mRuleThickness = onePixel;
}
char16_t one = '1';
nsBoundingMetrics bmOne =
nsLayoutUtils::AppUnitBoundsOfString(&one, 1, *fm, aDrawTarget);
///////////////
// General rules: the menclose element takes the size of the enclosed content.
// We add a padding when needed.
// determine padding & psi
nscoord padding = 3 * mRuleThickness;
nscoord delta = padding % onePixel;
if (delta)
padding += onePixel - delta; // round up
if (IsToDraw(NOTATION_LONGDIV) || IsToDraw(NOTATION_RADICAL)) {
GetRadicalParameters(fm, StyleFont()->mMathDisplay ==
NS_MATHML_DISPLAYSTYLE_BLOCK,
mRadicalRuleThickness, leading, psi);
// make sure that the rule appears on on screen
if (mRadicalRuleThickness < onePixel) {
mRadicalRuleThickness = onePixel;
}
// adjust clearance psi to get an exact number of pixels -- this
// gives a nicer & uniform look on stacked radicals (bug 130282)
delta = psi % onePixel;
if (delta) {
psi += onePixel - delta; // round up
}
}
// Set horizontal parameters
if (IsToDraw(NOTATION_ROUNDEDBOX) ||
IsToDraw(NOTATION_TOP) ||
IsToDraw(NOTATION_LEFT) ||
IsToDraw(NOTATION_BOTTOM) ||
IsToDraw(NOTATION_CIRCLE))
dx_left = padding;
if (IsToDraw(NOTATION_ROUNDEDBOX) ||
IsToDraw(NOTATION_TOP) ||
IsToDraw(NOTATION_RIGHT) ||
IsToDraw(NOTATION_BOTTOM) ||
IsToDraw(NOTATION_CIRCLE))
dx_right = padding;
// Set vertical parameters
if (IsToDraw(NOTATION_RIGHT) ||
IsToDraw(NOTATION_LEFT) ||
IsToDraw(NOTATION_UPDIAGONALSTRIKE) ||
IsToDraw(NOTATION_UPDIAGONALARROW) ||
IsToDraw(NOTATION_DOWNDIAGONALSTRIKE) ||
IsToDraw(NOTATION_VERTICALSTRIKE) ||
IsToDraw(NOTATION_CIRCLE) ||
IsToDraw(NOTATION_ROUNDEDBOX) ||
IsToDraw(NOTATION_RADICAL) ||
IsToDraw(NOTATION_LONGDIV) ||
IsToDraw(NOTATION_PHASORANGLE)) {
// set a minimal value for the base height
bmBase.ascent = std::max(bmOne.ascent, bmBase.ascent);
bmBase.descent = std::max(0, bmBase.descent);
//.........这里部分代码省略.........