--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -392,30 +392,30 @@ nsBlockFrame::List(FILE* out, const char
fprintf_stderr(out, "%s<\n", str.get());
nsCString pfx(aPrefix);
pfx += " ";
// Output the lines
if (!mLines.empty()) {
- const_line_iterator line = begin_lines(), line_end = end_lines();
+ ConstLineIterator line = begin_lines(), line_end = end_lines();
for ( ; line != line_end; ++line) {
line->List(out, pfx.get(), aFlags);
}
}
// Output the overflow lines.
const FrameLines* overflowLines = GetOverflowLines();
if (overflowLines && !overflowLines->mLines.empty()) {
fprintf_stderr(out, "%sOverflow-lines %p/%p <\n", pfx.get(), overflowLines, &overflowLines->mFrames);
nsCString nestedPfx(pfx);
nestedPfx += " ";
- const_line_iterator line = overflowLines->mLines.begin(),
- line_end = overflowLines->mLines.end();
+ ConstLineIterator line = overflowLines->mLines.begin(),
+ line_end = overflowLines->mLines.end();
for ( ; line != line_end; ++line) {
line->List(out, nestedPfx.get(), aFlags);
}
fprintf_stderr(out, "%s>\n", pfx.get());
}
// skip the principal list - we printed the lines above
// skip the overflow list - we printed the overflow lines above
@@ -499,17 +499,17 @@ nsBlockFrame::GetLogicalBaseline(Writing
nscoord
nsBlockFrame::GetCaretBaseline() const
{
nsRect contentRect = GetContentRect();
nsMargin bp = GetUsedBorderAndPadding();
if (!mLines.empty()) {
- const_line_iterator line = begin_lines();
+ ConstLineIterator line = begin_lines();
const nsLineBox* firstLine = line;
if (firstLine->GetChildCount()) {
return bp.top + firstLine->mFirstChild->GetCaretBaseline();
}
}
float inflation = nsLayoutUtils::FontSizeInflationFor(this);
RefPtr<nsFontMetrics> fm =
nsLayoutUtils::GetFontMetricsForFrame(this, inflation);
@@ -699,17 +699,17 @@ nsBlockFrame::GetMinISize(nsRenderingCon
if (RenumberList()) {
AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
}
if (GetStateBits() & NS_BLOCK_NEEDS_BIDI_RESOLUTION)
ResolveBidi();
InlineMinISizeData data;
for (nsBlockFrame* curFrame = this; curFrame;
curFrame = static_cast<nsBlockFrame*>(curFrame->GetNextContinuation())) {
- for (line_iterator line = curFrame->begin_lines(), line_end = curFrame->end_lines();
+ for (LineIterator line = curFrame->begin_lines(), line_end = curFrame->end_lines();
line != line_end; ++line)
{
#ifdef DEBUG
if (gNoisyIntrinsic) {
IndentBy(stdout, gNoiseIndent);
printf("line (%s%s)\n",
line->IsBlock() ? "block" : "inline",
line->IsEmpty() ? ", empty" : "");
@@ -787,17 +787,17 @@ nsBlockFrame::GetPrefISize(nsRenderingCo
if (RenumberList()) {
AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
}
if (GetStateBits() & NS_BLOCK_NEEDS_BIDI_RESOLUTION)
ResolveBidi();
InlinePrefISizeData data;
for (nsBlockFrame* curFrame = this; curFrame;
curFrame = static_cast<nsBlockFrame*>(curFrame->GetNextContinuation())) {
- for (line_iterator line = curFrame->begin_lines(), line_end = curFrame->end_lines();
+ for (LineIterator line = curFrame->begin_lines(), line_end = curFrame->end_lines();
line != line_end; ++line)
{
#ifdef DEBUG
if (gNoisyIntrinsic) {
IndentBy(stdout, gNoiseIndent);
printf("line (%s%s)\n",
line->IsBlock() ? "block" : "inline",
line->IsEmpty() ? ", empty" : "");
@@ -873,17 +873,17 @@ nsBlockFrame::GetPrefWidthTightBounds(ns
*aX = 0;
*aXMost = 0;
nsresult rv;
InlinePrefISizeData data;
for (nsBlockFrame* curFrame = this; curFrame;
curFrame = static_cast<nsBlockFrame*>(curFrame->GetNextContinuation())) {
- for (line_iterator line = curFrame->begin_lines(), line_end = curFrame->end_lines();
+ for (LineIterator line = curFrame->begin_lines(), line_end = curFrame->end_lines();
line != line_end; ++line)
{
nscoord childX, childXMost;
if (line->IsBlock()) {
data.ForceBreak();
rv = line->mFirstChild->GetPrefWidthTightBounds(aRenderingContext,
&childX, &childXMost);
NS_ENSURE_SUCCESS(rv, rv);
@@ -1308,17 +1308,17 @@ nsBlockFrame::Reflow(nsPresContext*
// logical direction progresses in a negative physical direction, and
// therefore block-dir coordinate conversion depends on knowing the width
// of the coordinate space in order to translate between the logical and
// physical origins.
if (wm.IsVerticalRL()) {
nsSize containerSize = aMetrics.PhysicalSize();
nscoord deltaX = containerSize.width - state.ContainerSize().width;
if (deltaX != 0) {
- for (line_iterator line = begin_lines(), end = end_lines();
+ for (LineIterator line = begin_lines(), end = end_lines();
line != end; line++) {
UpdateLineContainerSize(line, containerSize);
}
for (nsIFrame* f : mFloats) {
nsPoint physicalDelta(deltaX, 0);
f->MovePositionBy(physicalDelta);
}
nsFrameList* bulletList = GetOutsideBulletList();
@@ -1479,18 +1479,18 @@ nsBlockFrame::Reflow(nsPresContext*
#endif
NS_FRAME_SET_TRUNCATION(aStatus, (*reflowInput), aMetrics);
}
bool
nsBlockFrame::CheckForCollapsedBEndMarginFromClearanceLine()
{
- line_iterator begin = begin_lines();
- line_iterator line = end_lines();
+ LineIterator begin = begin_lines();
+ LineIterator line = end_lines();
while (true) {
if (begin == line) {
return false;
}
--line;
if (line->BSize() != 0 || !line->CachedIsEmpty()) {
return false;
@@ -1714,17 +1714,17 @@ nsBlockFrame::ComputeOverflowAreas(const
nscoord aBEndEdgeOfChildren,
nsOverflowAreas& aOverflowAreas)
{
// Compute the overflow areas of our children
// XXX_perf: This can be done incrementally. It is currently one of
// the things that makes incremental reflow O(N^2).
nsOverflowAreas areas(aBounds, aBounds);
if (!ShouldApplyOverflowClipping(this, aDisplay)) {
- for (line_iterator line = begin_lines(), line_end = end_lines();
+ for (LineIterator line = begin_lines(), line_end = end_lines();
line != line_end;
++line) {
areas.UnionWith(line->GetOverflowAreas());
}
// Factor an outside bullet in; normally the bullet will be factored into
// the line-box's overflow areas. However, if the line is a block
// line then it won't; if there are no lines, it won't. So just
@@ -1752,17 +1752,17 @@ nsBlockFrame::ComputeOverflowAreas(const
void
nsBlockFrame::UnionChildOverflow(nsOverflowAreas& aOverflowAreas)
{
// We need to update the overflow areas of lines manually, as they
// get cached and re-used otherwise. Lines aren't exposed as normal
// frame children, so calling UnionChildOverflow alone will end up
// using the old cached values.
- for (line_iterator line = begin_lines(), line_end = end_lines();
+ for (LineIterator line = begin_lines(), line_end = end_lines();
line != line_end;
++line) {
nsRect bounds = line->GetPhysicalBounds();
nsOverflowAreas lineAreas(bounds, bounds);
int32_t n = line->GetChildCount();
for (nsIFrame* lineFrame = line->mFirstChild;
n > 0; lineFrame = lineFrame->GetNextSibling(), --n) {
@@ -1802,34 +1802,34 @@ nsBlockFrame::ComputeCustomOverflow(nsOv
ClearLineCursor();
return nsContainerFrame::ComputeCustomOverflow(aOverflowAreas);
}
void
nsBlockFrame::LazyMarkLinesDirty()
{
if (GetStateBits() & NS_BLOCK_LOOK_FOR_DIRTY_FRAMES) {
- for (line_iterator line = begin_lines(), line_end = end_lines();
+ for (LineIterator line = begin_lines(), line_end = end_lines();
line != line_end; ++line) {
int32_t n = line->GetChildCount();
for (nsIFrame* lineFrame = line->mFirstChild;
n > 0; lineFrame = lineFrame->GetNextSibling(), --n) {
if (NS_SUBTREE_DIRTY(lineFrame)) {
// NOTE: MarkLineDirty does more than just marking the line dirty.
MarkLineDirty(line, &mLines);
break;
}
}
}
RemoveStateBits(NS_BLOCK_LOOK_FOR_DIRTY_FRAMES);
}
}
void
-nsBlockFrame::MarkLineDirty(line_iterator aLine, const nsLineList* aLineList)
+nsBlockFrame::MarkLineDirty(LineIterator aLine, const nsLineList* aLineList)
{
// Mark aLine dirty
aLine->MarkDirty();
aLine->SetInvalidateTextRuns(true);
#ifdef DEBUG
if (gNoisyReflow) {
IndentBy(stdout, gNoiseIndent);
ListTag(stdout);
@@ -1909,17 +1909,17 @@ nsBlockFrame::PrepareResizeReflow(BlockR
#ifdef DEBUG
if (gNoisyReflow) {
IndentBy(stdout, gNoiseIndent);
ListTag(stdout);
printf(": trying to avoid marking all lines dirty\n");
}
#endif
- for (line_iterator line = begin_lines(), line_end = end_lines();
+ for (LineIterator line = begin_lines(), line_end = end_lines();
line != line_end;
++line)
{
// We let child blocks make their own decisions the same
// way we are here.
bool isLastLine = line == mLines.back() && !GetNextInFlow();
if (line->IsBlock() ||
line->HasFloats() ||
@@ -1951,17 +1951,17 @@ nsBlockFrame::PrepareResizeReflow(BlockR
line->BreakTypeToString(line->GetBreakTypeAfter()),
line->IEnd());
}
#endif
}
}
else {
// Mark everything dirty
- for (line_iterator line = begin_lines(), line_end = end_lines();
+ for (LineIterator line = begin_lines(), line_end = end_lines();
line != line_end;
++line)
{
line->MarkDirty();
}
}
}
@@ -2119,17 +2119,17 @@ nsBlockFrame::ReflowDirtyLines(BlockRefl
(aState.mReflowInput.IsBResize() &&
(GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_BSIZE));
// Reflow our last line if our availableBSize has increased
// so that we (and our last child) pull up content as necessary
if (aState.mReflowInput.AvailableBSize() != NS_UNCONSTRAINEDSIZE
&& GetNextInFlow() && aState.mReflowInput.AvailableBSize() >
GetLogicalSize().BSize(aState.mReflowInput.GetWritingMode())) {
- line_iterator lastLine = end_lines();
+ LineIterator lastLine = end_lines();
if (lastLine != begin_lines()) {
--lastLine;
lastLine->MarkDirty();
}
}
// the amount by which we will slide the current line if it is not
// dirty
nscoord deltaBCoord = 0;
@@ -2140,17 +2140,17 @@ nsBlockFrame::ReflowDirtyLines(BlockRefl
bool needToRecoverState = false;
// Float continuations were reflowed in ReflowPushedFloats
bool reflowedFloat = mFloats.NotEmpty() &&
(mFloats.FirstChild()->GetStateBits() & NS_FRAME_IS_PUSHED_FLOAT);
bool lastLineMovedUp = false;
// We save up information about BR-clearance here
StyleClear inlineFloatBreakType = aState.mFloatBreakType;
- line_iterator line = begin_lines(), line_end = end_lines();
+ LineIterator line = begin_lines(), line_end = end_lines();
// Reflow the lines that are already ours
for ( ; line != line_end; ++line, aState.AdvanceToNextLine()) {
DumpLine(aState, line, deltaBCoord, 0);
#ifdef DEBUG
AutoNoisyIndenter indent2(gNoisyReflow);
#endif
@@ -2504,17 +2504,17 @@ nsBlockFrame::ReflowDirtyLines(BlockRefl
!lastLineMovedUp &&
!(GetStateBits() & NS_FRAME_IS_DIRTY) &&
!reflowedFloat)) {
// We'll place lineIter at the last line of this block, so that
// nsBlockInFlowLineIterator::Next() will take us to the first
// line of my next-in-flow-chain. (But first, check that I
// have any lines -- if I don't, just bail out of this
// optimization.)
- line_iterator lineIter = this->end_lines();
+ LineIterator lineIter = this->end_lines();
if (lineIter != this->begin_lines()) {
lineIter--; // I have lines; step back from dummy iterator to last line.
nsBlockInFlowLineIterator bifLineIter(this, lineIter);
// Check for next-in-flow-chain's first line.
// (First, see if there is such a line, and second, see if it's clean)
if (!bifLineIter.Next() ||
!bifLineIter.GetLine()->IsDirty()) {
@@ -2758,17 +2758,17 @@ nsBlockFrame::DeleteLine(BlockReflowInpu
/**
* Reflow a line. The line will either contain a single block frame
* or contain 1 or more inline frames. aKeepReflowGoing indicates
* whether or not the caller should continue to reflow more lines.
*/
void
nsBlockFrame::ReflowLine(BlockReflowInput& aState,
- line_iterator aLine,
+ LineIterator aLine,
bool* aKeepReflowGoing)
{
MOZ_ASSERT(aLine->GetChildCount(), "reflowing empty line");
// Setup the line-layout for the new line
aState.mCurrentLine = aLine;
aLine->ClearDirty();
aLine->InvalidateCachedIsEmpty();
@@ -2780,17 +2780,17 @@ nsBlockFrame::ReflowLine(BlockReflowInpu
} else {
aLine->SetLineWrapped(false);
ReflowInlineFrames(aState, aLine, aKeepReflowGoing);
}
}
nsIFrame*
nsBlockFrame::PullFrame(BlockReflowInput& aState,
- line_iterator aLine)
+ LineIterator aLine)
{
// First check our remaining lines.
if (end_lines() != aLine.next()) {
return PullFrameFrom(aLine, this, aLine.next());
}
NS_ASSERTION(!GetOverflowLines(),
"Our overflow lines should have been removed at the start of reflow");
@@ -3053,17 +3053,17 @@ nsBlockFrame::IsSelfEmpty()
bool
nsBlockFrame::CachedIsEmpty()
{
if (!IsSelfEmpty()) {
return false;
}
- for (line_iterator line = begin_lines(), line_end = end_lines();
+ for (LineIterator line = begin_lines(), line_end = end_lines();
line != line_end;
++line)
{
if (!line->CachedIsEmpty())
return false;
}
return true;
@@ -3071,17 +3071,17 @@ nsBlockFrame::CachedIsEmpty()
bool
nsBlockFrame::IsEmpty()
{
if (!IsSelfEmpty()) {
return false;
}
- for (line_iterator line = begin_lines(), line_end = end_lines();
+ for (LineIterator line = begin_lines(), line_end = end_lines();
line != line_end;
++line)
{
if (!line->IsEmpty())
return false;
}
return true;
@@ -3103,17 +3103,17 @@ nsBlockFrame::ShouldApplyBStartMargin(Bl
// If we aren't at the start block-coordinate then something of non-zero
// height must have been placed. Therefore the childs block-start margin
// applies.
aState.mFlags.mShouldApplyBStartMargin = true;
return true;
}
// Determine if this line is "essentially" the first line
- line_iterator line = begin_lines();
+ LineIterator line = begin_lines();
if (aState.mFlags.mHasLineAdjacentToTop) {
line = aState.mLineAdjacentToTop;
}
while (line != aLine) {
if (!line->CachedIsEmpty() || line->HasClearance()) {
// A line which precedes aLine is non-empty, or has clearance,
// so therefore the block-start margin applies.
aState.mFlags.mShouldApplyBStartMargin = true;
@@ -3129,17 +3129,17 @@ nsBlockFrame::ShouldApplyBStartMargin(Bl
// The line being reflowed is "essentially" the first line in the
// block. Therefore its block-start margin will be collapsed by the
// generational collapsing logic with its parent (us).
return false;
}
void
nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
- line_iterator aLine,
+ LineIterator aLine,
bool* aKeepReflowGoing)
{
NS_PRECONDITION(*aKeepReflowGoing, "bad caller");
nsIFrame* frame = aLine->mFirstChild;
if (!frame) {
NS_ASSERTION(false, "program error - unexpected empty line");
return;
@@ -3554,17 +3554,17 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl
overflowAreas,
frameReflowStatus);
if (!NS_FRAME_IS_FULLY_COMPLETE(frameReflowStatus) &&
ShouldAvoidBreakInside(aState.mReflowInput)) {
*aKeepReflowGoing = false;
}
if (aLine->SetCarriedOutBEndMargin(collapsedBEndMargin)) {
- line_iterator nextLine = aLine;
+ LineIterator nextLine = aLine;
++nextLine;
if (nextLine != end_lines()) {
nextLine->MarkPreviousMarginDirty();
}
}
aLine->SetOverflowAreas(overflowAreas);
if (*aKeepReflowGoing) {
@@ -3622,17 +3622,17 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl
// else one of our own overflow lines. In the latter case
// the line is already marked dirty, so just handle the
// first case.
if (!madeContinuation) {
nsBlockFrame* nifBlock =
nsLayoutUtils::GetAsBlock(nextFrame->GetParent());
NS_ASSERTION(nifBlock,
"A block's child's next in flow's parent must be a block!");
- for (line_iterator line = nifBlock->begin_lines(),
+ for (LineIterator line = nifBlock->begin_lines(),
line_end = nifBlock->end_lines(); line != line_end; ++line) {
if (line->Contains(nextFrame)) {
line->MarkDirty();
break;
}
}
}
}
@@ -3726,17 +3726,17 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl
#ifdef DEBUG
VerifyLines(true);
#endif
}
void
nsBlockFrame::ReflowInlineFrames(BlockReflowInput& aState,
- line_iterator aLine,
+ LineIterator aLine,
bool* aKeepReflowGoing)
{
*aKeepReflowGoing = true;
aLine->SetLineIsImpactedByFloat(false);
// Setup initial coordinate system for reflowing the inline frames
// into. Apply a previous block frame's block-end margin first.
@@ -3801,28 +3801,28 @@ nsBlockFrame::ReflowInlineFrames(BlockRe
allowPullUp = false;
} while (LineReflowStatus::RedoNoPull == lineReflowStatus);
} while (LineReflowStatus::RedoMoreFloats == lineReflowStatus);
} while (LineReflowStatus::RedoNextBand == lineReflowStatus);
}
void
nsBlockFrame::PushTruncatedLine(BlockReflowInput& aState,
- line_iterator aLine,
+ LineIterator aLine,
bool* aKeepReflowGoing)
{
PushLines(aState, aLine.prev());
*aKeepReflowGoing = false;
NS_FRAME_SET_INCOMPLETE(aState.mReflowStatus);
}
void
nsBlockFrame::DoReflowInlineFrames(BlockReflowInput& aState,
nsLineLayout& aLineLayout,
- line_iterator aLine,
+ LineIterator aLine,
nsFlowAreaRect& aFloatAvailableSpace,
nscoord& aAvailableSpaceHeight,
nsFloatManager::SavedState*
aFloatStateBeforeLine,
bool* aKeepReflowGoing,
LineReflowStatus* aLineReflowStatus,
bool aAllowPullUp)
{
@@ -4069,17 +4069,17 @@ nsBlockFrame::DoReflowInlineFrames(Block
* The line reflow status is simple: true means keep placing frames
* on the line; false means don't (the line is done). If the line
* has some sort of breaking affect then aLine's break-type will be set
* to something other than StyleClear::None.
*/
void
nsBlockFrame::ReflowInlineFrame(BlockReflowInput& aState,
nsLineLayout& aLineLayout,
- line_iterator aLine,
+ LineIterator aLine,
nsIFrame* aFrame,
LineReflowStatus* aLineReflowStatus)
{
if (!aFrame) { // XXX change to MOZ_ASSERT(aFrame)
NS_ERROR("why call me?");
return;
}
@@ -4303,17 +4303,17 @@ CheckPlaceholderInLine(nsIFrame* aBlock,
}
NS_ASSERTION(false, "aBlock is not an ancestor of aFrame!");
return true;
}
void
nsBlockFrame::SplitLine(BlockReflowInput& aState,
nsLineLayout& aLineLayout,
- line_iterator aLine,
+ LineIterator aLine,
nsIFrame* aFrame,
LineReflowStatus* aLineReflowStatus)
{
MOZ_ASSERT(aLine->IsInline(), "illegal SplitLine on block line");
int32_t pushCount = aLine->GetChildCount() - aLineLayout.GetCurrentSpanCount();
MOZ_ASSERT(pushCount >= 0, "bad push count");
@@ -4376,33 +4376,33 @@ nsBlockFrame::SplitLine(BlockReflowInput
#ifdef DEBUG
VerifyLines(true);
#endif
}
}
bool
nsBlockFrame::IsLastLine(BlockReflowInput& aState,
- line_iterator aLine)
+ LineIterator aLine)
{
while (++aLine != end_lines()) {
// There is another line
if (0 != aLine->GetChildCount()) {
// If the next line is a block line then this line is the last in a
// group of inline lines.
return aLine->IsBlock();
}
// The next line is empty, try the next one
}
// XXX Not sure about this part
// Try our next-in-flows lines to answer the question
nsBlockFrame* nextInFlow = (nsBlockFrame*) GetNextInFlow();
while (nullptr != nextInFlow) {
- for (line_iterator line = nextInFlow->begin_lines(),
+ for (LineIterator line = nextInFlow->begin_lines(),
line_end = nextInFlow->end_lines();
line != line_end;
++line)
{
if (0 != line->GetChildCount())
return line->IsBlock();
}
nextInFlow = (nsBlockFrame*) nextInFlow->GetNextInFlow();
@@ -4410,17 +4410,17 @@ nsBlockFrame::IsLastLine(BlockReflowInpu
// This is the last line - so don't allow justification
return true;
}
bool
nsBlockFrame::PlaceLine(BlockReflowInput& aState,
nsLineLayout& aLineLayout,
- line_iterator aLine,
+ LineIterator aLine,
nsFloatManager::SavedState *aFloatStateBeforeLine,
LogicalRect& aFloatAvailableSpace,
nscoord& aAvailableSpaceHeight,
bool* aKeepReflowGoing)
{
// Trim extra white-space from the line before placing the frames
aLineLayout.TrimTrailingWhiteSpace();
@@ -4683,17 +4683,17 @@ nsBlockFrame::PushLines(BlockReflowInput
// this takes ownership but it won't delete it immediately so we
// can keep using it.
SetOverflowLines(overflowLines);
// Mark all the overflow lines dirty so that they get reflowed when
// they are pulled up by our next-in-flow.
// XXXldb Can this get called O(N) times making the whole thing O(N^2)?
- for (line_iterator line = overflowLines->mLines.begin(),
+ for (LineIterator line = overflowLines->mLines.begin(),
line_end = overflowLines->mLines.end();
line != line_end;
++line)
{
line->MarkDirty();
line->MarkPreviousMarginDirty();
line->SetBoundsEmpty();
if (line->HasFloats()) {
@@ -5347,17 +5347,17 @@ nsBlockFrame::AddFrames(nsFrameList& aFr
#endif
}
void
nsBlockFrame::RemoveFloatFromFloatCache(nsIFrame* aFloat)
{
// Find which line contains the float, so we can update
// the float cache.
- line_iterator line = begin_lines(), line_end = end_lines();
+ LineIterator line = begin_lines(), line_end = end_lines();
for ( ; line != line_end; ++line) {
if (line->IsInline() && line->RemoveFloat(aFloat)) {
break;
}
}
}
void
@@ -5446,25 +5446,25 @@ nsBlockFrame::TryAllLines(nsLineList::it
*aEndIterator = lines->mLines.end();
*aOverflowLines = lines;
}
}
}
}
nsBlockInFlowLineIterator::nsBlockInFlowLineIterator(nsBlockFrame* aFrame,
- line_iterator aLine)
+ LineIterator aLine)
: mFrame(aFrame), mLine(aLine), mLineList(&aFrame->mLines)
{
// This will assert if aLine isn't in mLines of aFrame:
DebugOnly<bool> check = aLine == mFrame->begin_lines();
}
nsBlockInFlowLineIterator::nsBlockInFlowLineIterator(nsBlockFrame* aFrame,
- line_iterator aLine, bool aInOverflow)
+ LineIterator aLine, bool aInOverflow)
: mFrame(aFrame), mLine(aLine),
mLineList(aInOverflow ? &aFrame->GetOverflowLines()->mLines
: &aFrame->mLines)
{
}
nsBlockInFlowLineIterator::nsBlockInFlowLineIterator(nsBlockFrame* aFrame,
bool* aFoundValidLine)
@@ -5502,25 +5502,25 @@ nsBlockInFlowLineIterator::nsBlockInFlow
: mFrame(aFrame), mLineList(&aFrame->mLines)
{
*aFoundValidLine = false;
nsIFrame* child = FindChildContaining(aFrame, aFindFrame);
if (!child)
return;
- line_iterator line_end = aFrame->end_lines();
+ LineIterator line_end = aFrame->end_lines();
// Try to use the cursor if it exists, otherwise fall back to the first line
if (nsLineBox* const cursor = aFrame->GetLineCursor()) {
mLine = line_end;
// Perform a simultaneous forward and reverse search starting from the
// line cursor.
- nsBlockFrame::line_iterator line = aFrame->line(cursor);
- nsBlockFrame::reverse_line_iterator rline = aFrame->rline(cursor);
- nsBlockFrame::reverse_line_iterator rline_end = aFrame->rend_lines();
+ nsBlockFrame::LineIterator line = aFrame->line(cursor);
+ nsBlockFrame::ReverseLineIterator rline = aFrame->rline(cursor);
+ nsBlockFrame::ReverseLineIterator rline_end = aFrame->rend_lines();
// rline is positioned on the line containing 'cursor', so it's not
// rline_end. So we can safely increment it (i.e. move it to one line
// earlier) to start searching there.
++rline;
while (line != line_end || rline != rline_end) {
if (line != line_end) {
if (line->Contains(child)) {
mLine = line;
@@ -5566,40 +5566,40 @@ nsBlockInFlowLineIterator::nsBlockInFlow
do {
if (mLine->Contains(child)) {
*aFoundValidLine = true;
return;
}
} while (Next());
}
-nsBlockFrame::line_iterator
+nsBlockFrame::LineIterator
nsBlockInFlowLineIterator::End()
{
return mLineList->end();
}
bool
nsBlockInFlowLineIterator::IsLastLineInList()
{
- line_iterator end = End();
+ LineIterator end = End();
return mLine != end && mLine.next() == end;
}
bool
nsBlockInFlowLineIterator::Next()
{
++mLine;
return FindValidLine();
}
bool
nsBlockInFlowLineIterator::Prev()
{
- line_iterator begin = mLineList->begin();
+ LineIterator begin = mLineList->begin();
if (mLine != begin) {
--mLine;
return true;
}
bool currentlyInOverflowLines = GetInOverflow();
while (true) {
if (currentlyInOverflowLines) {
mLineList = &mFrame->mLines;
@@ -5623,17 +5623,17 @@ nsBlockInFlowLineIterator::Prev()
}
currentlyInOverflowLines = !currentlyInOverflowLines;
}
}
bool
nsBlockInFlowLineIterator::FindValidLine()
{
- line_iterator end = mLineList->end();
+ LineIterator end = mLineList->end();
if (mLine != end)
return true;
bool currentlyInOverflowLines = GetInOverflow();
while (true) {
if (currentlyInOverflowLines) {
mFrame = static_cast<nsBlockFrame*>(mFrame->GetNextInFlow());
if (!mFrame)
return false;
@@ -5737,17 +5737,17 @@ nsBlockFrame::DoRemoveFrame(nsIFrame* aD
line->MarkDirty();
line->SetInvalidateTextRuns(true);
}
// If the frame being deleted is the last one on the line then
// optimize away the line->Contains(next-in-flow) call below.
bool isLastFrameOnLine = 1 == line->GetChildCount();
if (!isLastFrameOnLine) {
- line_iterator next = line.next();
+ LineIterator next = line.next();
nsIFrame* lastFrame = next != line_end ?
next->mFirstChild->GetPrevSibling() :
(searchingOverflowList ? overflowLines->mFrames.LastChild() :
mFrames.LastChild());
NS_ASSERTION(next == line_end || lastFrame == line->LastChild(),
"unexpected line frames");
isLastFrameOnLine = lastFrame == aDeletedFrame;
}
@@ -6241,17 +6241,17 @@ nsBlockFrame::ReflowFloat(BlockReflowInp
}
StyleClear
nsBlockFrame::FindTrailingClear()
{
// find the break type of the last line
for (nsIFrame* b = this; b; b = b->GetPrevInFlow()) {
nsBlockFrame* block = static_cast<nsBlockFrame*>(b);
- line_iterator endLine = block->end_lines();
+ LineIterator endLine = block->end_lines();
if (endLine != block->begin_lines()) {
--endLine;
return endLine->GetBreakTypeAfter();
}
}
return StyleClear::None;
}
@@ -6345,17 +6345,17 @@ nsBlockFrame::RecoverFloats(nsFloatManag
// Recurse into our overflow container children
for (nsIFrame* oc = GetChildList(kOverflowContainersList).FirstChild();
oc; oc = oc->GetNextSibling()) {
RecoverFloatsFor(oc, aFloatManager, aWM, aContainerSize);
}
// Recurse into our normal children
- for (nsBlockFrame::line_iterator line = begin_lines(); line != end_lines(); ++line) {
+ for (nsBlockFrame::LineIterator line = begin_lines(); line != end_lines(); ++line) {
if (line->IsBlock()) {
RecoverFloatsFor(line->mFirstChild, aFloatManager, aWM, aContainerSize);
}
}
}
void
nsBlockFrame::RecoverFloatsFor(nsIFrame* aFrame,
@@ -6448,17 +6448,17 @@ static void DebugOutputDrawLine(int32_t
lineArea.x, lineArea.y,
lineArea.width, lineArea.height);
}
}
#endif
static void
DisplayLine(nsDisplayListBuilder* aBuilder, const nsRect& aLineArea,
- const nsRect& aDirtyRect, nsBlockFrame::line_iterator& aLine,
+ const nsRect& aDirtyRect, nsBlockFrame::LineIterator& aLine,
int32_t aDepth, int32_t& aDrawnLines, const nsDisplayListSet& aLists,
nsBlockFrame* aFrame, TextOverflow* aTextOverflow) {
// If the line's combined area (which includes child frames that
// stick outside of the line's bounding box or our bounding box)
// intersects the dirty rect then paint the line.
bool intersect = aLineArea.Intersects(aDirtyRect);
#ifdef DEBUG
if (nsBlockFrame::gLamePaintMetrics) {
@@ -6555,20 +6555,20 @@ nsBlockFrame::BuildDisplayList(nsDisplay
// it might skip lines that contain placeholders but don't themselves
// intersect with the dirty area.
// In particular, we really want to check ShouldDescendIntoFrame()
// on all our child frames, but that might be expensive. So we
// approximate it by checking it on |this|; if it's true for any
// frame in our child list, it's also true for |this|.
nsLineBox* cursor = aBuilder->ShouldDescendIntoFrame(this) ?
nullptr : GetFirstLineContaining(aDirtyRect.y);
- line_iterator line_end = end_lines();
+ LineIterator line_end = end_lines();
if (cursor) {
- for (line_iterator line = mLines.begin(cursor);
+ for (LineIterator line = mLines.begin(cursor);
line != line_end;
++line) {
nsRect lineArea = line->GetVisualOverflowArea();
if (!lineArea.IsEmpty()) {
// Because we have a cursor, the combinedArea.ys are non-decreasing.
// Once we've passed aDirtyRect.YMost(), we can never see it again.
if (lineArea.y >= aDirtyRect.YMost()) {
break;
@@ -6577,17 +6577,17 @@ nsBlockFrame::BuildDisplayList(nsDisplay
linesDisplayListCollection, this, textOverflow.get());
}
}
} else {
bool nonDecreasingYs = true;
int32_t lineCount = 0;
nscoord lastY = INT32_MIN;
nscoord lastYMost = INT32_MIN;
- for (line_iterator line = begin_lines();
+ for (LineIterator line = begin_lines();
line != line_end;
++line) {
nsRect lineArea = line->GetVisualOverflowArea();
DisplayLine(aBuilder, lineArea, aDirtyRect, line, depth, drawnLines,
linesDisplayListCollection, this, textOverflow.get());
if (!lineArea.IsEmpty()) {
if (lineArea.y < lastY
|| lineArea.YMost() < lastYMost) {
@@ -6708,17 +6708,17 @@ nsLineBox* nsBlockFrame::GetFirstLineCon
{
if (!(GetStateBits() & NS_BLOCK_HAS_LINE_CURSOR)) {
return nullptr;
}
FrameProperties props = Properties();
nsLineBox* property = props.Get(LineCursorProperty());
- line_iterator cursor = mLines.begin(property);
+ LineIterator cursor = mLines.begin(property);
nsRect cursorArea = cursor->GetVisualOverflowArea();
while ((cursorArea.IsEmpty() || cursorArea.YMost() > y)
&& cursor != mLines.front()) {
cursor = cursor.prev();
cursorArea = cursor->GetVisualOverflowArea();
}
while ((cursorArea.IsEmpty() || cursorArea.YMost() <= y)
@@ -6740,17 +6740,17 @@ nsBlockFrame::ChildIsDirty(nsIFrame* aCh
// See if the child is absolutely positioned
if (aChild->GetStateBits() & NS_FRAME_OUT_OF_FLOW &&
aChild->IsAbsolutelyPositioned()) {
// do nothing
} else if (aChild == GetOutsideBullet()) {
// The bullet lives in the first line, unless the first line has
// height 0 and there is a second line, in which case it lives
// in the second line.
- line_iterator bulletLine = begin_lines();
+ LineIterator bulletLine = begin_lines();
if (bulletLine != end_lines() && bulletLine->BSize() == 0 &&
bulletLine != mLines.back()) {
bulletLine = bulletLine.next();
}
if (bulletLine != end_lines()) {
MarkLineDirty(bulletLine, &mLines);
}
@@ -7131,17 +7131,17 @@ nsBlockFrame::CheckFloats(BlockReflowInp
#ifdef DEBUG
// If any line is still dirty, that must mean we're going to reflow this
// block again soon (e.g. because we bailed out after noticing that
// clearance was imposed), so don't worry if the floats are out of sync.
bool anyLineDirty = false;
// Check that the float list is what we would have built
AutoTArray<nsIFrame*, 8> lineFloats;
- for (line_iterator line = begin_lines(), line_end = end_lines();
+ for (LineIterator line = begin_lines(), line_end = end_lines();
line != line_end; ++line) {
if (line->HasFloats()) {
nsFloatCache* fc = line->GetFirstFloat();
while (fc) {
lineFloats.AppendElement(fc->mFloat);
fc = fc->Next();
}
}
@@ -7373,17 +7373,17 @@ nsBlockFrame::VerifyLines(bool aFinalChe
return;
}
nsLineBox* cursor = GetLineCursor();
// Add up the counts on each line. Also validate that IsFirstLine is
// set properly.
int32_t count = 0;
- line_iterator line, line_end;
+ LineIterator line, line_end;
for (line = begin_lines(), line_end = end_lines();
line != line_end;
++line) {
if (line == cursor) {
cursor = nullptr;
}
if (aFinalCheckOK) {
MOZ_ASSERT(line->GetChildCount(), "empty line");
@@ -7416,18 +7416,18 @@ nsBlockFrame::VerifyLines(bool aFinalChe
if ((line != line_end) && (0 != line->GetChildCount())) {
NS_ASSERTION(frame == line->mFirstChild, "bad line list");
}
}
if (cursor) {
FrameLines* overflowLines = GetOverflowLines();
if (overflowLines) {
- line_iterator line = overflowLines->mLines.begin();
- line_iterator line_end = overflowLines->mLines.end();
+ LineIterator line = overflowLines->mLines.begin();
+ LineIterator line_end = overflowLines->mLines.end();
for (; line != line_end; ++line) {
if (line == cursor) {
cursor = nullptr;
break;
}
}
}
}
@@ -7487,18 +7487,18 @@ nsBlockFrame::VerifyOverflowSituation()
NS_ASSERTION(overflowLines->mLines.front()->mFirstChild,
"bad overflow lines");
NS_ASSERTION(overflowLines->mLines.front()->mFirstChild ==
overflowLines->mFrames.FirstChild(),
"bad overflow frames / lines");
}
nsLineBox* cursor = flow->GetLineCursor();
if (cursor) {
- line_iterator line = flow->begin_lines();
- line_iterator line_end = flow->end_lines();
+ LineIterator line = flow->begin_lines();
+ LineIterator line_end = flow->end_lines();
for (; line != line_end && line != cursor; ++line)
;
if (line == line_end && overflowLines) {
line = overflowLines->mLines.begin();
line_end = overflowLines->mLines.end();
for (; line != line_end && line != cursor; ++line)
;
}
--- a/layout/generic/nsBlockFrame.h
+++ b/layout/generic/nsBlockFrame.h
@@ -78,31 +78,31 @@ class BlockReflowInput;
class nsBlockFrame : public nsContainerFrame
{
using BlockReflowInput = mozilla::BlockReflowInput;
public:
NS_DECL_QUERYFRAME_TARGET(nsBlockFrame)
NS_DECL_FRAMEARENA_HELPERS
- typedef nsLineList::iterator line_iterator;
- typedef nsLineList::const_iterator const_line_iterator;
- typedef nsLineList::reverse_iterator reverse_line_iterator;
- typedef nsLineList::const_reverse_iterator const_reverse_line_iterator;
+ typedef nsLineList::iterator LineIterator;
+ typedef nsLineList::const_iterator ConstLineIterator;
+ typedef nsLineList::reverse_iterator ReverseLineIterator;
+ typedef nsLineList::const_reverse_iterator ConstReverseLineIterator;
- line_iterator begin_lines() { return mLines.begin(); }
- line_iterator end_lines() { return mLines.end(); }
- const_line_iterator begin_lines() const { return mLines.begin(); }
- const_line_iterator end_lines() const { return mLines.end(); }
- reverse_line_iterator rbegin_lines() { return mLines.rbegin(); }
- reverse_line_iterator rend_lines() { return mLines.rend(); }
- const_reverse_line_iterator rbegin_lines() const { return mLines.rbegin(); }
- const_reverse_line_iterator rend_lines() const { return mLines.rend(); }
- line_iterator line(nsLineBox* aList) { return mLines.begin(aList); }
- reverse_line_iterator rline(nsLineBox* aList) { return mLines.rbegin(aList); }
+ LineIterator begin_lines() { return mLines.begin(); }
+ LineIterator end_lines() { return mLines.end(); }
+ ConstLineIterator begin_lines() const { return mLines.begin(); }
+ ConstLineIterator end_lines() const { return mLines.end(); }
+ ReverseLineIterator rbegin_lines() { return mLines.rbegin(); }
+ ReverseLineIterator rend_lines() { return mLines.rend(); }
+ ConstReverseLineIterator rbegin_lines() const { return mLines.rbegin(); }
+ ConstReverseLineIterator rend_lines() const { return mLines.rend(); }
+ LineIterator line(nsLineBox* aList) { return mLines.begin(aList); }
+ ReverseLineIterator rline(nsLineBox* aList) { return mLines.rbegin(aList); }
friend nsBlockFrame* NS_NewBlockFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext);
// nsQueryFrame
NS_DECL_QUERYFRAME
// nsIFrame
@@ -643,25 +643,25 @@ protected:
/**
* Reflow a line.
* @param aState the current reflow state
* @param aLine the line to reflow. can contain a single block frame
* or contain 1 or more inline frames.
* @param aKeepReflowGoing [OUT] indicates whether the caller should continue to reflow more lines
*/
void ReflowLine(BlockReflowInput& aState,
- line_iterator aLine,
+ LineIterator aLine,
bool* aKeepReflowGoing);
// Return false if it needs another reflow because of reduced space
// between floats that are next to it (but not next to its top), and
// return true otherwise.
bool PlaceLine(BlockReflowInput& aState,
nsLineLayout& aLineLayout,
- line_iterator aLine,
+ LineIterator aLine,
nsFloatManager::SavedState* aFloatStateBeforeLine,
mozilla::LogicalRect& aFloatAvailableSpace, //in-out
nscoord& aAvailableSpaceHeight, // in-out
bool* aKeepReflowGoing);
/**
* If NS_BLOCK_LOOK_FOR_DIRTY_FRAMES is set, call MarkLineDirty
* on any line with a child frame that is dirty.
@@ -671,55 +671,55 @@ protected:
/**
* Mark |aLine| dirty, and, if necessary because of possible
* pull-up, mark the previous line dirty as well. Also invalidates textruns
* on those lines because the text in the lines might have changed due to
* addition/removal of frames.
* @param aLine the line to mark dirty
* @param aLineList the line list containing that line
*/
- void MarkLineDirty(line_iterator aLine, const nsLineList* aLineList);
+ void MarkLineDirty(LineIterator aLine, const nsLineList* aLineList);
// XXX where to go
bool IsLastLine(BlockReflowInput& aState,
- line_iterator aLine);
+ LineIterator aLine);
void DeleteLine(BlockReflowInput& aState,
nsLineList::iterator aLine,
nsLineList::iterator aLineEnd);
//----------------------------------------
// Methods for individual frame reflow
bool ShouldApplyBStartMargin(BlockReflowInput& aState,
nsLineBox* aLine,
nsIFrame* aChildFrame);
void ReflowBlockFrame(BlockReflowInput& aState,
- line_iterator aLine,
+ LineIterator aLine,
bool* aKeepGoing);
void ReflowInlineFrames(BlockReflowInput& aState,
- line_iterator aLine,
+ LineIterator aLine,
bool* aKeepLineGoing);
void DoReflowInlineFrames(BlockReflowInput& aState,
nsLineLayout& aLineLayout,
- line_iterator aLine,
+ LineIterator aLine,
nsFlowAreaRect& aFloatAvailableSpace,
nscoord& aAvailableSpaceHeight,
nsFloatManager::SavedState*
aFloatStateBeforeLine,
bool* aKeepReflowGoing,
LineReflowStatus* aLineReflowStatus,
bool aAllowPullUp);
void ReflowInlineFrame(BlockReflowInput& aState,
nsLineLayout& aLineLayout,
- line_iterator aLine,
+ LineIterator aLine,
nsIFrame* aFrame,
LineReflowStatus* aLineReflowStatus);
// Compute the available inline size for a float.
mozilla::LogicalRect AdjustFloatAvailableSpace(
BlockReflowInput& aState,
const mozilla::LogicalRect& aFloatAvailableSpace,
nsIFrame* aFloatFrame);
@@ -758,32 +758,32 @@ protected:
nsIFrame* aFrame);
/**
* Push aLine (and any after it), since it cannot be placed on this
* page/column. Set aKeepReflowGoing to false and set
* flag aState.mReflowStatus as incomplete.
*/
void PushTruncatedLine(BlockReflowInput& aState,
- line_iterator aLine,
+ LineIterator aLine,
bool* aKeepReflowGoing);
void SplitLine(BlockReflowInput& aState,
nsLineLayout& aLineLayout,
- line_iterator aLine,
+ LineIterator aLine,
nsIFrame* aFrame,
LineReflowStatus* aLineReflowStatus);
/**
* Pull a frame from the next available location (one of our lines or
* one of our next-in-flows lines).
* @return the pulled frame or nullptr
*/
nsIFrame* PullFrame(BlockReflowInput& aState,
- line_iterator aLine);
+ LineIterator aLine);
/**
* Try to pull a frame out of a line pointed at by aFromLine.
*
* Note: pulling a frame from a line that is a place-holder frame
* doesn't automatically remove the corresponding float from the
* line's float array. This happens indirectly: either the line gets
* emptied (and destroyed) or the line gets reflowed (because we mark
@@ -949,22 +949,22 @@ private:
};
#endif
/**
* Iterates over all lines in the prev-in-flows/next-in-flows of this block.
*/
class nsBlockInFlowLineIterator {
public:
- typedef nsBlockFrame::line_iterator line_iterator;
+ typedef nsBlockFrame::LineIterator LineIterator;
/**
* Set up the iterator to point to aLine which must be a normal line
* in aFrame (not an overflow line).
*/
- nsBlockInFlowLineIterator(nsBlockFrame* aFrame, line_iterator aLine);
+ nsBlockInFlowLineIterator(nsBlockFrame* aFrame, LineIterator aLine);
/**
* Set up the iterator to point to the first line found starting from
* aFrame. Sets aFoundValidLine to false if there is no such line.
* After aFoundValidLine has returned false, don't call any methods on this
* object again.
*/
nsBlockInFlowLineIterator(nsBlockFrame* aFrame, bool* aFoundValidLine);
/**
@@ -973,50 +973,50 @@ public:
* out-of-flow, finds the line containing the out-of-flow's placeholder. If
* the frame is not found, sets aFoundValidLine to false. After
* aFoundValidLine has returned false, don't call any methods on this
* object again.
*/
nsBlockInFlowLineIterator(nsBlockFrame* aFrame, nsIFrame* aFindFrame,
bool* aFoundValidLine);
- line_iterator GetLine() { return mLine; }
+ LineIterator GetLine() { return mLine; }
bool IsLastLineInList();
nsBlockFrame* GetContainer() { return mFrame; }
bool GetInOverflow() { return mLineList != &mFrame->mLines; }
/**
* Returns the current line list we're iterating, null means
* we're iterating |mLines| of the container.
*/
nsLineList* GetLineList() { return mLineList; }
/**
* Returns the end-iterator of whatever line list we're in.
*/
- line_iterator End();
+ LineIterator End();
/**
* Returns false if there are no more lines. After this has returned false,
* don't call any methods on this object again.
*/
bool Next();
/**
* Returns false if there are no more lines. After this has returned false,
* don't call any methods on this object again.
*/
bool Prev();
private:
friend class nsBlockFrame;
// XXX nsBlockFrame uses this internally in one place. Try to remove it.
- nsBlockInFlowLineIterator(nsBlockFrame* aFrame, line_iterator aLine, bool aInOverflow);
+ nsBlockInFlowLineIterator(nsBlockFrame* aFrame, LineIterator aLine, bool aInOverflow);
nsBlockFrame* mFrame;
- line_iterator mLine;
+ LineIterator mLine;
nsLineList* mLineList; // the line list mLine is in
/**
* Moves iterator to next valid line reachable from the current block.
* Returns false if there are no valid lines.
*/
bool FindValidLine();
};