Bug 1134667 - Check length of text run before checking line break in reflow of ruby base container. r=jfkthame
authorXidorn Quan <quanxunzhen@gmail.com>
Fri, 20 Feb 2015 13:43:35 +1300
changeset 229945 a288fd1c1d0d9235ee36130929065ed90a0a98e2
parent 229944 1c7760c72b583da925ffe351fc4fec9e32717a77
child 229946 cacbad5e8e75107eb1d2329304b28b8870371128
push id28304
push usercbook@mozilla.com
push dateFri, 20 Feb 2015 14:15:44 +0000
treeherdermozilla-central@5f1009731a97 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs1134667
milestone38.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 1134667 - Check length of text run before checking line break in reflow of ruby base container. r=jfkthame
layout/generic/nsRubyBaseContainerFrame.cpp
--- a/layout/generic/nsRubyBaseContainerFrame.cpp
+++ b/layout/generic/nsRubyBaseContainerFrame.cpp
@@ -618,16 +618,20 @@ LineBreakBefore(const nsHTMLReflowState&
     gfxSkipCharsIterator iter =
       textFrame->EnsureTextRun(nsTextFrame::eInflated,
                                aReflowState.rendContext->ThebesContext(),
                                aReflowState.mLineLayout->LineContainerFrame(),
                                aReflowState.mLineLayout->GetLine());
     iter.SetOriginalOffset(textFrame->GetContentOffset());
     uint32_t pos = iter.GetSkippedOffset();
     gfxTextRun* textRun = textFrame->GetTextRun(nsTextFrame::eInflated);
+    if (pos >= textRun->GetLength()) {
+      // The text frame contains no character at all.
+      return gfxBreakPriority::eNoBreak;
+    }
     // Return whether we can break before the first character.
     if (textRun->CanBreakLineBefore(pos)) {
       return gfxBreakPriority::eNormalBreak;
     }
     // Check whether we can wrap word here.
     const nsStyleText* textStyle = textFrame->StyleText();
     if (textStyle->WordCanWrap(textFrame) && textRun->IsClusterStart(pos)) {
       return gfxBreakPriority::eWordWrapBreak;