本文整理汇总了C++中nslinelist::iterator::IsBlock方法的典型用法代码示例。如果您正苦于以下问题:C++ iterator::IsBlock方法的具体用法?C++ iterator::IsBlock怎么用?C++ iterator::IsBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nslinelist::iterator
的用法示例。
在下文中一共展示了iterator::IsBlock方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/*
* Reconstruct the vertical margin before the line |aLine| in order to
* do an incremental reflow that begins with |aLine| without reflowing
* the line before it. |aLine| may point to the fencepost at the end of
* the line list, and it is used this way since we (for now, anyway)
* always need to recover margins at the end of a block.
*
* The reconstruction involves walking backward through the line list to
* find any collapsed margins preceding the line that would have been in
* the reflow state's |mPrevBEndMargin| when we reflowed that line in
* a full reflow (under the rule in CSS2 that all adjacent vertical
* margins of blocks collapse).
*/
void
nsBlockReflowState::ReconstructMarginBefore(nsLineList::iterator aLine)
{
mPrevBEndMargin.Zero();
nsBlockFrame *block = mBlock;
nsLineList::iterator firstLine = block->begin_lines();
for (;;) {
--aLine;
if (aLine->IsBlock()) {
mPrevBEndMargin = aLine->GetCarriedOutBEndMargin();
break;
}
if (!aLine->IsEmpty()) {
break;
}
if (aLine == firstLine) {
// If the top margin was carried out (and thus already applied),
// set it to zero. Either way, we're done.
if (!GetFlag(BRS_ISBSTARTMARGINROOT)) {
mPrevBEndMargin.Zero();
}
break;
}
}
}
示例2: BorderPadding
/**
* Everything done in this function is done O(N) times for each pass of
* reflow so it is O(N*M) where M is the number of incremental reflow
* passes. That's bad. Don't do stuff here.
*
* When this function is called, |aLine| has just been slid by |aDeltaY|
* and the purpose of RecoverStateFrom is to ensure that the
* nsBlockReflowState is in the same state that it would have been in
* had the line just been reflowed.
*
* Most of the state recovery that we have to do involves floats.
*/
void
nsBlockReflowState::RecoverStateFrom(nsLineList::iterator aLine,
nscoord aDeltaY)
{
// Make the line being recovered the current line
mCurrentLine = aLine;
// Place floats for this line into the space manager
if (aLine->HasFloats() || aLine->IsBlock()) {
// Undo border/padding translation since the nsFloatCache's
// coordinates are relative to the frame not relative to the
// border/padding.
const nsMargin& bp = BorderPadding();
mSpaceManager->Translate(-bp.left, -bp.top);
RecoverFloats(aLine, aDeltaY);
#ifdef DEBUG
if (nsBlockFrame::gNoisyReflow || nsBlockFrame::gNoisySpaceManager) {
mSpaceManager->List(stdout);
}
#endif
// And then put the translation back again
mSpaceManager->Translate(bp.left, bp.top);
}
}
示例3:
/*
* Reconstruct the vertical margin before the line |aLine| in order to
* do an incremental reflow that begins with |aLine| without reflowing
* the line before it. |aLine| may point to the fencepost at the end of
* the line list, and it is used this way since we (for now, anyway)
* always need to recover margins at the end of a block.
*
* The reconstruction involves walking backward through the line list to
* find any collapsed margins preceding the line that would have been in
* the reflow state's |mPrevBEndMargin| when we reflowed that line in
* a full reflow (under the rule in CSS2 that all adjacent vertical
* margins of blocks collapse).
*/
void
BlockReflowInput::ReconstructMarginBefore(nsLineList::iterator aLine)
{
mPrevBEndMargin.Zero();
nsBlockFrame *block = mBlock;
nsLineList::iterator firstLine = block->LinesBegin();
for (;;) {
--aLine;
if (aLine->IsBlock()) {
mPrevBEndMargin = aLine->GetCarriedOutBEndMargin();
break;
}
if (!aLine->IsEmpty()) {
break;
}
if (aLine == firstLine) {
// If the top margin was carried out (and thus already applied),
// set it to zero. Either way, we're done.
if (!mFlags.mIsBStartMarginRoot) {
mPrevBEndMargin.Zero();
}
break;
}
}
}
示例4: RecoverFloats
/**
* Everything done in this function is done O(N) times for each pass of
* reflow so it is O(N*M) where M is the number of incremental reflow
* passes. That's bad. Don't do stuff here.
*
* When this function is called, |aLine| has just been slid by |aDeltaBCoord|
* and the purpose of RecoverStateFrom is to ensure that the
* nsBlockReflowState is in the same state that it would have been in
* had the line just been reflowed.
*
* Most of the state recovery that we have to do involves floats.
*/
void
nsBlockReflowState::RecoverStateFrom(nsLineList::iterator aLine,
nscoord aDeltaBCoord)
{
// Make the line being recovered the current line
mCurrentLine = aLine;
// Place floats for this line into the float manager
if (aLine->HasFloats() || aLine->IsBlock()) {
RecoverFloats(aLine, aDeltaBCoord);
#ifdef DEBUG
if (nsBlockFrame::gNoisyReflow || nsBlockFrame::gNoisyFloatManager) {
mFloatManager->List(stdout);
}
#endif
}
}
示例5: while
/**
* Restore information about floats into the float manager for an
* incremental reflow, and simultaneously push the floats by
* |aDeltaBCoord|, which is the amount |aLine| was pushed relative to its
* parent. The recovery of state is one of the things that makes
* incremental reflow O(N^2) and this state should really be kept
* around, attached to the frame tree.
*/
void
nsBlockReflowState::RecoverFloats(nsLineList::iterator aLine,
nscoord aDeltaBCoord)
{
WritingMode wm = mReflowState.GetWritingMode();
if (aLine->HasFloats()) {
// Place the floats into the space-manager again. Also slide
// them, just like the regular frames on the line.
nsFloatCache* fc = aLine->GetFirstFloat();
while (fc) {
nsIFrame* floatFrame = fc->mFloat;
if (aDeltaBCoord != 0) {
floatFrame->MovePositionBy(nsPoint(0, aDeltaBCoord));
nsContainerFrame::PositionFrameView(floatFrame);
nsContainerFrame::PositionChildViews(floatFrame);
}
#ifdef DEBUG
if (nsBlockFrame::gNoisyReflow || nsBlockFrame::gNoisyFloatManager) {
nscoord tI, tB;
mFloatManager->GetTranslation(tI, tB);
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
printf("RecoverFloats: tIB=%d,%d (%d,%d) ",
tI, tB, mFloatManagerI, mFloatManagerB);
nsFrame::ListTag(stdout, floatFrame);
LogicalRect region = nsFloatManager::GetRegionFor(wm, floatFrame,
ContainerSize());
printf(" aDeltaBCoord=%d region={%d,%d,%d,%d}\n",
aDeltaBCoord, region.IStart(wm), region.BStart(wm),
region.ISize(wm), region.BSize(wm));
}
#endif
mFloatManager->AddFloat(floatFrame,
nsFloatManager::GetRegionFor(wm, floatFrame,
ContainerSize()),
wm, ContainerSize());
fc = fc->Next();
}
} else if (aLine->IsBlock()) {
nsBlockFrame::RecoverFloatsFor(aLine->mFirstChild, *mFloatManager, wm,
ContainerSize());
}
}
示例6: while
/**
* Restore information about floats into the float manager for an
* incremental reflow, and simultaneously push the floats by
* |aDeltaY|, which is the amount |aLine| was pushed relative to its
* parent. The recovery of state is one of the things that makes
* incremental reflow O(N^2) and this state should really be kept
* around, attached to the frame tree.
*/
void
nsBlockReflowState::RecoverFloats(nsLineList::iterator aLine,
nscoord aDeltaY)
{
if (aLine->HasFloats()) {
// Place the floats into the space-manager again. Also slide
// them, just like the regular frames on the line.
nsFloatCache* fc = aLine->GetFirstFloat();
while (fc) {
nsIFrame* floatFrame = fc->mFloat;
if (aDeltaY != 0) {
nsPoint p = floatFrame->GetPosition();
floatFrame->SetPosition(nsPoint(p.x, p.y + aDeltaY));
nsContainerFrame::PositionFrameView(floatFrame);
nsContainerFrame::PositionChildViews(floatFrame);
}
#ifdef DEBUG
if (nsBlockFrame::gNoisyReflow || nsBlockFrame::gNoisyFloatManager) {
nscoord tx, ty;
mFloatManager->GetTranslation(tx, ty);
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
printf("RecoverFloats: txy=%d,%d (%d,%d) ",
tx, ty, mFloatManagerX, mFloatManagerY);
nsFrame::ListTag(stdout, floatFrame);
nsRect region = nsFloatManager::GetRegionFor(floatFrame);
printf(" aDeltaY=%d region={%d,%d,%d,%d}\n",
aDeltaY, region.x, region.y, region.width, region.height);
}
#endif
mFloatManager->AddFloat(floatFrame,
nsFloatManager::GetRegionFor(floatFrame));
fc = fc->Next();
}
} else if (aLine->IsBlock()) {
nsBlockFrame::RecoverFloatsFor(aLine->mFirstChild, *mFloatManager);
}
}
示例7: while
/**
* Restore information about floats into the space manager for an
* incremental reflow, and simultaneously push the floats by
* |aDeltaY|, which is the amount |aLine| was pushed relative to its
* parent. The recovery of state is one of the things that makes
* incremental reflow O(N^2) and this state should really be kept
* around, attached to the frame tree.
*/
void
nsBlockReflowState::RecoverFloats(nsLineList::iterator aLine,
nscoord aDeltaY)
{
if (aLine->HasFloats()) {
// Place the floats into the space-manager again. Also slide
// them, just like the regular frames on the line.
nsFloatCache* fc = aLine->GetFirstFloat();
while (fc) {
nsIFrame* floatFrame = fc->mPlaceholder->GetOutOfFlowFrame();
if (aDeltaY != 0) {
fc->mRegion.y += aDeltaY;
nsPoint p = floatFrame->GetPosition();
floatFrame->SetPosition(nsPoint(p.x, p.y + aDeltaY));
nsContainerFrame::PositionFrameView(floatFrame);
nsContainerFrame::PositionChildViews(floatFrame);
}
#ifdef DEBUG
if (nsBlockFrame::gNoisyReflow || nsBlockFrame::gNoisySpaceManager) {
nscoord tx, ty;
mSpaceManager->GetTranslation(tx, ty);
nsFrame::IndentBy(stdout, nsBlockFrame::gNoiseIndent);
printf("RecoverFloats: txy=%d,%d (%d,%d) ",
tx, ty, mSpaceManagerX, mSpaceManagerY);
nsFrame::ListTag(stdout, floatFrame);
printf(" aDeltaY=%d region={%d,%d,%d,%d}\n",
aDeltaY, fc->mRegion.x, fc->mRegion.y,
fc->mRegion.width, fc->mRegion.height);
}
#endif
mSpaceManager->AddRectRegion(floatFrame, fc->mRegion);
fc = fc->Next();
}
} else if (aLine->IsBlock()) {
nsBlockFrame *kid = nsnull;
aLine->mFirstChild->QueryInterface(kBlockFrameCID, (void**)&kid);
// don't recover any state inside a block that has its own space
// manager (we don't currently have any blocks like this, though,
// thanks to our use of extra frames for 'overflow')
if (kid && !nsBlockFrame::BlockNeedsSpaceManager(kid)) {
nscoord tx = kid->mRect.x, ty = kid->mRect.y;
// If the element is relatively positioned, then adjust x and y
// accordingly so that we consider relatively positioned frames
// at their original position.
if (NS_STYLE_POSITION_RELATIVE == kid->GetStyleDisplay()->mPosition) {
nsPoint *offsets = static_cast<nsPoint*>
(mPresContext->PropertyTable()->GetProperty(kid,
nsGkAtoms::computedOffsetProperty));
if (offsets) {
tx -= offsets->x;
ty -= offsets->y;
}
}
mSpaceManager->Translate(tx, ty);
for (nsBlockFrame::line_iterator line = kid->begin_lines(),
line_end = kid->end_lines();
line != line_end;
++line)
// Pass 0, not the real DeltaY, since these floats aren't
// moving relative to their parent block, only relative to
// the space manager.
RecoverFloats(line, 0);
mSpaceManager->Translate(-tx, -ty);
}
}
}