KDE/kdelibs/khtml/rendering

View: New views
1 Messages — Rating Filter:   Alert me  

KDE/kdelibs/khtml/rendering

by Bugzilla from germain@ebooksfrance.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

SVN commit 1046455 by ggarand:

better handling of <col> elements in fixed-layout tables

tested in webcore/fast/table/fixed-granular-cols.html

patch by Dan Bernstein <mitz@...> wc/r42577/

 M  +20 -16    table_layout.cpp  


--- trunk/KDE/kdelibs/khtml/rendering/table_layout.cpp #1046454:1046455
@@ -93,7 +93,6 @@
 
     // iterate over all <col> elements
     RenderObject *child = table->firstChild();
-    int cCol = 0;
     int nEffCols = table->numEffCols();
     width.resize( nEffCols );
     width.fill( Length( Auto ) );
@@ -103,11 +102,11 @@
     qDebug("    col elements:");
 #endif
 
+    int currentEffectiveColumn = 0;
     Length grpWidth;
     while ( child ) {
  if ( child->isTableCol() ) {
     RenderTableCol *col = static_cast<RenderTableCol *>(child);
-    int span = col->span();
     if ( col->firstChild() ) {
  grpWidth = col->style()->width();
     } else {
@@ -123,28 +122,33 @@
  qDebug("    col element: effCol=%d, span=%d: %d w=%d type=%d",
                        cCol, span, effWidth,  w.rawValue(), w.type());
 #endif
- int usedSpan = 0;
- int i = 0;
- while ( usedSpan < span ) {
-    if( cCol + i >= nEffCols ) {
- table->appendColumn( span - usedSpan );
+                int span = col->span();
+                while (span) {
+                    int spanInCurrentEffectiveColumn;
+                    if (currentEffectiveColumn >= nEffCols) {
+                        table->appendColumn(span);
  nEffCols++;
- width.resize( nEffCols );
- width[nEffCols-1] = Length();
+                        width.append(Length());
+                        spanInCurrentEffectiveColumn = span;
+                    } else {
+                        if (span < table->spanOfEffCol(currentEffectiveColumn)) {
+                            table->splitColumn(currentEffectiveColumn, span);
+                            nEffCols++;
+                            width.append(Length());
+                        }
+                        spanInCurrentEffectiveColumn = table->spanOfEffCol(currentEffectiveColumn);
     }
-    int eSpan = table->spanOfEffCol( cCol+i );
     if ( (w.isFixed() || w.isPercent()) && w.isPositive()) {
-        width[cCol+i].setRawValue(w.type(), w.rawValue() * eSpan);
- usedWidth += effWidth * eSpan;
+                        width[currentEffectiveColumn].setRawValue(w.type(), w.rawValue() * spanInCurrentEffectiveColumn);
+                        usedWidth += effWidth * spanInCurrentEffectiveColumn;
 #ifdef DEBUG_LAYOUT
  qDebug("    setting effCol %d (span=%d) to width %d(type=%d)",
                                cCol+i, eSpan, width[cCol+i].rawValue(), width[cCol+i].type() );
 #endif
     }
-    usedSpan += eSpan;
-    i++;
+                    span -= spanInCurrentEffectiveColumn;
+                    currentEffectiveColumn++;
  }
- cCol += i;
     }
  } else {
     break;
@@ -170,7 +174,7 @@
     if ( !section )
  section = table->foot;
     if ( section && section->firstChild() ) {
- cCol = 0;
+ int cCol = 0;
  // get the first cell in the first row
  child = section->firstChild()->firstChild();
  while ( child ) {
_______________________________________________
Khtml-cvs mailing list
Khtml-cvs@...
https://mail.kde.org/mailman/listinfo/khtml-cvs