[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    JS view of widths of table cells
From:       <koos.vriezen () xs4all ! nl>
Date:       2001-12-27 21:07:52
[Download RAW message or body]

Hi,

Consider this small HTML page of two nested tables:

<html><body>
<table bgcolor='#ffa0a0'>
 <tr>
  <td>
   <table bgcolor='#a0a0ff'><tr>
    <td WIDTH='70' onMouseDown='this.width=(this.width==100?50:100)'>cell1</td>
    <td WIDTH=1 onMouseDown='window.alert(this.width)'>cell2</td>
    <td WIDTH=1 onMouseDown='window.alert(this.style.width)'>cell3</td>
    <td onMouseDown='window.alert(this.style.width)'>cell4</td>
   </tr></table>
  </td>
  <td>other table
  </td>
 </tr>
</table>
</body></html>

The inner table has four cells. The second and third cell have a WIDTH
attribute set to 1. When you click on those, you see 1 (cell2) and 1px
(cell3). A click on cell4 shown an empty alert box.
Same happens with Mozilla, IE shows real widths. Anyone knows what is the
right outcome of td.width? If IE is right, any clues how to implement
this? I'm rather confused by the table rendering/stylesheets
implementation.

A click on the first cell, resizes this cell (the outer table is just for
showing that it is rendered correctly). This doesn't seem to work in
konqueror. It works in Mozilla and doesn't in IE. A quick ugly hack makes
it work in konqueror (sort of, it is out of sync by one click):

--- html/html_tableimpl.cpp.orig        Thu Dec 27 14:24:24 2001
+++ html/html_tableimpl.cpp     Thu Dec 27 21:54:06 2001
@@ -701,6 +701,11 @@
         m_nowrap = (attr->val() != 0);
         break;
     case ATTR_WIDTH:
+       if (m_render) {
+           RenderTable* rt = static_cast<RenderTableCell*>(m_render)->table();
+           rt->setNeedsCellsRecalc();
+           rt->updateSize();
+       }
         if (!attr->value().isEmpty())
             addCSSLength(CSS_PROP_WIDTH, attr->value());
         else

I don't know if it makes sense to implement this feature, but it looks
nice.

Regards,

Koos Vriezen



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic