Bug 164962 - Writer's horizontal scrollbar shows up randomly depending on window width, in "Fit Width" page zoom mode
Summary: Writer's horizontal scrollbar shows up randomly depending on window width, in...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.5.0 release
Hardware: All All
: low minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: difficultyInteresting, easyHack, perf, skillCpp
Depends on:
Blocks: Scrollbars Zoom Flickering-UI
  Show dependency treegraph
 
Reported: 2025-01-30 20:25 UTC by Jeff Fortin Tam
Modified: 2025-12-19 17:43 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Demonstration video (931.20 KB, video/mp4)
2025-01-30 20:25 UTC, Jeff Fortin Tam
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Fortin Tam 2025-01-30 20:25:44 UTC
Created attachment 198894 [details]
Demonstration video

See attached demonstration video.

1. Open Writer (it can be a blank document, or a document with contents)

2. Make sure page Zoom Factor is set to "Fit width". 
   Zoom's "View Layout" can be "Automatic" (i.e. single page) or "Columns: 2".

3. Slowly resize the width of the window

Result: the horizontal scrollbar frantically pops in and out of the view depending on the exact pixel position/width of the window.

This issue can also happen on startup / window creation, not just during resize.

---

Tested on GNOME 47.2's Wayland session on Fedora 41, with:

Version: 24.8.4.2 (X86_64) / LibreOffice Community
Build ID: bb3cfa12c7b1bf994ecc5649a80400d06cd71002
CPU threads: 8; OS: Linux 6.12; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Flatpak
Calc: threaded
Comment 1 Jeff Fortin Tam 2025-01-30 21:09:23 UTC
With my geek hat on, I'll also venture a guess that beyond the visual symptoms, this (and bug #164963) opens the potential for a performance optimization too:

If it's flashing the scrollbar like that, that means it's constantly calculating the width and checking whether it should be showing the scrollbar during resize. That is certainly very wasteful and contributes to unnecessary CPU usage, redraws, jank, etc.

If possible, don't make those checks at all when the zoom mode is set to automatically "Fit width" or "Fit width and height".
Comment 2 GJord 2025-12-16 14:40:20 UTC
Tested on LibreOffice 25.8.3.2 (x86_64) on Windows 11.

Version: 25.8.3.2 (X86_64)
CPU threads: 32
OS: Windows 11 (build 26200)
UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US

Using View → Zoom → Page Width in a blank Writer document, the horizontal scrollbar remains visible but stable.

During slow window resize, the scrollbar does not flicker, pop in/out, or change visibility depending on pixel width. The behavior is consistent and reproducible, and no flickering was observed on startup either.

The flickering behavior could not be reproduced on Windows in this configuration.
Comment 3 Buovjaga 2025-12-19 15:03:55 UTC
Repro already in oldest of linux-43all repo. Contrary to comment 2, I also repro on windows.
Comment 4 Buovjaga 2025-12-19 16:47:03 UTC
I did some searching and debugging and found that SwView::UpdateScrollbars() in sw/source/uibase/uiview/viewport.cxx is relevant to this. The machinery there seems rather complicated and I'm not sure where to stick a conditional for this.

Other stuff: SwView::IsHScrollbarVisible() in sw/source/uibase/uiview/viewmdi.cxx
Comment 5 Buovjaga 2025-12-19 16:54:41 UTC
Bonus: the flag for Fit width zoom is SvxZoomEnableFlags::PAGEWIDTH
Comment 6 Buovjaga 2025-12-19 17:41:49 UTC
Let's make this an easy hack. I'm not the best person to review patches for this, but I will find someone. Bug 164963 could be tackled in the same patch or in a separate patch depending on how many changes are needed. There the relevant zoom flag is  SvxZoomEnableFlags::WHOLEPAGE