diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2018-08-03 18:48:10 +0200 |
---|---|---|
committer | Michael Stahl <Michael.Stahl@cib.de> | 2018-09-19 10:18:23 +0200 |
commit | 7adb4a7ae48b4a1ddeb218a9c2e46b36996cbb4e (patch) | |
tree | 30f15a3b704f6a812b8b6ec4fa0b5b16ff545da4 /sw/source/core/layout/wsfrm.cxx | |
parent | 464ef392f901c6e2ad3d32df8b039f2226073cf4 (diff) |
sw_redlinehide_2: try to minimise invalidation on show/hide
InvalidateAllContent(Size) will basically format every paragraph
in the document from scratch; let's try to optimise this a bit
by invalidating only the SwTextFrames that actually contain redlines
and the SwPageFrames they're on, and also invalidate the position
of all flys anchored at these frames as a precautionary measure.
Change-Id: I22ed683dc2225992ee48faa6084f277ef8733e8b
Diffstat (limited to 'sw/source/core/layout/wsfrm.cxx')
-rw-r--r-- | sw/source/core/layout/wsfrm.cxx | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 71a6a524c313..5ac5b205fe27 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -4199,6 +4199,20 @@ static void UnHideRedlines(SwRootFrame & rLayout, pFrame->SetMergedPara(std::move(pMerged)); } auto const pMerged(pFrame->GetMergedPara()); + if (pMerged) + { + // invalidate SwInvalidateFlags::Size + pFrame->Prepare(PREP_CLEAR, nullptr, false); + pFrame->InvalidatePage(); + if (auto const pObjs = pFrame->GetDrawObjs()) + { // also invalidate position of existing flys + // because they may need to be moved + for (auto const pObject : *pObjs) + { + pObject->InvalidateObjPos(); + } + } + } if (pMerged // do this only *once*, for the *last* frame // otherwise AppendObj would create multiple frames for fly-frames! @@ -4244,6 +4258,16 @@ static void UnHideRedlines(SwRootFrame & rLayout, { if (auto const& pMergedPara = pFrame->GetMergedPara()) { + // invalidate SwInvalidateFlags::Size + pFrame->Prepare(PREP_CLEAR, nullptr, false); + pFrame->InvalidatePage(); + if (auto const pObjs = pFrame->GetDrawObjs()) + { // also invalidate position of existing flys + for (auto const pObject : *pObjs) + { + pObject->InvalidateObjPos(); + } + } // SwFlyAtContentFrame::Modify() always appends to // the master frame, so do the same here. // (RemoveFootnotesForNode must be called at least once) @@ -4418,7 +4442,7 @@ void SwRootFrame::SetHideRedlines(bool const bHideRedlines) UnHideRedlinesExtras(*this, rNodes, rNodes.GetEndOfInserts()); UnHideRedlines(*this, rNodes, rNodes.GetEndOfContent()); - InvalidateAllContent(SwInvalidateFlags::Size); // ??? TODO what to invalidate? +// InvalidateAllContent(SwInvalidateFlags::Size); // ??? TODO what to invalidate? this is the big hammer } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |