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

New commits:
commit 244a0c2f7b2ef79251860f9b4e5381a49f03de55
Author:     Mike Kaganski <[email protected]>
AuthorDate: Wed Jan 14 08:49:32 2026 +0100
Commit:     Mike Kaganski <[email protected]>
CommitDate: Wed Jan 14 10:24:21 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]>

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 edf0cba2343e..3c7e1f46aca6 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -4800,7 +4800,7 @@ static tools::Long CalcHeightWithFlys_Impl(const SwFrame* 
pTmp, const SwFrame* p
     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()
@@ -4814,6 +4814,11 @@ static tools::Long CalcHeightWithFlys_Impl(const 
SwFrame* pTmp, const SwFrame* p
 
         if ( pMaster )
         {
+            while (pMaster->IsFollow())
+            {
+                pMaster = pMaster->FindMaster();
+                assert(pMaster);
+            }
             pObjs = pMaster->GetDrawObjs();
             bIsFollow = true;
         }

Reply via email to