Bug 147802 - Clicking on header or footer area in long writer document takes a long time and slows down text selection and closing document
Summary: Clicking on header or footer area in long writer document takes a long time a...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.2.5.2 release
Hardware: x86-64 (AMD64) All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Writer-Header-Footer Selection
  Show dependency treegraph
 
Reported: 2022-03-06 15:34 UTC by ratatoeskr
Modified: 2022-03-23 16:20 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
Graphs from Callgrind analysis (70.24 KB, application/octet-stream)
2022-03-06 15:35 UTC, ratatoeskr
Details
Sample document with 500 pages (49.75 KB, application/vnd.oasis.opendocument.text-flat-xml)
2022-03-06 15:38 UTC, ratatoeskr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ratatoeskr 2022-03-06 15:34:01 UTC
Description:
When clicking on the area of a header or footer in a long (my sample: 500 pages) writer document, it takes a long time (several seconds on my machine) until the divider line and the button to create a header or footer appears.

Anytime after having clicked on the header or footer area (regardless whether an actual header or footer was created), this is also slow. While the caret follows the mouse during the selection without any noticeable delay, there is an initial delay of a few seconds until the highlighting of the selected text is visible. After this initial delay, moving the mouse (without releasing the mouse button) updates the highlighting without any noticeable delay.

Selecting text using the keyboard (shift + arrow keys) is unaffected by this slowdown or delay.

Also after having clicked on the header or footer area, closing the document takes a lot longer.

Closing and reopening the document restores the initial behaviour.

When having the same document open in two separate windows, clicking the header/footer area in one window does not affect selecting text in another window.

Enabling or disabling hardware acceleration or anti-aliasing makes no difference.

Steps to Reproduce:
1. Create a "long" writer document (my sample: 500 pages). Adding forced page breaks is sufficient, the amount of text, formatting etc. is unimportant.
2. Click on the header or footer area of any page of the document.
3. Select any text anywhere in the document (not inside a header or footer) with the mouse.

Actual Results:
There is a significant delay until the divider or the button to create a header/footer appears.

There is a significant delay until the selected text is highlighted.

Expected Results:
There is no significant delay when clicking on the header/footer area when comparing to a short document.

There is no significant delay when selecting text as compared to doing so in the same document without having previously clicked on the header/footer area.


Reproducible: Always


User Profile Reset: Yes


OpenGL enabled: Yes

Additional Info:
This occurs for me in 7.2.5.2 on arch. I also compiled LibreOffice from source (master as of commit 05502f78ed0d406ff50d43a39c05f7bb990001e9) and experienced the same behaviour.

I followed the guide for Performance debugging using Callgrind and will attach some graphs.

What I can see from those when comparing a run where I clicked on the header area with a run where I didn't, selecting text and closing the document causes 500 calls (one for each page I suspect) to SwHeaderFooterWin::LinkStubFaderHandler(void*, Timer*) which take up about 80 % of the time spent selecting text or about 16 % when closing the document.
Comment 1 ratatoeskr 2022-03-06 15:35:38 UTC
Created attachment 178681 [details]
Graphs from Callgrind analysis
Comment 2 ratatoeskr 2022-03-06 15:38:22 UTC
Created attachment 178682 [details]
Sample document with 500 pages
Comment 3 Dieter 2022-03-21 07:14:51 UTC
Thank you for reporting the bug. Could you please try to reproduce it with the latest version of LibreOffice from https://www.libreoffice.org/download/libreoffice-fresh/ ? I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' if the bug is still present in the latest version. Change to RESOLVED WORKSFORME, if the problem went away.
Comment 4 ratatoeskr 2022-03-21 09:15:23 UTC
I just checked version 7.3.1 and the behaviour with the attached sample document is the same.
Comment 5 Dieter 2022-03-23 16:20:12 UTC
I confirm it with

Version: 7.3.1.3 (x64) / LibreOffice Community
Build ID: a69ca51ded25f3eefd52d7bf9a5fad8c90b87951
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL

A significant delay until the divider or the button to create a header/footer appears.

A (short) delay until the selected text is highlighted.