Bug 145972 - UI: Displayed image width PROPERTY relative to page erroneous after changing default measurement unit to Pt
Summary: UI: Displayed image width PROPERTY relative to page erroneous after changing ...
Status: ASSIGNED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.2.0.0 alpha1+
Hardware: All All
: medium normal
Assignee: Miklos Vajna
URL:
Whiteboard:
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Writer-Images Measurement-Units
  Show dependency treegraph
 
Reported: 2021-11-30 19:22 UTC by Telesto
Modified: 2024-05-13 16:27 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Real example file (15.13 KB, application/vnd.oasis.opendocument.text)
2021-11-30 19:23 UTC, Telesto
Details
Bugdoc without a KeepRatio setting. (15.11 KB, application/vnd.oasis.opendocument.text)
2024-05-08 12:15 UTC, Miklos Vajna
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2021-11-30 19:22:00 UTC
Description:
UI: Image width relative to page becomes 1% when checked if default measurement unit set to pt  

Steps to Reproduce:
1. Open attachment 176576 [details]
2. Tools -> Options -> Writer -> General -> Set measurement unit to PT
3. Press Ok
4. Select the image & press F4
5. Check the relative width checkbox

Actual Results:
1%

Expected Results:
59% (based on CM)


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.4.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: ddc57169ac8d1de00403dbb09fef5221beaa0f3d
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL
Comment 1 Telesto 2021-11-30 19:23:32 UTC
Created attachment 176602 [details]
Real example file
Comment 2 Telesto 2021-11-30 19:30:49 UTC
Also in
Version: 6.2.9.0.0+ (x86)
Build ID: 5f01fe15eb2661f1f9ce12d1d99dc2a705b462ee
CPU threads: 4; OS: Windows 6.3; UI render: default; VCL: win; 
Locale: nl-NL (nl_NL); UI-Language: en-US
Calc: CL

still OK with
Version: 6.0.6.0.0+
Build ID: c30963b8b4bbbe42a24b97aafa161eff9d7ccdd4
CPU threads: 4; OS: Windows 6.3; UI render: default; 
Locale: nl-NL (nl_NL); Calc: CL
Comment 3 Rainer Bielefeld Retired 2021-12-01 08:09:37 UTC
More or less  REPRODUCIBLE with Installation of Version:7.2.1.2 (x64); Build ID: 87b77fad49947c1441b67c559c339af8f3517e22; CPU threads: 12; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win; Locale: de-DE (de_DE); UI: de-DE; Calc: threaded  |  my default User Profile:

Properties show 5% / 31% in (5) of STR.
  Should show px, not %          😥
  % - values are not plausible   😥
Comment 4 Rainer Bielefeld Retired 2021-12-01 08:11:35 UTC
No, of course should not show px in relative mode ...
Comment 5 Rainer Bielefeld Retired 2021-12-01 08:20:29 UTC
It's not only a UI property display problem. Dimensions adjustment in "relative mode" is completely broken, try to change to double width (62%) in keep ratio mode ...
Comment 6 BogdanB 2023-05-28 17:32:47 UTC
Also in
Version: 7.5.3.2 (X86_64) / LibreOffice Community
Build ID: 9f56dff12ba03b9acd7730a5a481eea045e468f3
CPU threads: 16; OS: Linux 5.19; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded
Comment 7 Stéphane Guillou (stragu) 2024-05-07 12:51:53 UTC
(In reply to Telesto from comment #2)
> Also in
> Version: 6.2.9.0.0+ (x86)
> 
> still OK with
> Version: 6.0.6.0.0+
For me, testing with a new profile each time, it started in LO 7.2: width at a wrong 5% after switching to Point unit. Maybe your profile was interfering with you tests?

Bibisected with linux-64-7.2 repo to first bad build [de2eefc55492407153136f104eb6414ed0472d7b] which points to:

commit 02c435082058ecf7f9d4d73cb47d31d0218dc10d
author	Miklos Vajna 	Mon Jun 07 18:03:33 2021 +0200
committer	Miklos Vajna 	Mon Jun 07 18:49:07 2021 +0200
sw keep aspect ratio: add filter for this setting
SwViewOption::IsKeepRatio() was only in-memory, so ticking that checkbox
and restarting soffice disabled it again.
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116791

And then, somewhere in 7.3, the height follows suit at 3% - which is still the case in a recent daily build.

Miklos, can you please have a look?
Comment 8 Miklos Vajna 2024-05-08 12:15:39 UTC
Created attachment 194026 [details]
Bugdoc without a KeepRatio setting.

Thanks for the bisect. I'm a bit confused how this has something to do with KeepRatio setting that was lost previously on restart and now we save with into the document settings.

Here is what I see with the attached bugdoc, which is the same as the original one, but with the KeepRatio setting removed:

1. Load the bugdoc in safe mode
2. Set tools -> options -> writer -> unit to CM
3. Check that once you right click -> properties on the image, then the size is 48%x31% in the file, as expected.
4. Go to tools -> options again, set unit to Points
5. Check the image size, now you get buggy values like 5%x3%.

I think there is a bug here (reading the SwFramePage code, we set the values in different ways: the configured unit, twips, percentage and this mix goes wrong), but the above should show that this was a bug earlier, not with the above commit. Either it was good originally, but then the bisect should be re-done using my bugdoc to find the deeper problem or it was broken all the time.

Could you please see if you still get a bisect result with the new bugdoc? Thanks.
Comment 9 Stéphane Guillou (stragu) 2024-05-09 06:09:47 UTC
(In reply to Miklos Vajna from comment #8)
> Created attachment 194026 [details]
> Bugdoc without a KeepRatio setting.
> Could you please see if you still get a bisect result with the new bugdoc?
> Thanks.
Weirdly enough, I get to your _later_ 7.4 commit:

commit 9e8712ed6f9fb5dbd971e352a5709bd45fadc74f (build [d534e4290183a0bfda350bdae7dfe469319902b7] in linux-64-7.4 repo)
author	Miklos Vajna 	Thu Mar 17 17:36:18 2022 +0100
committer	Miklos Vajna 	Thu Mar 17 19:03:42 2022 +0100
sw image dialog: fix fallback width/height for images with relative sizes
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131714
Comment 10 Miklos Vajna 2024-05-13 16:27:54 UTC
Thanks, this makes sense to me. We convert between the image absolute size, its percent size and the page size all the time, it's all integer based, it can go wrong if we're not careful. I'll take a look.