sw/source/core/layout/tabfrm.cxx | 40 +++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-)
New commits: commit 1015359b5f4d01e2a423cbed7b155412d3f6db66 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sat Apr 2 20:59:15 2022 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sun Apr 3 13:10:28 2022 +0200 Related: forcepoint#100 don't reacquire after every release instead release when we have to, and only reacquire if necessary before use of pAttrs Change-Id: I9c413fc479cf73c771e8349fe5e853a4eac72110 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132463 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index 8825280cd628..f9f655392521 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -2061,8 +2061,6 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) oAccess.reset(); m_bCalcLowers |= pLayout->Resize( pLayout->GetBrowseWidthByTabFrame( *this ) ); - oAccess.emplace(SwFrame::GetCache(), this); - pAttrs = oAccess->Get(); } setFramePrintAreaValid(false); @@ -2097,6 +2095,12 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) const tools::Long nOldPrtWidth = aRectFnSet.GetWidth(getFramePrintArea()); const tools::Long nOldFrameWidth = aRectFnSet.GetWidth(getFrameArea()); const Point aOldPrtPos = aRectFnSet.GetPos(getFramePrintArea()); + + if (!oAccess) + { + oAccess.emplace(SwFrame::GetCache(), this); + pAttrs = oAccess->Get(); + } Format( getRootFrame()->GetCurrShell()->GetOut(), pAttrs ); SwHTMLTableLayout *pLayout = GetTable()->GetHTMLTableLayout(); @@ -2107,8 +2111,6 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) oAccess.reset(); m_bCalcLowers |= pLayout->Resize( pLayout->GetBrowseWidthByTabFrame( *this ) ); - oAccess.emplace(SwFrame::GetCache(), this); - pAttrs = oAccess->Get(); } if ( aOldPrtPos != aRectFnSet.GetPos(getFramePrintArea()) ) aNotify.SetLowersComplete( false ); @@ -2162,12 +2164,15 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) oAccess.reset(); m_bCalcLowers |= pHTMLLayout->Resize( pHTMLLayout->GetBrowseWidthByTabFrame( *this ) ); + } + + setFramePrintAreaValid(false); + if (!oAccess) + { oAccess.emplace(SwFrame::GetCache(), this); pAttrs = oAccess->Get(); } - - setFramePrintAreaValid(false); Format( getRootFrame()->GetCurrShell()->GetOut(), pAttrs ); } @@ -2175,9 +2180,6 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) lcl_RecalcTable( *this, nullptr, aNotify ); - oAccess.emplace(SwFrame::GetCache(), this); - pAttrs = oAccess->Get(); - m_bLowersFormatted = true; if ( bKeep && KEEPTAB ) { @@ -2341,11 +2343,18 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) // 6. There is no section change behind the table (see IsKeep) // 7. The last table row wants to keep with its next. const SwRowFrame* pLastRow = static_cast<const SwRowFrame*>(GetLastLower()); - if (pLastRow - && IsKeep(pAttrs->GetAttrSet().GetKeep(), GetBreakItem(), true) - && pLastRow->ShouldRowKeepWithNext()) + if (pLastRow) { - bFormat = true; + if (!oAccess) + { + oAccess.emplace(SwFrame::GetCache(), this); + pAttrs = oAccess->Get(); + } + if (IsKeep(pAttrs->GetAttrSet().GetKeep(), GetBreakItem(), true) + && pLastRow->ShouldRowKeepWithNext()) + { + bFormat = true; + } } } @@ -2359,9 +2368,6 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) // is found, get its first content. const SwFrame* pTmpNxt = sw_FormatNextContentForKeep( this ); - oAccess.emplace(SwFrame::GetCache(), this); - pAttrs = oAccess->Get(); - // The last row wants to keep with the frame behind the table. // Check if the next frame is on a different page and valid. // In this case we do a magic trick: @@ -2650,8 +2656,6 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) } } - oAccess.emplace(SwFrame::GetCache(), this); - pAttrs = oAccess->Get(); --nStack; } else if ( GetFollow() == GetNext() )