Changeset 81097 in webkit


Ignore:
Timestamp:
Mar 14, 2011 7:17:53 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-03-14 Rik Cabanier <cabanier@gmail.com>

Reviewed by David Hyatt.

bug 56052: percentages are incorrectly rounded in WebKit
https://bugs.webkit.org/show_bug.cgi?id=56052

  • platform/mac/fast/css/percentage-non-integer-expected.txt:

2011-03-14 Rik Cabanier <cabanier@adobe.com>

Reviewed by David Hyatt.

bug 56052: percentages are incorrectly rounded in WebKit
https://bugs.webkit.org/show_bug.cgi?id=56052

test: fast/css/percentage-non-integer.html

  • css/CSSStyleSelector.cpp: (WebCore::CSSStyleSelector::applyProperty):
  • page/PrintContext.cpp: (WebCore::PrintContext::pageProperty):
  • platform/Length.h: (WebCore::Length::Length): (WebCore::Length::operator*=): (WebCore::Length::value): (WebCore::Length::percent): (WebCore::Length::setValue): (WebCore::Length::calcValue): (WebCore::Length::calcMinValue): (WebCore::Length::isUndefined): (WebCore::Length::isZero): (WebCore::Length::isPositive): (WebCore::Length::isNegative):
  • rendering/AutoTableLayout.cpp: (WebCore::AutoTableLayout::recalcColumn): (WebCore::AutoTableLayout::computePreferredLogicalWidths): (WebCore::AutoTableLayout::calcEffectiveLogicalWidth): (WebCore::AutoTableLayout::layout):
  • rendering/FixedTableLayout.cpp: (WebCore::FixedTableLayout::calcWidthArray): (WebCore::FixedTableLayout::layout):
  • rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::addCell): (WebCore::RenderTableSection::layoutRows):
  • rendering/style/BorderData.h: (WebCore::BorderData::hasBorderRadius):
Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r81095 r81097  
     12011-03-14  Rik Cabanier  <cabanier@gmail.com>
     2
     3        Reviewed by David Hyatt.
     4
     5        bug 56052: percentages are incorrectly rounded in WebKit
     6        https://bugs.webkit.org/show_bug.cgi?id=56052
     7
     8        * platform/mac/fast/css/percentage-non-integer-expected.txt:
     9
    1102011-03-14  Anton Muhin  <antonm@chromium.org>
    211
  • trunk/LayoutTests/platform/mac/fast/css/percentage-non-integer-expected.checksum

    r38008 r81097  
    1 414caaa2ee09823fcc6b1200d30ec127
     1c6d9055341a9904929ccc49476c7bd9e
  • trunk/LayoutTests/platform/mac/fast/css/percentage-non-integer-expected.txt

    r73385 r81097  
    3030          RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
    3131        RenderBlock {DIV} at (0,48) size 910x4
    32           RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
     32          RenderBlock {DIV} at (0,0) size 101x4 [bgcolor=#0000007F]
    3333        RenderBlock {DIV} at (0,52) size 900x4
    3434          RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
     
    5050          RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
    5151        RenderBlock {DIV} at (0,88) size 835x4
    52           RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
     52          RenderBlock {DIV} at (0,0) size 101x4 [bgcolor=#0000007F]
    5353        RenderBlock {DIV} at (0,92) size 825x4
    5454          RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
     
    8585    RenderTableSection {TBODY} at (0,0) size 1000x20
    8686      RenderTableRow {TR} at (0,0) size 1000x20
    87         RenderTableCell {TD} at (0,1) size 11x18 [bgcolor=#0000007F] [r=0 c=0 rs=1 cs=1]
     87        RenderTableCell {TD} at (0,1) size 12x18 [bgcolor=#0000007F] [r=0 c=0 rs=1 cs=1]
    8888          RenderText {#text} at (0,0) size 4x18
    8989            text run at (0,0) width 4: " "
    90         RenderTableCell {TD} at (11,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=1 rs=1 cs=1]
     90        RenderTableCell {TD} at (12,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=1 rs=1 cs=1]
    9191          RenderText {#text} at (0,0) size 4x18
    9292            text run at (0,0) width 4: " "
    93         RenderTableCell {TD} at (21,1) size 13x18 [bgcolor=#0000007F] [r=0 c=2 rs=1 cs=1]
     93        RenderTableCell {TD} at (22,1) size 13x18 [bgcolor=#0000007F] [r=0 c=2 rs=1 cs=1]
    9494          RenderText {#text} at (0,0) size 4x18
    9595            text run at (0,0) width 4: " "
    96         RenderTableCell {TD} at (34,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=3 rs=1 cs=1]
     96        RenderTableCell {TD} at (35,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=3 rs=1 cs=1]
    9797          RenderText {#text} at (0,0) size 4x18
    9898            text run at (0,0) width 4: " "
    99         RenderTableCell {TD} at (44,1) size 15x18 [bgcolor=#0000007F] [r=0 c=4 rs=1 cs=1]
     99        RenderTableCell {TD} at (45,1) size 16x18 [bgcolor=#0000007F] [r=0 c=4 rs=1 cs=1]
    100100          RenderText {#text} at (0,0) size 4x18
    101101            text run at (0,0) width 4: " "
    102         RenderTableCell {TD} at (59,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=5 rs=1 cs=1]
     102        RenderTableCell {TD} at (61,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=5 rs=1 cs=1]
    103103          RenderText {#text} at (0,0) size 4x18
    104104            text run at (0,0) width 4: " "
    105         RenderTableCell {TD} at (69,1) size 17x18 [bgcolor=#0000007F] [r=0 c=6 rs=1 cs=1]
     105        RenderTableCell {TD} at (71,1) size 17x18 [bgcolor=#0000007F] [r=0 c=6 rs=1 cs=1]
    106106          RenderText {#text} at (0,0) size 4x18
    107107            text run at (0,0) width 4: " "
    108         RenderTableCell {TD} at (86,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=7 rs=1 cs=1]
     108        RenderTableCell {TD} at (88,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=7 rs=1 cs=1]
    109109          RenderText {#text} at (0,0) size 4x18
    110110            text run at (0,0) width 4: " "
    111         RenderTableCell {TD} at (96,1) size 20x18 [bgcolor=#0000007F] [r=0 c=8 rs=1 cs=1]
     111        RenderTableCell {TD} at (98,1) size 20x18 [bgcolor=#0000007F] [r=0 c=8 rs=1 cs=1]
    112112          RenderText {#text} at (0,0) size 4x18
    113113            text run at (0,0) width 4: " "
    114         RenderTableCell {TD} at (116,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=9 rs=1 cs=1]
     114        RenderTableCell {TD} at (118,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=9 rs=1 cs=1]
    115115          RenderText {#text} at (0,0) size 4x18
    116116            text run at (0,0) width 4: " "
    117         RenderTableCell {TD} at (126,1) size 21x18 [bgcolor=#0000007F] [r=0 c=10 rs=1 cs=1]
     117        RenderTableCell {TD} at (128,1) size 22x18 [bgcolor=#0000007F] [r=0 c=10 rs=1 cs=1]
    118118          RenderText {#text} at (0,0) size 4x18
    119119            text run at (0,0) width 4: " "
    120         RenderTableCell {TD} at (147,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=11 rs=1 cs=1]
     120        RenderTableCell {TD} at (150,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=11 rs=1 cs=1]
    121121          RenderText {#text} at (0,0) size 4x18
    122122            text run at (0,0) width 4: " "
    123         RenderTableCell {TD} at (157,1) size 23x18 [bgcolor=#0000007F] [r=0 c=12 rs=1 cs=1]
     123        RenderTableCell {TD} at (160,1) size 24x18 [bgcolor=#0000007F] [r=0 c=12 rs=1 cs=1]
    124124          RenderText {#text} at (0,0) size 4x18
    125125            text run at (0,0) width 4: " "
    126         RenderTableCell {TD} at (180,10) size 10x0 [bgcolor=#00FF007F] [r=0 c=13 rs=1 cs=1]
    127         RenderTableCell {TD} at (190,1) size 25x18 [bgcolor=#0000007F] [r=0 c=14 rs=1 cs=1]
     126        RenderTableCell {TD} at (184,10) size 10x0 [bgcolor=#00FF007F] [r=0 c=13 rs=1 cs=1]
     127        RenderTableCell {TD} at (194,1) size 25x18 [bgcolor=#0000007F] [r=0 c=14 rs=1 cs=1]
    128128          RenderText {#text} at (0,0) size 4x18
    129129            text run at (0,0) width 4: " "
    130         RenderTableCell {TD} at (215,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=15 rs=1 cs=1]
     130        RenderTableCell {TD} at (219,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=15 rs=1 cs=1]
    131131          RenderText {#text} at (0,0) size 4x18
    132132            text run at (0,0) width 4: " "
    133         RenderTableCell {TD} at (225,1) size 27x18 [bgcolor=#0000007F] [r=0 c=16 rs=1 cs=1]
     133        RenderTableCell {TD} at (229,1) size 27x18 [bgcolor=#0000007F] [r=0 c=16 rs=1 cs=1]
    134134          RenderText {#text} at (0,0) size 4x18
    135135            text run at (0,0) width 4: " "
    136         RenderTableCell {TD} at (252,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=17 rs=1 cs=1]
     136        RenderTableCell {TD} at (256,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=17 rs=1 cs=1]
    137137          RenderText {#text} at (0,0) size 4x18
    138138            text run at (0,0) width 4: " "
    139         RenderTableCell {TD} at (262,1) size 30x18 [bgcolor=#0000007F] [r=0 c=18 rs=1 cs=1]
     139        RenderTableCell {TD} at (266,1) size 30x18 [bgcolor=#0000007F] [r=0 c=18 rs=1 cs=1]
    140140          RenderText {#text} at (0,0) size 4x18
    141141            text run at (0,0) width 4: " "
    142         RenderTableCell {TD} at (292,1) size 708x18 [r=0 c=19 rs=1 cs=1]
     142        RenderTableCell {TD} at (296,1) size 704x18 [r=0 c=19 rs=1 cs=1]
    143143          RenderText {#text} at (0,0) size 4x18
    144144            text run at (0,0) width 4: " "
  • trunk/Source/WebCore/ChangeLog

    r81096 r81097  
     12011-03-14  Rik Cabanier  <cabanier@adobe.com>
     2
     3        Reviewed by David Hyatt.
     4
     5        bug 56052: percentages are incorrectly rounded in WebKit
     6        https://bugs.webkit.org/show_bug.cgi?id=56052
     7
     8        test: fast/css/percentage-non-integer.html
     9
     10        * css/CSSStyleSelector.cpp:
     11        (WebCore::CSSStyleSelector::applyProperty):
     12        * page/PrintContext.cpp:
     13        (WebCore::PrintContext::pageProperty):
     14        * platform/Length.h:
     15        (WebCore::Length::Length):
     16        (WebCore::Length::operator*=):
     17        (WebCore::Length::value):
     18        (WebCore::Length::percent):
     19        (WebCore::Length::setValue):
     20        (WebCore::Length::calcValue):
     21        (WebCore::Length::calcMinValue):
     22        (WebCore::Length::isUndefined):
     23        (WebCore::Length::isZero):
     24        (WebCore::Length::isPositive):
     25        (WebCore::Length::isNegative):
     26        * rendering/AutoTableLayout.cpp:
     27        (WebCore::AutoTableLayout::recalcColumn):
     28        (WebCore::AutoTableLayout::computePreferredLogicalWidths):
     29        (WebCore::AutoTableLayout::calcEffectiveLogicalWidth):
     30        (WebCore::AutoTableLayout::layout):
     31        * rendering/FixedTableLayout.cpp:
     32        (WebCore::FixedTableLayout::calcWidthArray):
     33        (WebCore::FixedTableLayout::layout):
     34        * rendering/RenderTableSection.cpp:
     35        (WebCore::RenderTableSection::addCell):
     36        (WebCore::RenderTableSection::layoutRows):
     37        * rendering/style/BorderData.h:
     38        (WebCore::BorderData::hasBorderRadius):
     39
    1402011-03-14  Adam Barth  <abarth@webkit.org>
    241
  • trunk/Source/WebCore/css/CSSStyleSelector.cpp

    r81049 r81097  
    52665266        else
    52675267            radiusHeight = Length(max(intMinForLength, min(intMaxForLength, pair->second()->computeLengthInt(style(), m_rootElementStyle, zoomFactor))), Fixed);
    5268         int width = radiusWidth.rawValue();
    5269         int height = radiusHeight.rawValue();
     5268        int width = radiusWidth.value();
     5269        int height = radiusHeight.value();
    52705270        if (width < 0 || height < 0)
    52715271            return;
  • trunk/Source/WebCore/page/PrintContext.cpp

    r78434 r81097  
    283283        if (style->marginLeft().isAuto())
    284284            return String("auto");
    285         return String::number(style->marginLeft().rawValue());
     285        return String::number(style->marginLeft().value());
    286286    }
    287287    if (!strcmp(propertyName, "line-height"))
    288         return String::number(style->lineHeight().rawValue());
     288        return String::number(style->lineHeight().value());
    289289    if (!strcmp(propertyName, "font-size"))
    290290        return String::number(style->fontDescription().computedPixelSize());
     
    292292        return style->fontDescription().family().family().string();
    293293    if (!strcmp(propertyName, "size"))
    294         return makeString(String::number(style->pageSize().width().rawValue()), ' ', String::number(style->pageSize().height().rawValue()));
     294        return makeString(String::number(style->pageSize().width().value()), ' ', String::number(style->pageSize().height().value()));
    295295
    296296    return makeString("pageProperty() unimplemented for: ", propertyName);
  • trunk/Source/WebCore/platform/Length.h

    r80806 r81097  
    22    Copyright (C) 1999 Lars Knoll (knoll@kde.org)
    33    Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
     4    Copyright (C) 2011 Rik Cabanier (cabanier@adobe.com)
    45
    56    This library is free software; you can redistribute it and/or
     
    3132
    3233const int undefinedLength = -1;
    33 const int percentScaleFactor = 128;
    3434const int intMaxForLength = 0x7ffffff; // max value for a 28-bit int
    3535const int intMinForLength = (-0x7ffffff - 1); // min value for a 28-bit int
     
    5353        : m_intValue(v), m_quirk(q), m_type(t), m_isFloat(false)
    5454    {
    55         ASSERT(t != Percent);
    5655    }
    5756
    5857    Length(double v, LengthType t, bool q = false)
    59         : m_quirk(q), m_type(t), m_isFloat(false)
    60     {
    61         if (m_type == Percent)
    62             m_intValue = static_cast<int>(v*percentScaleFactor);
    63         else {
    64             m_isFloat = true;           
    65             m_floatValue = static_cast<float>(v);
    66        }
     58        : m_quirk(q), m_type(t), m_isFloat(true)
     59    {           
     60        m_floatValue = static_cast<float>(v);   
    6761    }
    6862
     
    7064    bool operator!=(const Length& o) const { return (getFloatValue() != o.getFloatValue()) || (m_type != o.m_type) || (m_quirk != o.m_quirk); }
    7165
     66    const Length& operator*=(double v)
     67    {       
     68        if (m_isFloat)
     69            m_floatValue *= v;
     70        else       
     71            m_intValue *= v;
     72       
     73        return *this;
     74    }
     75   
    7276    int value() const {
    73         ASSERT(type() != Percent);
    74         return rawValue();
    75     }
    76 
    77     int rawValue() const { return getIntValue(); }
     77        return getIntValue();
     78    }
    7879
    7980    double percent() const
    8081    {
    8182        ASSERT(type() == Percent);
    82         return static_cast<double>(rawValue()) / percentScaleFactor;
     83        return static_cast<double>(getFloatValue());
    8384    }
    8485
     
    8889    void setValue(LengthType t, int value)
    8990    {
     91        ASSERT(type() != Percent);
    9092        m_type = t;
    9193        m_intValue = value;
     
    9597    void setValue(int value)
    9698    {
    97         ASSERT(!value || type() != Percent);
    9899        setValue(Fixed, value);
    99100    }
     
    120121                if (roundPercentages)
    121122                    return static_cast<int>(round(maxValue * percent() / 100.0));
    122                 return maxValue * rawValue() / (100 * percentScaleFactor);
     123                return static_cast<int>(maxValue * percent() / 100.0);
    123124            case Auto:
    124125                return maxValue;
     
    136137                if (roundPercentages)
    137138                    return static_cast<int>(round(maxValue * percent() / 100.0));
    138                 return maxValue * rawValue() / (100 * percentScaleFactor);
     139                return static_cast<int>(maxValue * percent() / 100.0);
    139140            case Auto:
    140141            default:
     
    157158    }
    158159
    159     bool isUndefined() const { return rawValue() == undefinedLength; }
    160     bool isZero() const { return !getIntValue(); }
    161     bool isPositive() const { return rawValue() > 0; }
    162     bool isNegative() const { return rawValue() < 0; }
     160    bool isUndefined() const { return value() == undefinedLength; }
     161    bool isZero() const
     162    {
     163        if (m_isFloat)
     164            return !m_floatValue;
     165       
     166        return !m_intValue;
     167    }
     168    bool isPositive() const { return getFloatValue() > 0; }
     169    bool isNegative() const { return getFloatValue() < 0; }
    163170
    164171    bool isAuto() const { return type() == Auto; }
  • trunk/Source/WebCore/rendering/AutoTableLayout.cpp

    r80806 r81097  
    8282                    Length cellLogicalWidth = cell->styleOrColLogicalWidth();
    8383                    // FIXME: What is this arbitrary value?
    84                     if (cellLogicalWidth.rawValue() > 32760)
     84                    if (cellLogicalWidth.value() > 32760)
    8585                        cellLogicalWidth.setValue(32760);
    8686                    if (cellLogicalWidth.isNegative())
     
    106106                    case Percent:
    107107                        m_hasPercent = true;
    108                         if (cellLogicalWidth.isPositive() && (!columnLayout.logicalWidth.isPercent() || cellLogicalWidth.rawValue() > columnLayout.logicalWidth.rawValue()))
     108                        if (cellLogicalWidth.isPositive() && (!columnLayout.logicalWidth.isPercent() || cellLogicalWidth.value() > columnLayout.logicalWidth.value()))
    109109                            columnLayout.logicalWidth = cellLogicalWidth;
    110110                        break;
     
    112112                        // FIXME: Need to understand this case and whether it makes sense to compare values
    113113                        // which are not necessarily of the same type.
    114                         if (cellLogicalWidth.isAuto() || (cellLogicalWidth.isRelative() && cellLogicalWidth.value() > columnLayout.logicalWidth.rawValue()))
     114                        if (cellLogicalWidth.isAuto() || (cellLogicalWidth.isRelative() && cellLogicalWidth.value() > columnLayout.logicalWidth.value()))
    115115                            columnLayout.logicalWidth = cellLogicalWidth;
    116116                    default:
     
    233233    // We substitute 0 percent by (epsilon / percentScaleFactor) percent in two places below to avoid division by zero.
    234234    // FIXME: Handle the 0% cases properly.
    235     const int epsilon = 1;
    236 
    237     int remainingPercent = 100 * percentScaleFactor;
     235    const float epsilon = 1 / 128.0;
     236
     237    float remainingPercent = 100;
    238238    for (size_t i = 0; i < m_layoutStruct.size(); ++i) {
    239239        minWidth += m_layoutStruct[i].effectiveMinLogicalWidth;
     
    241241        if (scaleColumns) {
    242242            if (m_layoutStruct[i].effectiveLogicalWidth.isPercent()) {
    243                 int percent = min(m_layoutStruct[i].effectiveLogicalWidth.rawValue(), remainingPercent);
    244                 float logicalWidth = static_cast<float>(m_layoutStruct[i].effectiveMaxLogicalWidth) * 100 * percentScaleFactor / max(percent, epsilon);
     243                float percent = min(static_cast<float>(m_layoutStruct[i].effectiveLogicalWidth.percent()), remainingPercent);
     244                float logicalWidth = static_cast<float>(m_layoutStruct[i].effectiveMaxLogicalWidth) * 100 / max(percent, epsilon);
    245245                maxPercent = max(logicalWidth,  maxPercent);
    246246                remainingPercent -= percent;
     
    251251
    252252    if (scaleColumns) {
    253         maxNonPercent = maxNonPercent * 100 * percentScaleFactor / max(remainingPercent, epsilon);
     253        maxNonPercent = maxNonPercent * 100 / max(remainingPercent, epsilon);
    254254        maxWidth = max(maxWidth, static_cast<int>(min(maxNonPercent, INT_MAX / 2.0f)));
    255255        maxWidth = max(maxWidth, static_cast<int>(min(maxPercent, INT_MAX / 2.0f)));
     
    267267        maxWidth = minWidth;
    268268    }
     269   
     270    // if there was no remaining percent, maxWidth is invalid.
     271    if (!remainingPercent && maxNonPercent)
     272        maxWidth = intMaxForLength;       
    269273}
    270274
     
    301305        int cellMinLogicalWidth = cell->minPreferredLogicalWidth() + spacingInRowDirection;
    302306        float cellMaxLogicalWidth = cell->maxPreferredLogicalWidth() + spacingInRowDirection;
    303         int totalPercent = 0;
     307        float totalPercent = 0;
    304308        int spanMinLogicalWidth = 0;
    305309        float spanMaxLogicalWidth = 0;
     
    313317            switch (columnLayout.logicalWidth.type()) {
    314318            case Percent:
    315                 totalPercent += columnLayout.logicalWidth.rawValue();
     319                totalPercent += columnLayout.logicalWidth.percent();
    316320                allColsAreFixed = false;
    317321                break;
     
    340344                    allColsArePercent = false;
    341345                } else
    342                     totalPercent += columnLayout.effectiveLogicalWidth.rawValue();
     346                    totalPercent += columnLayout.effectiveLogicalWidth.percent();
    343347                allColsAreFixed = false;
    344348            }
     
    355359        // adjust table max width if needed
    356360        if (cellLogicalWidth.isPercent()) {
    357             if (totalPercent > cellLogicalWidth.rawValue() || allColsArePercent) {
     361            if (totalPercent > cellLogicalWidth.percent() || allColsArePercent) {
    358362                // can't satify this condition, treat as variable
    359363                cellLogicalWidth = Length();
    360364            } else {
    361                 maxLogicalWidth = max(maxLogicalWidth, max(spanMaxLogicalWidth, cellMaxLogicalWidth) * 100 * percentScaleFactor / cellLogicalWidth.rawValue());
     365                maxLogicalWidth = max(maxLogicalWidth, static_cast<float>(max(spanMaxLogicalWidth, cellMaxLogicalWidth) * 100  / cellLogicalWidth.percent()));
    362366
    363367                // all non percent columns in the span get percent values to sum up correctly.
    364                 int percentMissing = cellLogicalWidth.rawValue() - totalPercent;
     368                float percentMissing = cellLogicalWidth.percent() - totalPercent;
    365369                float totalWidth = 0;
    366370                for (unsigned pos = effCol; pos < lastCol; ++pos) {
     
    371375                for (unsigned pos = effCol; pos < lastCol && totalWidth > 0; ++pos) {
    372376                    if (!m_layoutStruct[pos].effectiveLogicalWidth.isPercent()) {
    373                         int percent = static_cast<int>(percentMissing * static_cast<float>(m_layoutStruct[pos].effectiveMaxLogicalWidth) / totalWidth);
     377                        float percent = percentMissing * static_cast<float>(m_layoutStruct[pos].effectiveMaxLogicalWidth) / totalWidth;
    374378                        totalWidth -= m_layoutStruct[pos].effectiveMaxLogicalWidth;
    375379                        percentMissing -= percent;
     
    492496    float totalAuto = 0;
    493497    float totalFixed = 0;
    494     int totalPercent = 0;
     498    float totalPercent = 0;
    495499    int allocAuto = 0;
    496500    unsigned numAutoEmptyCellsOnly = 0;
     
    505509        case Percent:
    506510            havePercent = true;
    507             totalPercent += logicalWidth.rawValue();
     511            totalPercent += logicalWidth.percent();
    508512            break;
    509513        case Relative:
     
    539543            }
    540544        }
    541         if (totalPercent > 100 * percentScaleFactor) {
     545        if (totalPercent > 100) {
    542546            // remove overallocated space from the last columns
    543             int excess = tableLogicalWidth * (totalPercent - 100 * percentScaleFactor) / (100 * percentScaleFactor);
     547            int excess = tableLogicalWidth * (totalPercent - 100) / 100;
    544548            for (int i = nEffCols - 1; i >= 0; --i) {
    545549                if (m_layoutStruct[i].effectiveLogicalWidth.isPercent()) {
     
    608612
    609613    // spread over percent colums
    610     if (available > 0 && m_hasPercent && totalPercent < 100 * percentScaleFactor) {
     614    if (available > 0 && m_hasPercent && totalPercent < 100) {
    611615        for (size_t i = 0; i < nEffCols; ++i) {
    612616            Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
    613617            if (logicalWidth.isPercent()) {
    614                 int cellLogicalWidth = available * logicalWidth.rawValue() / totalPercent;
     618                int cellLogicalWidth = available * logicalWidth.percent() / totalPercent;
    615619                available -= cellLogicalWidth;
    616                 totalPercent -= logicalWidth.rawValue();
     620                totalPercent -= logicalWidth.percent();
    617621                m_layoutStruct[i].computedLogicalWidth += cellLogicalWidth;
    618622                if (!available || !totalPercent)
  • trunk/Source/WebCore/rendering/FixedTableLayout.cpp

    r80806 r81097  
    119119                }
    120120                if ((w.isFixed() || w.isPercent()) && w.isPositive()) {
    121                     m_width[currentEffectiveColumn].setValue(w.type(), w.rawValue() * spanInCurrentEffectiveColumn);
     121                    m_width[currentEffectiveColumn] = w;
     122                    m_width[currentEffectiveColumn] *= spanInCurrentEffectiveColumn;
    122123                    usedWidth += effWidth * spanInCurrentEffectiveColumn;
    123124                }
     
    165166                int i = 0;
    166167                while (usedSpan < span && cCol + i < nEffCols) {
    167                     int eSpan = m_table->spanOfEffCol(cCol + i);
     168                    float eSpan = m_table->spanOfEffCol(cCol + i);
    168169                    // Only set if no col element has already set it.
    169170                    if (m_width[cCol + i].isAuto() && w.type() != Auto) {
    170                         m_width[cCol + i].setValue(w.type(), w.rawValue() * eSpan / span);
     171                        m_width[cCol + i] = w;
     172                        m_width[cCol + i] *= eSpan / span;
    171173                        usedWidth += effWidth * eSpan / span;
    172174                    }
     
    235237    int totalFixedWidth = 0;
    236238    int totalPercentWidth = 0;
    237     int totalRawPercent = 0;
     239    float totalPercent = 0;
    238240
    239241    // Compute requirements and try to satisfy fixed and percent widths.
     
    248250            calcWidth[i] = m_width[i].calcValue(tableLogicalWidth);
    249251            totalPercentWidth += calcWidth[i];
    250             totalRawPercent += m_width[i].rawValue();
     252            totalPercent += m_width[i].percent();
    251253        } else if (m_width[i].isAuto()) {
    252254            numAuto++;
     
    271273                }
    272274            }
    273             if (totalRawPercent) {
     275            if (totalPercent) {
    274276                totalPercentWidth = 0;
    275277                for (int i = 0; i < nEffCols; i++) {
    276278                    if (m_width[i].isPercent()) {
    277                         calcWidth[i] = m_width[i].rawValue() * (tableLogicalWidth - totalFixedWidth) / totalRawPercent;
     279                        calcWidth[i] = m_width[i].percent() * (tableLogicalWidth - totalFixedWidth) / totalPercent;
    278280                        totalPercentWidth += calcWidth[i];
    279281                    }
  • trunk/Source/WebCore/rendering/RenderTableSection.cpp

    r80878 r81097  
    200200                case Percent:
    201201                    if (!(cRowLogicalHeight.isPercent()) ||
    202                         (cRowLogicalHeight.isPercent() && cRowLogicalHeight.rawValue() < logicalHeight.rawValue()))
     202                        (cRowLogicalHeight.isPercent() && cRowLogicalHeight.percent() < logicalHeight.percent()))
    203203                        m_grid[m_cRow].logicalHeight = logicalHeight;
    204204                        break;
     
    435435                numAuto++;
    436436            else if (m_grid[r].logicalHeight.isPercent())
    437                 totalPercent += m_grid[r].logicalHeight.rawValue();
     437                totalPercent += m_grid[r].logicalHeight.percent();
    438438        }
    439439        if (totalPercent) {
    440440            // try to satisfy percent
    441441            int add = 0;
    442             totalPercent = min(totalPercent, 100 * percentScaleFactor);
     442            totalPercent = min(totalPercent, 100);
    443443            int rh = m_rowPos[1] - m_rowPos[0];
    444444            for (int r = 0; r < totalRows; r++) {
    445445                if (totalPercent > 0 && m_grid[r].logicalHeight.isPercent()) {
    446                     int toAdd = min(dh, (totalHeight * m_grid[r].logicalHeight.rawValue() / (100 * percentScaleFactor)) - rh);
     446                    int toAdd = min(dh, static_cast<int>((totalHeight * m_grid[r].logicalHeight.percent() / 100) - rh));
    447447                    // If toAdd is negative, then we don't want to shrink the row (this bug
    448448                    // affected Outlook Web Access).
     
    450450                    add += toAdd;
    451451                    dh -= toAdd;
    452                     totalPercent -= m_grid[r].logicalHeight.rawValue();
     452                    totalPercent -= m_grid[r].logicalHeight.percent();
    453453                }
    454454                if (r < totalRows - 1)
  • trunk/Source/WebCore/rendering/style/BorderData.h

    r76083 r81097  
    5050    bool hasBorderRadius() const
    5151    {
    52         if (m_topLeft.width().rawValue() > 0)
     52        if (!m_topLeft.width().isZero())
    5353            return true;
    54         if (m_topRight.width().rawValue() > 0)
     54        if (!m_topRight.width().isZero())
    5555            return true;
    56         if (m_bottomLeft.width().rawValue() > 0)
     56        if (!m_bottomLeft.width().isZero())
    5757            return true;
    58         if (m_bottomRight.width().rawValue() > 0)
     58        if (!m_bottomRight.width().isZero())
    5959            return true;
    6060        return false;
Note: See TracChangeset for help on using the changeset viewer.