Bug 1321394 - Remove unnecessary loop in nsRubyBaseContainerFrame. r=dholbert
authorXidorn Quan <me@upsuper.org>
Thu, 01 Dec 2016 13:47:26 +1100
changeset 372302 308bc1917b91c428eeaffe19940018f1373c3e82
parent 372301 0932c3f7208bd6629a7e1dfb6f87501900e94a0a
child 372303 4c343bdb6e2aad0f2254bfa14d39b19810a53201
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1321394
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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