Bug 160472 - Writer Web: Loading an html file changes picture "height" from "Auto" to actual picture size
Summary: Writer Web: Loading an html file changes picture "height" from "Auto" to actu...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer Web (show other bugs)
Version:
(earliest affected)
24.2.2.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: (X)HTML-Export
  Show dependency treegraph
 
Reported: 2024-04-01 22:15 UTC by Francis Hauber
Modified: 2024-12-19 17:28 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Files for testing: html file and png image file (6.47 KB, application/zip)
2024-07-23 16:45 UTC, Francis Hauber
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Francis Hauber 2024-04-01 22:15:47 UTC
Description:
When opening a html file with Writer Web the size of constant ratio pictures are not properly loaded. If a picture has a given "width" and "auto" "height" Writer  Web is replacing the "auto" height with the actual height of the picture.
Exemple: file with html code: <img src="../image.png" name="Image" align="bottom" width="75%" height="auto" border="0"/> becomes 
<img src="../image.png" name="Image" align="bottom" width="75%" height="305" border="0"/> when saved again by Writer.
Issue seems to be at html file reading step as the pictures ratio changes when resizing Writer Web window after file opening.


Steps to Reproduce:
1.Create HTML file with picture. Set picture proportional width size, set "keep original ratio"
2.Store html file and close Writer Web. In the saved html file height="auto".
3.Load the html file in Writer Web, picture ratio isn't kept.

Actual Results:
When loading an html file containing a picture with constant ratio (width=xxx, height=auto) the "keep ratio" property shall be set for the picture.

Expected Results:
When loading an html file containing a picture with constant ratio (width=xxx, height=auto) the "keep ratio" property isn't set for the picture. "Keep ratio" Property is lost.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Load picture with "auto" height attribute as a "constant W/H ratio".
Comment 1 Francis Hauber 2024-04-20 08:24:54 UTC
Creation of an HTML document with Writer Web is working well and HTML file saved is correct as well.

However when the document loaded again the sizes of the images aren't properly restored: images created with a given proportional width (width="60%" for instance) and height="auto" are loaded with the correct proportional width (width="60%") but a fixed pixel width: width="305" for instance!

This makes writer web unusable to edit an html document.
Comment 2 Buovjaga 2024-07-23 07:45:28 UTC
Please attach an example file, so we can quickly test. The picture could be base64 encoded in the html, so there is no need to attach a zipped collection of files. The picture could be some single-colour rectangle for simplicity and small size.
Comment 3 Francis Hauber 2024-07-23 16:45:26 UTC
Created attachment 195457 [details]
Files for testing: html file and png image file

Please find attached a zip file with two files:
- test_file.html
- image.png
Unzip in a single directory. Then you can examine the html_test.htmlexample in a browser, examine the html file in a text editor and notice the image format:
<img src="image.png" name="Image1" width="30%" height="auto" border="0"/>
Then open the file with LibreOffice Web, examine the image properties and notice that "Keep ratio" checkbox is UNCHECKED.
Thanks
Francis
Comment 4 QA Administrators 2024-07-24 03:14:54 UTC Comment hidden (obsolete)
Comment 5 Buovjaga 2024-08-21 17:48:10 UTC
Confirmed with attached files.

Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 85e4dc15d09dc3193870041b2814263971a27791
CPU threads: 8; OS: Linux 6.10; UI render: default; VCL: kf6 (cairo+wayland)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: CL threaded