sw/source/core/layout/trvlfrm.cxx |   59 ++++++++++++++++----------------------
 1 file changed, 26 insertions(+), 33 deletions(-)

New commits:
commit 9c9f5c9ed7a1d11fd34be6af5b09f836ed442211
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Thu Dec 7 10:37:15 2023 -0500
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Wed Jan 3 01:35:28 2024 +0100

    flatten SwCellFrame::GetModelPositionForViewPoint
    
    With Lower() already checked for earlier,
    this can be flattened by a couple of levels.
    
    Change-Id: I594ebe4611938f79450f8d61a24c2060217eeb59
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161391
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/sw/source/core/layout/trvlfrm.cxx 
b/sw/source/core/layout/trvlfrm.cxx
index 27922156b31d..7944d79cb880 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -507,43 +507,36 @@ bool SwCellFrame::GetModelPositionForViewPoint( 
SwPosition *pPos, Point &rPoint,
         }
     }
 
-    if ( Lower() )
+    if (Lower()->IsLayoutFrame())
+        return SwLayoutFrame::GetModelPositionForViewPoint(pPos, rPoint, pCMS);
+
+    Calc(pRenderContext);
+    bool bRet = false;
+
+    const SwFrame *pFrame = Lower();
+    while (pFrame && !bRet)
     {
-        if ( Lower()->IsLayoutFrame() )
-            return SwLayoutFrame::GetModelPositionForViewPoint( pPos, rPoint, 
pCMS );
-        else
+        pFrame->Calc(pRenderContext);
+        if (pFrame->getFrameArea().Contains(rPoint))
         {
-            Calc(pRenderContext);
-            bool bRet = false;
-
-            const SwFrame *pFrame = Lower();
-            while ( pFrame && !bRet )
-            {
-                pFrame->Calc(pRenderContext);
-                if ( pFrame->getFrameArea().Contains( rPoint ) )
-                {
-                    bRet = pFrame->GetModelPositionForViewPoint( pPos, rPoint, 
pCMS );
-                    if ( pCMS && pCMS->m_bStop )
-                        return false;
-                }
-                pFrame = pFrame->GetNext();
-            }
-            if ( !bRet )
-            {
-                const bool bFill = pCMS && pCMS->m_pFill;
-                Point aPoint( rPoint );
-                const SwContentFrame *pCnt = GetContentPos( rPoint, true );
-                if( bFill && pCnt->IsTextFrame() )
-                {
-                    rPoint = aPoint;
-                }
-                pCnt->GetModelPositionForViewPoint( pPos, rPoint, pCMS );
-            }
-            return true;
+            bRet = pFrame->GetModelPositionForViewPoint(pPos, rPoint, pCMS);
+            if (pCMS && pCMS->m_bStop)
+                return false;
         }
+        pFrame = pFrame->GetNext();
     }
-
-    return false;
+    if (!bRet)
+    {
+        const bool bFill = pCMS && pCMS->m_pFill;
+        Point aPoint(rPoint);
+        const SwContentFrame *pCnt = GetContentPos(rPoint, true);
+        if (bFill && pCnt->IsTextFrame())
+        {
+            rPoint = aPoint;
+        }
+        pCnt->GetModelPositionForViewPoint(pPos, rPoint, pCMS);
+    }
+    return true;
 }
 
 //Problem: If two Flys have the same size and share the same position then

Reply via email to