Bug 1171158: Convert some code to use range-based for loops in nsPresShell.cpp. r=mats

This commit is contained in:
Daniel Holbert 2015-06-03 21:13:37 -07:00
parent 6cf4c5f107
commit 800e9e74fd

View File

@ -2894,9 +2894,7 @@ PresShell::FrameNeedsReflow(nsIFrame *aFrame, IntrinsicDirty aIntrinsicDirty,
nsIFrame::ChildListIterator lists(f);
for (; !lists.IsDone(); lists.Next()) {
nsFrameList::Enumerator childFrames(lists.CurrentList());
for (; !childFrames.AtEnd(); childFrames.Next()) {
nsIFrame* kid = childFrames.get();
for (nsIFrame* kid : lists.CurrentList()) {
kid->MarkIntrinsicISizesDirty();
stack.AppendElement(kid);
}
@ -4728,8 +4726,7 @@ nsIPresShell::ReconstructStyleDataInternal()
restyleManager->PostRestyleEvent(root, eRestyle_Subtree,
NS_STYLE_HINT_NONE);
} else {
for (uint32_t i = 0; i < scopeRoots.Length(); i++) {
Element* scopeRoot = scopeRoots[i];
for (Element* scopeRoot : scopeRoots) {
restyleManager->PostRestyleEvent(scopeRoot, eRestyle_Subtree,
NS_STYLE_HINT_NONE);
}
@ -5287,9 +5284,7 @@ PresShell::PaintRangePaintInfo(nsTArray<nsAutoPtr<RangePaintInfo> >* aItems,
frameSelection->SetDisplaySelection(nsISelectionController::SELECTION_HIDDEN);
// next, paint each range in the selection
int32_t count = aItems->Length();
for (int32_t i = 0; i < count; i++) {
RangePaintInfo* rangeInfo = (*aItems)[i];
for (RangePaintInfo* rangeInfo : *aItems) {
// the display lists paint relative to the offset from the reference
// frame, so account for that translation too:
gfxPoint rootOffset =
@ -5962,10 +5957,7 @@ PresShell::MarkImagesInSubtreeVisible(nsIFrame* aFrame, const nsRect& aRect)
continue;
}
nsFrameList children = childLists.CurrentList();
for (nsFrameList::Enumerator e(children); !e.AtEnd(); e.Next()) {
nsIFrame* child = e.get();
for (nsIFrame* child : childLists.CurrentList()) {
nsRect r = rect - child->GetPosition();
if (!r.IntersectRect(r, child->GetVisualOverflowRect())) {
continue;
@ -7722,9 +7714,7 @@ PresShell::HandleEvent(nsIFrame* aFrame,
case NS_TOUCH_END: {
// get the correct shell to dispatch to
WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent();
WidgetTouchEvent::TouchArray& touches = touchEvent->touches;
for (uint32_t i = 0; i < touches.Length(); ++i) {
dom::Touch* touch = touches[i];
for (dom::Touch* touch : touchEvent->touches) {
if (!touch) {
break;
}
@ -8300,8 +8290,7 @@ PresShell::DispatchTouchEventToDOM(WidgetEvent* aEvent,
WidgetTouchEvent* touchEvent = aEvent->AsTouchEvent();
// loop over all touches and dispatch events on any that have changed
for (uint32_t i = 0; i < touchEvent->touches.Length(); ++i) {
dom::Touch* touch = touchEvent->touches[i];
for (dom::Touch* touch : touchEvent->touches) {
if (!touch || !touch->mChanged) {
continue;
}
@ -10984,8 +10973,8 @@ nsIPresShell::MarkFixedFramesForReflow(IntrinsicDirty aIntrinsicDirty)
nsIFrame* rootFrame = mFrameConstructor->GetRootFrame();
if (rootFrame) {
const nsFrameList& childList = rootFrame->GetChildList(nsIFrame::kFixedList);
for (nsFrameList::Enumerator e(childList); !e.AtEnd(); e.Next()) {
FrameNeedsReflow(e.get(), aIntrinsicDirty, NS_FRAME_IS_DIRTY);
for (nsIFrame* childFrame : childList) {
FrameNeedsReflow(childFrame, aIntrinsicDirty, NS_FRAME_IS_DIRTY);
}
}
}