Bug 1321394 - Remove unnecessary loop in nsRubyBaseContainerFrame. r=dholbert
authorXidorn Quan <me@upsuper.org>
Thu, 01 Dec 2016 13:47:26 +1100
changeset 325060 308bc1917b91c428eeaffe19940018f1373c3e82
parent 325059 0932c3f7208bd6629a7e1dfb6f87501900e94a0a
child 325061 4c343bdb6e2aad0f2254bfa14d39b19810a53201
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersdholbert
bugs1321394
milestone53.0a1
Bug 1321394 - Remove unnecessary loop in nsRubyBaseContainerFrame. r=dholbert MozReview-Commit-ID: DqRD0w823Sv
layout/generic/nsRubyBaseContainerFrame.cpp
--- a/layout/generic/nsRubyBaseContainerFrame.cpp
+++ b/layout/generic/nsRubyBaseContainerFrame.cpp
@@ -764,21 +764,20 @@ nsRubyBaseContainerFrame::PullOneColumn(
       if (textFrame && !textFrame->IsIntraLevelWhitespace()) {
         textFrame = nullptr;
       }
     }
   } else {
     // We are not pulling an intra-level whitespace, which means all
     // elements we are going to pull can have non-whitespace content,
     // which may contain float which we need to reparent.
-    nsBlockFrame* oldFloatCB = nullptr;
-    for (nsIFrame* frame : aColumn) {
-      oldFloatCB = nsLayoutUtils::GetFloatContainingBlock(frame);
-      break;
-    }
+    MOZ_ASSERT(aColumn.begin() != aColumn.end(),
+               "Ruby column shouldn't be empty");
+    nsBlockFrame* oldFloatCB =
+      nsLayoutUtils::GetFloatContainingBlock(*aColumn.begin());
 #ifdef DEBUG
     MOZ_ASSERT(oldFloatCB, "Must have found a float containing block");
     for (nsIFrame* frame : aColumn) {
       MOZ_ASSERT(nsLayoutUtils::GetFloatContainingBlock(frame) == oldFloatCB,
                  "All frames in the same ruby column should share "
                  "the same old float containing block");
     }
 #endif