summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2023-08-08 12:21:20 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2023-08-10 12:52:28 +0200
commitf7062f0568a60898b3ccea25caab73807f528d6c (patch)
tree50d5f981205a4839c5f2954867c758ada3f5099c
parent21a0cf9b0d990f8a10dbea99f9d4a2bfbf2ba855 (diff)
tdf#156551 tdf#150606 sw: layout: only invalidate SwTabFrame if it...
... wants to move back. In this document, the table 1709 splits across 3 columns of the section 1702 with 1 row each, and when its follows are invalidated in CalcContent(), the later SwTabFrame::MakeAll() of the 1st follow joins the 2nd follow and invalidates the size of the section frame, causing a loop. So only invalidate if that actually looks necessary. (regression from commit 59987d3c77ec7dbf59fbea9f47cc226f4e8903f9) Change-Id: I360c8f697a7666a19a08d8ebcabbcfa3a7cdf844 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155452 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de> (cherry picked from commit a9b19f78f3cdcbf5c949a85b45877e903114cc54) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155456 Tested-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r--sw/source/core/inc/tabfrm.hxx1
-rw-r--r--sw/source/core/layout/fly.cxx7
-rw-r--r--sw/source/core/layout/tabfrm.cxx24
3 files changed, 29 insertions, 3 deletions
diff --git a/sw/source/core/inc/tabfrm.hxx b/sw/source/core/inc/tabfrm.hxx
index 95da935cd079..6dfa6c743a13 100644
--- a/sw/source/core/inc/tabfrm.hxx
+++ b/sw/source/core/inc/tabfrm.hxx
@@ -43,6 +43,7 @@ class SwTabFrame: public SwLayoutFrame, public SwFlowFrame
bool m_bCalcLowers :1; /// For stability of the content in MakeAll
bool m_bLowersFormatted :1; /// Communication between MakeAll and Layact
bool m_bLockBackMove :1; /// The Master took care of the BackMove test
+ bool m_bWantBackMove :1; /// Table wants to move back but was locked
bool m_bResizeHTMLTable :1; /// Call the Resize of the HTMLTableLayout in the MakeAll
/// This is an optimization, so that we don't have to call
/// it in ContentFrame::Grow; there it might be called for
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 6cdec269c2d9..2b6973d14e97 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -1663,7 +1663,12 @@ void CalcContent( SwLayoutFrame *pLay, bool bNoColl )
{
assert(static_cast<SwTabFrame*>(pFrame)->IsFollow());
static_cast<SwTabFrame*>(pFrame)->m_bLockBackMove = false;
- pFrame->InvalidatePos();
+ // tdf#150606 encourage it to move back in FormatLayout()
+ if (static_cast<SwTabFrame*>(pFrame)->m_bWantBackMove)
+ {
+ static_cast<SwTabFrame*>(pFrame)->m_bWantBackMove = false;
+ pFrame->InvalidatePos();
+ }
}
}
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 4489142e8e56..f39250dcc67b 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -74,6 +74,7 @@ SwTabFrame::SwTabFrame( SwTable &rTab, SwFrame* pSib )
, m_bCalcLowers(false)
, m_bLowersFormatted(false)
, m_bLockBackMove(false)
+ , m_bWantBackMove(false)
, m_bResizeHTMLTable(false)
, m_bONECalcLowers(false)
, m_bHasFollowFlowLine(false)
@@ -113,6 +114,7 @@ SwTabFrame::SwTabFrame( SwTabFrame &rTab )
, m_bCalcLowers(false)
, m_bLowersFormatted(false)
, m_bLockBackMove(false)
+ , m_bWantBackMove(false)
, m_bResizeHTMLTable(false)
, m_bONECalcLowers(false)
, m_bHasFollowFlowLine(false)
@@ -3549,9 +3551,17 @@ bool SwTabFrame::ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool &rReformat )
}
else if (!m_bLockBackMove)
bMoveAnyway = true;
+ else
+ {
+ m_bWantBackMove = true;
+ }
}
else if (!m_bLockBackMove)
bMoveAnyway = true;
+ else
+ {
+ m_bWantBackMove = true;
+ }
if ( bMoveAnyway )
{
@@ -3563,7 +3573,7 @@ bool SwTabFrame::ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool &rReformat )
// This frame fits into pNewUpper in case it has no space, but this
// frame is empty.
bFits = nSpace >= 0;
- if (!m_bLockBackMove && bFits)
+ if (bFits)
{
// #i26945# - check, if follow flow line
// contains frame, which are moved forward due to its object
@@ -3582,7 +3592,17 @@ bool SwTabFrame::ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool &rReformat )
// 'return nHeight <= nSpace' to 'return nTmpHeight < nSpace'.
// This obviously results in problems with table frames in
// sections. Remember: Every twip is sacred.
- return nTmpHeight <= nSpace;
+ if (nTmpHeight <= nSpace)
+ {
+ if (m_bLockBackMove)
+ {
+ m_bWantBackMove = true;
+ }
+ else
+ {
+ return true;
+ }
+ }
}
}
return false;