/** * @param aBaseISizeData is an in/out param. This method updates the * `skipWhitespace` and `trailingWhitespace` fields of the struct with * the base level frame. Note that we don't need to do the same thing * for ruby text frames, because they are text run container themselves * (see nsTextFrame.cpp:BuildTextRuns), and thus no whitespace collapse * happens across the boundary of those frames. */ static nscoord CalculateColumnPrefISize(nsRenderingContext* aRenderingContext, const RubyColumnEnumerator& aEnumerator, nsIFrame::InlineIntrinsicISizeData* aBaseISizeData) { nscoord max = 0; uint32_t levelCount = aEnumerator.GetLevelCount(); for (uint32_t i = 0; i < levelCount; i++) { nsIFrame* frame = aEnumerator.GetFrameAtLevel(i); if (frame) { nsIFrame::InlinePrefISizeData data; if (i == 0) { data.lineContainer = aBaseISizeData->lineContainer; data.skipWhitespace = aBaseISizeData->skipWhitespace; data.trailingWhitespace = aBaseISizeData->trailingWhitespace; } else { // The line container of ruby text frames is their parent, // ruby text container frame. data.lineContainer = frame->GetParent(); } frame->AddInlinePrefISize(aRenderingContext, &data); MOZ_ASSERT(data.prevLines == 0, "Shouldn't have prev lines"); max = std::max(max, data.currentLine); if (i == 0) { aBaseISizeData->skipWhitespace = data.skipWhitespace; aBaseISizeData->trailingWhitespace = data.trailingWhitespace; } } } return max; }
static nscoord CalculateColumnPrefISize(nsRenderingContext* aRenderingContext, const RubyColumnEnumerator& aEnumerator) { nscoord max = 0; uint32_t levelCount = aEnumerator.GetLevelCount(); for (uint32_t i = 0; i < levelCount; i++) { nsIFrame* frame = aEnumerator.GetFrameAtLevel(i); if (frame) { nsIFrame::InlinePrefISizeData data; frame->AddInlinePrefISize(aRenderingContext, &data); MOZ_ASSERT(data.prevLines == 0, "Shouldn't have prev lines"); max = std::max(max, data.currentLine); } } return max; }