Changeset 125917 in webkit


Ignore:
Timestamp:
Aug 17, 2012 11:31:56 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

ASSERTION FAILED: allocatedMaxLogicalWidth <= cellMaxLogicalWidth : int WebCore::AutoTableLayout::calcEffectiveLogicalWidth()
https://bugs.webkit.org/show_bug.cgi?id=92471

Patch by Arpita Bahuguna <arpitabahuguna@gmail.com> on 2012-08-17
Reviewed by Julien Chaffraix.

Source/WebCore:

The assert occurs due to the float based computations causing a floating
point rounding error between allocatedMaxLogicalWidth and cellMaxLogicalWidth.

Test: fast/table/assert-autotablelayout-maxlogicalwidth.html

  • rendering/AutoTableLayout.cpp:

(WebCore::AutoTableLayout::calcEffectiveLogicalWidth):
Converting float based calculations for computing max logical width to int based;
similar to the calculations for min logical width.

LayoutTests:

  • fast/table/assert-autotablelayout-maxlogicalwidth-expected.txt: Added.
  • fast/table/assert-autotablelayout-maxlogicalwidth.html: Added.

Added a testcase for verifying that the assert in AutoTableLayout::calcEffectiveLogicalWidth()
for allocatedMaxLogicalWidth coming greater than cellMaxLogicalWidth, does not occur.

Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r125914 r125917  
     12012-08-17  Arpita Bahuguna  <arpitabahuguna@gmail.com>
     2
     3        ASSERTION FAILED: allocatedMaxLogicalWidth <= cellMaxLogicalWidth : int WebCore::AutoTableLayout::calcEffectiveLogicalWidth()
     4        https://bugs.webkit.org/show_bug.cgi?id=92471
     5
     6        Reviewed by Julien Chaffraix.
     7
     8        * fast/table/assert-autotablelayout-maxlogicalwidth-expected.txt: Added.
     9        * fast/table/assert-autotablelayout-maxlogicalwidth.html: Added.
     10        Added a testcase for verifying that the assert in AutoTableLayout::calcEffectiveLogicalWidth()
     11        for allocatedMaxLogicalWidth coming greater than cellMaxLogicalWidth, does not occur.
     12
    1132012-08-17  Adrienne Walker  <enne@google.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r125916 r125917  
     12012-08-17  Arpita Bahuguna  <arpitabahuguna@gmail.com>
     2
     3        ASSERTION FAILED: allocatedMaxLogicalWidth <= cellMaxLogicalWidth : int WebCore::AutoTableLayout::calcEffectiveLogicalWidth()
     4        https://bugs.webkit.org/show_bug.cgi?id=92471
     5
     6        Reviewed by Julien Chaffraix.
     7
     8        The assert occurs due to the float based computations causing a floating
     9        point rounding error between allocatedMaxLogicalWidth and cellMaxLogicalWidth.
     10
     11        Test: fast/table/assert-autotablelayout-maxlogicalwidth.html
     12
     13        * rendering/AutoTableLayout.cpp:
     14        (WebCore::AutoTableLayout::calcEffectiveLogicalWidth):
     15        Converting float based calculations for computing max logical width to int based;
     16        similar to the calculations for min logical width.
     17
    1182012-08-17  John J. Barton  <johnjbarton@chromium.org>
    219
  • trunk/Source/WebCore/rendering/AutoTableLayout.cpp

    r125694 r125917  
    278278int AutoTableLayout::calcEffectiveLogicalWidth()
    279279{
    280     float maxLogicalWidth = 0;
     280    int maxLogicalWidth = 0;
    281281
    282282    size_t nEffCols = m_layoutStruct.size();
     
    303303        size_t lastCol = effCol;
    304304        int cellMinLogicalWidth = cell->minPreferredLogicalWidth() + spacingInRowDirection;
    305         float cellMaxLogicalWidth = cell->maxPreferredLogicalWidth() + spacingInRowDirection;
     305        int cellMaxLogicalWidth = cell->maxPreferredLogicalWidth() + spacingInRowDirection;
    306306        float totalPercent = 0;
    307307        int spanMinLogicalWidth = 0;
    308         float spanMaxLogicalWidth = 0;
     308        int spanMaxLogicalWidth = 0;
    309309        bool allColsArePercent = true;
    310310        bool allColsAreFixed = true;
     
    362362                cellLogicalWidth = Length();
    363363            } else {
    364                 maxLogicalWidth = max(maxLogicalWidth, static_cast<float>(max(spanMaxLogicalWidth, cellMaxLogicalWidth) * 100  / cellLogicalWidth.percent()));
     364                maxLogicalWidth = max(maxLogicalWidth, static_cast<int>(max(spanMaxLogicalWidth, cellMaxLogicalWidth) * 100  / cellLogicalWidth.percent()));
    365365
    366366                // all non percent columns in the span get percent values to sum up correctly.
    367367                float percentMissing = cellLogicalWidth.percent() - totalPercent;
    368                 float totalWidth = 0;
     368                int totalWidth = 0;
    369369                for (unsigned pos = effCol; pos < lastCol; ++pos) {
    370370                    if (!m_layoutStruct[pos].effectiveLogicalWidth.isPercent())
     
    398398                // In this case, we just split the colspan's min amd max widths following the percentage.
    399399                int allocatedMinLogicalWidth = 0;
    400                 float allocatedMaxLogicalWidth = 0;
     400                int allocatedMaxLogicalWidth = 0;
    401401                for (unsigned pos = effCol; pos < lastCol; ++pos) {
    402402                    ASSERT(m_layoutStruct[pos].logicalWidth.isPercent() || m_layoutStruct[pos].effectiveLogicalWidth.isPercent());
     
    404404                    float percent = m_layoutStruct[pos].logicalWidth.isPercent() ? m_layoutStruct[pos].logicalWidth.percent() : m_layoutStruct[pos].effectiveLogicalWidth.percent();
    405405                    int columnMinLogicalWidth = static_cast<int>(percent * cellMinLogicalWidth / totalPercent);
    406                     float columnMaxLogicalWidth = percent * cellMaxLogicalWidth / totalPercent;
     406                    int columnMaxLogicalWidth = static_cast<int>(percent * cellMaxLogicalWidth / totalPercent);
    407407                    m_layoutStruct[pos].effectiveMinLogicalWidth = max(m_layoutStruct[pos].effectiveMinLogicalWidth, columnMinLogicalWidth);
    408408                    m_layoutStruct[pos].effectiveMaxLogicalWidth = columnMaxLogicalWidth;
     
    415415                cellMaxLogicalWidth -= allocatedMaxLogicalWidth;
    416416            } else {
    417                 float remainingMaxLogicalWidth = spanMaxLogicalWidth;
     417                int remainingMaxLogicalWidth = spanMaxLogicalWidth;
    418418                int remainingMinLogicalWidth = spanMinLogicalWidth;
    419419               
     
    463463    m_effectiveLogicalWidthDirty = false;
    464464
    465     return static_cast<int>(min(maxLogicalWidth, INT_MAX / 2.0f));
     465    return min(maxLogicalWidth, INT_MAX / 2);
    466466}
    467467
Note: See TracChangeset for help on using the changeset viewer.