Changeset 28118 in webkit


Ignore:
Timestamp:
Nov 28, 2007, 2:04:44 PM (17 years ago)
Author:
mitz@apple.com
Message:

WebCore:

Reviewed by Dave Hyatt.

  • fix <rdar://problem/5612459> CrashTracer: [REGRESSION] 61 crashes in Safari at com.apple.WebCore: WebCore::AutoTableLayout::layout + 2046

Test: fast/table/empty-auto-column-zero-divide.html

  • rendering/AutoTableLayout.cpp: (WebCore::AutoTableLayout::recalcColumn): (WebCore::AutoTableLayout::fullRecalc): (WebCore::AutoTableLayout::calcEffectiveWidth): (WebCore::AutoTableLayout::layout): When distributing the remaining width among columns, skip those whose effective (rather than specified) width is auto and contain only empty cells.

LayoutTests:

Reviewed by Dave Hyatt.

  • test for <rdar://problem/5612459> CrashTracer: [REGRESSION] 61 crashes in Safari at com.apple.WebCore: WebCore::AutoTableLayout::layout + 2046
  • fast/table/empty-auto-column-zero-divide-expected.txt: Added.
  • fast/table/empty-auto-column-zero-divide.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r28113 r28118  
     12007-11-28  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Dave Hyatt.
     4
     5        - test for <rdar://problem/5612459> CrashTracer: [REGRESSION] 61 crashes in Safari at com.apple.WebCore: WebCore::AutoTableLayout::layout + 2046
     6
     7        * fast/table/empty-auto-column-zero-divide-expected.txt: Added.
     8        * fast/table/empty-auto-column-zero-divide.html: Added.
     9
    1102007-11-28  Jon Honeycutt  <jhoneycutt@apple.com>
    211
  • trunk/WebCore/ChangeLog

    r28114 r28118  
     12007-11-28  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Dave Hyatt.
     4
     5        - fix <rdar://problem/5612459> CrashTracer: [REGRESSION] 61 crashes in Safari at com.apple.WebCore: WebCore::AutoTableLayout::layout + 2046
     6
     7        Test: fast/table/empty-auto-column-zero-divide.html
     8
     9        * rendering/AutoTableLayout.cpp:
     10        (WebCore::AutoTableLayout::recalcColumn):
     11        (WebCore::AutoTableLayout::fullRecalc):
     12        (WebCore::AutoTableLayout::calcEffectiveWidth):
     13        (WebCore::AutoTableLayout::layout): When distributing the remaining
     14        width among columns, skip those whose effective (rather than
     15        specified) width is auto and contain only empty cells.
     16
    1172007-11-28  Peter Kasting  <zerodpx@gmail.com>
    218
  • trunk/WebCore/rendering/AutoTableLayout.cpp

    r25754 r28118  
    150150
    151151    l.maxWidth = max(l.maxWidth, l.minWidth);
    152 #ifdef DEBUG_LAYOUT
    153     qDebug("col %d, final min=%d, max=%d, width=%d(%d)", effCol, l.minWidth, l.maxWidth, l.width.value,  l.width.type);
    154 #endif
    155152
    156153    // ### we need to add col elements as well
     
    184181                    w = Length();
    185182                int cEffCol = m_table->colToEffCol(cCol);
    186 #ifdef DEBUG_LAYOUT
    187                 qDebug("    col element %d (eff=%d): Length=%d(%d), span=%d, effColSpan=%d",  cCol, cEffCol, w.value, w.type, span, m_table->spanOfEffCol(cEffCol));
    188 #endif
    189183                if (!w.isAuto() && span == 1 && cEffCol < nEffCols) {
    190184                    if (m_table->spanOfEffCol(cEffCol) == 1) {
     
    307301    unsigned int nEffCols = m_layoutStruct.size();
    308302    int hspacing = m_table->hBorderSpacing();
    309 #ifdef DEBUG_LAYOUT
    310     qDebug("AutoTableLayout::calcEffectiveWidth for %d cols", nEffCols);
    311 #endif
     303
    312304    for (unsigned int i = 0; i < nEffCols; i++) {
    313305        m_layoutStruct[i].effWidth = m_layoutStruct[i].width;
     
    513505        nEffCols = m_table->numEffCols();
    514506    }
    515 #ifdef DEBUG_LAYOUT
    516     qDebug("AutoTableLayout::layout()");
    517 #endif
    518507
    519508    if (m_effWidthDirty)
    520509        calcEffectiveWidth();
    521 
    522 #ifdef DEBUG_LAYOUT
    523     qDebug("    tableWidth=%d,  nEffCols=%d", tableWidth,  nEffCols);
    524     for (int i = 0; i < nEffCols; i++) {
    525         qDebug("    effcol %d is of type %d value %d, minWidth=%d, maxWidth=%d",
    526                i, m_layoutStruct[i].width.type, m_layoutStruct[i].width.value,
    527                m_layoutStruct[i].minWidth, m_layoutStruct[i].maxWidth);
    528         qDebug("        effective: type %d value %d, minWidth=%d, maxWidth=%d",
    529                m_layoutStruct[i].effWidth.type, m_layoutStruct[i].effWidth.value,
    530                m_layoutStruct[i].effMinWidth, m_layoutStruct[i].effMaxWidth);
    531     }
    532 #endif
    533510
    534511    bool havePercent = false;
     
    604581        }
    605582    }
    606 #ifdef DEBUG_LAYOUT
    607     qDebug("percent satisfied: available is %d", available);
    608 #endif
    609583   
    610584    // then allocate width to fixed cols
     
    618592        }
    619593    }
    620 #ifdef DEBUG_LAYOUT
    621     qDebug("fixed satisfied: available is %d", available);
    622 #endif
    623594
    624595    // now satisfy relative
     
    648619        }
    649620    }
    650 #ifdef DEBUG_LAYOUT
    651     qDebug("variable satisfied: available is %d",  available);
    652 #endif
    653621
    654622    // spread over fixed columns
     
    665633        }
    666634    }
    667    
    668 #ifdef DEBUG_LAYOUT
    669     qDebug("after fixed distribution: available=%d",  available);
    670 #endif
    671    
     635
    672636    // spread over percent colums
    673637    if (available > 0 && m_hasPercent && totalPercent < 100 * percentScaleFactor) {
     
    685649    }
    686650
    687 #ifdef DEBUG_LAYOUT
    688     qDebug("after percent distribution: available=%d",  available);
    689 #endif
    690 
    691651    // spread over the rest
    692652    if (available > 0 && nEffCols > numAutoEmptyCellsOnly) {
     
    696656        while (i--) {
    697657            // variable columns with empty cells only don't get any width
    698             if (m_layoutStruct[i].width.isAuto() && m_layoutStruct[i].emptyCellsOnly)
     658            if (m_layoutStruct[i].effWidth.isAuto() && m_layoutStruct[i].emptyCellsOnly)
    699659                continue;
    700660            int w = available / total;
     
    705665    }
    706666
    707 #ifdef DEBUG_LAYOUT
    708     qDebug("after equal distribution: available=%d",  available);
    709 #endif
    710667    // if we have overallocated, reduce every cell according to the difference between desired width and minwidth
    711668    // this seems to produce to the pixel exaxt results with IE. Wonder is some of this also holds for width distributing.
     
    808765    int pos = 0;
    809766    for (int i = 0; i < nEffCols; i++) {
    810 #ifdef DEBUG_LAYOUT
    811         qDebug("col %d: %d (width %d)", i, pos, m_layoutStruct[i].calcWidth);
    812 #endif
    813767        m_table->columnPositions()[i] = pos;
    814768        pos += m_layoutStruct[i].calcWidth + m_table->hBorderSpacing();
Note: See TracChangeset for help on using the changeset viewer.