sw/qa/core/text/frmform.cxx      |    9 +++++++++
 sw/source/core/layout/tabfrm.cxx |    7 ++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 44b3fe6bbede8e4f6ef9a7548e8d47a55cbd65f1
Author:     Mike Kaganski <[email protected]>
AuthorDate: Wed Jan 14 08:49:32 2026 +0100
Commit:     Miklos Vajna <[email protected]>
CommitDate: Mon Jan 19 08:53:10 2026 +0100

    tdf#170337: find the correct master containing the anchored objects
    
    Was this way since commit f66ac0bacb9a57228dfd3b24b347b985376b63df
    (INTEGRATION: CWS swqbugfixes09 (1.67.38); FILE MERGED, 2004-11-16).
    
    Change-Id: I7feeeb2d77849ef626b6ed7ce6385c10cae02c6e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197240
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197529
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/sw/qa/core/text/frmform.cxx b/sw/qa/core/text/frmform.cxx
index b73497f42b33..3ad8ab305ad1 100644
--- a/sw/qa/core/text/frmform.cxx
+++ b/sw/qa/core/text/frmform.cxx
@@ -148,6 +148,15 @@ CPPUNIT_TEST_FIXTURE(Test, testFloattableBadFlyPos)
     CPPUNIT_ASSERT(pPage4);
     CPPUNIT_ASSERT(pPage4->GetSortedObjs());
     CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), 
pPage4->GetSortedObjs()->size());
+
+    // tdf#170337: Make sure that page 4's toplevel table has the correct 
height (it was 517, not
+    // taking inner floating table height into account):
+    auto pBody = pPage4->FindBodyCont();
+    CPPUNIT_ASSERT(pBody);
+    auto pTable = pBody->GetLower();
+    CPPUNIT_ASSERT(pTable);
+    CPPUNIT_ASSERT(pTable->IsTabFrame());
+    CPPUNIT_ASSERT_EQUAL(tools::Long(3658), pTable->getFrameArea().Height());
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testFullPageShapeWrap)
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index c3a5f0f99edc..73d909957952 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -4786,7 +4786,7 @@ tools::Long CalcHeightWithFlys( const SwFrame *pFrame )
         bool bIsFollow( false );
         if ( pTmp->IsTextFrame() && static_cast<const 
SwTextFrame*>(pTmp)->IsFollow() )
         {
-            const SwFrame* pMaster;
+            const SwTextFrame* pMaster;
             // #i46450# Master does not necessarily have
             // to exist if this function is called from JoinFrame() ->
             // Cut() -> Shrink()
@@ -4800,6 +4800,11 @@ tools::Long CalcHeightWithFlys( const SwFrame *pFrame )
 
             if ( pMaster )
             {
+                while (pMaster->IsFollow())
+                {
+                    pMaster = pMaster->FindMaster();
+                    assert(pMaster);
+                }
                 pObjs = pMaster->GetDrawObjs();
                 bIsFollow = true;
             }

Reply via email to