#14909 closed defect (fixed)

wxHtml regression: bgcolor inside table elements

Reported by: robind Owned by: vadz
Priority: normal Milestone: 2.9.5
Component: wxHtml Version: stable-latest
Keywords: regression Cc: gevorg
Blocked By: Blocking:
Patch: yes

Description

Some semi-recent change has caused the wrong background color to be used for text inside a table element, as shown in the attachment. Both the <body> tag and the <table> tags have the bgcolor attribute set. I'm guessing it was probably r72589 but I haven't verified that yet.

The HTML used for the screenshot is

<html>
<body bgcolor="#AC76DE">
<center><table bgcolor="#458154" width="100%%" cellspacing="0"
cellpadding="0" border="1">
<tr>
    <td align="center">
    <h1>wxPython %s</h1>
    (%s)<br>
    Running on Python %s<br>
    </td>
</tr>
</table>

<p><b>wxPython</b> is a Python extension module that
encapsulates the wxWindows GUI classes.</p>

<p>This demo shows off some of the capabilities
of <b>wxPython</b>.  Select items from the menu or tree control,
sit back and enjoy.  Be sure to take a peek at the source code for each
demo item so you can learn how to use the classes yourself.</p>

<p><b>wxPython</b> is brought to you by <b>Robin Dunn</b> and<br>
<b>Total Control Software,</b> Copyright (c) 1997-2011.</p>

<p>
<font size="-1">Please see <i>license.txt</i> for licensing information.</font>
</p>

<p><wxp module="wx" class="Button">
    <param name="label" value="Okay">
    <param name="id"    value="ID_OK">
</wxp></p>
</center>
</body>
</html>

Attachments (4)

Snap001.png download (66.5 KB) - added by robind 19 months ago.
14909_bgcolor_inside_table_elements.patch download (3.9 KB) - added by gevorg 19 months ago.
This patch appears to fix it, HTH
td-bgcolor-ignored.png download (260 bytes) - added by LukasK 19 months ago.
use-td-bgcolor.patch download (906 bytes) - added by LukasK 18 months ago.
Patch for also considering the bgcolor from td-elements.

Download all attachments as: .zip

Change History (14)

Changed 19 months ago by robind

comment:1 Changed 19 months ago by vadz

  • Cc gevorg added
  • Keywords regression added

I didn't have time to test it neither but I also think this must have been done by this r72589 (see #14443), so I'd like to CC its author to ask for help with this as otherwise we'd probably have to just revert that change. TIA!

Changed 19 months ago by gevorg

This patch appears to fix it, HTH

comment:2 Changed 19 months ago by vadz

Thanks a lot, this does seem to fix it, so I'll commit a slightly modified (to avoid duplicating the same code) version of the patch soon.

comment:3 Changed 19 months ago by VZ

  • Resolution set to fixed
  • Status changed from new to closed

(In [73283]) Fix regression with wxHTML table elements background handling.

Wrong background was used for the text inside HTML tables since r72589, fix
this by setting the correct background before processing the table elements
and restoring it after doing it.

Closes #14909.

comment:4 follow-up: Changed 19 months ago by LukasK

This is still not quite fixed:

Within a td-element, any bgcolor attribute the td-element is not used for the text background. The patch fixed this for the bgcolor of the table-element, but not individual table cells.

This worked before the original bug.

Example, this will render the text background green, within the cell with red background:

<table bgcolor="#00ff00">
<tr>
  <td bgcolor="#ff0000" width="100">TEST</td>
</tr>
</table>

comment:5 Changed 19 months ago by LukasK

  • Resolution fixed deleted
  • Status changed from closed to reopened

Changed 19 months ago by LukasK

comment:6 in reply to: ↑ 4 Changed 19 months ago by gevorg

Replying to LukasK:

This is still not quite fixed:

Within a td-element, any bgcolor attribute the td-element is not used for the text background. The patch fixed this for the bgcolor of the table-element, but not individual table cells.

This worked before the original bug.

Example, this will render the text background green, within the cell with red background:

<table bgcolor="#00ff00">
<tr>
  <td bgcolor="#ff0000" width="100">TEST</td>
</tr>
</table>

I might not be able to look into it this week due to the New Year. Next week most probably...

comment:7 Changed 18 months ago by vadz

It would be really great to do something about it before 2.9.5 but I definitely won't have time to do anything myself.

Changed 18 months ago by LukasK

Patch for also considering the bgcolor from td-elements.

comment:8 Changed 18 months ago by LukasK

  • Patch set

I attached "use-td-bgcolor.patch", which seems to fix this.
I added a check for the <td>-case, using its bgcolor if specified.

Note: I don't know this code well, and have only done a little testing. It works for my html, and for the initial example from robind.

comment:9 Changed 18 months ago by vadz

  • Owner set to vadz
  • Status changed from reopened to accepted

I'm not an expert here neither but at least superficially this does seem correct to me so I'll apply this soon (in slightly simplified form), thanks!

comment:10 Changed 18 months ago by VZ

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [73393]) Really fix the background colour used for the cells in wxHTML tables.

Respect "bgcolor" attributes of <td> tags, they were ignored since the changes
of r72589 (see #14443).

Closes #14909.

Note: See TracTickets for help on using tickets.