[webkit-changes] cvs commit: WebCore/khtml/rendering render_block.cpp render_table.cpp render_table.h table_layout.cpp

Eric eseidel at opensource.apple.com
Tue Nov 29 18:51:59 PST 2005


eseidel     05/11/29 18:51:59

  Modified:    .        ChangeLog
               khtml/rendering render_block.cpp render_table.cpp
                        render_table.h table_layout.cpp
  Log:
  Bug #: 5820
  Submitted by: mitz
  Reviewed by: darin
          Test: fast/table/cell-width-auto.html
  
          Fix for: http://bugzilla.opendarwin.org/show_bug.cgi?id=5820
          Table cells with width:auto should use width from their <col>
  
          * khtml/rendering/render_block.cpp:
          (khtml::RenderBlock::calcMinMaxWidth):
          * khtml/rendering/render_table.cpp:
          (RenderTableCell::styleOrColWidth):
          (RenderTableCell::calcMinMaxWidth):
          * khtml/rendering/render_table.h:
          * khtml/rendering/table_layout.cpp:
          (FixedTableLayout::calcWidthArray):
          (AutoTableLayout::recalcColumn):
          (AutoTableLayout::calcEffectiveWidth):
  
  Revision  Changes    Path
  1.438     +20 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.437
  retrieving revision 1.438
  diff -u -r1.437 -r1.438
  --- ChangeLog	30 Nov 2005 02:40:24 -0000	1.437
  +++ ChangeLog	30 Nov 2005 02:51:51 -0000	1.438
  @@ -1,5 +1,25 @@
   2005-11-29  Mitz Pettel  <opendarwin.org at mitzpettel.com>
   
  +        Reviewed by darin.  Committed by eseidel.
  +
  +        Test: fast/table/cell-width-auto.html
  +
  +        Fix for: http://bugzilla.opendarwin.org/show_bug.cgi?id=5820
  +        Table cells with width:auto should use width from their <col>
  +
  +        * khtml/rendering/render_block.cpp:
  +        (khtml::RenderBlock::calcMinMaxWidth):
  +        * khtml/rendering/render_table.cpp:
  +        (RenderTableCell::styleOrColWidth):
  +        (RenderTableCell::calcMinMaxWidth):
  +        * khtml/rendering/render_table.h:
  +        * khtml/rendering/table_layout.cpp:
  +        (FixedTableLayout::calcWidthArray):
  +        (AutoTableLayout::recalcColumn):
  +        (AutoTableLayout::calcEffectiveWidth):
  +
  +2005-11-29  Mitz Pettel  <opendarwin.org at mitzpettel.com>
  +
           Reviewed by hyatt.  Committed by eseidel.
   
           Test: fast/text/span-in-word-space-causes-overflow.html
  
  
  
  1.216     +6 -6      WebCore/khtml/rendering/render_block.cpp
  
  Index: render_block.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_block.cpp,v
  retrieving revision 1.215
  retrieving revision 1.216
  diff -u -r1.215 -r1.216
  --- render_block.cpp	5 Nov 2005 00:20:28 -0000	1.215
  +++ render_block.cpp	30 Nov 2005 02:51:57 -0000	1.216
  @@ -2674,12 +2674,12 @@
               m_minWidth = 0;
       }
   
  -    if (style()->width().isFixed() && style()->width().value > 0) {
  -        if (isTableCell())
  -            m_maxWidth = kMax(m_minWidth, calcContentBoxWidth(style()->width().value));
  -        else
  -            m_minWidth = m_maxWidth = calcContentBoxWidth(style()->width().value);
  -    }
  +    if (isTableCell()) {
  +        Length w = static_cast<RenderTableCell*>(this)->styleOrColWidth();
  +        if (w.isFixed() && w.value > 0)
  +            m_maxWidth = kMax(m_minWidth, calcContentBoxWidth(w.value));
  +    } else if (style()->width().isFixed() && style()->width().value > 0)
  +        m_minWidth = m_maxWidth = calcContentBoxWidth(style()->width().value);
       
       if (style()->minWidth().isFixed() && style()->minWidth().value > 0) {
           m_maxWidth = kMax(m_maxWidth, calcContentBoxWidth(style()->minWidth().value));
  
  
  
  1.142     +15 -3     WebCore/khtml/rendering/render_table.cpp
  
  Index: render_table.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_table.cpp,v
  retrieving revision 1.141
  retrieving revision 1.142
  diff -u -r1.141 -r1.142
  --- render_table.cpp	27 Nov 2005 01:10:02 -0000	1.141
  +++ render_table.cpp	30 Nov 2005 02:51:57 -0000	1.142
  @@ -1505,20 +1505,32 @@
           setNeedsLayoutAndMinMaxRecalc();
   }
       
  +Length RenderTableCell::styleOrColWidth()
  +{
  +    Length w = style()->width();
  +    if (colSpan() > 1 || !w.isAuto())
  +        return w;
  +    RenderTableCol* col = table()->colElement(_col);
  +    if (col)
  +        w = col->style()->width();
  +    return w;
  +}
  +
   void RenderTableCell::calcMinMaxWidth()
   {
       RenderBlock::calcMinMaxWidth();
       if (element() && style()->autoWrap()) {
           // See if nowrap was set.
  +        Length w = styleOrColWidth();
           DOMString nowrap = static_cast<ElementImpl*>(element())->getAttribute(nowrapAttr);
  -        if (!nowrap.isNull() && style()->width().isFixed())
  +        if (!nowrap.isNull() && w.isFixed())
               // Nowrap is set, but we didn't actually use it because of the
               // fixed width set on the cell.  Even so, it is a WinIE/Moz trait
               // to make the minwidth of the cell into the fixed width.  They do this
               // even in strict mode, so do not make this a quirk.  Affected the top
               // of hiptop.com.
  -            if (m_minWidth < style()->width().value)
  -                m_minWidth = style()->width().value;
  +            if (m_minWidth < w.value)
  +                m_minWidth = w.value;
       }
   }
   
  
  
  
  1.51      +2 -0      WebCore/khtml/rendering/render_table.h
  
  Index: render_table.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/render_table.h,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- render_table.h	17 Nov 2005 23:40:01 -0000	1.50
  +++ render_table.h	30 Nov 2005 02:51:57 -0000	1.51
  @@ -337,6 +337,8 @@
       int row() const { return _row; }
       void setRow(int r) { _row = r; }
   
  +    Length styleOrColWidth();
  +
       // overrides
       virtual void calcMinMaxWidth();
       virtual void calcWidth();
  
  
  
  1.27      +4 -4      WebCore/khtml/rendering/table_layout.cpp
  
  Index: table_layout.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/rendering/table_layout.cpp,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- table_layout.cpp	17 Nov 2005 18:44:54 -0000	1.26
  +++ table_layout.cpp	30 Nov 2005 02:51:57 -0000	1.27
  @@ -20,7 +20,7 @@
    * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    * Boston, MA 02111-1307, USA.
    *
  - * $Id: table_layout.cpp,v 1.26 2005/11/17 18:44:54 bdakin Exp $
  + * $Id: table_layout.cpp,v 1.27 2005/11/30 02:51:57 eseidel Exp $
    */
   #include "config.h"
   #include "table_layout.h"
  @@ -181,7 +181,7 @@
   	while ( child ) {
   	    if ( child->isTableCell() ) {
   		RenderTableCell *cell = static_cast<RenderTableCell *>(child);
  -		Length w = cell->style()->width();
  +		Length w = cell->styleOrColWidth();
   		int span = cell->colSpan();
   		int effWidth = 0;
   		if ( (w.type == Fixed || w.type == Percent) && w.value > 0 )
  @@ -395,7 +395,7 @@
   			maxContributor = cell;
   		    }
   
  -		    Length w = cell->style()->width();
  +		    Length w = cell->styleOrColWidth();
   		    if (w.value > 32760)
   			w.value = 32760;
   		    if (w.value < 0)
  @@ -632,7 +632,7 @@
   	    break;
   	int span = cell->colSpan();
   
  -	Length w = cell->style()->width();
  +	Length w = cell->styleOrColWidth();
   	if ( !(w.type == Relative) && w.value == 0 )
   	    w = Length(); // make it Auto
   
  
  
  



More information about the webkit-changes mailing list