Bug 1116037 part 9 - Move ruby text container arrays to stack. r=dbaron
authorXidorn Quan <quanxunzhen@gmail.com>
Tue, 30 Dec 2014 09:56:34 +1100
changeset 221823 fb2cec3732eaea0ac606db50761b74cec0606707
parent 221822 769f499c51abc35ffe1b5882beba56658efc9f06
child 221824 dad0ce12d7785e1016db43df25603f1cbbfa67e5
push id53430
push userxquan@mozilla.com
push dateFri, 02 Jan 2015 05:10:36 +0000
treeherdermozilla-inbound@305b1834db85 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1116037
milestone37.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 1116037 part 9 - Move ruby text container arrays to stack. r=dbaron
layout/generic/nsRubyBaseContainerFrame.cpp
layout/generic/nsRubyBaseContainerFrame.h
layout/generic/nsRubyFrame.cpp
--- a/layout/generic/nsRubyBaseContainerFrame.cpp
+++ b/layout/generic/nsRubyBaseContainerFrame.cpp
@@ -148,70 +148,74 @@ CalculateColumnPrefISize(nsRenderingCont
   }
   return max;
 }
 
 /* virtual */ void
 nsRubyBaseContainerFrame::AddInlineMinISize(
     nsRenderingContext *aRenderingContext, nsIFrame::InlineMinISizeData *aData)
 {
-  for (uint32_t i = 0, iend = mTextContainers.Length(); i < iend; i++) {
-    if (mTextContainers[i]->IsSpanContainer()) {
+  AutoTextContainerArray textContainers;
+  GetTextContainers(textContainers);
+
+  for (uint32_t i = 0, iend = textContainers.Length(); i < iend; i++) {
+    if (textContainers[i]->IsSpanContainer()) {
       // Since spans are not breakable internally, use our pref isize
       // directly if there is any span.
       aData->currentLine += GetPrefISize(aRenderingContext);
       return;
     }
   }
 
   nscoord max = 0;
-  RubyColumnEnumerator enumerator(this, mTextContainers);
+  RubyColumnEnumerator enumerator(this, textContainers);
   for (; !enumerator.AtEnd(); enumerator.Next()) {
     // We use *pref* isize for computing the min isize of columns
     // because ruby bases and texts are unbreakable internally.
     max = std::max(max, CalculateColumnPrefISize(aRenderingContext,
                                                  enumerator));
   }
   aData->currentLine += max;
 }
 
 /* virtual */ void
 nsRubyBaseContainerFrame::AddInlinePrefISize(
     nsRenderingContext *aRenderingContext, nsIFrame::InlinePrefISizeData *aData)
 {
+  AutoTextContainerArray textContainers;
+  GetTextContainers(textContainers);
+
   nscoord sum = 0;
-  RubyColumnEnumerator enumerator(this, mTextContainers);
+  RubyColumnEnumerator enumerator(this, textContainers);
   for (; !enumerator.AtEnd(); enumerator.Next()) {
     sum += CalculateColumnPrefISize(aRenderingContext, enumerator);
   }
-  for (uint32_t i = 0, iend = mTextContainers.Length(); i < iend; i++) {
-    if (mTextContainers[i]->IsSpanContainer()) {
-      nsIFrame* frame = mTextContainers[i]->GetFirstPrincipalChild();
+  for (uint32_t i = 0, iend = textContainers.Length(); i < iend; i++) {
+    if (textContainers[i]->IsSpanContainer()) {
+      nsIFrame* frame = textContainers[i]->GetFirstPrincipalChild();
       sum = std::max(sum, frame->GetPrefISize(aRenderingContext));
     }
   }
   aData->currentLine += sum;
 }
 
 /* virtual */ bool 
 nsRubyBaseContainerFrame::IsFrameOfType(uint32_t aFlags) const 
 {
   return nsContainerFrame::IsFrameOfType(aFlags & 
          ~(nsIFrame::eLineParticipant));
 }
 
-void nsRubyBaseContainerFrame::AppendTextContainer(nsIFrame* aFrame)
+void
+nsRubyBaseContainerFrame::GetTextContainers(TextContainerArray& aTextContainers)
 {
-  nsRubyTextContainerFrame* rtcFrame = do_QueryFrame(aFrame);
-  MOZ_ASSERT(rtcFrame, "Must provide a ruby text container.");
-  mTextContainers.AppendElement(rtcFrame);
-}
-
-void nsRubyBaseContainerFrame::ClearTextContainers() {
-  mTextContainers.Clear();
+  MOZ_ASSERT(aTextContainers.IsEmpty());
+  for (RubyTextContainerIterator iter(this); !iter.AtEnd(); iter.Next()) {
+    aTextContainers.AppendElement(iter.GetTextContainer());
+  }
 }
 
 /* virtual */ bool
 nsRubyBaseContainerFrame::CanContinueTextRun() const
 {
   return true;
 }
 
@@ -234,16 +238,17 @@ nsRubyBaseContainerFrame::ComputeSize(ns
 nsRubyBaseContainerFrame::GetLogicalBaseline(WritingMode aWritingMode) const
 {
   return mBaseline;
 }
 
 struct nsRubyBaseContainerFrame::ReflowState
 {
   bool mAllowLineBreak;
+  const TextContainerArray& mTextContainers;
   const nsHTMLReflowState& mBaseReflowState;
   const nsTArray<UniquePtr<nsHTMLReflowState>>& mTextReflowStates;
 };
 
 // Check whether the given extra isize can fit in the line in base level.
 static bool
 ShouldBreakBefore(const nsHTMLReflowState& aReflowState, nscoord aExtraISize)
 {
@@ -267,21 +272,24 @@ nsRubyBaseContainerFrame::Reflow(nsPresC
 
   if (!aReflowState.mLineLayout) {
     NS_ASSERTION(
       aReflowState.mLineLayout,
       "No line layout provided to RubyBaseContainerFrame reflow method.");
     return;
   }
 
+  AutoTextContainerArray textContainers;
+  GetTextContainers(textContainers);
+
   MoveOverflowToChildList();
   // Ask text containers to drain overflows
-  const uint32_t rtcCount = mTextContainers.Length();
+  const uint32_t rtcCount = textContainers.Length();
   for (uint32_t i = 0; i < rtcCount; i++) {
-    mTextContainers[i]->MoveOverflowToChildList();
+    textContainers[i]->MoveOverflowToChildList();
   }
 
   WritingMode lineWM = aReflowState.mLineLayout->GetWritingMode();
   LogicalSize availSize(lineWM, aReflowState.AvailableWidth(),
                         aReflowState.AvailableHeight());
 
   // We have a reflow state and a line layout for each RTC.
   // They are conceptually the state of the RTCs, but we don't actually
@@ -293,17 +301,17 @@ nsRubyBaseContainerFrame::Reflow(nsPresC
   nsAutoTArray<UniquePtr<nsHTMLReflowState>, RTC_ARRAY_SIZE> reflowStates;
   nsAutoTArray<UniquePtr<nsLineLayout>, RTC_ARRAY_SIZE> lineLayouts;
   reflowStates.SetCapacity(rtcCount);
   lineLayouts.SetCapacity(rtcCount);
 
   // Begin the line layout for each ruby text container in advance.
   bool hasSpan = false;
   for (uint32_t i = 0; i < rtcCount; i++) {
-    nsRubyTextContainerFrame* textContainer = mTextContainers[i];
+    nsRubyTextContainerFrame* textContainer = textContainers[i];
     if (textContainer->IsSpanContainer()) {
       hasSpan = true;
     }
 
     nsHTMLReflowState* reflowState = new nsHTMLReflowState(
       aPresContext, *aReflowState.parentReflowState, textContainer, availSize);
     reflowStates.AppendElement(reflowState);
     nsLineLayout* lineLayout = new nsLineLayout(aPresContext,
@@ -353,30 +361,30 @@ nsRubyBaseContainerFrame::Reflow(nsPresC
         gfxBreakPriority::eNormalBreak)) {
     aStatus = NS_INLINE_LINE_BREAK_BEFORE();
   }
 
   nscoord isize = 0;
   if (aStatus == NS_FRAME_COMPLETE) {
     // Reflow columns excluding any span
     ReflowState reflowState = {
-      allowLineBreak && !hasSpan, aReflowState, reflowStates
+      allowLineBreak && !hasSpan, textContainers, aReflowState, reflowStates
     };
     isize = ReflowColumns(reflowState, aStatus);
   }
 
   // If there exists any span, the columns must either be completely
   // reflowed, or be not reflowed at all.
   MOZ_ASSERT(NS_INLINE_IS_BREAK_BEFORE(aStatus) ||
              NS_FRAME_IS_COMPLETE(aStatus) || !hasSpan);
   if (!NS_INLINE_IS_BREAK_BEFORE(aStatus) &&
       NS_FRAME_IS_COMPLETE(aStatus) && hasSpan) {
     // Reflow spans
     ReflowState reflowState = {
-      false, aReflowState, reflowStates
+      false, textContainers, aReflowState, reflowStates
     };
     nscoord spanISize = ReflowSpans(reflowState);
     nscoord deltaISize = spanISize - isize;
     if (deltaISize <= 0) {
       RubyUtils::ClearReservedISize(this);
     } else if (allowLineBreak && ShouldBreakBefore(aReflowState, deltaISize)) {
       aStatus = NS_INLINE_LINE_BREAK_BEFORE();
     } else {
@@ -399,17 +407,17 @@ nsRubyBaseContainerFrame::Reflow(nsPresC
   // When there are no frames inside the ruby base container, EndSpan
   // will return 0. However, in this case, the actual width of the
   // container could be non-zero because of non-empty ruby annotations.
   MOZ_ASSERT(NS_INLINE_IS_BREAK_BEFORE(aStatus) ||
              isize == lineSpanSize || mFrames.IsEmpty());
   for (uint32_t i = 0; i < rtcCount; i++) {
     // It happens before the ruby text container is reflowed, and that
     // when it is reflowed, it will just use this size.
-    nsRubyTextContainerFrame* textContainer = mTextContainers[i];
+    nsRubyTextContainerFrame* textContainer = textContainers[i];
     nsLineLayout* lineLayout = lineLayouts[i].get();
 
     RubyUtils::ClearReservedISize(textContainer);
     nscoord rtcISize = lineLayout->GetCurrentICoord();
     // Only span containers and containers with collapsed annotations
     // need reserving isize. For normal ruby text containers, their
     // children will be expanded properly. We only need to expand their
     // own size.
@@ -434,47 +442,49 @@ nsRubyBaseContainerFrame::Reflow(nsPresC
  * This struct stores the continuations after this frame and
  * corresponding text containers. It is used to speed up looking
  * ahead for nonempty continuations.
  */
 struct MOZ_STACK_CLASS nsRubyBaseContainerFrame::PullFrameState
 {
   ContinuationTraversingState mBase;
   nsAutoTArray<ContinuationTraversingState, RTC_ARRAY_SIZE> mTexts;
+  const TextContainerArray& mTextContainers;
 
-  explicit PullFrameState(nsRubyBaseContainerFrame* aFrame);
+  PullFrameState(nsRubyBaseContainerFrame* aBaseContainer,
+                 const TextContainerArray& aTextContainers);
 };
 
 nscoord
 nsRubyBaseContainerFrame::ReflowColumns(const ReflowState& aReflowState,
                                         nsReflowStatus& aStatus)
 {
   nsLineLayout* lineLayout = aReflowState.mBaseReflowState.mLineLayout;
-  const uint32_t rtcCount = mTextContainers.Length();
+  const uint32_t rtcCount = aReflowState.mTextContainers.Length();
   nscoord istart = lineLayout->GetCurrentICoord();
   nscoord icoord = istart;
   nsReflowStatus reflowStatus = NS_FRAME_COMPLETE;
   aStatus = NS_FRAME_COMPLETE;
 
   mColumnCount = 0;
   RubyColumn column;
   column.mTextFrames.SetCapacity(rtcCount);
-  RubyColumnEnumerator e(this, mTextContainers);
+  RubyColumnEnumerator e(this, aReflowState.mTextContainers);
   for (; !e.AtEnd(); e.Next()) {
     e.GetColumn(column);
     icoord += ReflowOneColumn(aReflowState, column, reflowStatus);
     if (NS_INLINE_IS_BREAK(reflowStatus)) {
       break;
     }
     // We are not handling overflow here.
     MOZ_ASSERT(reflowStatus == NS_FRAME_COMPLETE);
   }
 
   bool isComplete = false;
-  PullFrameState pullFrameState(this);
+  PullFrameState pullFrameState(this, aReflowState.mTextContainers);
   while (!NS_INLINE_IS_BREAK(reflowStatus)) {
     // We are not handling overflow here.
     MOZ_ASSERT(reflowStatus == NS_FRAME_COMPLETE);
 
     // Try pull some frames from next continuations. This call replaces
     // frames in |column| with the frame pulled in each level.
     PullOneColumn(lineLayout, pullFrameState, column, isComplete);
     if (isComplete) {
@@ -506,18 +516,18 @@ nsRubyBaseContainerFrame::ReflowColumns(
     MOZ_ASSERT(NS_FRAME_IS_COMPLETE(aStatus) || aReflowState.mAllowLineBreak);
 
     if (column.mBaseFrame) {
       PushChildren(column.mBaseFrame, column.mBaseFrame->GetPrevSibling());
     }
     for (uint32_t i = 0; i < rtcCount; i++) {
       nsIFrame* textFrame = column.mTextFrames[i];
       if (textFrame) {
-        mTextContainers[i]->PushChildren(textFrame,
-                                         textFrame->GetPrevSibling());
+        aReflowState.mTextContainers[i]->PushChildren(
+          textFrame, textFrame->GetPrevSibling());
       }
     }
   } else if (NS_INLINE_IS_BREAK_AFTER(reflowStatus)) {
     // |reflowStatus| being break after here may only happen when
     // there is a break after the column just pulled, or the whole
     // segment has been completely reflowed. In those cases, we do
     // not need to push anything.
     MOZ_ASSERT(e.AtEnd());
@@ -531,17 +541,17 @@ nscoord
 nsRubyBaseContainerFrame::ReflowOneColumn(const ReflowState& aReflowState,
                                           const RubyColumn& aColumn,
                                           nsReflowStatus& aStatus)
 {
   const nsHTMLReflowState& baseReflowState = aReflowState.mBaseReflowState;
   const auto& textReflowStates = aReflowState.mTextReflowStates;
 
   WritingMode lineWM = baseReflowState.mLineLayout->GetWritingMode();
-  const uint32_t rtcCount = mTextContainers.Length();
+  const uint32_t rtcCount = aReflowState.mTextContainers.Length();
   MOZ_ASSERT(aColumn.mTextFrames.Length() == rtcCount);
   MOZ_ASSERT(textReflowStates.Length() == rtcCount);
   nscoord istart = baseReflowState.mLineLayout->GetCurrentICoord();
   nscoord columnISize = 0;
 
   nsAutoString baseText;
   if (aColumn.mBaseFrame) {
     if (!nsContentUtils::GetNodeTextContent(aColumn.mBaseFrame->GetContent(),
@@ -612,17 +622,17 @@ nsRubyBaseContainerFrame::ReflowOneColum
   nscoord deltaISize = icoord - baseReflowState.mLineLayout->GetCurrentICoord();
   if (deltaISize > 0) {
     baseReflowState.mLineLayout->AdvanceICoord(deltaISize);
     if (aColumn.mBaseFrame) {
       RubyUtils::SetReservedISize(aColumn.mBaseFrame, deltaISize);
     }
   }
   for (uint32_t i = 0; i < rtcCount; i++) {
-    if (mTextContainers[i]->IsSpanContainer()) {
+    if (aReflowState.mTextContainers[i]->IsSpanContainer()) {
       continue;
     }
     nsLineLayout* lineLayout = textReflowStates[i]->mLineLayout;
     nsIFrame* textFrame = aColumn.mTextFrames[i];
     nscoord deltaISize = icoord - lineLayout->GetCurrentICoord();
     if (deltaISize > 0) {
       lineLayout->AdvanceICoord(deltaISize);
       if (textFrame) {
@@ -641,40 +651,43 @@ nsRubyBaseContainerFrame::ReflowOneColum
         gfxBreakPriority::eNormalBreak)) {
     aStatus = NS_INLINE_LINE_BREAK_AFTER(aStatus);
   }
 
   return columnISize;
 }
 
 nsRubyBaseContainerFrame::PullFrameState::PullFrameState(
-    nsRubyBaseContainerFrame* aFrame)
-  : mBase(aFrame)
+    nsRubyBaseContainerFrame* aBaseContainer,
+    const TextContainerArray& aTextContainers)
+  : mBase(aBaseContainer)
+  , mTextContainers(aTextContainers)
 {
-  const uint32_t rtcCount = aFrame->mTextContainers.Length();
+  const uint32_t rtcCount = aTextContainers.Length();
   for (uint32_t i = 0; i < rtcCount; i++) {
-    mTexts.AppendElement(aFrame->mTextContainers[i]);
+    mTexts.AppendElement(aTextContainers[i]);
   }
 }
 
 void
 nsRubyBaseContainerFrame::PullOneColumn(nsLineLayout* aLineLayout,
                                         PullFrameState& aPullFrameState,
                                         RubyColumn& aColumn,
                                         bool& aIsComplete)
 {
-  const uint32_t rtcCount = mTextContainers.Length();
+  const TextContainerArray& textContainers = aPullFrameState.mTextContainers;
+  const uint32_t rtcCount = textContainers.Length();
 
   aColumn.mBaseFrame = PullNextInFlowChild(aPullFrameState.mBase);
   aIsComplete = !aColumn.mBaseFrame;
 
   aColumn.mTextFrames.ClearAndRetainStorage();
   for (uint32_t i = 0; i < rtcCount; i++) {
     nsIFrame* nextText =
-      mTextContainers[i]->PullNextInFlowChild(aPullFrameState.mTexts[i]);
+      textContainers[i]->PullNextInFlowChild(aPullFrameState.mTexts[i]);
     aColumn.mTextFrames.AppendElement(nextText);
     // If there exists any frame in continations, we haven't
     // completed the reflow process.
     aIsComplete = aIsComplete && !nextText;
   }
 
   if (!aIsComplete) {
     // We pulled frames from the next line, hence mark it dirty.
@@ -684,18 +697,19 @@ nsRubyBaseContainerFrame::PullOneColumn(
 
 nscoord
 nsRubyBaseContainerFrame::ReflowSpans(const ReflowState& aReflowState)
 {
   WritingMode lineWM =
     aReflowState.mBaseReflowState.mLineLayout->GetWritingMode();
   nscoord spanISize = 0;
 
-  for (uint32_t i = 0, iend = mTextContainers.Length(); i < iend; i++) {
-    nsRubyTextContainerFrame* container = mTextContainers[i];
+  for (uint32_t i = 0, iend = aReflowState.mTextContainers.Length();
+       i < iend; i++) {
+    nsRubyTextContainerFrame* container = aReflowState.mTextContainers[i];
     if (!container->IsSpanContainer()) {
       continue;
     }
 
     nsIFrame* rtFrame = container->GetFirstPrincipalChild();
     nsReflowStatus reflowStatus;
     nsHTMLReflowMetrics metrics(*aReflowState.mTextReflowStates[i]);
     bool pushedFrame;
--- a/layout/generic/nsRubyBaseContainerFrame.h
+++ b/layout/generic/nsRubyBaseContainerFrame.h
@@ -58,32 +58,26 @@ public:
 
   virtual nscoord
     GetLogicalBaseline(mozilla::WritingMode aWritingMode) const MOZ_OVERRIDE;
 
 #ifdef DEBUG_FRAME_DUMP
   virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
 #endif
 
-#ifdef DEBUG
-  void AssertTextContainersEmpty()
-  {
-    MOZ_ASSERT(mTextContainers.IsEmpty());
-  }
-#endif
-
-  void AppendTextContainer(nsIFrame* aFrame);
-  void ClearTextContainers();
-
 protected:
   friend nsContainerFrame*
     NS_NewRubyBaseContainerFrame(nsIPresShell* aPresShell,
                                  nsStyleContext* aContext);
   explicit nsRubyBaseContainerFrame(nsStyleContext* aContext) : nsContainerFrame(aContext) {}
 
+  typedef nsTArray<nsRubyTextContainerFrame*> TextContainerArray;
+  typedef nsAutoTArray<nsRubyTextContainerFrame*, RTC_ARRAY_SIZE> AutoTextContainerArray;
+  void GetTextContainers(TextContainerArray& aTextContainers);
+
   struct ReflowState;
   nscoord ReflowColumns(const ReflowState& aReflowState,
                         nsReflowStatus& aStatus);
   nscoord ReflowOneColumn(const ReflowState& aReflowState,
                           const mozilla::RubyColumn& aColumn,
                           nsReflowStatus& aStatus);
   nscoord ReflowSpans(const ReflowState& aReflowState);
 
@@ -91,20 +85,13 @@ protected:
 
   // Pull ruby base and corresponding ruby text frames from
   // continuations after them.
   void PullOneColumn(nsLineLayout* aLineLayout,
                      PullFrameState& aPullFrameState,
                      mozilla::RubyColumn& aColumn,
                      bool& aIsComplete);
 
-  /**
-   * The array of ruby text containers below is filled before the ruby
-   * frame (parent) starts reflowing this ruby segment, and cleared when
-   * the reflow finishes.
-   */
-  nsTArray<nsRubyTextContainerFrame*> mTextContainers;
-
   nscoord mBaseline;
   uint32_t mColumnCount;
 };
 
 #endif /* nsRubyBaseContainerFrame_h___ */
--- a/layout/generic/nsRubyFrame.cpp
+++ b/layout/generic/nsRubyFrame.cpp
@@ -56,48 +56,16 @@ nsRubyFrame::IsFrameOfType(uint32_t aFla
 nsresult
 nsRubyFrame::GetFrameName(nsAString& aResult) const
 {
   return MakeFrameName(NS_LITERAL_STRING("Ruby"), aResult);
 }
 #endif
 
 /**
- * This class is responsible for appending and clearing
- * text container list of the base container.
- */
-class MOZ_STACK_CLASS AutoSetTextContainers
-{
-public:
-  explicit AutoSetTextContainers(nsRubyBaseContainerFrame* aBaseContainer);
-  ~AutoSetTextContainers();
-
-private:
-  nsRubyBaseContainerFrame* mBaseContainer;
-};
-
-AutoSetTextContainers::AutoSetTextContainers(
-    nsRubyBaseContainerFrame* aBaseContainer)
-  : mBaseContainer(aBaseContainer)
-{
-#ifdef DEBUG
-  aBaseContainer->AssertTextContainersEmpty();
-#endif
-  for (RubyTextContainerIterator iter(aBaseContainer);
-       !iter.AtEnd(); iter.Next()) {
-    aBaseContainer->AppendTextContainer(iter.GetTextContainer());
-  }
-}
-
-AutoSetTextContainers::~AutoSetTextContainers()
-{
-  mBaseContainer->ClearTextContainers();
-}
-
-/**
  * This enumerator enumerates each segment.
  */
 class MOZ_STACK_CLASS SegmentEnumerator
 {
 public:
   explicit SegmentEnumerator(nsRubyFrame* aRubyFrame);
 
   void Next();
@@ -132,29 +100,27 @@ SegmentEnumerator::Next()
 }
 
 /* virtual */ void
 nsRubyFrame::AddInlineMinISize(nsRenderingContext *aRenderingContext,
                                nsIFrame::InlineMinISizeData *aData)
 {
   nscoord max = 0;
   for (SegmentEnumerator e(this); !e.AtEnd(); e.Next()) {
-    AutoSetTextContainers holder(e.GetBaseContainer());
     max = std::max(max, e.GetBaseContainer()->GetMinISize(aRenderingContext));
   }
   aData->currentLine += max;
 }
 
 /* virtual */ void
 nsRubyFrame::AddInlinePrefISize(nsRenderingContext *aRenderingContext,
                                 nsIFrame::InlinePrefISizeData *aData)
 {
   nscoord sum = 0;
   for (SegmentEnumerator e(this); !e.AtEnd(); e.Next()) {
-    AutoSetTextContainers holder(e.GetBaseContainer());
     sum += e.GetBaseContainer()->GetPrefISize(aRenderingContext);
   }
   aData->currentLine += sum;
 }
 
 /* virtual */ LogicalSize
 nsRubyFrame::ComputeSize(nsRenderingContext *aRenderingContext,
                            WritingMode aWM,
@@ -257,17 +223,16 @@ SanityCheckRubyPosition(int8_t aRubyPosi
 #endif
 
 void
 nsRubyFrame::ReflowSegment(nsPresContext* aPresContext,
                            const nsHTMLReflowState& aReflowState,
                            nsRubyBaseContainerFrame* aBaseContainer,
                            nsReflowStatus& aStatus)
 {
-  AutoSetTextContainers holder(aBaseContainer);
   WritingMode lineWM = aReflowState.mLineLayout->GetWritingMode();
   LogicalSize availSize(lineWM, aReflowState.AvailableISize(),
                         aReflowState.AvailableBSize());
 
   nsAutoTArray<nsRubyTextContainerFrame*, RTC_ARRAY_SIZE> textContainers;
   for (RubyTextContainerIterator iter(aBaseContainer); !iter.AtEnd(); iter.Next()) {
     textContainers.AppendElement(iter.GetTextContainer());
   }