本文整理汇总了C++中WritingMode类的典型用法代码示例。如果您正苦于以下问题:C++ WritingMode类的具体用法?C++ WritingMode怎么用?C++ WritingMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WritingMode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: info
nsresult
nsFloatManager::AddFloat(nsIFrame* aFloatFrame, const LogicalRect& aMarginRect,
WritingMode aWM, nscoord aContainerWidth)
{
NS_ASSERTION(aMarginRect.ISize(aWM) >= 0, "negative inline size!");
NS_ASSERTION(aMarginRect.BSize(aWM) >= 0, "negative block size!");
FloatInfo info(aFloatFrame, aWM, aMarginRect + mOffset);
// Set mLeftBEnd and mRightBEnd.
if (HasAnyFloats()) {
FloatInfo &tail = mFloats[mFloats.Length() - 1];
info.mLeftBEnd = tail.mLeftBEnd;
info.mRightBEnd = tail.mRightBEnd;
} else {
info.mLeftBEnd = nscoord_MIN;
info.mRightBEnd = nscoord_MIN;
}
uint8_t floatStyle = aFloatFrame->StyleDisplay()->mFloats;
NS_ASSERTION(floatStyle == NS_STYLE_FLOAT_LEFT ||
floatStyle == NS_STYLE_FLOAT_RIGHT, "unexpected float");
nscoord& sideBEnd =
((floatStyle == NS_STYLE_FLOAT_LEFT) == aWM.IsBidiLTR()) ? info.mLeftBEnd
: info.mRightBEnd;
nscoord thisBEnd = info.mRect.BEnd(aWM);
if (thisBEnd > sideBEnd)
sideBEnd = thisBEnd;
if (!mFloats.AppendElement(info))
return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
}
开发者ID:stormandsun,项目名称:firefox,代码行数:33,代码来源:nsFloatManager.cpp
示例2: an
/* virtual */
LogicalSize
nsFieldSetFrame::ComputeSize(nsRenderingContext *aRenderingContext,
WritingMode aWM,
const LogicalSize& aCBSize,
nscoord aAvailableISize,
const LogicalSize& aMargin,
const LogicalSize& aBorder,
const LogicalSize& aPadding,
ComputeSizeFlags aFlags)
{
LogicalSize result =
nsContainerFrame::ComputeSize(aRenderingContext, aWM,
aCBSize, aAvailableISize,
aMargin, aBorder, aPadding, aFlags);
// XXX The code below doesn't make sense if the caller's writing mode
// is orthogonal to this frame's. Not sure yet what should happen then;
// for now, just bail out.
if (aWM.IsVertical() != GetWritingMode().IsVertical()) {
return result;
}
// Fieldsets never shrink below their min width.
// If we're a container for font size inflation, then shrink
// wrapping inside of us should not apply font size inflation.
AutoMaybeDisableFontInflation an(this);
nscoord minISize = GetMinISize(aRenderingContext);
if (minISize > result.ISize(aWM)) {
result.ISize(aWM) = minISize;
}
return result;
}
开发者ID:bolt-dev,项目名称:gecko-dev,代码行数:36,代码来源:nsFieldSetFrame.cpp
示例3: NS_ASSERTION
nscoord
nsSubDocumentFrame::GetIntrinsicBSize()
{
// <frame> processing does not use this routine, only <iframe>
NS_ASSERTION(IsInline(), "Shouldn't have been called");
if (mContent->IsXULElement()) {
return 0;
}
NS_ASSERTION(ObtainIntrinsicSizeFrame() == nullptr,
"Intrinsic bsize should come from the embedded document.");
// Use size of 300px x 150px, for compatibility with IE, and per CSS2.1 draft.
WritingMode wm = GetWritingMode();
return nsPresContext::CSSPixelsToAppUnits(wm.IsVertical() ? 300 : 150);
}
开发者ID:bitwiseworks,项目名称:mozilla-os2,代码行数:17,代码来源:nsSubDocumentFrame.cpp
示例4: 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());
}
开发者ID:luke-chang,项目名称:gecko-1,代码行数:20,代码来源:nsSimplePageSequenceFrame.cpp
示例5: DISPLAY_PREF_WIDTH
/* virtual */ nscoord
nsSVGOuterSVGFrame::GetPrefISize(nsRenderingContext *aRenderingContext)
{
nscoord result;
DISPLAY_PREF_WIDTH(this, result);
SVGSVGElement *svg = static_cast<SVGSVGElement*>(mContent);
WritingMode wm = GetWritingMode();
const nsSVGLength2& isize = wm.IsVertical()
? svg->mLengthAttributes[SVGSVGElement::ATTR_HEIGHT]
: svg->mLengthAttributes[SVGSVGElement::ATTR_WIDTH];
if (isize.IsPercentage()) {
// It looks like our containing block's isize may depend on our isize. In
// that case our behavior is undefined according to CSS 2.1 section 10.3.2.
// As a last resort, we'll fall back to returning zero.
result = nscoord(0);
// Returning zero may be unhelpful, however, as it leads to unexpected
// disappearance of %-sized SVGs in orthogonal contexts, where our
// containing block wants to shrink-wrap. So let's look for an ancestor
// with non-zero size in this dimension, and use that as a (somewhat
// arbitrary) result instead.
nsIFrame *parent = GetParent();
while (parent) {
nscoord parentISize = parent->GetLogicalSize(wm).ISize(wm);
if (parentISize > 0 && parentISize != NS_UNCONSTRAINEDSIZE) {
result = parentISize;
break;
}
parent = parent->GetParent();
}
} else {
result = nsPresContext::CSSPixelsToAppUnits(isize.GetAnimValue(svg));
if (result < 0) {
result = nscoord(0);
}
}
return result;
}
开发者ID:Nazi-Nigger,项目名称:gecko-dev,代码行数:41,代码来源:nsSVGOuterSVGFrame.cpp
示例6: NS_ASSERTION
nscoord
nsSubDocumentFrame::GetIntrinsicISize()
{
if (!IsInline()) {
return 0; // HTML <frame> has no useful intrinsic isize
}
if (mContent->IsXULElement()) {
return 0; // XUL <iframe> and <browser> have no useful intrinsic isize
}
NS_ASSERTION(ObtainIntrinsicSizeFrame() == nullptr,
"Intrinsic isize should come from the embedded document.");
// We must be an HTML <iframe>. Default to size of 300px x 150px, for IE
// compat (and per CSS2.1 draft).
// This depends on the applied styles, which the comments in nsLeafFrame.h
// say it should not, but we know it cannot change during the lifetime of
// the frame because changing writing-mode leads to frame reconstruction.
WritingMode wm = GetWritingMode();
return nsPresContext::CSSPixelsToAppUnits(wm.IsVertical() ? 150 : 300);
}
开发者ID:bolt-dev,项目名称:gecko-dev,代码行数:22,代码来源:nsSubDocumentFrame.cpp
示例7: switch
nscoord
nsFloatManager::ClearFloats(WritingMode aWM, nscoord aBCoord,
uint8_t aBreakType, nscoord aContainerWidth,
uint32_t aFlags) const
{
if (!(aFlags & DONT_CLEAR_PUSHED_FLOATS) && ClearContinues(aBreakType)) {
return nscoord_MAX;
}
if (!HasAnyFloats()) {
return aBCoord;
}
LogicalPoint offset = mOffset.ConvertTo(aWM, mWritingMode, 0);
nscoord blockEnd = aBCoord + offset.B(aWM);
const FloatInfo &tail = mFloats[mFloats.Length() - 1];
switch (aBreakType) {
case NS_STYLE_CLEAR_BOTH:
blockEnd = std::max(blockEnd, tail.mLeftBEnd);
blockEnd = std::max(blockEnd, tail.mRightBEnd);
break;
case NS_STYLE_CLEAR_LEFT:
blockEnd = std::max(blockEnd, aWM.IsBidiLTR() ? tail.mLeftBEnd
: tail.mRightBEnd);
break;
case NS_STYLE_CLEAR_RIGHT:
blockEnd = std::max(blockEnd, aWM.IsBidiLTR() ? tail.mRightBEnd
: tail.mLeftBEnd);
break;
default:
// Do nothing
break;
}
blockEnd -= offset.B(aWM);
return blockEnd;
}
开发者ID:yati-sagade,项目名称:PerlitoMonkey,代码行数:38,代码来源:nsFloatManager.cpp
示例8: GetWritingMode
LogicalSize
nsProgressFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
WritingMode aWM,
const LogicalSize& aCBSize,
nscoord aAvailableISize,
const LogicalSize& aMargin,
const LogicalSize& aBorder,
const LogicalSize& aPadding,
bool aShrinkWrap)
{
const WritingMode wm = GetWritingMode();
LogicalSize autoSize(wm);
autoSize.BSize(wm) = autoSize.ISize(wm) =
NSToCoordRound(StyleFont()->mFont.size *
nsLayoutUtils::FontSizeInflationFor(this)); // 1em
if (ResolvedOrientationIsVertical() == wm.IsVertical()) {
autoSize.ISize(wm) *= 10; // 10em
} else {
autoSize.BSize(wm) *= 10; // 10em
}
return autoSize.ConvertTo(aWM, wm);
}
开发者ID:Jar-win,项目名称:Waterfox,代码行数:24,代码来源:nsProgressFrame.cpp
示例9: NS_ASSERTION
nscoord
nsFormControlFrame::GetLogicalBaseline(WritingMode aWritingMode) const
{
NS_ASSERTION(!NS_SUBTREE_DIRTY(this),
"frame must not be dirty");
// Treat radio buttons and checkboxes as having an intrinsic baseline
// at the block-end of the control (use the block-end content edge rather
// than the margin edge).
// For "inverted" lines (typically in writing-mode:vertical-lr), use the
// block-start end instead.
return aWritingMode.IsLineInverted()
? GetLogicalUsedBorderAndPadding(aWritingMode).BStart(aWritingMode)
: BSize(aWritingMode) -
GetLogicalUsedBorderAndPadding(aWritingMode).BEnd(aWritingMode);
}
开发者ID:ajkerrigan,项目名称:gecko-dev,代码行数:15,代码来源:nsFormControlFrame.cpp
示例10: an
nscoord
nsTableWrapperFrame::ChildShrinkWrapISize(nsRenderingContext* aRenderingContext,
nsIFrame* aChildFrame,
WritingMode aWM,
LogicalSize aCBSize,
nscoord aAvailableISize,
nscoord* aMarginResult) const
{
AutoMaybeDisableFontInflation an(aChildFrame);
// For the caption frame, child's WM may differ from the table's main WM.
WritingMode childWM = aChildFrame->GetWritingMode();
SizeComputationInput offsets(aChildFrame, aRenderingContext, aWM,
aCBSize.ISize(aWM));
LogicalSize marginSize =
offsets.ComputedLogicalMargin().Size(childWM).ConvertTo(aWM, childWM);
LogicalSize paddingSize =
offsets.ComputedLogicalPadding().Size(childWM).ConvertTo(aWM, childWM);
LogicalSize bpSize =
offsets.ComputedLogicalBorderPadding().Size(childWM).ConvertTo(aWM, childWM);
// Shrink-wrap aChildFrame by default, except if we're a stretched grid item.
auto flags = ComputeSizeFlags::eShrinkWrap;
auto parent = GetParent();
nsIAtom* parentFrameType = parent ? parent->GetType() : nullptr;
bool isGridItem = (parentFrameType == nsGkAtoms::gridContainerFrame &&
!HasAnyStateBits(NS_FRAME_OUT_OF_FLOW));
if (MOZ_UNLIKELY(isGridItem) &&
!StyleMargin()->HasInlineAxisAuto(aWM)) {
auto inlineAxisAlignment = aWM.IsOrthogonalTo(parent->GetWritingMode()) ?
StylePosition()->UsedAlignSelf(parent->StyleContext()) :
StylePosition()->UsedJustifySelf(parent->StyleContext());
if (inlineAxisAlignment == NS_STYLE_ALIGN_NORMAL ||
inlineAxisAlignment == NS_STYLE_ALIGN_STRETCH) {
flags = nsIFrame::ComputeSizeFlags::eDefault;
}
}
LogicalSize size =
aChildFrame->ComputeSize(aRenderingContext, aWM, aCBSize, aAvailableISize,
marginSize, bpSize - paddingSize, paddingSize,
flags);
if (aMarginResult) {
*aMarginResult = offsets.ComputedLogicalMargin().IStartEnd(aWM);
}
return size.ISize(aWM) + marginSize.ISize(aWM) + bpSize.ISize(aWM);
}
开发者ID:bitwiseworks,项目名称:mozilla-os2,代码行数:48,代码来源:nsTableWrapperFrame.cpp
示例11: autoSize
LogicalSize
nsTextControlFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
WritingMode aWM,
const LogicalSize& aCBSize,
nscoord aAvailableISize,
const LogicalSize& aMargin,
const LogicalSize& aBorder,
const LogicalSize& aPadding,
bool aShrinkWrap)
{
float inflation = nsLayoutUtils::FontSizeInflationFor(this);
LogicalSize autoSize(aWM);
nsresult rv = CalcIntrinsicSize(aRenderingContext, aWM, autoSize, inflation);
if (NS_FAILED(rv)) {
// What now?
autoSize.SizeTo(aWM, 0, 0);
}
#ifdef DEBUG
// Note: Ancestor ComputeAutoSize only computes a width if we're auto-width
else {
const nsStyleCoord& inlineStyleCoord =
aWM.IsVertical() ? StylePosition()->mHeight : StylePosition()->mWidth;
if (inlineStyleCoord.GetUnit() == eStyleUnit_Auto) {
LogicalSize ancestorAutoSize =
nsContainerFrame::ComputeAutoSize(aRenderingContext, aWM,
aCBSize, aAvailableISize,
aMargin, aBorder,
aPadding, aShrinkWrap);
// Disabled when there's inflation; see comment in GetPrefSize.
MOZ_ASSERT(inflation != 1.0f ||
ancestorAutoSize.ISize(aWM) == autoSize.ISize(aWM),
"Incorrect size computed by ComputeAutoSize?");
}
}
#endif
return autoSize;
}
开发者ID:ajkerrigan,项目名称:gecko-dev,代码行数:38,代码来源:nsTextControlFrame.cpp
示例12: GetWritingMode
bool
nsColumnSetFrame::ReflowChildren(ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus,
const ReflowConfig& aConfig,
bool aUnboundedLastColumn,
nsCollapsingMargin* aCarriedOutBEndMargin,
ColumnBalanceData& aColData)
{
aColData.Reset();
bool allFit = true;
WritingMode wm = GetWritingMode();
bool isVertical = wm.IsVertical();
bool isRTL = !wm.IsBidiLTR();
bool shrinkingBSizeOnly = !NS_SUBTREE_DIRTY(this) &&
mLastBalanceBSize > aConfig.mColMaxBSize;
#ifdef DEBUG_roc
printf("*** Doing column reflow pass: mLastBalanceBSize=%d, mColMaxBSize=%d, RTL=%d\n"
" mBalanceColCount=%d, mColISize=%d, mColGap=%d\n",
mLastBalanceBSize, aConfig.mColMaxBSize, isRTL, aConfig.mBalanceColCount,
aConfig.mColISize, aConfig.mColGap);
#endif
DrainOverflowColumns();
const bool colBSizeChanged = mLastBalanceBSize != aConfig.mColMaxBSize;
if (colBSizeChanged) {
mLastBalanceBSize = aConfig.mColMaxBSize;
// XXX Seems like this could fire if incremental reflow pushed the column set
// down so we reflow incrementally with a different available height.
// We need a way to do an incremental reflow and be sure availableHeight
// changes are taken account of! Right now I think block frames with absolute
// children might exit early.
//NS_ASSERTION(aKidReason != eReflowReason_Incremental,
// "incremental reflow should not have changed the balance height");
}
// get our border and padding
LogicalMargin borderPadding = aReflowInput.ComputedLogicalBorderPadding();
borderPadding.ApplySkipSides(GetLogicalSkipSides(&aReflowInput));
nsRect contentRect(0, 0, 0, 0);
nsOverflowAreas overflowRects;
nsIFrame* child = mFrames.FirstChild();
LogicalPoint childOrigin(wm, borderPadding.IStart(wm),
borderPadding.BStart(wm));
// In vertical-rl mode, columns will not be correctly placed if the
// reflowInput's ComputedWidth() is UNCONSTRAINED (in which case we'll get
// a containerSize.width of zero here). In that case, the column positions
// will be adjusted later, after our correct contentSize is known.
nsSize containerSize = aReflowInput.ComputedSizeAsContainerIfConstrained();
// For RTL, since the columns might not fill the frame exactly, we
// need to account for the slop. Otherwise we'll waste time moving the
// columns by some tiny amount
// XXX when all of layout is converted to logical coordinates, we
// probably won't need to do this hack any more. For now, we
// confine it to the legacy horizontal-rl case
if (!isVertical && isRTL) {
nscoord availISize = aReflowInput.AvailableISize();
if (aReflowInput.ComputedISize() != NS_INTRINSICSIZE) {
availISize = aReflowInput.ComputedISize();
}
if (availISize != NS_INTRINSICSIZE) {
childOrigin.I(wm) = containerSize.width - borderPadding.Left(wm) -
availISize;
#ifdef DEBUG_roc
printf("*** childOrigin.iCoord = %d\n", childOrigin.I(wm));
#endif
}
}
int columnCount = 0;
int contentBEnd = 0;
bool reflowNext = false;
while (child) {
// Try to skip reflowing the child. We can't skip if the child is dirty. We also can't
// skip if the next column is dirty, because the next column's first line(s)
// might be pullable back to this column. We can't skip if it's the last child
// because we need to obtain the bottom margin. We can't skip
// if this is the last column and we're supposed to assign unbounded
// height to it, because that could change the available height from
// the last time we reflowed it and we should try to pull all the
// content from its next sibling. (Note that it might be the last
// column, but not be the last child because the desired number of columns
// has changed.)
bool skipIncremental = !aReflowInput.ShouldReflowAllKids()
&& !NS_SUBTREE_DIRTY(child)
&& child->GetNextSibling()
&& !(aUnboundedLastColumn && columnCount == aConfig.mBalanceColCount - 1)
&& !NS_SUBTREE_DIRTY(child->GetNextSibling());
// If we need to pull up content from the prev-in-flow then this is not just
// a height shrink. The prev in flow will have set the dirty bit.
// Check the overflow rect YMost instead of just the child's content height. The child
// may have overflowing content that cares about the available height boundary.
//.........这里部分代码省略.........
开发者ID:mephisto41,项目名称:gecko-dev,代码行数:101,代码来源:nsColumnSetFrame.cpp
示例13:
bool
nsAbsoluteContainingBlock::FrameDependsOnContainer(nsIFrame* f,
bool aCBWidthChanged,
bool aCBHeightChanged)
{
const nsStylePosition* pos = f->StylePosition();
// See if f's position might have changed because it depends on a
// placeholder's position
// This can happen in the following cases:
// 1) Vertical positioning. "top" must be auto and "bottom" must be auto
// (otherwise the vertical position is completely determined by
// whichever of them is not auto and the height).
// 2) Horizontal positioning. "left" must be auto and "right" must be auto
// (otherwise the horizontal position is completely determined by
// whichever of them is not auto and the width).
// See nsHTMLReflowState::InitAbsoluteConstraints -- these are the
// only cases when we call CalculateHypotheticalBox().
if ((pos->mOffset.GetTopUnit() == eStyleUnit_Auto &&
pos->mOffset.GetBottomUnit() == eStyleUnit_Auto) ||
(pos->mOffset.GetLeftUnit() == eStyleUnit_Auto &&
pos->mOffset.GetRightUnit() == eStyleUnit_Auto)) {
return true;
}
if (!aCBWidthChanged && !aCBHeightChanged) {
// skip getting style data
return false;
}
const nsStylePadding* padding = f->StylePadding();
const nsStyleMargin* margin = f->StyleMargin();
WritingMode wm = f->GetWritingMode();
if (wm.IsVertical() ? aCBHeightChanged : aCBWidthChanged) {
// See if f's inline-size might have changed.
// If margin-inline-start/end, padding-inline-start/end,
// inline-size, min/max-inline-size are all lengths, 'none', or enumerated,
// then our frame isize does not depend on the parent isize.
// Note that borders never depend on the parent isize.
// XXX All of the enumerated values except -moz-available are ok too.
if (pos->ISizeDependsOnContainer(wm) ||
pos->MinISizeDependsOnContainer(wm) ||
pos->MaxISizeDependsOnContainer(wm) ||
!IsFixedPaddingSize(padding->mPadding.GetIStart(wm)) ||
!IsFixedPaddingSize(padding->mPadding.GetIEnd(wm))) {
return true;
}
// See if f's position might have changed. If we're RTL then the
// rules are slightly different. We'll assume percentage or auto
// margins will always induce a dependency on the size
if (!IsFixedMarginSize(margin->mMargin.GetIStart(wm)) ||
!IsFixedMarginSize(margin->mMargin.GetIEnd(wm))) {
return true;
}
if (!wm.IsBidiLTR()) {
// Note that even if 'istart' is a length, our position can
// still depend on the containing block isze, because if
// 'iend' is also a length we will discard 'istart' and be
// positioned relative to the containing block iend edge.
// 'istart' length and 'iend' auto is the only combination
// we can be sure of.
if (!IsFixedOffset(pos->mOffset.GetIStart(wm)) ||
pos->mOffset.GetIEndUnit(wm) != eStyleUnit_Auto) {
return true;
}
} else {
if (!IsFixedOffset(pos->mOffset.GetIStart(wm))) {
return true;
}
}
}
if (wm.IsVertical() ? aCBWidthChanged : aCBHeightChanged) {
// See if f's block-size might have changed.
// If margin-block-start/end, padding-block-start/end,
// min-block-size, and max-block-size are all lengths or 'none',
// and bsize is a length or bsize and bend are auto and bstart is not auto,
// then our frame bsize does not depend on the parent bsize.
// Note that borders never depend on the parent bsize.
if ((pos->BSizeDependsOnContainer(wm) &&
!(pos->BSize(wm).GetUnit() == eStyleUnit_Auto &&
pos->mOffset.GetBEndUnit(wm) == eStyleUnit_Auto &&
pos->mOffset.GetBStartUnit(wm) != eStyleUnit_Auto)) ||
pos->MinBSizeDependsOnContainer(wm) ||
pos->MaxBSizeDependsOnContainer(wm) ||
!IsFixedPaddingSize(padding->mPadding.GetBStart(wm)) ||
!IsFixedPaddingSize(padding->mPadding.GetBEnd(wm))) {
return true;
}
// See if f's position might have changed.
if (!IsFixedMarginSize(margin->mMargin.GetBStart(wm)) ||
!IsFixedMarginSize(margin->mMargin.GetBEnd(wm))) {
return true;
}
if (!IsFixedOffset(pos->mOffset.GetBStart(wm))) {
return true;
}
}
return false;
}
开发者ID:Nazi-Nigger,项目名称:gecko-dev,代码行数:98,代码来源:nsAbsoluteContainingBlock.cpp
示例14: ResolvedOrientationIsVertical
void
nsProgressFrame::ReflowBarFrame(nsIFrame* aBarFrame,
nsPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
bool vertical = ResolvedOrientationIsVertical();
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;
nscoord yoffset = aReflowState.ComputedPhysicalBorderPadding().top;
double position = static_cast<HTMLProgressElement*>(mContent)->Position();
// Force the bar's size to match the current progress.
// When indeterminate, the progress' size will be 100%.
if (position >= 0.0) {
size *= position;
}
if (!vertical && (wm.IsVertical() ? wm.IsVerticalRL() : !wm.IsBidiLTR())) {
xoffset += aReflowState.ComputedWidth() - size;
}
// The bar size is fixed in these cases:
// - the progress position is determined: the bar size is fixed according
// to it's value.
// - the progress position is indeterminate and the bar appearance should be
// shown as native: the bar size is forced to 100%.
// Otherwise (when the progress is indeterminate and the bar appearance isn't
// native), the bar size isn't fixed and can be set by the author.
if (position != -1 || ShouldUseNativeStyle()) {
if (vertical) {
// We want the bar to begin at the bottom.
yoffset += aReflowState.ComputedHeight() - size;
size -= reflowState.ComputedPhysicalMargin().TopBottom() +
reflowState.ComputedPhysicalBorderPadding().TopBottom();
size = std::max(size, 0);
reflowState.SetComputedHeight(size);
} else {
size -= reflowState.ComputedPhysicalMargin().LeftRight() +
reflowState.ComputedPhysicalBorderPadding().LeftRight();
size = std::max(size, 0);
reflowState.SetComputedWidth(size);
}
} else if (vertical) {
// For vertical progress bars, we need to position the bar specificly when
// the width isn't constrained (position == -1 and !ShouldUseNativeStyle())
// because aReflowState.ComputedHeight() - size == 0.
yoffset += aReflowState.ComputedHeight() - reflowState.ComputedHeight();
}
xoffset += reflowState.ComputedPhysicalMargin().left;
yoffset += reflowState.ComputedPhysicalMargin().top;
nsHTMLReflowMetrics barDesiredSize(aReflowState);
ReflowChild(aBarFrame, aPresContext, barDesiredSize, reflowState, xoffset,
yoffset, 0, aStatus);
FinishReflowChild(aBarFrame, aPresContext, barDesiredSize, &reflowState,
xoffset, yoffset, 0);
}
开发者ID:Jar-win,项目名称:Waterfox,代码行数:67,代码来源:nsProgressFrame.cpp
示例15: availSize
void
nsRubyFrame::ReflowSegment(nsPresContext* aPresContext,
const ReflowInput& aReflowInput,
nsRubyBaseContainerFrame* aBaseContainer,
nsReflowStatus& aStatus)
{
WritingMode lineWM = aReflowInput.mLineLayout->GetWritingMode();
LogicalSize availSize(lineWM, aReflowInput.AvailableISize(),
aReflowInput.AvailableBSize());
WritingMode rubyWM = GetWritingMode();
NS_ASSERTION(!rubyWM.IsOrthogonalTo(lineWM),
"Ruby frame writing-mode shouldn't be orthogonal to its line");
AutoRubyTextContainerArray textContainers(aBaseContainer);
const uint32_t rtcCount = textContainers.Length();
ReflowOutput baseMetrics(aReflowInput);
bool pushedFrame;
aReflowInput.mLineLayout->ReflowFrame(aBaseContainer, aStatus,
&baseMetrics, pushedFrame);
if (NS_INLINE_IS_BREAK_BEFORE(aStatus)) {
if (aBaseContainer != mFrames.FirstChild()) {
// Some segments may have been reflowed before, hence it is not
// a break-before for the ruby container.
aStatus = NS_INLINE_LINE_BREAK_AFTER(NS_FRAME_NOT_COMPLETE);
PushChildren(aBaseContainer, aBaseContainer->GetPrevSibling());
aReflowInput.mLineLayout->SetDirtyNextLine();
}
// This base container is not placed at all, we can skip all
// text containers paired with it.
return;
}
if (NS_FRAME_IS_NOT_COMPLETE(aStatus)) {
// It always promise that if the status is incomplete, there is a
// break occurs. Break before has been processed above. However,
// it is possible that break after happens with the frame reflow
// completed. It happens if there is a force break at the end.
MOZ_ASSERT(NS_INLINE_IS_BREAK_AFTER(aStatus));
// Find the previous sibling which we will
// insert new continuations after.
nsIFrame* lastChild;
if (rtcCount > 0) {
lastChild = textContainers.LastElement();
} else {
lastChild = aBaseContainer;
}
// Create continuations for the base container
nsIFrame* newBaseContainer = CreateNextInFlow(aBaseContainer);
// newBaseContainer is null if there are existing next-in-flows.
// We only need to move and push if there were not.
if (newBaseContainer) {
// Move the new frame after all the text containers
mFrames.RemoveFrame(newBaseContainer);
mFrames.InsertFrame(nullptr, lastChild, newBaseContainer);
// Create continuations for text containers
nsIFrame* newLastChild = newBaseContainer;
for (uint32_t i = 0; i < rtcCount; i++) {
nsIFrame* newTextContainer = CreateNextInFlow(textContainers[i]);
MOZ_ASSERT(newTextContainer, "Next-in-flow of rtc should not exist "
"if the corresponding rbc does not");
mFrames.RemoveFrame(newTextContainer);
mFrames.InsertFrame(nullptr, newLastChild, newTextContainer);
newLastChild = newTextContainer;
}
}
if (lastChild != mFrames.LastChild()) {
// Always push the next frame after the last child in this segment.
// It is possible that we pulled it back before our next-in-flow
// drain our overflow.
PushChildren(lastChild->GetNextSibling(), lastChild);
aReflowInput.mLineLayout->SetDirtyNextLine();
}
} else {
// If the ruby base container is reflowed completely, the line
// layout will remove the next-in-flows of that frame. But the
// line layout is not aware of the ruby text containers, hence
// it is necessary to remove them here.
for (uint32_t i = 0; i < rtcCount; i++) {
nsIFrame* nextRTC = textContainers[i]->GetNextInFlow();
if (nextRTC) {
nextRTC->GetParent()->DeleteNextInFlowChild(nextRTC, true);
}
}
}
nscoord segmentISize = baseMetrics.ISize(lineWM);
const nsSize dummyContainerSize;
LogicalRect baseRect =
aBaseContainer->GetLogicalRect(lineWM, dummyContainerSize);
// We need to position our rtc frames on one side or the other of the
// base container's rect, using a coordinate space that's relative to
// the ruby frame. Right now, the base container's rect's block-axis
// position is relative to the block container frame containing the
// lines, so we use 0 instead. (i.e. we assume that the base container
// is adjacent to the ruby frame's block-start edge.)
// XXX We may need to add border/padding here. See bug 1055667.
baseRect.BStart(lineWM) = 0;
//.........这里部分代码省略.........
开发者ID:cstipkovic,项目名称:gecko-dev,代码行数:101,代码来源:nsRubyFrame.cpp
示例16: NS_ASSERTION
nsFlowAreaRect
nsFloatManager::GetFlowArea(WritingMode aWM, nscoord aBOffset,
BandInfoType aInfoType, nscoord aBSize,
LogicalRect aContentArea, SavedState* aState,
nscoord aContainerWidth) const
{
NS_ASSERTION(aBSize >= 0, "unexpected max block size");
NS_ASSERTION(aContentArea.ISize(aWM) >= 0,
"unexpected content area inline size");
LogicalPoint offset = mOffset.ConvertTo(aWM, mWritingMode, 0);
nscoord blockStart = aBOffset + offset.B(aWM);
if (blockStart < nscoord_MIN) {
NS_WARNING("bad value");
blockStart = nscoord_MIN;
}
// Determine the last float that we should consider.
uint32_t floatCount;
if (aState) {
// Use the provided state.
floatCount = aState->mFloatInfoCount;
NS_ABORT_IF_FALSE(floatCount <= mFloats.Length(), "bad state");
} else {
// Use our current state.
floatCount = mFloats.Length();
}
// If there are no floats at all, or we're below the last one, return
// quickly.
if (floatCount == 0 ||
(mFloats[floatCount-1].mLeftBEnd <= blockStart &&
mFloats[floatCount-1].mRightBEnd <= blockStart)) {
return nsFlowAreaRect(aWM, aContentArea.IStart(aWM), aBOffset,
aContentArea.ISize(aWM), aBSize, false);
}
nscoord blockEnd;
if (aBSize == nscoord_MAX) {
// This warning (and the two below) are possible to hit on pages
// with really large objects.
NS_WARN_IF_FALSE(aInfoType == BAND_FROM_POINT,
"bad height");
blockEnd = nscoord_MAX;
} else {
blockEnd = blockStart + aBSize;
if (blockEnd < blockStart || blockEnd > nscoord_MAX) {
NS_WARNING("bad value");
blockEnd = nscoord_MAX;
}
}
nscoord inlineStart = offset.I(aWM) + aContentArea.IStart(aWM);
nscoord inlineEnd = offset.I(aWM) + aContentArea.IEnd(aWM);
if (inlineEnd < inlineStart) {
NS_WARNING("bad value");
inlineEnd = inlineStart;
}
// Walk backwards through the floats until we either hit the front of
// the list or we're above |blockStart|.
bool haveFloats = false;
for (uint32_t i = floatCount; i > 0; --i) {
const FloatInfo &fi = mFloats[i-1];
if (fi.mLeftBEnd <= blockStart && fi.mRightBEnd <= blockStart) {
// There aren't any more floats that could intersect this band.
break;
}
if (fi.mRect.IsEmpty()) {
// For compatibility, ignore floats with empty rects, even though it
// disagrees with the spec. (We might want to fix this in the
// future, though.)
continue;
}
LogicalRect rect = fi.mRect.ConvertTo(aWM, fi.mWritingMode,
aContainerWidth);
nscoord floatBStart = rect.BStart(aWM);
nscoord floatBEnd = rect.BEnd(aWM);
if (blockStart < floatBStart && aInfoType == BAND_FROM_POINT) {
// This float is below our band. Shrink our band's height if needed.
if (floatBStart < blockEnd) {
blockEnd = floatBStart;
}
}
// If blockStart == blockEnd (which happens only with WIDTH_WITHIN_HEIGHT),
// we include floats that begin at our 0-height vertical area. We
// need to to this to satisfy the invariant that a
// WIDTH_WITHIN_HEIGHT call is at least as narrow on both sides as a
// BAND_WITHIN_POINT call beginning at its blockStart.
else if (blockStart < floatBEnd &&
(floatBStart < blockEnd ||
(floatBStart == blockEnd && blockStart == blockEnd))) {
// This float is in our band.
// Shrink our band's height if needed.
if (floatBEnd < blockEnd && aInfoType == BAND_FROM_POINT) {
blockEnd = floatBEnd;
}
// Shrink our band's width if needed.
//.........这里部分代码省略.........
开发者ID:yati-sagade,项目名称:PerlitoMonkey,代码行数:101,代码来源:nsFloatManager.cpp
示例17: MarkInReflow
void
nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsFieldSetFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
NS_PRECONDITION(aReflowState.ComputedISize() != NS_INTRINSICSIZE,
"Should have a precomputed inline-size!");
// Initialize OUT parameter
aStatus = NS_FRAME_COMPLETE;
nsOverflowAreas ocBounds;
nsReflowStatus ocStatus = NS_FRAME_COMPLETE;
if (GetPrevInFlow()) {
ReflowOverflowContainerChildren(aPresContext, aReflowState, ocBounds, 0,
ocStatus);
}
//------------ Handle Incremental Reflow -----------------
bool reflowInner;
bool reflowLegend;
nsIFrame* legend = GetLegend();
nsIFrame* inner = GetInner();
if (aReflowState.ShouldReflowAllKids()) {
reflowInner = inner != nullptr;
reflowLegend = legend != nullptr;
} else {
reflowInner = inner && NS_SUBTREE_DIRTY(inner);
reflowLegend = legend && NS_SUBTREE_DIRTY(legend);
}
// We don't allow fieldsets to break vertically. If we did, we'd
// 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.
WritingMode wm = GetWritingMode();
WritingMode innerWM = inner ? inner->GetWritingMode() : wm;
WritingMode legendWM = legend ? legend->GetWritingMode() : wm;
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_ISIZE) <=
innerAvailSize.ISize(innerWM),
"Bogus availSize.ISize; should be bigger");
NS_ASSERTION(!legend ||
nsLayoutUtils::IntrinsicForContainer(aReflowState.rendContext,
legend,
nsLayoutUtils::MIN_ISIZE) <=
legendAvailSize.ISize(legendWM),
"Bogus availSize.ISize; should be bigger");
// get our border and padding
LogicalMargin border = aReflowState.ComputedLogicalBorderPadding() -
aReflowState.ComputedLogicalPadding();
// Figure out how big the legend is if there is one.
// get the legend's margin
LogicalMargin legendMargin(wm);
// reflow the legend only if needed
Maybe<nsHTMLReflowState> legendReflowState;
if (legend) {
legendReflowState.emplace(aPresContext, aReflowState, legend,
legendAvailSize);
}
if (reflowLegend) {
nsHTMLReflowMetrics legendDesiredSize(aReflowState);
// We'll move the legend to its proper place later, so the position
// and containerSize passed here are unimportant.
const nsSize dummyContainerSize;
ReflowChild(legend, aPresContext, legendDesiredSize, *legendReflowState,
wm, LogicalPoint(wm), dummyContainerSize,
NS_FRAME_NO_MOVE_FRAME, aStatus);
#ifdef NOISY_REFLOW
printf(" returned (%d, %d)\n",
legendDesiredSize.Width(), legendDesiredSize.Height());
#endif
// figure out the legend's rectangle
legendMargin = legend->GetLogicalUsedMargin(wm);
mLegendRect =
LogicalRect(wm, 0, 0,
legendDesiredSize.ISize(wm) + legendMargin.IStartEnd(wm),
legendDesiredSize.BSize(wm) + legendMargin.BStartEnd(wm));
nscoord oldSpace = mLegendSpace;
mLegendSpace = 0;
if (mLegendRect.BSize(wm) > border.BStart(wm)) {
// center the border on the legend
mLegendSpace = mLegendRect.BSize(wm) - border.BStart(wm);
} else {
mLegendRect.BStart(wm) =
(border.BStart(wm) - mLegendRect.BSize(wm)) / 2;
//.........这里部分代码省略.........
开发者ID:bolt-dev,项目名称:gecko-dev,代码行数:101,代码来源:nsFieldSetFrame.cpp
示例18: MarkInReflow
void
BRFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aMetrics,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("BRFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowInput, aMetrics, aStatus);
WritingMode wm = aReflowInput.GetWritingMode();
LogicalSize finalSize(wm);
finalSize.BSize(wm) = 0; // BR frames with block size 0 are ignored in quirks
// mode by nsLineLayout::VerticalAlignFrames .
// However, it's not always 0.
|
请发表评论