Bug 154827 - Regression in 7.5.x: Graphics anchored in Writer as character become anchored at paragraph when reopening the document
Summary: Regression in 7.5.x: Graphics anchored in Writer as character become anchored...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.5.2.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.6.0 target:7.5.3.2
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Anchor-and-Text-Wrap
  Show dependency treegraph
 
Reported: 2023-04-15 17:13 UTC by Roland Baudin
Modified: 2023-08-04 09:27 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
First SVG image (6.39 KB, image/svg+xml)
2023-04-15 17:13 UTC, Roland Baudin
Details
Second SVG image (4.83 KB, image/svg+xml)
2023-04-15 17:13 UTC, Roland Baudin
Details
Test document with both images originally anchores as character (12.43 KB, application/vnd.oasis.opendocument.text)
2023-04-15 17:15 UTC, Roland Baudin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roland Baudin 2023-04-15 17:13:03 UTC
Description:
In Writer 7.5.x in Linux, some graphics anchored as character become anchored at paragraph when reopening the document.

This is observed in Linux (Ubuntu 22.04 and 22.10) and fully reproducible, but not observed in Windows 10 20H2 (in a VM) nor in Mac OS X Monterey (in a VM).

The bug is also not present in LibreOffice 7.4.6.2, in all systems.


Steps to Reproduce:
1. Create a new Draw document and insert the SVG image eq1.svg in it

2. In Draw, select the image, then right click on it and make Convert / To Curve. Then copy the image to clipboard (Ctrl-C)

3. Create a new Writer document, type the text 'Equation 1 ' and then paste the image from clipboard (simple paste, Ctrl-V) after the text

4. In Writer, anchor the image as character (right click on the image, then Anchor / As character)

5. In Draw again, insert the SVG image eq2.svg, then repeat step 2 on this image 

6. In the opened Writer document, add a new line and type the text 'Equation 2 ', then paste the second image after the text and anchor it as character like in step 4

7. Save the Writer document where both images are anchored as character

8. Reopen the Writer document => now, the *second image* is anchored at paragraph. The first image is still anchored as character


Actual Results:
After reopening the Writer document, the second image has lost its 'as character' anchoring.

Expected Results:
The image anchoring must not change after saving and reopening a Writer document.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Some observations:

1. The bug also appears if the SVG image is converted to contour or to polygon instead of curve, but does not appear when the image is converted to metafile

2. When adding other SVG images and repeating the same process, the 'as character' anchoring is lost for all images, except the first one

3. In Writer, using the Tools / Development Tools menu (for that tool, select the second image, then click on Current Selection, then select the Properties tab, then click on the @0 object), one can see that the Anchor property and the AnchorType property are Null. These properties are well defined for the first image.

LibreOffice:
Version: 7.5.2.2 (X86_64) / LibreOffice Community
Build ID: 53bb9681a964705cf672590721dbc85eb4d0c3a2
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: en-US
Calc: CL threaded

System:
Ubuntu 22.04.2 LTS 64 bits
Comment 1 Roland Baudin 2023-04-15 17:13:27 UTC
Created attachment 186684 [details]
First SVG image
Comment 2 Roland Baudin 2023-04-15 17:13:46 UTC
Created attachment 186685 [details]
Second SVG image
Comment 3 Roland Baudin 2023-04-15 17:15:51 UTC
Created attachment 186686 [details]
Test document with both images originally anchores as character
Comment 4 Roland Baudin 2023-04-15 17:18:30 UTC
I forgot to mention an important point: this kind of SVG images and their conversion to curve and anchoring as character are at the core of the TexMaths extension. So, this regression affects the TexMaths extension in Linux.
Comment 5 pglpm 2023-04-16 15:42:26 UTC
I confirm this bug, which also affects LibreOffice Impress.
Comment 6 Robert Großkopf 2023-04-17 07:52:27 UTC
Tested with the attached document.

Opened the document in
Version: 7.4.6.2 / LibreOffice Community
Build ID: 5b1f5509c2decdade7fda905e3e1429a67acd63d
CPU threads: 6; OS: Linux 5.14; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-DE (de_DE.UTF-8); UI: en-US
Calc: threaded

Seen the second svg-image is anchored at paragraph. So I set this image to "anchored as character", because description says: Bug doesen't happen with LO 7.4.6.2

Save this and opened this in 
Version: 7.5.2.2 (X86_64) / LibreOffice Community
Build ID: 53bb9681a964705cf672590721dbc85eb4d0c3a2
CPU threads: 6; OS: Linux 5.14; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-DE (de_DE.UTF-8); UI: en-US
Calc: threaded

svg-images are anchored to paragraph, as they are sown in LO 7.4.6.2. So I couldn't find any buggy behavior here.

@pglpm: If you could confirm the bug: Show the version of LO you are using and set this bug to NEW. I can't confirm …
Comment 7 Stéphane Guillou (stragu) 2023-04-17 13:16:20 UTC
Same observations as Robert using Ubuntu 20.04 and:

Version: 7.4.6.2 / LibreOffice Community
Build ID: 5b1f5509c2decdade7fda905e3e1429a67acd63d
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

and

Version: 7.5.2.2 (X86_64) / LibreOffice Community
Build ID: 53bb9681a964705cf672590721dbc85eb4d0c3a2
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

However, starting from scratch using the Description steps does reproduce the issue: second image switches to "to paragraph" anchoring, moving from the end of the paragraph to the beginning.

Shorter steps:
1. Open attachment 186686 [details]
2. Copy first equation
3. Paste at end of line 1 (or 2)
4. Save and Reload

Result: anchor change, equation before text.

Repro in 7.5.2.2, not in 7.4.6.2.
Comment 8 Stéphane Guillou (stragu) 2023-04-17 15:13:52 UTC
Bibisected with linux-64-7.5 repo to first bad commit 6f10bfc3f53a7d88037a32deadcc7f3be94c061e which points to core commit:

commit 8611f6e259b807b4f19c8dc0eab86ca648891ce3
author	Noel Grandin <noel.grandin@collabora.co.uk>	Thu May 27 10:27:46 2021 +0200
committer	Noel Grandin <noel.grandin@collabora.co.uk>	Mon Aug 29 13:44:02 2022 +0200
ref-count SdrObject
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138837

Noel, can you please have a look?
Comment 9 Commit Notification 2023-04-20 13:05:52 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/40babcfa637957bf7b59caa3cd12a630189e3e63

tdf#154827 and tdf#154428 graphics anchored in Writer as character..

It will be available in 7.6.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 10 Commit Notification 2023-04-21 08:53:01 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

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

tdf#154827 and tdf#154428 graphics anchored in Writer as character..

It will be available in 7.5.4.

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 11 Roland Baudin 2023-04-21 13:56:47 UTC
OK, I'll give you a feedback as soon as the new version is out.
Comment 12 Stéphane Guillou (stragu) 2023-04-25 22:21:19 UTC
Fix verified in:

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 5cd9de202765e243e41416802f3e4486b8a96f16
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Thank you all!
Comment 13 Commit Notification 2023-04-26 12:01:26 UTC
Noel Grandin committed a patch related to this issue.
It has been pushed to "libreoffice-7-5-3":

https://git.libreoffice.org/core/commit/397c30d9faae596803ebb087fb609d8eb52e1efd

tdf#154827 and tdf#154428 graphics anchored in Writer as character..

It will be available in 7.5.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 14 Roland Baudin 2023-05-06 17:23:31 UTC
Hi,

I did some tests in LO 7.5.3.2 and it works OK now.

To me, the bug is fixed and can be close.

Many thanks to all of you,
RB
Comment 15 Stéphane Guillou (stragu) 2023-05-09 10:04:27 UTC
(In reply to Roland Baudin from comment #14)
> Hi,
> 
> I did some tests in LO 7.5.3.2 and it works OK now.
> 
> To me, the bug is fixed and can be close.
> 
> Many thanks to all of you,
> RB

Thank you for verifying the fix, RB!