How to "flush" Writer node changes into layouting?

Jan-Marek Glogowski glogow at fbihome.de
Thu Aug 18 08:40:18 UTC 2016


Am 17. August 2016 21:09:16 MESZ, schrieb Miklos Vajna
<vmiklos at collabora.co.uk>:
>Hi Jan-Marek,
>
>On Sat, Aug 13, 2016 at 02:10:15AM +0200, Jan-Marek Glogowski
><glogow at fbihome.de> wrote:
>> 2. Fix the layouting problem introduced by commit
>> 60d34e1c840d2c317bb7d0a5b14f4602c22b3fcc
>> 
>> This also just happens for large MM documents with page bound frames.
>> Everything with 300+ pages is basically unbearable now. The commit is
>> correct, but previously the - now enabled - "fixup" code was just run
>at
>> the end of the SwPageFrm generation.
>> 
>> One of the bugs uncovered by the fix is fixed by "Use InsertPage in
>> AssertFlyPages", but for the second I just found the workaround done
>by
>> "Switch back to InsertPageBreak in SwDoc::AppendDoc".
>> 
>> I would like to get rid of this workaround, but before spending even
>> more time on the problem, I would like to know, if anyone knows - as
>> quoted from the patch:
>> 
>> +  // a magic call to sync with whatever, so AssertFlyPages
>> +  // sees the correct format AKA same as InsertPageBreak does
>> 
>> ???
>> 
>> My workaround just works, because InsertPageBreak actually splits the
>> current content node, which moves the cursor to a now page, which
>isn't
>> generated. Now EndOfAction needs to fix the cursor and somehow
>something
>> in the stack is able to flush the cached data. Some comments in the
>code
>> of the backtrace mention an IdleCollector, but I guess that's code is
>> already done.
>> 
>> I've added most information to the commit message of "Switch back to
>> InsertPageBreak in SwDoc::AppendDoc"
>
>Do I understand correctly that the tip of your branch is a unit test
>for
>the problem, and the previous commit is the conditional revert? (As in:
>it re-introduces the previously existing behavior without introducing
>the mentioned Coverity problem again.)

This is directly related to the Coverity fix in the way, that we got a
very unpleasant - AKA O(n) => O(n2) + heavy algorithm - changed
behaviour for MM / AppendDoc.

I want to add a page break to the source document. The original code
(#if 0) uses AppendTextNode and just works on the SwNode level. When
calling EndAllAction, the cursor hasn't changed and then AssertFlyPages
code uses the wrong SwPageDesc, all time, which is just detected at the
very end of MM in the CalcLayout, requiring a whole re-layout of the
document for every wrong SwPageDesc. For 300 pages that's 300 times a
O(n2) algo. Additionally it involve(s/ed) - there is also a fix for that
in the patchset - moving all Flys on all later pages, due to
re-inserting empty pages (CheckPageDescs).

BTW: calling CalcLayout after the SwNode change also fixes this problem,
but since it basically invalidates the whole document, the end result is
almost the same, time-wise (didn't check, but the generation is much
slower and slows down fast).

> If so, I think that's fine to
>have, but please don't pick the revert as-is to master, i.e. instead of
>introducing that #if 0 code, just remove the code that would be
>disabled. I'm afraid I don't know more about the SwDoc::AppendDoc()
>code
>than you. :-)

This is not really AppendDoc related, as it involves no other code of
AppendDoc - I know I wrote most of it ;-)

This patch will never be applied anywhere, as I'll merge it into "Fix
SwDoc::AppendDoc for trailing sections" and get rid of the "#if 0"
section - this was just added to make it easier for people to compare
the two code blocks based on the extensive description in the patch.

>Regards,

Jan-Marek



More information about the LibreOffice mailing list