Bug 99492 - cell background colour ignored on all but the top grids of a vertically merged cell.
Summary: cell background colour ignored on all but the top grids of a vertically merge...
Status: REOPENED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: low minor
Assignee: Not Assigned
URL:
Whiteboard: target:7.1.0 target:7.3.0 target:7.2....
Keywords:
Depends on:
Blocks: Writer-Tables
  Show dependency treegraph
 
Reported: 2016-04-25 10:10 UTC by Yan Pas
Modified: 2021-09-23 12:39 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
screenshot (35.77 KB, image/png)
2016-04-25 10:10 UTC, Yan Pas
Details
mergedCellBackgroundColour.odt: merged cells only show cell color in top grid. (13.40 KB, application/vnd.oasis.opendocument.text)
2020-07-23 13:13 UTC, Justin L
Details
mergedCellColor.odt: only row background interferes with cell, not table background. (57.53 KB, application/vnd.oasis.opendocument.text)
2020-07-23 15:51 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yan Pas 2016-04-25 10:10:38 UTC
Created attachment 124621 [details]
screenshot

Steps to reproduce:
1) Open this link http://www.gunza.ru/faq/svd.html
2) Select first table and copy it to buffer
3) Paste it to LO Writer
4) Select all cells and try to make them yellow - first two cells will remain half-gray.
Comment 1 Buovjaga 2016-05-02 15:26:13 UTC
Reproduced.

Arch Linux 64-bit, KDE Plasma 5
Version: 5.2.0.0.alpha1+
Build ID: 540fee2dc7553152914f7f1d8a41921e765087ef
CPU Threads: 8; OS Version: Linux 4.5; UI Render: default; 
Locale: fi-FI (fi_FI.UTF-8)
Built on April 30th 2016
Comment 2 Telesto 2017-05-10 16:40:06 UTC
Found in
Version: 5.4.0.0.alpha1+
Build ID: 9d320ec4d818f86e58a15fd46248026502b1cc94
CPU threads: 4; OS: Windows 6.2; UI render: default; 
TinderBox: Win-x86@62-TDF, Branch:MASTER, Time: 2017-05-09_01:27:12
Locale: en-US (nl_NL); Calc: single

and in
LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-3.3.0.4
Comment 3 QA Administrators 2018-05-11 02:32:54 UTC Comment hidden (obsolete, spam)
Comment 4 Justin L 2018-08-18 10:20:43 UTC
confirmed in 6.2 master
Comment 5 Justin L 2020-07-23 13:13:41 UTC
Created attachment 163451 [details]
mergedCellBackgroundColour.odt: merged cells only show cell color in top grid.

repro 7.1+
This has nothing to do with HTML or copy/paste.

So what you have here with OPs example is a table-wide background property of light gray, which is overridden in some rows via with row-level background properties of dark gray or yellow.  The cells themselves don't have a background property. Because A1 is merged with A2, and B1 is merged with B2, those grids kindof don't exist, but yet the row property is shining through in those spaces.

This is easy to reproduce by hand in LO. I notice that horizontal merges are OK - it is only the vertical merges where the colour doesn't apply to each grid-section of the merged cell.
Comment 6 Justin L 2020-07-23 13:16:31 UTC
I confirmed with a few bibisect spot-checks that this new definition of the problem has also been inherited from OOo.
Comment 7 Justin L 2020-07-23 15:48:22 UTC
Code pointer: this commit probably stopped painting merged cells
commit 4207a09677e03f857dc9341616775be6c4e5a199
Author: Vladimir Glazounov on Wed Jun 4 08:50:59 2008 +0000
  INTEGRATION: CWS sw30bf04 (1.115.2); FILE MERGED
  2008/05/09 14:05:11 fme 1.115.2.1: #i80595# ww8 import should create new tables

I can't tell why this was added. Reverting it fixes the problem.
Comment 8 Justin L 2020-07-23 15:51:21 UTC
Created attachment 163454 [details]
mergedCellColor.odt: only row background interferes with cell, not table background.
Comment 9 Justin L 2020-07-24 05:33:07 UTC
proposed fix at https://gerrit.libreoffice.org/c/core/+/99343
Comment 10 Commit Notification 2020-07-24 11:42:23 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#99492 sw layout: always paint merged cell grids

It will be available in 7.1.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 11 Commit Notification 2021-09-20 16:47:12 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

Revert "tdf#99492 sw layout: always paint merged cell grids"

It will be available in 7.3.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 12 Commit Notification 2021-09-21 07:16:29 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-7-2":

https://git.libreoffice.org/core/commit/20672741eded49de01e8b7bc660e115f404203aa

Revert "tdf#99492 sw layout: always paint merged cell grids"

It will be available in 7.2.2.

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 13 Commit Notification 2021-09-21 08:28:11 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-7-1":

https://git.libreoffice.org/core/commit/093392709e8f50fe4484977b61dfe47b5ed8968a

Revert "tdf#99492 sw layout: always paint merged cell grids"

It will be available in 7.1.7.

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 Justin L 2021-09-21 12:20:22 UTC
re-opening since the attempted commit caused a nasty regression as documented in bug 144554. The fix has been reverted back to 7.1.7.

Make sure to review  attachment 175083 [details] (mergedCellWithBackground.odt) and attachment 175139 [details] (mergedCellWithBackgroundC.docx) with any attempted fix.
Comment 15 Justin L 2021-09-23 12:39:50 UTC
This painting of Table / Row / Cell is currently handled by recursive calls to SwFrame::PaintSwFrameBackground.

It first paints the table (IsTabFrame()), then it GetLower() and paints the row (IsRowFrame()), then it GetLower() and paints the cell (IsCellFrame()).

I expect the key to solving this is to cache/delay the CellFrame paintings, and to handle them after all the rows have been printed. But that is starting to get past my skill level.