Bug 132739 - HTML Document: Table borders disappear, because multiple style attributes are written within a single tag
Summary: HTML Document: Table borders disappear, because multiple style attributes are...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
5.2.0.4 release
Hardware: All All
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard: target:7.3.0 target:7.2.1 target:7.1.6
Keywords: bibisected, bisected, regression
Depends on:
Blocks: (X)HTML-Export
  Show dependency treegraph
 
Reported: 2020-05-05 19:21 UTC by Alex
Modified: 2021-08-15 23:42 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
test html file with a table, cell borders, cell background color created with LibreOffice 4.3.7.2 (2.92 KB, text/html)
2020-05-05 19:24 UTC, Alex
Details
test html file with a table, cell borders, cell background color created with LibreOffice 6.4.3.2 (3.16 KB, text/html)
2020-05-05 19:25 UTC, Alex
Details
Example ODT file (8.63 KB, application/vnd.oasis.opendocument.text)
2020-08-30 19:00 UTC, Buovjaga
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex 2020-05-05 19:21:04 UTC
Description:
If you create a HTML document containing a table with cell borders and colored cell background, LibreOffice writes multiple style attributes into every td tag like this:
    <td width="33%" bgcolor="#5983b0" style="background: #5983b0" style="border-top: 1px double #333333; border-bottom: 1px double #333333; border-left: 1px double #333333; border-right: none; padding-top: 0.04in; padding-bottom: 0.04in; padding-left: 0.04in; padding-right: 0in">

The problem is, that LibreOffice itself and also Firefox simply ignore the re-definition of style (the second style argument).

I'm not quite sure what the XHTML-specification says about this, but AFAIU it should be one style argument containing both background and border styles.

At least LibreOffice should display the document the same way it looked like before closing.

Steps to Reproduce:
1. Start soffice
2. "File" -> "New" -> "HTML Document"
3. "Insert Table", e.g. 3x3
4. Select the whole table, right click -> "Table Properties..." -> "Borders" -> "Set Outer Border and All Inner Lines"
5. Select "Color": "Dark Gray 2", click "OK"
6. Select the whole table, set "Table Cell Background Color" e.g. to "Light Blue 1"
7. Save the document as html file (watch the cell borders)
8. Close soffice
9. Open document with soffice or any modern web browser (take a look at the borders now)

or

1. Take a HTML document containing a table with borders and cells with background color created by LibreOffice 4.3.7.2.
2. Open this document with LibreOffice >= 5.3.6.1.
3. Change something, save.
4. Have your table borders disappear.

Actual Results:
Cell borders are shown wrong. Same in a modern web browser.

Expected Results:
The HTML document should be saved as displayed.


Reproducible: Always


User Profile Reset: Yes



Additional Info:
Latest known unaffected version: 4.3.7.2 (on CentOS 6).
In 4.3.7.2 the background color wasn't written in CSS, but only with the bgcolor argument (see test_4.3.7.2.html).

Earliest known affected version: 5.3.6.1 (on CentOS 7).
Latest known affected version: 6.4.3.2.

Version: 6.4.3.2
Build ID: 6.4.3.2-1.fc32
CPU threads: 4; OS: Linux 5.6; UI render: default; VCL: gtk3; 
Locale: en-US (en_US.UTF-8); UI-Language: en-US
Calc: threaded
Comment 1 Alex 2020-05-05 19:24:49 UTC
Created attachment 160401 [details]
test html file with a table, cell borders, cell background color created with LibreOffice 4.3.7.2

HTML document by an unaffected version.
Comment 2 Alex 2020-05-05 19:25:42 UTC
Created attachment 160402 [details]
test html file with a table, cell borders, cell background color created with LibreOffice 6.4.3.2
Comment 3 Buovjaga 2020-08-30 19:00:10 UTC
Created attachment 164892 [details]
Example ODT file
Comment 4 Buovjaga 2020-08-30 19:46:45 UTC
Bibisected with win32-5.2 repo to this massive change https://git.libreoffice.org/core/commit/46fa816aa0a713c54836b9689fa7a1c9ff55ef5a
tdf#63211: saving embedded images to HTML optional
Comment 5 Stéphane Guillou (stragu) 2021-05-26 13:05:58 UTC
I also reproduced that issue when testing Bug 36447:

1. Open ODT attachment 45897 [details]
2. File > Save as... > HTML
3. Open in web browser

Tested with Firefox 88, which highlights the second style element in red when looking at the source.

Version: 7.2.0.0.alpha1+ / LibreOffice Community
Build ID: 4a9eef7849a75ba91806886ea9c96d114c8d56f9
CPU threads: 8; OS: Linux 4.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2021-05-22_06:45:25
Calc: threaded
(On Ubuntu 18.04)
Comment 6 Commit Notification 2021-08-12 18:20:21 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6833e0c0af09637bb410dc800435dcc6c8333680

Resolves: tdf#132739 two style tags where there should be just one

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 7 Caolán McNamara 2021-08-12 18:26:18 UTC
I think the identified regression point may be a red herring in that it seems to restore functionally broken earlier and so restored this problem along with that functionality and the problem originates at some unknown earlier point.

Anyhow, seems to work now in trunk, backports to 7-2 and 7-1 in gerrit
Comment 8 Commit Notification 2021-08-13 11:02:52 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-2":

https://git.libreoffice.org/core/commit/0b5243bcd938f65550ad240c8dab8a0a519d108e

Resolves: tdf#132739 two style tags where there should be just one

It will be available in 7.2.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 9 Commit Notification 2021-08-13 11:04:06 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-7-1":

https://git.libreoffice.org/core/commit/5c705fbd9e4d231fed87b7e8ac06d8b7d4c6891f

Resolves: tdf#132739 two style tags where there should be just one

It will be available in 7.1.6.

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 10 Buovjaga 2021-08-13 16:23:39 UTC
Verified, thanks!

Arch Linux 64-bit
Version: 7.3.0.0.alpha0+ / LibreOffice Community
Build ID: 4b41880be6894aaa2d2392554e858631278ba320
CPU threads: 8; OS: Linux 5.13; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 13 August 2021
Comment 11 Commit Notification 2021-08-15 23:42:52 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/5aac78e5fb241050a86714687e9ff8804588ae3c

tdf#132739: sw_htmlexport: Add unittest

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.