Bug 1141919 - Drain overflow list of ruby content frame if line break suppression fails somewhere. r=dbaron, a=sledru
authorXidorn Quan <quanxunzhen@gmail.com>
Sat, 14 Mar 2015 16:29:06 +1100
changeset 248164 16fb0cf8266abbb9f6fa64d11763170fc3024d8a
parent 248163 c36dcffd0b40ac1b01cb3b5ce0df1a0569415acb
child 248165 0bbebc0cac80d314402f8e01f0596a6c08fa94a1
push id7774
push userryanvm@gmail.com
push dateTue, 17 Mar 2015 15:07:24 +0000
treeherdermozilla-aurora@0aa24399b11b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron, sledru
bugs1141919
milestone38.0a2
Bug 1141919 - Drain overflow list of ruby content frame if line break suppression fails somewhere. r=dbaron, a=sledru
layout/generic/nsRubyBaseContainerFrame.cpp
--- a/layout/generic/nsRubyBaseContainerFrame.cpp
+++ b/layout/generic/nsRubyBaseContainerFrame.cpp
@@ -747,35 +747,45 @@ nsRubyBaseContainerFrame::ReflowOneColum
       }
       RubyUtils::ClearReservedISize(textFrame);
 
       bool pushedFrame;
       nsReflowStatus reflowStatus;
       nsLineLayout* lineLayout = textReflowStates[i]->mLineLayout;
       nscoord textIStart = lineLayout->GetCurrentICoord();
       lineLayout->ReflowFrame(textFrame, reflowStatus, nullptr, pushedFrame);
-      MOZ_ASSERT(!NS_INLINE_IS_BREAK(reflowStatus) && !pushedFrame,
-                 "Any line break inside ruby box should has been suppressed");
+      if (MOZ_UNLIKELY(NS_INLINE_IS_BREAK(reflowStatus) || pushedFrame)) {
+        MOZ_ASSERT_UNREACHABLE(
+            "Any line break inside ruby box should have been suppressed");
+        // For safety, always drain the overflow list, so that
+        // no frames are left there after reflow.
+        textFrame->DrainSelfOverflowList();
+      }
       nscoord textISize = lineLayout->GetCurrentICoord() - textIStart;
       columnISize = std::max(columnISize, textISize);
     }
   }
 
   // Reflow the base frame
   if (aColumn.mBaseFrame) {
     RubyUtils::ClearReservedISize(aColumn.mBaseFrame);
 
     bool pushedFrame;
     nsReflowStatus reflowStatus;
     nsLineLayout* lineLayout = baseReflowState.mLineLayout;
     nscoord baseIStart = lineLayout->GetCurrentICoord();
     lineLayout->ReflowFrame(aColumn.mBaseFrame, reflowStatus,
                             nullptr, pushedFrame);
-    MOZ_ASSERT(!NS_INLINE_IS_BREAK(reflowStatus) && !pushedFrame,
-               "Any line break inside ruby box should has been suppressed");
+    if (MOZ_UNLIKELY(NS_INLINE_IS_BREAK(reflowStatus) || pushedFrame)) {
+      MOZ_ASSERT_UNREACHABLE(
+        "Any line break inside ruby box should have been suppressed");
+      // For safety, always drain the overflow list, so that
+      // no frames are left there after reflow.
+      aColumn.mBaseFrame->DrainSelfOverflowList();
+    }
     nscoord baseISize = lineLayout->GetCurrentICoord() - baseIStart;
     columnISize = std::max(columnISize, baseISize);
 
     bool allowBreakBefore = aColumnIndex ?
       aReflowState.mAllowLineBreak : aReflowState.mAllowInitialLineBreak;
     if (allowBreakBefore) {
       bool shouldBreakBefore = false;
       gfxBreakPriority breakPriority = LineBreakBefore(