-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
5.0
-
x86
-
windows_xp
FULL PRODUCT VERSION :
java version "1.5.0_10"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_10-b03)
Java HotSpot(TM) Client VM (build 1.5.0_10-b03, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
HTMLEditorKit renders HTML table background color differently when compared to Mozilla, Firefox and IE.
When using the "bgcolor" attribute for a table row element "<tr>", the text of a cell spanning from a previous row will be clipped by the color drawing operation. In addition, the logic will color cells that span rows only in the area the logically belongs to that row (i.e. a cell spanning multiple rows can have different colors). This is different from other browsers, such as IE and Firefox, which color cells based on the color that was specified for the row their definition was in.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run submitted test case
2. Create an HTML file with the following, and open in a web browser for comparison.
<html>
<head>
</head>
<body>
<table>
<tr bgcolor="yellow">
<td>
First row, first col
</td>
<td rowspan="2">
Second col
</td>
<td>
First row, third col
</td>
</tr>
<tr bgcolor="red">
<td>
Second row, first col
</td>
<td>
Second row, third col
</td>
</tr>
</table>
</body>
</html>
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expected result is that the cells in the first row are painted yellow, and the cells in the second row are painted red. This is based on browsers such as Mozilla, Firefox, and IE.
ACTUAL -
Instead of the cells being painted, the screen real-estate for the row is painted. This results in a cell that spans multiple rows to be half painted. And not only that, it is painted blithefully over previously painted text of a cell spanning multiple rows. The latter is the more serious problem.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Test {
public static void main(String[] args) {
try {
JTextPane p = new JTextPane();
p.setEditorKit(new HTMLEditorKit());
p.setText("<table><tr bgcolor=\"yellow\"><td>First row, first col</td><td rowspan=\"2\">Second col</td><td>First row, third col</td></tr><tr bgcolor=\"red\"><td>Second row, first col</td><td>Second row, third col</td></tr></table>");
JFrame f = new JFrame("This is a test");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.add(p);
f.pack();
f.setVisible(true);
} catch (Throwable t) {
t.printStackTrace();
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
None that I know of.
java version "1.5.0_10"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_10-b03)
Java HotSpot(TM) Client VM (build 1.5.0_10-b03, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
HTMLEditorKit renders HTML table background color differently when compared to Mozilla, Firefox and IE.
When using the "bgcolor" attribute for a table row element "<tr>", the text of a cell spanning from a previous row will be clipped by the color drawing operation. In addition, the logic will color cells that span rows only in the area the logically belongs to that row (i.e. a cell spanning multiple rows can have different colors). This is different from other browsers, such as IE and Firefox, which color cells based on the color that was specified for the row their definition was in.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run submitted test case
2. Create an HTML file with the following, and open in a web browser for comparison.
<html>
<head>
</head>
<body>
<table>
<tr bgcolor="yellow">
<td>
First row, first col
</td>
<td rowspan="2">
Second col
</td>
<td>
First row, third col
</td>
</tr>
<tr bgcolor="red">
<td>
Second row, first col
</td>
<td>
Second row, third col
</td>
</tr>
</table>
</body>
</html>
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expected result is that the cells in the first row are painted yellow, and the cells in the second row are painted red. This is based on browsers such as Mozilla, Firefox, and IE.
ACTUAL -
Instead of the cells being painted, the screen real-estate for the row is painted. This results in a cell that spans multiple rows to be half painted. And not only that, it is painted blithefully over previously painted text of a cell spanning multiple rows. The latter is the more serious problem.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Test {
public static void main(String[] args) {
try {
JTextPane p = new JTextPane();
p.setEditorKit(new HTMLEditorKit());
p.setText("<table><tr bgcolor=\"yellow\"><td>First row, first col</td><td rowspan=\"2\">Second col</td><td>First row, third col</td></tr><tr bgcolor=\"red\"><td>Second row, first col</td><td>Second row, third col</td></tr></table>");
JFrame f = new JFrame("This is a test");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.add(p);
f.pack();
f.setVisible(true);
} catch (Throwable t) {
t.printStackTrace();
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
None that I know of.