Bug 122789

Summary: Writer html image widths messed up when in percentages when opening file
Product: LibreOffice Reporter: Terry Barnaby <terry>
Component: WriterAssignee: Miklos Vajna <vmiklos>
Status: VERIFIED FIXED    
Severity: normal CC: ilmari.lauhakangas, os, telesto, vmiklos, xiscofauli
Priority: medium Keywords: bibisected, bisected, filter:html, regression
Version: 6.1.0.0.alpha0+   
Hardware: All   
OS: Linux (All)   
Whiteboard: target:6.4.0 target:6.3.0.1 target:6.2.5
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 111951    
Attachments: example html file
Example html and png

Description Terry Barnaby 2019-01-17 16:07:25 UTC
Using the Fedora_29 libreoffice system, if you open a html file that has image widths in percentages, the width is messed up and the image is shown at a very large size. When this file is saved the image size is wrong.

Example html would be:
<img src="pic.png" name="Image1" alt="Pic" align="bottom" width="70%" border="0"/>

When saved this becomes:
<img src="pic.png" name="Image1" alt="Pic" align="bottom" width="166%" height="738" border="0"/>

Also it has added the height parameter as an absolute value even though the image properties were marked as "Keep ratio" when saved. The "Keep ratio" option was in effect lost.
Comment 1 Usama 2019-05-19 07:52:55 UTC
Confirmed.

This line:
<body lang="en-US" dir="ltr"><p><img src="pic.png" name="Image1" alt="Pic" align="bottom" width="70%" border="0"/>

Changed to this:
<body lang="en-US" dir="ltr"><p><img src="pic.png" name="Image1" alt="Pic" align="bottom" width="230%" height="156" border="0"/>

Tested on generated image 220x156:
mx=220;my=156;head -c "$((3*mx*my))" /dev/urandom | convert -depth 8 -size "${mx}x${my}" RGB:- pic.png

----- Tested on ----
Version: 6.3.0.0.alpha0+
Build ID: 98630a0bd49bd80652145a21e4e0d0ded792b36b
CPU threads: 4; OS: Linux 4.4; UI render: default; VCL: gtk3; 
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2019-05-04_04:44:35
Locale: tr-TR (tr_TR.UTF-8); UI-Language: en-US
Calc: threaded


Version: 6.3.0.0.alpha1+
Build ID: 31cc28ca7c02f28b64e9d757c9fc17e2a81ba352
CPU threads: 1; OS: Windows 6.1; UI render: default; VCL: win; 
TinderBox: Win-x86@42, Branch:master, Time: 2019-05-15_04:21:42
Locale: en-US (en_US); UI-Language: en-US
Calc: threaded
Comment 2 Usama 2019-05-19 07:59:56 UTC
Created attachment 151509 [details]
example html file

On 5.1.6.2 it didn't change the size but it got showed the image source as 
"src="data:image/png;base64,iVBORw0KGgo.....very long string". 

Version: 5.1.6.2
Build ID: 1:5.1.6~rc2-0ubuntu1~xenial6
CPU Threads: 4; OS Version: Linux 4.4; UI Render: default; 
Locale: tr-TR (tr_TR.UTF-8); Calc: group
Comment 3 Buovjaga 2019-05-19 15:22:27 UTC
Created attachment 151517 [details]
Example html and png
Comment 4 Buovjaga 2019-05-19 15:23:14 UTC
Bibisected with win32-6.1 to https://gerrit.libreoffice.org/plugins/gitiles/core/+/84854917835b13851d4855fa5eb30036a38b9166%5E!/

Adding Cc: to Miklos Vajna
Comment 5 Commit Notification 2019-06-04 07:15:09 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/a628c01e783b8970ec6d1a4499f01981c077e607%5E%21

tdf#122789 sw HTML import: fix handling of images with relative sizes

It will be available in 6.4.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 2019-06-04 10:04:09 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-6-3":

https://git.libreoffice.org/core/+/8fa88c4b90c8b9e8abadded1a724a6ebdfa44d63%5E%21

tdf#122789 sw HTML import: fix handling of images with relative sizes

It will be available in 6.3.0.1.

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 2019-06-05 09:18:45 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-6-2":

https://git.libreoffice.org/core/+/cf839dcb09fa117744380d3213cb3cf8d9f363f2%5E%21

tdf#122789 sw HTML import: fix handling of images with relative sizes

It will be available in 6.2.5.

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 Xisco FaulĂ­ 2019-06-05 15:33:15 UTC
Verified in

Version: 6.4.0.0.alpha0+
Build ID: 0d6ec494f83fb26524bf3a5fc7af27c225293e87
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); UI-Language: en-US
Calc: threaded

@Miklos, thanks for fixing this issue!