Simplify a conditional in CXFA_TextLayout::ItemBlocks(). Change-Id: If5eed65b2d13fefb92c442aefc38ccae0b7da302 Reviewed-on: https://pdfium-review.googlesource.com/c/49870 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/xfa/fxfa/cxfa_textlayout.cpp b/xfa/fxfa/cxfa_textlayout.cpp index d502783..cd3039c 100644 --- a/xfa/fxfa/cxfa_textlayout.cpp +++ b/xfa/fxfa/cxfa_textlayout.cpp
@@ -545,7 +545,6 @@ if (iCountHeight == 0) return; - bool bEndItem = true; float fLinePos = m_pLoader->fStartLineOffset; int32_t iLineIndex = 0; if (iBlockIndex > 0) { @@ -565,12 +564,11 @@ float fLineHeight = m_pLoader->lineHeights[i]; if (fLinePos + fLineHeight - rtText.height > kHeightTolerance) { m_Blocks.push_back({iLineIndex, i - iLineIndex}); - bEndItem = false; - break; + return; } fLinePos += fLineHeight; } - if (iCountHeight > 0 && (i - iLineIndex) > 0 && bEndItem) + if (i > iLineIndex) m_Blocks.push_back({iLineIndex, i - iLineIndex}); }