sw/source/core/text/itrpaint.cxx | 47 +++++++++++++++++++++++++++------------ sw/source/core/text/porlay.cxx | 4 +++ 2 files changed, 37 insertions(+), 14 deletions(-)
New commits: commit 21e6aea941d297545b1acd6592e0769af2b4d8a6 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Wed May 10 13:15:15 2023 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed May 10 19:03:09 2023 +0200 sw: fix crashtesting assert on moz386569-2.odt itrpaint.cxx:434: SwTextPainter::DrawTextLine: Assertion `!roTaggedParagraph' failed. The list item has the soft hyphen as a bullet char. Surprisingly this creates a SwSoftHyphPortion followed by an empty SwNumberPortion. (regression from commit 9b38beadf9eaf027b201cdf0ecb2bce5611014dd) Change-Id: Id58687c7e968a8a77ed5fab85d4c20d239174569 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151608 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx index 8bfe1631db72..827f8d4fcfd2 100644 --- a/sw/source/core/text/itrpaint.cxx +++ b/sw/source/core/text/itrpaint.cxx @@ -405,7 +405,9 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip, } // multiple numbering portions are possible :( - if (pPor->InNumberGrp() // also footnote label + if ((pPor->InNumberGrp() // also footnote label + // weird special case, bullet with soft hyphen + || (pPor->InHyphGrp() && pNext && pNext->InNumberGrp())) && !roTaggedLabel) // note: CalcPaintOfst may skip some portions { assert(isPDFTaggingEnabled); diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index 7111709aa6bc..d00dcc4992c0 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -2695,6 +2695,10 @@ bool SwParaPortion::HasNumberingPortion(FootnoteOrNot const eFootnote) const pPortion = pPortion->GetNextPortion(); } } + if (pPortion && pPortion->InHyphGrp()) + { // weird special case, bullet with soft hyphen + pPortion = pPortion->GetNextPortion(); + } return pPortion && pPortion->InNumberGrp() && (eFootnote == SwParaPortion::FootnoteToo || !pPortion->IsFootnoteNumPortion()); } commit ef692c98d43aeb861afb5b01f62e46344e835cb2 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Wed May 10 12:41:46 2023 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed May 10 19:02:56 2023 +0200 sw: fix crashtesting assert on fdo38226-1.odt frmpaint.cxx:804: SwTextFrame::PaintSwFrame: Assertion `!oTaggedLabel' failed. This is similar to what was fixed in commit 0913da454e2dd88fb8fc83cddd20c735b79f73ca except that the last numbering portion is now in a subsequent line that isn't painted at all due to the "aLine.Y() <= nBottom" check in SwTextFrame::PaintSwFrame(). (regression from commit 9b38beadf9eaf027b201cdf0ecb2bce5611014dd) Change-Id: I16cd8bd254457b81e74cb02a46ddf0e2167f11ab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151607 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx index e0fc758fb597..8bfe1631db72 100644 --- a/sw/source/core/text/itrpaint.cxx +++ b/sw/source/core/text/itrpaint.cxx @@ -408,7 +408,7 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip, if (pPor->InNumberGrp() // also footnote label && !roTaggedLabel) // note: CalcPaintOfst may skip some portions { - assert(isPDFTaggingEnabled); (void) isPDFTaggingEnabled; + assert(isPDFTaggingEnabled); Por_Info aPorInfo(*pPor, *this, true); // open Lbl roTaggedLabel.emplace(nullptr, nullptr, &aPorInfo, *pOut); } @@ -456,22 +456,39 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip, pNext && pNext->IsHolePortion() ) ? pNext : nullptr; - if (!pPor) // check if the end of the list label is off-screen - { - while (pNext) + if (!pPor && isPDFTaggingEnabled && !roTaggedParagraph) + { // check if the end of the list label is off-screen + auto FindEndOfNumbering = [&](SwLinePortion const* pP) { + while (pP) + { + if (pP->InNumberGrp() + && !static_cast<SwNumberPortion const*>(pP)->HasFollow()) + { + if (roTaggedLabel) + { + roTaggedLabel.reset(); + } // else, if the numbering isn't visible at all, no Lbl + Frame_Info aFrameInfo(*m_pFrame); // open LBody + roTaggedParagraph.emplace(nullptr, &aFrameInfo, nullptr, *GetInfo().GetOut()); + return true; + } + pP = pP->GetNextPortion(); + } + return false; + }; + if (!FindEndOfNumbering(pNext)) // check rest of current line { - if (!roTaggedParagraph && pNext->InNumberGrp() - && !static_cast<SwNumberPortion const*>(pNext)->HasFollow()) + // check lines that will be cut off + if (rPaint.Bottom() < Y() + GetLineHeight()) { - if (roTaggedLabel) + for (SwLineLayout const* pLine = GetNext(); pLine; pLine = pLine->GetNext()) { - roTaggedLabel.reset(); - } // else, if the numbering isn't visible at all, no Lbl - Frame_Info aFrameInfo(*m_pFrame); // open LBody - roTaggedParagraph.emplace(nullptr, &aFrameInfo, nullptr, *GetInfo().GetOut()); - break; + if (FindEndOfNumbering(pLine->GetFirstPortion())) + { + break; + } + } } - pNext = pNext->GetNextPortion(); } } }