[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

hyatt hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:32:09 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit c17fb1961751ef53f5da5045fdcfbb598c0536bf
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Mar 28 02:17:17 2003 +0000

    	A collection of fixes for tables.
    
    	(1) Fixed table layout should only be used if an explicit width
    	is specified on a table.
    	(2) width="0" and height="0" should be ignored on table cells!
    	(3) Fixed table layout wasn't spreading extra space over
    	columns.
    
            Reviewed by mjs
    
            * khtml/html/html_tableimpl.cpp:
            (HTMLTableCellElementImpl::parseAttribute):
            * khtml/rendering/render_table.cpp:
            (RenderTable::setStyle):
            * khtml/rendering/table_layout.cpp:
            (FixedTableLayout::layout):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3952 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 51c8d05..5c4801a 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,5 +1,24 @@
 2003-03-27  David Hyatt  <hyatt at apple.com>
 
+	A collection of fixes for tables.
+
+	(1) Fixed table layout should only be used if an explicit width
+	is specified on a table.
+	(2) width="0" and height="0" should be ignored on table cells!
+	(3) Fixed table layout wasn't spreading extra space over 
+	columns.
+	
+        Reviewed by mjs
+
+        * khtml/html/html_tableimpl.cpp:
+        (HTMLTableCellElementImpl::parseAttribute):
+        * khtml/rendering/render_table.cpp:
+        (RenderTable::setStyle):
+        * khtml/rendering/table_layout.cpp:
+        (FixedTableLayout::layout):
+
+2003-03-27  David Hyatt  <hyatt at apple.com>
+
 	Fix for the top of directory.apple.com.  Only use the fixed
 	width on the cell (with nowrap set) if it is *larger* than
 	our current minwidth.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 51c8d05..5c4801a 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,5 +1,24 @@
 2003-03-27  David Hyatt  <hyatt at apple.com>
 
+	A collection of fixes for tables.
+
+	(1) Fixed table layout should only be used if an explicit width
+	is specified on a table.
+	(2) width="0" and height="0" should be ignored on table cells!
+	(3) Fixed table layout wasn't spreading extra space over 
+	columns.
+	
+        Reviewed by mjs
+
+        * khtml/html/html_tableimpl.cpp:
+        (HTMLTableCellElementImpl::parseAttribute):
+        * khtml/rendering/render_table.cpp:
+        (RenderTable::setStyle):
+        * khtml/rendering/table_layout.cpp:
+        (FixedTableLayout::layout):
+
+2003-03-27  David Hyatt  <hyatt at apple.com>
+
 	Fix for the top of directory.apple.com.  Only use the fixed
 	width on the cell (with nowrap set) if it is *larger* than
 	our current minwidth.
diff --git a/WebCore/khtml/html/html_tableimpl.cpp b/WebCore/khtml/html/html_tableimpl.cpp
index 53a017e..87fe158 100644
--- a/WebCore/khtml/html/html_tableimpl.cpp
+++ b/WebCore/khtml/html/html_tableimpl.cpp
@@ -854,11 +854,23 @@ void HTMLTableCellElementImpl::parseAttribute(AttributeImpl *attr)
             removeCSSProperty(CSS_PROP_WHITE_SPACE);
         break;
     case ATTR_WIDTH:
-        if (!attr->value().isEmpty())
-            addCSSLength( CSS_PROP_WIDTH, attr->value() );
+        if (!attr->value().isEmpty()) {
+            int widthInt = attr->val()->toInt();
+            if (widthInt > 0) // width="0" is ignored for compatibility with WinIE.
+                addCSSLength( CSS_PROP_WIDTH, attr->value() );
+        }
         else
             removeCSSProperty(CSS_PROP_WIDTH);
         break;
+    case ATTR_HEIGHT:
+        if (!attr->value().isEmpty()) {
+            int heightInt = attr->val()->toInt();
+            if (heightInt > 0) // height="0" is ignored for compatibility with WinIE.
+                addCSSLength( CSS_PROP_HEIGHT, attr->value() );
+        }
+        else
+            removeCSSProperty(CSS_PROP_HEIGHT);
+        break;
     case ATTR_NOSAVE:
 	break;
     default:
diff --git a/WebCore/khtml/rendering/render_table.cpp b/WebCore/khtml/rendering/render_table.cpp
index 83c7570..6a979f1 100644
--- a/WebCore/khtml/rendering/render_table.cpp
+++ b/WebCore/khtml/rendering/render_table.cpp
@@ -91,7 +91,9 @@ void RenderTable::setStyle(RenderStyle *_style)
     if ( !tableLayout || style()->tableLayout() != oldTableLayout ) {
 	delete tableLayout;
 
-	if (style()->tableLayout() == TFIXED ) {
+        // According to the CSS2 spec, you only use fixed table layout if an
+        // explicit width is specified on the table.  Auto width implies auto table layout.
+	if (style()->tableLayout() == TFIXED && !style()->width().isVariable()) {
 	    tableLayout = new FixedTableLayout(this);
 #ifdef DEBUG_LAYOUT
 	    kdDebug( 6040 ) << "using fixed table layout" << endl;
diff --git a/WebCore/khtml/rendering/table_layout.cpp b/WebCore/khtml/rendering/table_layout.cpp
index cfd3ad5..45792af 100644
--- a/WebCore/khtml/rendering/table_layout.cpp
+++ b/WebCore/khtml/rendering/table_layout.cpp
@@ -263,6 +263,8 @@ void FixedTableLayout::layout()
     int tableWidth = table->width() - table->bordersAndSpacing();
     int available = tableWidth;
     int nEffCols = table->numEffCols();
+    int totalPercent = 0;
+    
 #ifdef DEBUG_LAYOUT
     qDebug("FixedTableLayout::layout: tableWidth=%d, numEffCols=%d",  tableWidth, nEffCols);
 #endif
@@ -272,30 +274,21 @@ void FixedTableLayout::layout()
     calcWidth.resize( nEffCols );
     calcWidth.fill( -1 );
 
-    // first assign  fixed width
-    for ( int i = 0; i < nEffCols; i++ ) {
-	if ( width[i].type == Fixed ) {
-	    calcWidth[i] = width[i].value;
-	    available -= width[i].value;
-	}
-    }
-
     // assign  percent width
     if ( available > 0 ) {
-	int totalPercent = 0;
-	for ( int i = 0; i < nEffCols; i++ )
-	    if ( width[i].type == Percent )
-		totalPercent += width[i].value;
+        for ( int i = 0; i < nEffCols; i++ )
+            if ( width[i].type == Percent )
+                totalPercent += width[i].value;
 
-	// calculate how much to distribute to percent cells.
-	int base = tableWidth * totalPercent / 100;
-	if ( base > available )
-	    base = available;
-	else
-	    totalPercent = 100;
+        // calculate how much to distribute to percent cells.
+        int base = tableWidth * totalPercent / 100;
+        if ( base > available )
+            base = available;
+        else
+            totalPercent = 100;
 
 #ifdef DEBUG_LAYOUT
-    qDebug("FixedTableLayout::layout: assigning percent width, base=%d, totalPercent=%d", base, totalPercent);
+        qDebug("FixedTableLayout::layout: assigning percent width, base=%d, totalPercent=%d", base, totalPercent);
 #endif
         for ( int i = 0; available > 0 && i < nEffCols; i++ ) {
             if ( width[i].type == Percent ) {
@@ -305,8 +298,16 @@ void FixedTableLayout::layout()
             }
         }
     }
+    
+    // next assign fixed width
+    for ( int i = 0; i < nEffCols; i++ ) {
+	if ( width[i].type == Fixed ) {
+	    calcWidth[i] = width[i].value;
+	    available -= width[i].value;
+	}
+    }
 
-    // assign  variable width
+    // assign variable width
     if ( available > 0 ) {
 	int totalVariable = 0;
 	for ( int i = 0; i < nEffCols; i++ )
@@ -327,6 +328,19 @@ void FixedTableLayout::layout()
 	if ( calcWidth[i] <= 0 )
 	    calcWidth[i] = 0; // IE gives min 1 px...
 
+    // spread extra space over columns
+    if ( available > 0 ) {
+        int total = nEffCols;
+        // still have some width to spread
+        int i = nEffCols;
+        while (  i-- ) {
+            int w = available / total;
+            available -= w;
+            total--;
+            calcWidth[i] += w;
+        }
+    }
+    
     int pos = 0;
     int spacing = table->cellSpacing();
     for ( int i = 0; i < nEffCols; i++ ) {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list