Bug 1321394 - Remove unnecessary loop in nsRubyBaseContainerFrame. r=dholbert draft
authorXidorn Quan <me@upsuper.org>
Thu, 01 Dec 2016 13:47:26 +1100
changeset 446857 5d4e55c12a411e9f0c3579eca362d0b793aef445
parent 446193 b4dfc37a501caa6f9c36eff00627bdd359bbf5bf
child 538886 55409cd7b62d297a420f64cbc5ba31128f71dacc
push id37901
push userxquan@mozilla.com
push dateFri, 02 Dec 2016 00:31:49 +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
@@ -763,21 +763,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