Bug 165047 - LAYOUT: top margin after changing page style should be "reduced" by the "shared" amount below the previous paragraph
Summary: LAYOUT: top margin after changing page style should be "reduced" by the "shar...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:25.8.0 target:25.2.3
Keywords: bibisected, bisected, filter:docx
Depends on:
Blocks: DOCX-Paragraph
  Show dependency treegraph
 
Reported: 2025-02-04 20:39 UTC by Justin L
Modified: 2025-05-09 21:27 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
forum-mso-en-16581B_compat15.docx: example document that seems focused on Heading after page break (27.33 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2025-02-04 20:39 UTC, Justin L
Details
forum-mso-en-16581B_compat15.zip: RED=comment 0 commit, BLUE=the prior commit, grayscale=Word 2019 (119.15 KB, application/zip)
2025-02-04 20:41 UTC, Justin L
Details
165047_topMarginAfterPageBreak.doc (22.50 KB, application/msword)
2025-02-04 22:23 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Justin L 2025-02-04 20:39:45 UTC
Created attachment 198979 [details]
forum-mso-en-16581B_compat15.docx: example document that seems focused on Heading after page break

Starting in 25.8 (backported to 24.8.5), some top-margins-after-page-breaks are taller than they are in Word 2019.

In one sense, this looks like the perfect example document. No headers to complicate things. The first page still looks perfect, suggesting no underlying issues with header size, page size, etc.

In the other sense, I do see Word 2019 being affected by changing the ULSpacing. However, changing the spacing using values less than 10pt seem to do nothing / little, while values 12 and higher seem to work as vmiklos' commit expects.

So why the discrepancy? I've seen MANY document affected by this commit of course, and it is really hard to determine whether the commit is always just exposing something else (very possible), or whether there actually are additional factors coming into play. This document seems like one of the better ones to find "additional factors".

It isn't easy to make any "steps to reproduce" because it has to do with comparative space. I'll attach overlay comparison images to illustrate.

This started with 25.8 commit ae7900dd42a65aaf60df6b21b9ad511496b209d9
Author: Miklos Vajna on Fri Dec 6 14:09:28 2024 +0100
    tdf#164095 sw: fix missing top margin on paragraph after changing page style

Found by Collabora's mso-test

Another possible example is LibreOffice - DRN V09 Reloaded.docx (attachment 135880 [details] from bug 99970) - "Índice" on page 3.
Comment 1 Justin L 2025-02-04 20:41:05 UTC
Created attachment 198980 [details]
forum-mso-en-16581B_compat15.zip: RED=comment 0 commit, BLUE=the prior commit, grayscale=Word 2019
Comment 2 Justin L 2025-02-04 22:23:24 UTC
Created attachment 198983 [details]
165047_topMarginAfterPageBreak.doc

Amazingly enough, it seems like the top spacing depends on the bottom spacing from the paragraph containing the section break.

This is something that has never worked.
Comment 3 Justin L 2025-02-04 22:35:38 UTC
Based on comment 3, the steps to reproduce are really easy
1.) Open 165047_topMarginAfterPageBreak.doc.

Look at page 2. There should not be any significant gap between the header and the first line of text.

If you do the same in MS Word, you can see the gap appear if you change page 1's paragraph to have a zero spacing below the paragraph.
Comment 4 Justin L 2025-04-01 13:34:17 UTC
Since comment 2's example is in DOC format, it always returns SwFrame::IsCollapseUpper() as false, so comment 0's patch doesn't have any effect on DOC files.

This is the proof that it is not a true regression - this has never worked properly. Re-affirmed that OOo 3.3 acts the same way as 25.8 master.
Comment 5 Commit Notification 2025-04-02 22:09:59 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/9a8eb2dc17435d290f482070dd5f20f538b5b68b

tdf#165047 sw mso-compat layout: always consolidate top margin

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Commit Notification 2025-04-02 22:11:02 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/74f67cd1c3ef1bb38bf3de6b3a888d9c94227957

tdf#165047 sw mso-compat layout: always honour contextualSpacing

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Commit Notification 2025-04-03 07:01:03 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-25-2":

https://git.libreoffice.org/core/commit/395c4f07a61bf607f3283d7a75be93c95a3571d7

tdf#165047 sw mso-compat layout: always consolidate top margin

It will be available in 25.2.3.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Commit Notification 2025-04-03 07:02:05 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-25-2":

https://git.libreoffice.org/core/commit/be07e6e8bef7f594494a866e36e972a379aa0513

tdf#165047 sw mso-compat layout: always honour contextualSpacing

It will be available in 25.2.3.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.