Bug 75267 - bad CSS render of :hover with empty table cell "td"
Summary: bad CSS render of :hover with empty table cell "td"
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
: 85440 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-02-15 11:52 UTC by Shift
Modified: 2005-02-25 05:39 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Shift 2004-02-15 11:52:49 UTC
Version:           3.2.0 (using KDE 3.2 BRANCH >= 20040204, Mandrake Linux Cooker i586 - Cooker)
Compiler:          gcc version 3.3.2 (Mandrake Linux 10.0 3.3.2-4mdk)
OS:          Linux (i686) release 2.4.23-0.1mdk

Konqueror does nt render empty cells background properly when dynamically changed.

Here is the testcase : 

----------------------------------------------------
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
    <title>Test case</title>
    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=iso-8859-15" />
</head>

<style type="text/css">
td {
     border:1px solid black;

}
td:hover {
     background-color: gray;
}
</style>
<body>
	<h1>Test case</h1>
	
        <table>
              <tr>
                 <td>fd gdfgsdsdfg s</td>
                 <td></td>
              </tr>
              <tr>
                 <td>rehter</td>
                 <td>ert erh trr</td>
              </tr>
              
        </table>
 
</body>
</html>
-------------------------------------------------

When the mouse is hover a non-empty cell the the background become gray but under the empty cell only a part of it become gray and sometimes when exiting the cell a part stay gray.

The expected behaviuor is that all the background become gray as the other cells.
Comment 1 Shift 2004-02-15 11:54:13 UTC
Here is an example in real website : http://shift.freezope.org/konq_rellinks/development_html

I don't post it in the report because I wil probably change this page one day :)
Comment 2 Shift 2004-02-15 12:02:36 UTC
Here is the testcase I put on the report :
http://perso.wanadoo.fr/shift/kde-bug/td-hover.html

I will remove it from my site only when it will be resolved or when I'll change of internet access provider.
Comment 3 Dan Ostrowski 2004-07-28 15:53:46 UTC
Hi.

I've put a similar bug in the system that I will probably close out. I would just like to note that in your example your text is all the same height, but if you have, for instance, this html:

------------------------------------
<html> 
 <head> 
 <style> 
 td.mytest { border: 1px dotted #EEE; background-color: #FFF; } 
 td.mytest:hover { border: 1px dashed black; background-color: #666; } 
 </style> 
 <body> 
 <table width="400px" cellpadding="0" cellspacing="0"> 
   <tr> 
     <td class="mytest"> <p>some</p><p>stuff</p><p>in</p><p>here</p> </td> 
     <td class="mytest"> hiya </td> 
   </tr> 
 </table> 
 </body> 
 ------------------------------------

You can see that the cell with text in it that says "hiya" only has the row with text in it changed on hover. 

Dan Ostrowski
Comment 4 Charles Samuels 2005-02-01 23:14:43 UTC
Hey, guys, in the future, please attach your testcases and don't just paste them in. It makes things a lot easier, thanks.

-charles
Comment 5 Leo Savernik 2005-02-15 21:23:21 UTC
CVS commit by savernik: 

Fixed incomplete dynamic repainting of table backgrounds by including the
top and bottom extra space in the hit tests.

BUG: 75267


  M +5 -0      ChangeLog   1.381
  M +13 -0     rendering/render_table.cpp   1.273
  M +2 -0      rendering/render_table.h   1.112


--- kdelibs/khtml/ChangeLog  #1.380:1.381
@@ -1,2 +1,7 @@
+2005-02-15  Leo Savernik  <l.savernik@aon.at>
+
+        * rendering/render_table.{cpp,h} (RenderCell::nodeAtPoint):
+        Including top and bottom extra space in hit testing.
+        
 2005-02-15  Allan Sandfeld Jensen <kde@carewolf.com>
 

--- kdelibs/khtml/rendering/render_table.cpp  #1.272:1.273
@@ -1946,4 +1946,17 @@ void RenderTableCell::setStyle( RenderSt
 }
 
+bool RenderTableCell::nodeAtPoint(NodeInfo& info, int _x, int _y, int _tx, int _ty, HitTestAction hitTestAction, bool inside)
+{
+  int tx = _tx + m_x;
+  int ty = _ty + m_y;
+
+  // also include the top and bottom extra space
+  inside |= style()->visibility() != HIDDEN
+      && (_y >= ty) && (_y < ty + height() + _topExtra + _bottomExtra)
+      && (_x >= tx) && (_x < tx + width());
+
+  return RenderBlock::nodeAtPoint(info, _x, _y, _tx, _ty, hitTestAction, inside);
+}
+
 // The following rules apply for resolving conflicts and figuring out which border
 // to use.

--- kdelibs/khtml/rendering/render_table.h  #1.111:1.112
@@ -388,4 +388,6 @@ public:
     virtual short baselinePosition( bool = false ) const;
 
+    virtual bool nodeAtPoint(NodeInfo& info, int _x, int _y, int _tx, int _ty, HitTestAction hitTestAction, bool inside);
+
     RenderTable *table() const { return static_cast<RenderTable *>(parent()->parent()->parent()); }
     RenderTableSection *section() const { return static_cast<RenderTableSection *>(parent()->parent()); }


Comment 6 Dominik Haumann 2005-02-16 12:49:02 UTC
*** Bug 85440 has been marked as a duplicate of this bug. ***
Comment 7 ZĂ© 2005-02-25 04:09:24 UTC
Im using kdelibs-050224.tar.bz2 snapshot, and if i apply this patch, when compiling i get this error:

In file included from libkhtmlhtml_la.all_cpp.cpp:4:
dtd.cpp:48: warning: `visibility' attribute ignored
In file included from html_tableimpl.cpp:42,
                 from libkhtmlhtml_la.all_cpp.cpp:16:
../../khtml/rendering/render_table.h:392: error: `virtual bool khtml::RenderTableCell::nodeAtPoint(khtml::RenderObject::NodeInfo&, int, int, int, int, HitTestAction, bool)' and `virtual bool khtml::RenderTableCell::nodeAtPoint(khtml::RenderObject::NodeInfo&, int, int, int, int, HitTestAction, bool)' cannot be overloaded
make[3]: ** [libkhtmlhtml_la.all_cpp.lo] Erro 1
make[3]: Leaving directory `/home/mmodem/rpm/BUILD/kdelibs-3.3.92/khtml/html'
make[2]: ** [all-recursive] Erro 1
make[2]: Leaving directory `/home/mmodem/rpm/BUILD/kdelibs-3.3.92/khtml'
make[1]: ** [all-recursive] Erro 1
make[1]: Leaving directory `/home/mmodem/rpm/BUILD/kdelibs-3.3.92'
make: ** [all] Erro 2

Why want this patch included in the snapshot?
Does have a fix?
Comment 8 Thiago Macieira 2005-02-25 05:39:12 UTC
Ze, comment #5 to this bug report is a CVS commit message, dated Feb 15th. It means the patch was applied on that date to CVS. Do not try to apply it *again* to your snapshot, which is of a later date.

Doing so will cause conflicts exactly of the kind you're seeing.