sw/source/core/layout/flycnt.cxx | 20 ++++++++++++++++++-- sw/source/core/text/itratr.cxx | 9 +++++++-- 2 files changed, 25 insertions(+), 4 deletions(-)
New commits: commit fc4dc4378b6bbf57a63df10915ad81e8a8bae867 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Mon Jun 10 19:48:27 2024 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Jun 12 12:22:36 2024 +0200 (related: tdf#161215) sw: layout: fix another floating table loop The full bugdoc loops; text frame 3160 (on which a floating table is anchored) is split, immediately joined, and split again... SwTextFrame::IsEmptyWithSplitFly() has a wrong condition that compares document coordinates with relative position inside the frame; try to use the confusing SwRectFnSet to compare instead, which prevents this frame from splitting because it actually fits into its upper. Another problem in that function is that it checks RES_PAGEDESC but not RES_BREAK; try to fix that too. (regression from commit 16b5b21d36da87be9b50235acbbb8008ed23b8bb) Change-Id: I94251b7443e51303b28d14f0597b0bf782142480 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168668 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 48659fa6cf8b2c5e3810696cf0c9257ddb57dd4d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168623 Reviewed-by: Miklos Vajna <vmik...@collabora.com> (cherry picked from commit f38ba192a52f46a386789557fc2f2600dd2e676e) diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx index bb008d24a344..e29fe5ebe916 100644 --- a/sw/source/core/text/itratr.cxx +++ b/sw/source/core/text/itratr.cxx @@ -32,6 +32,7 @@ #include <fmtflcnt.hxx> #include <fmtcntnt.hxx> #include <fmtftn.hxx> +#include <fmtpdsc.hxx> #include <frmatr.hxx> #include <frmfmt.hxx> #include <fmtfld.hxx> @@ -1553,12 +1554,16 @@ bool SwTextFrame::IsEmptyWithSplitFly() const return false; } - if (GetTextNodeFirst()->GetSwAttrSet().HasItem(RES_PAGEDESC)) + if (SvxBreak const eBreak = GetBreakItem().GetBreak(); + eBreak == SvxBreak::ColumnBefore || eBreak == SvxBreak::ColumnBoth + || eBreak == SvxBreak::PageBefore || eBreak == SvxBreak::PageBoth + || GetPageDescItem().GetPageDesc() != nullptr) { return false; } - if (getFrameArea().Bottom() <= GetUpper()->getFramePrintArea().Bottom()) + SwRectFnSet fnUpper(GetUpper()); + if (fnUpper.YDiff(fnUpper.GetBottom(getFrameArea()), fnUpper.GetPrtBottom(*GetUpper())) <= 0) { return false; } commit 58546ab3697b789a718ecfe599a8d6fc18c3c4a2 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Fri Jun 7 14:16:23 2024 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Jun 12 12:22:33 2024 +0200 tdf#161215 sw: layout: don't move into section frame on same page The problem is that in SwFrame::GetNextFlyLeaf() pLayLeaf is in the body on the same page as pFlyAnchor, so the MoveSubTree() effectively removes the pNext chain from the layout into a circular structure whose upper is an indirect lower, causing an infinite loop later. Change-Id: I08f96cf483205d6213d7cec7b239f750fff5d3ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168529 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 724c17602fac7476f068e6b66f30e9ef3c9f0940) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168536 Reviewed-by: Miklos Vajna <vmik...@collabora.com> (cherry picked from commit 13728add48675b470d596c77fd186d3654b29525) diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index f1611a516775..61ffc387a6da 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -1630,7 +1630,17 @@ SwLayoutFrame *SwFrame::GetNextFlyLeaf( MakePageType eMakePage ) { // Make sure the candidate is not inside the same body frame, that would prevent // inserting a new page. - if (pFlyAnchor->FindBodyFrame() == pLayLeaf->FindBodyFrame()) + SwBodyFrame const* pAnchorBody(pFlyAnchor->FindBodyFrame()); + while (!pAnchorBody->IsPageBodyFrame()) + { + pAnchorBody = pAnchorBody->GetUpper()->FindBodyFrame(); + }; + SwBodyFrame const* pLeafBody(pLayLeaf->FindBodyFrame()); + while (!pLeafBody->IsPageBodyFrame()) + { + pLeafBody = pLeafBody->GetUpper()->FindBodyFrame(); + }; + if (pAnchorBody == pLeafBody) { bSameBody = true; } commit 08ba5977170694d653b324fa8ae9ec99931bb77a Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Fri Jun 7 13:59:04 2024 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Jun 12 12:22:29 2024 +0200 tdf#161217 sw: layout: don't move into to-be-deleted section frame The problem is that in SwFrame::GetNextFlyLeaf() pLayLeaf is found inside a SwSectionFrame that has no m_pSection because it has been scheduled for deletion via SwRootFrame::InsertEmptySct(). Skip such frames, now it goes into infinite loop later... Change-Id: I93e5febba19213c1503fd699c8e4517067c6ec6b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168528 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Tested-by: Jenkins (cherry picked from commit e607bf096d4fb182388ccaefb1179cdd924af02a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168535 Reviewed-by: Miklos Vajna <vmik...@collabora.com> (cherry picked from commit a7548d6b38a9b075f31f5955d1512d9ff5017d66) diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index 2ed6fbf08942..f1611a516775 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -1652,7 +1652,13 @@ SwLayoutFrame *SwFrame::GetNextFlyLeaf( MakePageType eMakePage ) { // The above conditions are not held, reject. pOldLayLeaf = pLayLeaf; - pLayLeaf = pLayLeaf->GetNextLayoutLeaf(); + do + { + pLayLeaf = pLayLeaf->GetNextLayoutLeaf(); + } + // skip deleted section frames - do not move into these + while (pLayLeaf && pLayLeaf->FindSctFrame() + && !pLayLeaf->FindSctFrame()->GetSection()); if (pLayLeaf && pLayLeaf->IsInDocBody() && !bSameBody && !pLayLeaf->IsInFly() && pLayLeaf->IsInTab()) {