Bug Hunting Session
Bug 96218 - FILEOPEN: MSO DOCX image incorrectly placed when using Alignment Position(Top Margin, Top Page ...)
Summary: FILEOPEN: MSO DOCX image incorrectly placed when using Alignment Position(Top...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
4.5.0.0.alpha0+ Master
Hardware: All All
: medium normal
Assignee: Tamás Zolnai
URL:
Whiteboard: target:5.4.0 target:5.3.0.1 target:5.2.5
Keywords: bibisected, bisected, filter:docx, regression
: 104529 104669 (view as bug list)
Depends on:
Blocks: DOCX-Images
  Show dependency treegraph
 
Reported: 2015-12-03 03:36 UTC by Luke
Modified: 2017-08-29 09:50 UTC (History)
9 users (show)

See Also:
Crash report or crash signature:


Attachments
Simple example. Image should be at the top of the page, no whitepace (40.92 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2015-12-03 03:36 UTC, Luke
Details
MS-DOC importer correctly sets image position (49.00 KB, application/msword)
2015-12-03 03:44 UTC, Luke
Details
Another example. The image should start at the top of the page text area (45.18 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2015-12-03 04:39 UTC, Luke
Details
another sample (181.16 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2016-11-25 13:26 UTC, Xisco Faulí
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Luke 2015-12-03 03:36:01 UTC
Created attachment 120970 [details]
Simple example. Image should be at the top of the page, no whitepace

The DOCX importer shifts down images that were positioned using "alignment". 

Steps to reproduce:
1. In Word, insert image
2. Select one of the Wrapping options except In Line With Text.
3. In Layout -> Positions-> Vertical -> Select Alignment:Top,Page
4. Save
5. Open in Writer

Note: Unchecking "Follow Text Flow" resolves this issue.
Comment 1 Luke 2015-12-03 03:44:02 UTC
Created attachment 120971 [details]
MS-DOC importer correctly sets image position

When comparing format image->type->position of MS-DOC vs DOCX files, the MS-DOC importer always keeps the "Follow Text Flow" off and uses a different vertical position. The horizontal positions are imported with the same value.
Comment 2 Luke 2015-12-03 04:39:00 UTC
Created attachment 120972 [details]
Another example. The image should start at the top of the page text area

Again this import is fixed by unchecking "Follow text flow"

Word gives 7 options to position by Alignment. The first 4 all are incorrectly shifted down. The last 3 already place the image at the bottom of the page.
Comment 3 Buovjaga 2015-12-05 16:40:25 UTC
Confirmed.

OK in 4.3.

Win 7 Pro 64-bit, Version: 5.0.3.2 (x64)
Build ID: e5f16313668ac592c1bfb310f4390624e3dbfb75
Locale: fi-FI (fi_FI)

Version: 5.2.0.0.alpha0+
Build ID: 81fa5340191baf8687f9c82f1f414f5afc86b529
Threads 4; Ver: Windows 6.1; Render: default; 
TinderBox: Win-x86@62-merge-TDF, Branch:MASTER, Time: 2015-12-03_21:19:19
Locale: fi-FI (fi_FI)

4.3.0.1
Comment 4 raal 2015-12-07 09:42:47 UTC
bibisect-win32-5.0, oldest version contains bug too.
git checkout oldest: Version: 4.5.0.0.alpha0+
Build ID: 57d6b92b69a31260dea0d84fcd1fc5866ada7adb
Comment 5 raal 2015-12-07 21:33:13 UTC
This seems to have begun at the below commit.
Adding Cc: to Luboš Luňák ; Could you possibly take a look at this one?
Thanks

cf196516a0f26272ee89c78c70881fbc054fa6fb is the first bad commit
commit cf196516a0f26272ee89c78c70881fbc054fa6fb
Author: Matthew Francis <mjay.francis@gmail.com>
Date:   Sun Mar 15 02:57:35 2015 +0800

    source-hash-3891ba42a886fa85eb43da24d1badf44e765d54c
    
    commit 3891ba42a886fa85eb43da24d1badf44e765d54c
    Author:     Luboš Luňák <l.lunak@collabora.com>
    AuthorDate: Sun Sep 21 17:52:58 2014 +0200
    Commit:     Luboš Luňák <l.lunak@collabora.com>
    CommitDate: Sun Sep 21 17:54:41 2014 +0200
    
        handle docx's w:anchor layoutInCell attribute (bnc#891663)
    
        Change-Id: I8268567b84aa0f6e42624bfd0f79c8c49c153edd

bibisect-44max$ git bisect log
# bad: [cf6ea17155fabb2a120ba07c150735591ac861d7] source-hash-3f94c9e9ddfd807b449f3bb9b232cf2041fa12d2
# good: [fc71ac001f16209654d15ef8c1c4018aa55769f5] source-hash-c15927f20d4727c3b8de68497b6949e72f9e6e9e
git bisect start 'latest' 'oldest'
# good: [8cf60cc706948588e2f33a6d98b7c55d454e362a] source-hash-f340f0454627939f1830826fb5cc53a90e6c62a4
git bisect good 8cf60cc706948588e2f33a6d98b7c55d454e362a
# bad: [7beddf3808dadd525d7e55c00a5a90a2b44c23d3] source-hash-2f10386ce577f52e139aa23d41bc787d8e0b4d59
git bisect bad 7beddf3808dadd525d7e55c00a5a90a2b44c23d3
# good: [7d319609d8266af06aa3256fd3773d052b9150dc] source-hash-1fec67aab152e0c0ad6dd85082c50f1beff7d520
git bisect good 7d319609d8266af06aa3256fd3773d052b9150dc
# bad: [136c4fdf380a2d05111e313540e4be01a74c4eb6] source-hash-7bacb89bb955f4985e435c33dde629099dab744b
git bisect bad 136c4fdf380a2d05111e313540e4be01a74c4eb6
# bad: [f3c053a278b473b5029baf72c02bdc3d78289b51] source-hash-a37a8733609a59eccabf89b2ff67d5ee6bf194bb
git bisect bad f3c053a278b473b5029baf72c02bdc3d78289b51
# good: [71689e22672a593ea6e869f0b2009d9046b5c880] source-hash-1f291178605aea72a988d19db75500dfd2c23424
git bisect good 71689e22672a593ea6e869f0b2009d9046b5c880
# bad: [5dc233d30274d6d3a51c2dcbcab55b19ed789497] source-hash-ce5dd8647083c944fb298c491fb526dad17a8a1a
git bisect bad 5dc233d30274d6d3a51c2dcbcab55b19ed789497
# good: [5691387e06fe9ff3ab8cf482f048d9784394a182] source-hash-8a5ffa063a7edc78f9c75e9dc3490108732435e5
git bisect good 5691387e06fe9ff3ab8cf482f048d9784394a182
# bad: [25a65eaea6ae387e9cbf9296c996888485d73919] source-hash-4e124fd1409af419990bacade74fcf355624243f
git bisect bad 25a65eaea6ae387e9cbf9296c996888485d73919
# good: [f4e6cfd456d0d09f740526fc6fb389817b40ebda] source-hash-7d860f6134654c2f46ceebb1ca1a792c143af795
git bisect good f4e6cfd456d0d09f740526fc6fb389817b40ebda
# bad: [e85ea519eb669444c33f16b6f921d8dd59963b58] source-hash-51c8fb46743c43b1b460086d148a5facd7b004fa
git bisect bad e85ea519eb669444c33f16b6f921d8dd59963b58
# bad: [cf196516a0f26272ee89c78c70881fbc054fa6fb] source-hash-3891ba42a886fa85eb43da24d1badf44e765d54c
git bisect bad cf196516a0f26272ee89c78c70881fbc054fa6fb
# good: [768a57837341bc020b073477fe22d190b98862aa] source-hash-c0a709e9912de8adb6777b40197accf865c4f046
git bisect good 768a57837341bc020b073477fe22d190b98862aa
# first bad commit: [cf196516a0f26272ee89c78c70881fbc054fa6fb] source-hash-3891ba42a886fa85eb43da24d1badf44e765d54c
Comment 6 Robinson Tryon (qubit) 2015-12-10 01:18:36 UTC Comment hidden (obsolete)
Comment 7 Aron Budea 2016-09-11 23:38:04 UTC
Still occurs in v5.2.1.2 / Windows 7.
Comment 8 Xisco Faulí 2016-11-16 23:21:33 UTC
*** Bug 96219 has been marked as a duplicate of this bug. ***
Comment 9 Xisco Faulí 2016-11-16 23:22:24 UTC
Same problem can be reproduced with attachment 63331 [details]
Comment 10 Xisco Faulí 2016-11-20 15:39:34 UTC
and attachment 76819 [details]
Comment 11 Xisco Faulí 2016-11-25 13:26:59 UTC
Created attachment 129003 [details]
another sample
Comment 12 Xisco Faulí 2016-12-11 16:09:48 UTC
*** Bug 104529 has been marked as a duplicate of this bug. ***
Comment 13 Xisco Faulí 2016-12-14 11:37:57 UTC
*** Bug 104669 has been marked as a duplicate of this bug. ***
Comment 14 Luke 2016-12-14 21:10:31 UTC
Zolnai,
You been working in this area recently. Is this regression something you could take a look at?
Comment 15 Commit Notification 2016-12-21 00:18:21 UTC
Tamás Zolnai committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=36750bc977b3210b23b7822abd395b30a78af6f5

tdf#96218: MSO DOCX image incorrectly placed when using Alignment Position

It will be available in 5.4.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 16 Luke 2016-12-21 07:12:46 UTC
Verified 36750bc977b3210b23b7822abd395b30a78af6f5 fixes the vertical position of my examples and that of the dupes. 

Considering all the dupes, this might be worthy of a backport to at least 5.3.

Thank you Tamás!
Comment 17 Commit Notification 2016-12-21 11:42:03 UTC
Tamás Zolnai committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=15d821aa366265f86fda4484574e598b5744d23b&h=libreoffice-5-3

tdf#96218: MSO DOCX image incorrectly placed when using Alignment Position

It will be available in 5.3.0.1.

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

Affected users are encouraged to test the fix and report feedback.
Comment 18 Commit Notification 2017-01-05 09:12:56 UTC
Tamás Zolnai committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=a5f5312de639048dac65da292f2b2dcc330cee15&h=libreoffice-5-2

tdf#96218: MSO DOCX image incorrectly placed when using Alignment Position

It will be available in 5.2.5.

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

Affected users are encouraged to test the fix and report feedback.
Comment 19 Timur 2017-01-05 16:01:08 UTC
(In reply to Luke from comment #16)
> Verified 36750bc977b3210b23b7822abd395b30a78af6f5 fixes the vertical
> position of my examples and that of the dupes. 
In that, case, please set to Verified (I did now).