sw/source/core/layout/flowfrm.cxx |   37 ++++++++++++++++---------------------
 1 file changed, 16 insertions(+), 21 deletions(-)

New commits:
commit d98dafcde1e136d30419bc7624d42e5edbd6a95c
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Tue Jun 3 18:18:24 2025 +0500
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sat Jun 7 10:20:23 2025 +0200

    Drop an exclusion that seems obsolete
    
    During a debug session, I saw these warnings appearing all the time:
    
    > <SwFlowFrame::MovedBwd(..)> - incorrect next found.
    
    It turned out, that the code emitting them found tables, which were
    not in OSL_ENSURE's condition. It didnэt warn about tables prior to
    commit 960ef1a29fe441360f6b9536f4239656566f06cf (INTEGRATION: CWS
    swqbugfixes11 (1.43.40); FILE MERGED, 2005-01-05); the said commit
    added a condition to enter the search loop and eventual "is locked"
    check, which excluded the case when the initially found frame was
    a table. But it didn't handle the case of a table found in the loop.
    
    Adding such a check looks unreasonable now, when the code didn't
    need better filtering of tables in all these years. Before adding
    the table back to the condition of OSL_ENSURE (to silence the wrong
    warning), I checked if the whole change is indeed still needed. It
    turns out, that reverting the change completely does not break the
    bugdoc in i#38232, nor any unit tests. So it looks like this may be
    reverted as obsolete.
    
    Unfortunately, the bugdoc uses fonts that are unavailable in unit
    tests, and it's impossible to re-create the bug to prepare another
    test document, so no unit test.
    
    Change-Id: I3d451dd6ebd0d54fbef2f16c1406f7c2693e7cab
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186235
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins

diff --git a/sw/source/core/layout/flowfrm.cxx 
b/sw/source/core/layout/flowfrm.cxx
index ad5a630ee963..f4c21c2ad4ff 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -2692,36 +2692,31 @@ bool SwFlowFrame::MoveBwd( bool &rbReformat )
 
     // i#21478 - don't move backward, if flow frame wants to
     // keep with next frame and next frame is locked.
-    // i#38232 - If next frame is a table, do *not* check,
-    // if it's locked.
     if ( pNewUpper && !IsFollow() && !m_rThis.IsHiddenNow() &&
          m_rThis.GetAttrSet()->GetKeep().GetValue() && m_rThis.GetIndNext() )
     {
         SwFrame* pIndNext = m_rThis.GetIndNext();
-        // i#38232
-        if ( !pIndNext->IsTabFrame() )
+        // get first content of section, while empty sections are skipped
+        while ( pIndNext && pIndNext->IsSctFrame() )
         {
-            // get first content of section, while empty sections are skipped
-            while ( pIndNext && pIndNext->IsSctFrame() )
+            if( static_cast<SwSectionFrame*>(pIndNext)->GetSection() )
             {
-                if( static_cast<SwSectionFrame*>(pIndNext)->GetSection() )
+                SwFrame* pTmp = 
static_cast<SwSectionFrame*>(pIndNext)->ContainsAny();
+                if ( pTmp )
                 {
-                    SwFrame* pTmp = 
static_cast<SwSectionFrame*>(pIndNext)->ContainsAny();
-                    if ( pTmp )
-                    {
-                        pIndNext = pTmp;
-                        break;
-                    }
+                    pIndNext = pTmp;
+                    break;
                 }
-                pIndNext = pIndNext->GetIndNext();
-            }
-            OSL_ENSURE( !pIndNext || dynamic_cast<const SwTextFrame*>( 
pIndNext) !=  nullptr,
-                    "<SwFlowFrame::MovedBwd(..)> - incorrect next found." );
-            if ( pIndNext && pIndNext->IsFlowFrame() &&
-                 SwFlowFrame::CastFlowFrame(pIndNext)->IsJoinLocked() )
-            {
-                pNewUpper = nullptr;
             }
+            pIndNext = pIndNext->GetIndNext();
+        }
+        OSL_ENSURE(!pIndNext || dynamic_cast<const SwTextFrame*>(pIndNext)
+                       || dynamic_cast<const SwTabFrame*>(pIndNext),
+                "<SwFlowFrame::MovedBwd(..)> - incorrect next found." );
+        if ( pIndNext && pIndNext->IsFlowFrame() &&
+             SwFlowFrame::CastFlowFrame(pIndNext)->IsJoinLocked() )
+        {
+            pNewUpper = nullptr;
         }
     }
 

Reply via email to