Bug 70326 - [test case] problems with displaying <tr onmouseover="this.background.color=...">
Summary: [test case] problems with displaying <tr onmouseover="this.background.color=....
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml ecma (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
: 50921 55005 85462 86149 89979 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-12-13 17:37 UTC by Piotrek
Modified: 2005-02-16 18:33 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
test case (227 bytes, text/html)
2004-01-17 12:37 UTC, Stephan Kulow
Details
Patch (977 bytes, patch)
2004-12-30 13:46 UTC, Allan Sandfeld
Details
Another solution (1.81 KB, patch)
2004-12-30 22:51 UTC, Charles Samuels
Details
testcase exhibiting border space handling (207 bytes, text/html)
2005-02-16 18:33 UTC, Leo Savernik
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Piotrek 2003-12-13 17:37:44 UTC
Version:           3.1.94 (using KDE 3.1.94 (3.2 Beta 2), compiled sources)
Compiler:          gcc version 3.2.3
OS:          Linux (i686) release 2.4.23

In tables, where rows have onmouseover="this.background.color='#(something)'" property konqueror doesn't react when mouse cursor is over the row. But if there's a link in a cell of the row some rectangular area around the link changes it's color to the desired colour, but it's still not the whole row...
Comment 1 Thiago Macieira 2003-12-13 18:04:09 UTC
Can you provide a simple test case? On what other browsers/versions does this construct work?
Comment 2 Piotrek 2003-12-13 20:13:31 UTC
Here's a simple example:

<table border=1>
<tr onmouseover="this.style.backgroundColor='#00FF00'" onmouseout="this.style.backgroundColor='#FFFFFF'" height="100">
	<td>something<td>something<td> <a href=whatever>link</a><td>something else
</table>

I've seen how it looks on Mozilla and IE - both highlight whole row on green when a cursor is over it. As You'll see KOnqueror will highlight only the "link" word when the mouse cursor is over it, and often won't change background of the link even when the cursor is out! That's also very important thing.
Comment 3 Thiago Macieira 2003-12-13 20:48:54 UTC
Confirmed for HEAD 20031201.
Comment 4 Stephan Kulow 2004-01-17 12:37:34 UTC
Created attachment 4205 [details]
test case
Comment 5 Tom Simnett 2004-04-23 00:37:04 UTC
This bug is still active in 3.2.2. The same goes for <TD> tags where there is linked text within. Only within the area of text does the colour change, whereas the whole TD colour should change.
Comment 6 Maksim Orlovich 2004-07-28 14:55:21 UTC
*** Bug 85462 has been marked as a duplicate of this bug. ***
Comment 7 Maksim Orlovich 2004-07-28 14:55:35 UTC
*** Bug 86149 has been marked as a duplicate of this bug. ***
Comment 8 Maksim Orlovich 2004-09-22 01:17:23 UTC
*** Bug 89979 has been marked as a duplicate of this bug. ***
Comment 9 Vedran Ljubovic 2004-09-22 09:48:29 UTC
This is a regression introduced about the time of 3.2 beta2. It's still valid in 3.3.0.
Comment 10 Ian Ventura-Whiting 2004-10-25 17:38:04 UTC
This bug is still active in 3.3.1. Another example of this happening is on http://stayingslim.com in the menu on the left.

In 3.3.1 the onmouseover seems to work on <td> just not on <tr>. This problem was hightlighted by some recent development work I have been involved in.
Comment 11 Stephan Kulow 2004-11-07 22:25:06 UTC
*** Bug 50921 has been marked as a duplicate of this bug. ***
Comment 12 Stephan Kulow 2004-11-07 22:27:36 UTC
*** Bug 55005 has been marked as a duplicate of this bug. ***
Comment 13 Charles Samuels 2004-12-30 01:44:22 UTC
I think this is a bug in khtml/render/render_table

The css style property is set, so from what I gather the table row merely forgets to have its child TDs repaint themselves (this is further evidenced by how the cells get their color changed when you cause a paintevent over those cells.

I write this because I'm taking an interest in khtml but realise that I won't be able to fix this in just one go.  Here's hoping someone gets to it first!
Comment 14 Allan Sandfeld 2004-12-30 13:46:27 UTC
Created attachment 8861 [details]
Patch

Based on Charles description here is a crude patch that fixes the problem (and
#57605 as well). Although I believe it should be done more generically and
efficiently in render_container.
Comment 15 Charles Samuels 2004-12-30 22:51:16 UTC
Created attachment 8866 [details]
Another solution

This patch also fixes this bug, and also 57605.

It works in a totally different way
Comment 16 Charles Samuels 2004-12-30 23:02:29 UTC
due to popular demand, I will explain my patch.

When painting the Row, the Row's parent Box gets asked to do the painting.
When asked to repaint itself, a Box just invalidates its whole rectangle

Anyway, the Row's parent Box is the Section.  And the section never sets its width, so it stays to its default of 0.  This results in the invalidated rectangle being 0 width.

The one inefficiency of my patch is that it repaints the entire table, not just the row that was invalidated.  But OTOH, it would also fix the hypothetical state of onmouseover on the TBODY.

-Charles
Comment 17 Charles Samuels 2004-12-30 23:34:56 UTC
CVS commit by charles: 

fix bug: problems with displaying <tr onmouseover="this.background.color=...">

BUG:70326
BUG:57605

Allan claims this is the 3rd most "popular" khtml bug.


  M +7 -1      render_table.cpp   1.269
  M +3 -1      render_table.h   1.109


--- kdelibs/khtml/rendering/render_table.cpp  #1.268:1.269
@@ -1135,4 +1135,9 @@ void RenderTableSection::setCellWidths()
 }
 
+short RenderTableSection::width() const
+{
+  return table()->width();
+}
+
 
 void RenderTableSection::calcRowHeight()
@@ -1753,4 +1758,5 @@ void RenderTableRow::layout()
 
     RenderObject *child = firstChild();
+        
     while( child ) {
         if ( child->isTableCell() ) {

--- kdelibs/khtml/rendering/render_table.h  #1.108:1.109
@@ -229,4 +229,6 @@ public:
     virtual void position(InlineBox*, int, int, bool) {}
 
+        virtual short width() const;
+
     virtual FindSelectionResult checkSelectionPoint( int _x, int _y, int _tx, int _ty,
                                                      DOM::NodeImpl*& node, int & offset,


Comment 18 Dominik Haumann 2005-01-02 14:26:04 UTC
Are you sure it is really fixed?
The attached test in Comment #4 still behaves differently in firefox: if you hover over a table cell the background changes to green. In khtml the background only changes if the mouse hovers over text.
(Allan's and Charles' patch have the same behavior)
I don't know the right behavior, so maybe this is a ff bug - dunno.
Comment 19 Dominik Haumann 2005-01-05 17:38:07 UTC
CVS commit by dhaumann: 

backport charles fix for bug: problems with displaying <tr onmouseover="this.background.color=...">

CCBUG:70326
CCBUG:57605


  M +4 -0      render_table.cpp   1.258.2.6
  M +2 -0      render_table.h   1.105.2.4


--- kdelibs/khtml/rendering/render_table.cpp  #1.258.2.5:1.258.2.6
@@ -1130,4 +1130,8 @@ void RenderTableSection::setCellWidths()
 }
 
+short RenderTableSection::width() const
+{
+    return table()->width();
+}
 
 void RenderTableSection::calcRowHeight()

--- kdelibs/khtml/rendering/render_table.h  #1.105.2.3:1.105.2.4
@@ -229,4 +229,6 @@ public:
     virtual void position(InlineBox*, int, int, bool) {}
 
+    virtual short width() const;
+
     virtual FindSelectionResult checkSelectionPoint( int _x, int _y, int _tx, int _ty,
                                                      DOM::NodeImpl*& node, int & offset,


Comment 20 Allan Sandfeld 2005-01-05 17:54:56 UTC
Hmm. The reason mouseover is not activated outside "the text" is because that area is margin. Centering in table-cells is accomplished by setting the two margins to "auto". Since the margin is not part of the object, no event is generated when hovering over it.

The question is then if a row should be larger the sum of its cells and include their margins?
Comment 21 Jason Keirstead 2005-01-18 17:33:03 UTC
This bug exists in HEAD as of Jan 17. The test case in comment #4 fails - note that the onmouseover and onmouseout should be activated as soon as you enter the table row - currently they only fire once you mouse over the text node.

Possibly a regression? Did this work before?

Note, it is likely closely tied to bug #72804
Comment 22 Allan Sandfeld 2005-01-19 01:23:39 UTC
Did you read my comment?

The margin of a HTML object is not treated as part of the object. You do not get mouseover event when entering the margin of any other object so why should you for table-rows?
Comment 23 Allan Sandfeld 2005-01-19 14:27:42 UTC
I've studied it closer. There seems to be no official definition of a table-row besides being a container table-cells. I've even seen a test that suggest tr:hover should activate when hovering over borders between cells.
Comment 24 Stephen Leaf 2005-01-25 04:52:04 UTC
This bug is fixed in 3.4 Beta1 for me :)
Glad to see a year old bug finally getting fixed.
Comment 25 Maksim Orlovich 2005-01-25 23:30:55 UTC
For the margin event stuff, please see bug #72804. No need to overload this if there are already ~3 bugs specifically about that
Comment 26 Leo Savernik 2005-02-16 18:33:05 UTC
Created attachment 9672 [details]
testcase exhibiting border space handling

Though [1] makes the onmouse* events react on the whole area of table cells, it
still does not work in the cell spacing.

Mozilla exhibits the same bug, fwiw.

[1]
http://webcvs.kde.org/kdelibs/khtml/rendering/render_table.cpp?r1=1.272&r2=1.273