mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1177925: Use range-based "for" loops for nsFrameList iteration, in various places in layout. r=tn
This commit is contained in:
parent
5a5ec8aa12
commit
fbbaf1f5d6
@ -3509,7 +3509,7 @@ AddBoxesForFrame(nsIFrame* aFrame,
|
||||
pseudoType == nsCSSAnonBoxes::mozAnonymousPositionedBlock ||
|
||||
pseudoType == nsCSSAnonBoxes::mozMathMLAnonymousBlock ||
|
||||
pseudoType == nsCSSAnonBoxes::mozXULAnonymousBlock) {
|
||||
for (nsIFrame* kid = aFrame->GetFirstPrincipalChild(); kid; kid = kid->GetNextSibling()) {
|
||||
for (nsIFrame* kid : aFrame->PrincipalChildList()) {
|
||||
AddBoxesForFrame(kid, aCallback);
|
||||
}
|
||||
} else {
|
||||
@ -3548,7 +3548,7 @@ nsLayoutUtils::GetFirstNonAnonymousFrame(nsIFrame* aFrame)
|
||||
pseudoType == nsCSSAnonBoxes::mozAnonymousPositionedBlock ||
|
||||
pseudoType == nsCSSAnonBoxes::mozMathMLAnonymousBlock ||
|
||||
pseudoType == nsCSSAnonBoxes::mozXULAnonymousBlock) {
|
||||
for (nsIFrame* kid = aFrame->GetFirstPrincipalChild(); kid; kid = kid->GetNextSibling()) {
|
||||
for (nsIFrame* kid : aFrame->PrincipalChildList()) {
|
||||
nsIFrame* f = GetFirstNonAnonymousFrame(kid);
|
||||
if (f) {
|
||||
return f;
|
||||
@ -6958,7 +6958,7 @@ nsLayoutUtils::GetEditableRootContentByContentEditable(nsIDocument* aDocument)
|
||||
nsLayoutUtils::AssertNoDuplicateContinuations(nsIFrame* aContainer,
|
||||
const nsFrameList& aFrameList)
|
||||
{
|
||||
for (nsIFrame* f = aFrameList.FirstChild(); f ; f = f->GetNextSibling()) {
|
||||
for (nsIFrame* f : aFrameList) {
|
||||
// Check only later continuations of f; we deal with checking the
|
||||
// earlier continuations when we hit those earlier continuations in
|
||||
// the frame list.
|
||||
|
@ -331,9 +331,7 @@ nsAbsoluteContainingBlock::MarkAllFramesDirty()
|
||||
void
|
||||
nsAbsoluteContainingBlock::DoMarkFramesDirty(bool aMarkAllDirty)
|
||||
{
|
||||
for (nsIFrame* kidFrame = mAbsoluteFrames.FirstChild();
|
||||
kidFrame;
|
||||
kidFrame = kidFrame->GetNextSibling()) {
|
||||
for (nsIFrame* kidFrame : mAbsoluteFrames) {
|
||||
if (aMarkAllDirty) {
|
||||
kidFrame->AddStateBits(NS_FRAME_IS_DIRTY);
|
||||
} else if (FrameDependsOnContainer(kidFrame, true, true)) {
|
||||
|
@ -1279,15 +1279,14 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
|
||||
line != end; line++) {
|
||||
UpdateLineContainerWidth(line, containerWidth);
|
||||
}
|
||||
for (nsIFrame* f = mFloats.FirstChild(); f; f = f->GetNextSibling()) {
|
||||
for (nsIFrame* f : mFloats) {
|
||||
nsPoint physicalDelta(deltaX, 0);
|
||||
f->MovePositionBy(physicalDelta);
|
||||
}
|
||||
nsFrameList* bulletList = GetOutsideBulletList();
|
||||
if (bulletList) {
|
||||
nsPoint physicalDelta(deltaX, 0);
|
||||
for (nsIFrame* f = bulletList->FirstChild(); f;
|
||||
f = f->GetNextSibling()) {
|
||||
for (nsIFrame* f : *bulletList) {
|
||||
f->MovePositionBy(physicalDelta);
|
||||
}
|
||||
}
|
||||
@ -2001,7 +2000,7 @@ nsBlockFrame::ReparentFloats(nsIFrame* aFirstFrame, nsBlockFrame* aOldParent,
|
||||
nsFrameList list;
|
||||
aOldParent->CollectFloats(aFirstFrame, list, aReparentSiblings);
|
||||
if (list.NotEmpty()) {
|
||||
for (nsIFrame* f = list.FirstChild(); f; f = f->GetNextSibling()) {
|
||||
for (nsIFrame* f : list) {
|
||||
ReparentFrame(f, aOldParent, this);
|
||||
}
|
||||
mFloats.AppendFrames(nullptr, list);
|
||||
@ -6361,7 +6360,7 @@ nsBlockFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
|
||||
if (GetPrevInFlow()) {
|
||||
DisplayOverflowContainers(aBuilder, aDirtyRect, aLists);
|
||||
for (nsIFrame* f = mFloats.FirstChild(); f; f = f->GetNextSibling()) {
|
||||
for (nsIFrame* f : mFloats) {
|
||||
if (f->GetStateBits() & NS_FRAME_IS_PUSHED_FLOAT)
|
||||
BuildDisplayListForChild(aBuilder, f, aDirtyRect, aLists);
|
||||
}
|
||||
@ -7119,7 +7118,7 @@ nsBlockFrame::CheckFloats(nsBlockReflowState& aState)
|
||||
nsAutoTArray<nsIFrame*, 8> storedFloats;
|
||||
bool equal = true;
|
||||
uint32_t i = 0;
|
||||
for (nsIFrame* f = mFloats.FirstChild(); f; f = f->GetNextSibling()) {
|
||||
for (nsIFrame* f : mFloats) {
|
||||
if (f->GetStateBits() & NS_FRAME_IS_PUSHED_FLOAT)
|
||||
continue;
|
||||
storedFloats.AppendElement(f);
|
||||
|
@ -860,8 +860,7 @@ nsContainerFrame::DoInlineIntrinsicISize(nsRenderingContext *aRenderingContext,
|
||||
if (aData->currentLine == 0) {
|
||||
aData->currentLine = clonePBM;
|
||||
}
|
||||
for (nsIFrame *kid = nif->mFrames.FirstChild(); kid;
|
||||
kid = kid->GetNextSibling()) {
|
||||
for (nsIFrame* kid : nif->mFrames) {
|
||||
if (aType == nsLayoutUtils::MIN_ISIZE)
|
||||
kid->AddInlineMinISize(aRenderingContext,
|
||||
static_cast<InlineMinISizeData*>(aData));
|
||||
@ -1224,8 +1223,7 @@ nsContainerFrame::ReflowOverflowContainerChildren(nsPresContext* aPres
|
||||
nsOverflowContinuationTracker tracker(this, false, false);
|
||||
bool shouldReflowAllKids = aReflowState.ShouldReflowAllKids();
|
||||
|
||||
for (nsIFrame* frame = overflowContainers->FirstChild(); frame;
|
||||
frame = frame->GetNextSibling()) {
|
||||
for (nsIFrame* frame : *overflowContainers) {
|
||||
if (frame->GetPrevInFlow()->GetParent() != GetPrevInFlow()) {
|
||||
// frame's prevInFlow has moved, skip reflowing this frame;
|
||||
// it will get reflowed once it's been placed
|
||||
@ -1315,8 +1313,7 @@ nsContainerFrame::DisplayOverflowContainers(nsDisplayListBuilder* aBuilder,
|
||||
{
|
||||
nsFrameList* overflowconts = GetPropTableFrames(OverflowContainersProperty());
|
||||
if (overflowconts) {
|
||||
for (nsIFrame* frame = overflowconts->FirstChild(); frame;
|
||||
frame = frame->GetNextSibling()) {
|
||||
for (nsIFrame* frame : *overflowconts) {
|
||||
BuildDisplayListForChild(aBuilder, frame, aDirtyRect, aLists);
|
||||
}
|
||||
}
|
||||
|
@ -289,16 +289,14 @@ static uint32_t
|
||||
DoCharCountOfLargestOption(nsIFrame *aContainer)
|
||||
{
|
||||
uint32_t result = 0;
|
||||
for (nsIFrame* option = aContainer->GetFirstPrincipalChild();
|
||||
option; option = option->GetNextSibling()) {
|
||||
for (nsIFrame* option : aContainer->PrincipalChildList()) {
|
||||
uint32_t optionResult;
|
||||
if (option->GetContent()->IsHTMLElement(nsGkAtoms::optgroup)) {
|
||||
optionResult = DoCharCountOfLargestOption(option);
|
||||
} else {
|
||||
// REVIEW: Check the frame structure for this!
|
||||
optionResult = 0;
|
||||
for (nsIFrame *optionChild = option->GetFirstPrincipalChild();
|
||||
optionChild; optionChild = optionChild->GetNextSibling()) {
|
||||
for (nsIFrame* optionChild : option->PrincipalChildList()) {
|
||||
if (optionChild->GetType() == nsGkAtoms::textFrame) {
|
||||
optionResult += nsTextFrameUtils::
|
||||
ComputeApproximateLengthWithWhitespaceCompression(
|
||||
|
@ -674,8 +674,7 @@ void nsHTMLFramesetFrame::GetSizeOfChild(nsIFrame* aChild,
|
||||
// Reflow only creates children frames for <frameset> and <frame> content.
|
||||
// this assumption is used here
|
||||
int i = 0;
|
||||
for (nsIFrame* child = mFrames.FirstChild(); child;
|
||||
child = child->GetNextSibling()) {
|
||||
for (nsIFrame* child : mFrames) {
|
||||
if (aChild == child) {
|
||||
nsIntPoint ignore;
|
||||
GetSizeOfChildAt(i, aWM, aSize, ignore);
|
||||
|
@ -2543,7 +2543,7 @@ ScrollFrameHelper::AppendScrollPartsTo(nsDisplayListBuilder* aBuilder,
|
||||
LookAndFeel::GetInt(LookAndFeel::eIntID_UseOverlayScrollbars) != 0;
|
||||
|
||||
nsAutoTArray<nsIFrame*, 3> scrollParts;
|
||||
for (nsIFrame* kid = mOuter->GetFirstPrincipalChild(); kid; kid = kid->GetNextSibling()) {
|
||||
for (nsIFrame* kid : mOuter->PrincipalChildList()) {
|
||||
if (kid == mScrolledFrame ||
|
||||
(kid->IsAbsPosContaininingBlock() || overlayScrollbars) != aPositioned)
|
||||
continue;
|
||||
|
@ -1167,7 +1167,7 @@ static bool AreAllEarlierInFlowFramesEmpty(nsIFrame* aFrame,
|
||||
*aFound = false;
|
||||
return false;
|
||||
}
|
||||
for (nsIFrame* f = aFrame->GetFirstPrincipalChild(); f; f = f->GetNextSibling()) {
|
||||
for (nsIFrame* f : aFrame->PrincipalChildList()) {
|
||||
bool allEmpty = AreAllEarlierInFlowFramesEmpty(f, aDescendant, aFound);
|
||||
if (*aFound || !allEmpty) {
|
||||
return allEmpty;
|
||||
|
@ -165,7 +165,7 @@ nsInlineFrame::IsEmpty()
|
||||
return false;
|
||||
}
|
||||
|
||||
for (nsIFrame *kid = mFrames.FirstChild(); kid; kid = kid->GetNextSibling()) {
|
||||
for (nsIFrame* kid : mFrames) {
|
||||
if (!kid->IsEmpty())
|
||||
return false;
|
||||
}
|
||||
|
@ -1311,10 +1311,8 @@ BuildTextRuns(gfxContext* aContext, nsTextFrame* aForFrame,
|
||||
// just one line
|
||||
scanner.SetAtStartOfLine();
|
||||
scanner.SetCommonAncestorWithLastFrame(nullptr);
|
||||
nsIFrame* child = textRunContainer->GetFirstPrincipalChild();
|
||||
while (child) {
|
||||
for (nsIFrame* child : textRunContainer->PrincipalChildList()) {
|
||||
scanner.ScanFrame(child);
|
||||
child = child->GetNextSibling();
|
||||
}
|
||||
// Set mStartOfLine so FlushFrames knows its textrun ends a line
|
||||
scanner.SetAtStartOfLine();
|
||||
|
@ -264,9 +264,7 @@ nsVideoFrame::Reflow(nsPresContext* aPresContext,
|
||||
|
||||
// Reflow the child frames. We may have up to two, an image frame
|
||||
// which is the poster, and a box frame, which is the video controls.
|
||||
for (nsIFrame *child = mFrames.FirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
for (nsIFrame* child : mFrames) {
|
||||
if (child->GetContent() == mPosterImage) {
|
||||
// Reflow the poster frame.
|
||||
nsImageFrame* imageFrame = static_cast<nsImageFrame*>(child);
|
||||
@ -438,9 +436,7 @@ nsVideoFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
// Add child frames to display list. We expect various children,
|
||||
// but only want to draw mPosterImage conditionally. Others we
|
||||
// always add to the display list.
|
||||
for (nsIFrame *child = mFrames.FirstChild();
|
||||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
for (nsIFrame* child : mFrames) {
|
||||
if (child->GetContent() != mPosterImage || shouldDisplayPoster) {
|
||||
child->BuildDisplayListForStackingContext(aBuilder,
|
||||
aDirtyRect - child->GetOffsetTo(this),
|
||||
|
@ -303,13 +303,11 @@ GetBSizeOfRowsSpannedBelowFirst(nsTableCellFrame& aTableCellFrame,
|
||||
nsTableCellFrame*
|
||||
nsTableRowFrame::GetFirstCell()
|
||||
{
|
||||
nsIFrame* childFrame = mFrames.FirstChild();
|
||||
while (childFrame) {
|
||||
for (nsIFrame* childFrame : mFrames) {
|
||||
nsTableCellFrame *cellFrame = do_QueryFrame(childFrame);
|
||||
if (cellFrame) {
|
||||
return cellFrame;
|
||||
}
|
||||
childFrame = childFrame->GetNextSibling();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@ -538,8 +536,7 @@ nsTableRowFrame::CalcBSize(const nsHTMLReflowState& aReflowState)
|
||||
}
|
||||
// calc() with percentages is treated like 'auto' on table rows.
|
||||
|
||||
for (nsIFrame* kidFrame = mFrames.FirstChild(); kidFrame;
|
||||
kidFrame = kidFrame->GetNextSibling()) {
|
||||
for (nsIFrame* kidFrame : mFrames) {
|
||||
nsTableCellFrame *cellFrame = do_QueryFrame(kidFrame);
|
||||
if (cellFrame) {
|
||||
MOZ_ASSERT(cellFrame->GetWritingMode() == wm);
|
||||
@ -1394,8 +1391,7 @@ nsTableRowFrame::InsertCellFrame(nsTableCellFrame* aFrame,
|
||||
{
|
||||
// Find the cell frame where col index < aColIndex
|
||||
nsTableCellFrame* priorCell = nullptr;
|
||||
for (nsIFrame* child = mFrames.FirstChild(); child;
|
||||
child = child->GetNextSibling()) {
|
||||
for (nsIFrame* child : mFrames) {
|
||||
nsTableCellFrame *cellFrame = do_QueryFrame(child);
|
||||
if (cellFrame) {
|
||||
int32_t colIndex;
|
||||
|
@ -83,8 +83,7 @@ int32_t nsTableRowGroupFrame::GetStartRowIndex()
|
||||
void nsTableRowGroupFrame::AdjustRowIndices(int32_t aRowIndex,
|
||||
int32_t anAdjustment)
|
||||
{
|
||||
nsIFrame* rowFrame = GetFirstPrincipalChild();
|
||||
for ( ; rowFrame; rowFrame = rowFrame->GetNextSibling()) {
|
||||
for (nsIFrame* rowFrame : mFrames) {
|
||||
if (NS_STYLE_DISPLAY_TABLE_ROW==rowFrame->StyleDisplay()->mDisplay) {
|
||||
int32_t index = ((nsTableRowFrame*)rowFrame)->GetRowIndex();
|
||||
if (index >= aRowIndex)
|
||||
@ -485,8 +484,7 @@ nsTableRowGroupFrame::ReflowChildren(nsPresContext* aPresContext,
|
||||
nsTableRowFrame*
|
||||
nsTableRowGroupFrame::GetFirstRow()
|
||||
{
|
||||
for (nsIFrame* childFrame = mFrames.FirstChild(); childFrame;
|
||||
childFrame = childFrame->GetNextSibling()) {
|
||||
for (nsIFrame* childFrame : mFrames) {
|
||||
nsTableRowFrame *rowFrame = do_QueryFrame(childFrame);
|
||||
if (rowFrame) {
|
||||
return rowFrame;
|
||||
|
Loading…
Reference in New Issue
Block a user