void
nsRubyTextContainerFrame::BeginRTCLineLayout(nsPresContext* aPresContext,
                                             const nsHTMLReflowState& aReflowState)
{
  // Construct block reflow state and line layout
  nscoord consumedBSize = GetConsumedBSize();

  ClearLineCursor();

  mISize = 0;

  nsBlockReflowState state(aReflowState, aPresContext, this, true, true,
                           false, consumedBSize);

  NS_ASSERTION(!mLines.empty(),
    "There should be at least one line in the ruby text container");
  line_iterator firstLine = begin_lines();
  mLineLayout = mozilla::MakeUnique<nsLineLayout>(
                           state.mPresContext,
                           state.mReflowState.mFloatManager,
                           &state.mReflowState, &firstLine);
  mLineLayout->Init(&state, state.mMinLineHeight, state.mLineNumber);

  mozilla::WritingMode lineWM = aReflowState.mLineLayout->GetWritingMode();
  mozilla::LogicalRect lineRect(state.mContentArea);
  nscoord iStart = lineRect.IStart(lineWM);
  nscoord availISize = lineRect.ISize(lineWM);
  nscoord availBSize = NS_UNCONSTRAINEDSIZE;

  mLineLayout->BeginLineReflow(iStart, state.mBCoord,
                              availISize, availBSize,
                              false,
                              false,
                              lineWM, state.mContainerWidth);
}
Esempio n. 2
0
nscoord
nsSplittableFrame::GetEffectiveComputedBSize(const nsHTMLReflowState& aReflowState,
                                              nscoord aConsumedBSize) const
{
  nscoord bSize = aReflowState.ComputedBSize();
  if (bSize == NS_INTRINSICSIZE) {
    return NS_INTRINSICSIZE;
  }

  if (aConsumedBSize == NS_INTRINSICSIZE) {
    aConsumedBSize = GetConsumedBSize();
  }

  bSize -= aConsumedBSize;

  // We may have stretched the frame beyond its computed height. Oh well.
  return std::max(0, bSize);
}