summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-04-02 20:59:15 +0100
committerCaolán McNamara <caolanm@redhat.com>2022-04-03 13:10:28 +0200
commit1015359b5f4d01e2a423cbed7b155412d3f6db66 (patch)
treede7336a2273332adf6619e796e115767dc9f4287 /sw
parent6bc187b2eb6b9520c942f232b1abcb4fb29bfa04 (diff)
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 <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/layout/tabfrm.cxx40
1 files changed, 22 insertions, 18 deletions
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() )