From 417353e1c0dca23d888f554ff272f66e40b77eab Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Wed, 3 Jun 2020 16:03:09 +0200 Subject: tdf#130804 sw: fix bookmark portions in line containing only as-char fly There were 2 problems: * due to the first bookmark portion, the line got an additional 55 twips of its descent added to its height in SwLineLayout::CalcLine(). * when called from SwTextFrame::CalcHeightOfLastLine(), SwLineLayout::MaxAscentDescent() is supposed to ignore FlyInCnt portions, but it didn't ignore the bookmark portion which had the same height, hence the resulting line spacing was 855 instead of 0 and the upper margin of the next paragraph increased similarly. (regression from 4ce8120f1e53f7b81e653b01d141643013bc69ab) Change-Id: I52b154a48c5d712b7e3e323d2e3e08f37bf1afd1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95438 Tested-by: Jenkins Reviewed-by: Michael Stahl --- sw/source/core/text/porlay.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index 2b51a2eca9bc..499dac050009 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -408,7 +408,9 @@ void SwLineLayout::CalcLine( SwTextFormatter &rLine, SwTextFormatInfo &rInf ) } // Ignore drop portion height - if( pPos->IsDropPortion() && static_cast(pPos)->GetLines() > 1) + // tdf#130804 ... and bookmark portions + if ((pPos->IsDropPortion() && static_cast(pPos)->GetLines() > 1) + || pPos->GetWhichPor() == PortionType::Bookmark) { pLast = pPos; pPos = pPos->GetNextPortion(); @@ -618,6 +620,8 @@ void SwLineLayout::MaxAscentDescent( SwTwips& _orAscent, while ( pTmpPortion ) { if ( !pTmpPortion->IsBreakPortion() && !pTmpPortion->IsFlyPortion() && + // tdf#130804 ignore bookmark portions + pTmpPortion->GetWhichPor() != PortionType::Bookmark && ( !_bNoFlyCntPorAndLinePor || ( !pTmpPortion->IsFlyCntPortion() && !(pTmpPortion == this && pTmpPortion->GetNextPortion() ) ) ) ) -- cgit