Changeset 18574 in webkit


Ignore:
Timestamp:
Jan 3, 2007 9:28:35 PM (17 years ago)
Author:
ddkilzer
Message:

LayoutTests:

Reviewed by Hyatt.

  • css2.1/t0804-c5507-padn-r-00-c-ag-expected.checksum:
  • css2.1/t0804-c5507-padn-r-00-c-ag-expected.png:
  • css2.1/t0804-c5507-padn-r-00-c-ag-expected.txt:
  • css2.1/t0804-c5509-padn-l-00-b-ag-expected.checksum:
  • css2.1/t0804-c5509-padn-l-00-b-ag-expected.png:
  • css2.1/t0804-c5509-padn-l-00-b-ag-expected.txt:
  • css2.1/t09-c5526c-display-00-e-expected.checksum:
  • css2.1/t09-c5526c-display-00-e-expected.png:
  • css2.1/t09-c5526c-display-00-e-expected.txt:
  • fast/block/basic/011-expected.checksum:
  • fast/block/basic/011-expected.png:
  • fast/block/basic/011-expected.txt:
  • fast/css/percentage-non-integer-expected.checksum: Added.
  • fast/css/percentage-non-integer-expected.png: Added.
  • fast/css/percentage-non-integer-expected.txt: Added.
  • fast/css/percentage-non-integer.html: Added.
  • tables/mozilla/bugs/bug4385-expected.checksum:
  • tables/mozilla/bugs/bug4385-expected.png:
  • tables/mozilla/bugs/bug4385-expected.txt:
  • tables/mozilla_expected_failures/core/col_span2-expected.checksum:
  • tables/mozilla_expected_failures/core/col_span2-expected.txt:

WebCore:

Reviewed by Hyatt.

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

Added floating point constructor and accessors to Length for use with
Percent lengths only. The raw value of a percent length is the integer
part of a constant multiple of the original double value. The constant
is percentScaleFactor, which is currently 128.


Added assertions that the correct constructors and accessors are used
depending on the type: the double-based percent(), setValue() and Length()
for the Percent type, and the integer-based value(), setValue() and Length()
for all other types.


calcValue() and calcMinValue() work the same as before, regardless of the
type.

Added helpers for testing if the value is 0, positive, negative or undefined
without having to check the type first.


Added raw value accessors. These are useful for doing integer math and
comparisons with scaled percent values or doing Length type-agnostic math.

Changed the rest of the code to use the appropriate accessors and helpers.

  • css/CSSComputedStyleDeclaration.cpp: (WebCore::valueForLength): (WebCore::primitiveValueFromLength): (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
  • css/cssstyleselector.cpp: (WebCore::convertToLength): (WebCore::CSSStyleSelector::applyProperty): (WebCore::CSSStyleSelector::mapBackgroundSize): (WebCore::CSSStyleSelector::mapBackgroundXPosition): (WebCore::CSSStyleSelector::mapBackgroundYPosition):
  • platform/StringImpl.cpp: (WebCore::parseLength):
  • rendering/AutoTableLayout.cpp: (WebCore::AutoTableLayout::recalcColumn): (WebCore::AutoTableLayout::fullRecalc): (WebCore::AutoTableLayout::calcMinMaxWidth): (WebCore::AutoTableLayout::calcEffectiveWidth): (WebCore::AutoTableLayout::layout): (WebCore::AutoTableLayout::calcPercentages):
  • rendering/FixedTableLayout.cpp: (WebCore::FixedTableLayout::calcWidthArray): (WebCore::FixedTableLayout::layout):
  • rendering/Length.h: (WebCore::Length::Length): (WebCore::Length::value): (WebCore::Length::rawValue): (WebCore::Length::percent): (WebCore::Length::setValue): (WebCore::Length::setRawValue): (WebCore::Length::calcValue): (WebCore::Length::calcMinValue): (WebCore::Length::isUndefined): (WebCore::Length::isZero): (WebCore::Length::isPositive): (WebCore::Length::isNegative):
  • rendering/RenderBR.cpp: (WebCore::RenderBR::lineHeight):
  • rendering/RenderBlock.cpp: (WebCore::RenderBlock::isSelfCollapsingBlock):
  • rendering/RenderBox.cpp: (WebCore::cacluateBackgroundSize): (WebCore::RenderBox::calcWidth): (WebCore::RenderBox::calcHeight): (WebCore::RenderBox::calcReplacedWidth): (WebCore::RenderBox::calcReplacedHeight): (WebCore::RenderBox::calcAbsoluteHorizontal): (WebCore::RenderBox::calcAbsoluteVertical):
  • rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::allowedChildFlex):
  • rendering/RenderFlow.cpp: (WebCore::RenderFlow::lineHeight):
  • rendering/RenderImage.cpp: (WebCore::RenderImage::calcReplacedWidth): (WebCore::RenderImage::calcReplacedHeight):
  • rendering/RenderLayer.cpp: (WebCore::Marquee::direction): (WebCore::Marquee::start):
  • rendering/RenderObject.cpp: (WebCore::RenderObject::mustRepaintBackgroundOrBorder): (WebCore::RenderObject::lineHeight):
  • rendering/RenderSlider.cpp: (WebCore::RenderSlider::layout): Added FIXMEs.
  • rendering/RenderStyle.h: (WebCore::LengthBox::nonZero): (WebCore::RenderStyle::initialLineHeight):
  • rendering/RenderTable.cpp: (WebCore::RenderTable::calcWidth):
  • rendering/RenderTableSection.cpp: (WebCore::RenderTableSection::addCell): (WebCore::RenderTableSection::layoutRows):
Location:
trunk
Files:
4 added
37 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r18572 r18574  
     12007-01-03  Mitz Pettel  <mitz@webkit.org>
     2
     3        Reviewed by Hyatt.
     4
     5        - test and updated results for http://bugs.webkit.org/show_bug.cgi?id=5164
     6          Non-integer percentages are incorrectly rounded down in Safari
     7
     8        * css2.1/t0804-c5507-padn-r-00-c-ag-expected.checksum:
     9        * css2.1/t0804-c5507-padn-r-00-c-ag-expected.png:
     10        * css2.1/t0804-c5507-padn-r-00-c-ag-expected.txt:
     11        * css2.1/t0804-c5509-padn-l-00-b-ag-expected.checksum:
     12        * css2.1/t0804-c5509-padn-l-00-b-ag-expected.png:
     13        * css2.1/t0804-c5509-padn-l-00-b-ag-expected.txt:
     14        * css2.1/t09-c5526c-display-00-e-expected.checksum:
     15        * css2.1/t09-c5526c-display-00-e-expected.png:
     16        * css2.1/t09-c5526c-display-00-e-expected.txt:
     17        * fast/block/basic/011-expected.checksum:
     18        * fast/block/basic/011-expected.png:
     19        * fast/block/basic/011-expected.txt:
     20        * fast/css/percentage-non-integer-expected.checksum: Added.
     21        * fast/css/percentage-non-integer-expected.png: Added.
     22        * fast/css/percentage-non-integer-expected.txt: Added.
     23        * fast/css/percentage-non-integer.html: Added.
     24        * tables/mozilla/bugs/bug4385-expected.checksum:
     25        * tables/mozilla/bugs/bug4385-expected.png:
     26        * tables/mozilla/bugs/bug4385-expected.txt:
     27        * tables/mozilla_expected_failures/core/col_span2-expected.checksum:
     28        * tables/mozilla_expected_failures/core/col_span2-expected.txt:
     29
    1302007-01-03  Mitz Pettel  <mitz@webkit.org>
    231
  • trunk/LayoutTests/css2.1/t0804-c5507-padn-r-00-c-ag-expected.checksum

    r14231 r18574  
    1 7711ab1b2502c95d804d4dfba8796ae0
     17f7132b79b97bb2b06e2727a324edecc
  • trunk/LayoutTests/css2.1/t0804-c5507-padn-r-00-c-ag-expected.txt

    r14684 r18574  
    2121            text run at (48,0) width 10: "x"
    2222        RenderBlock {P} at (0,80) size 106x10 [bgcolor=#000080]
    23           RenderText {#text} at (49,0) size 10x10
    24             text run at (49,0) width 10: "x"
     23          RenderText {#text} at (48,0) size 10x10
     24            text run at (48,0) width 10: "x"
  • trunk/LayoutTests/css2.1/t0804-c5509-padn-l-00-b-ag-expected.checksum

    r14231 r18574  
    1 2b7595d0d1513f162454186d04d583bd
     17f7132b79b97bb2b06e2727a324edecc
  • trunk/LayoutTests/css2.1/t0804-c5509-padn-l-00-b-ag-expected.txt

    r14684 r18574  
    2121            text run at (48,0) width 10: "x"
    2222        RenderBlock {P} at (0,80) size 106x10 [bgcolor=#000080]
    23           RenderText {#text} at (47,0) size 10x10
    24             text run at (47,0) width 10: "x"
     23          RenderText {#text} at (48,0) size 10x10
     24            text run at (48,0) width 10: "x"
  • trunk/LayoutTests/css2.1/t09-c5526c-display-00-e-expected.checksum

    r14231 r18574  
    1 9d0299b6d59c126fb7c9c410f535e55f
     125ed9975af1d56ff395d80fc87bacaac
  • trunk/LayoutTests/css2.1/t09-c5526c-display-00-e-expected.txt

    r14684 r18574  
    55    RenderBody {BODY} at (15,15) size 490x390 [bgcolor=#FFFFFF] [border: (5px solid #000000)]
    66      RenderBlock {DL} at (5,5) size 480x10
    7         RenderBlock (floating) {DT} at (5,5) size 77x310 [bgcolor=#CC0000] [border: (5px solid #000000)]
     7        RenderBlock (floating) {DT} at (5,5) size 79x310 [bgcolor=#CC0000] [border: (5px solid #000000)]
    88          RenderText {#text} at (15,14) size 31x12
    99            text run at (15,14) width 31: "toggle"
  • trunk/LayoutTests/fast/block/basic/011-expected.checksum

    r11995 r18574  
    1 dc8e164fe2bf66b76a68b84faea8a7e7
     17b35526e2db3a84ab2cf05332f3c1c12
  • trunk/LayoutTests/fast/block/basic/011-expected.txt

    r14684 r18574  
    55    RenderBody {BODY} at (15,15) size 490x390 [bgcolor=#FFFFFF] [border: (5px solid #000000)]
    66      RenderBlock {DL} at (5,5) size 480x10
    7         RenderBlock (floating) {DT} at (5,5) size 77x310 [bgcolor=#CC0000] [border: (5px solid #000000)]
     7        RenderBlock (floating) {DT} at (5,5) size 79x310 [bgcolor=#CC0000] [border: (5px solid #000000)]
    88          RenderText {#text} at (15,14) size 31x12
    99            text run at (15,14) width 31: "toggle"
  • trunk/LayoutTests/tables/mozilla/bugs/bug4385-expected.checksum

    r16428 r18574  
    1 ff5c33d0a2ce20927f83a1b91b20c392
     16707f72f5237fc83cb3b9964a9d36a65
  • trunk/LayoutTests/tables/mozilla/bugs/bug4385-expected.txt

    r14684 r18574  
    1111                text run at (2,2) width 12: "A"
    1212          RenderTableRow {TR} at (0,26) size 782x22
    13             RenderTableCell {TD} at (2,35) size 8x4 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
    14             RenderTableCell {TD} at (12,26) size 768x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
     13            RenderTableCell {TD} at (2,35) size 16x4 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
     14            RenderTableCell {TD} at (20,26) size 760x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
    1515              RenderText {#text} at (2,2) size 195x18
    1616                text run at (2,2) width 195: "This text is invariably wrapped"
  • trunk/LayoutTests/tables/mozilla_expected_failures/core/col_span2-expected.checksum

    r16432 r18574  
    1 c73a41b72a58b7019bf7365514617012
     12a4b3675cb2c398069a47c7fb891d24a
  • trunk/LayoutTests/tables/mozilla_expected_failures/core/col_span2-expected.txt

    r14684 r18574  
    493493                text run at (2,2) width 27: "auto"
    494494          RenderTableRow {TR} at (0,32) size 498x22
    495             RenderTableCell {TD} at (5,32) size 291x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
    496               RenderText {#text} at (2,2) size 24x18
    497                 text run at (2,2) width 24: "100"
    498             RenderTableCell {TD} at (301,32) size 90x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
     495            RenderTableCell {TD} at (5,32) size 294x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
     496              RenderText {#text} at (2,2) size 24x18
     497                text run at (2,2) width 24: "100"
     498            RenderTableCell {TD} at (304,32) size 87x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
    499499              RenderText {#text} at (2,2) size 27x18
    500500                text run at (2,2) width 27: "auto"
     
    514514                text run at (2,2) width 27: "auto"
    515515          RenderTableRow {TR} at (0,32) size 498x22
    516             RenderTableCell {TD} at (5,32) size 95x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
    517               RenderText {#text} at (2,2) size 24x18
    518                 text run at (2,2) width 24: "100"
    519             RenderTableCell {TD} at (105,32) size 286x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
     516            RenderTableCell {TD} at (5,32) size 97x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
     517              RenderText {#text} at (2,2) size 24x18
     518                text run at (2,2) width 24: "100"
     519            RenderTableCell {TD} at (107,32) size 284x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
    520520              RenderText {#text} at (2,2) size 24x18
    521521                text run at (2,2) width 24: "300"
     
    644644                text run at (2,2) width 27: "auto"
    645645          RenderTableRow {TR} at (0,32) size 498x58
    646             RenderTableCell {TD} at (5,50) size 66x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
    647               RenderText {#text} at (2,2) size 27x18
    648                 text run at (2,2) width 27: "auto"
    649             RenderTableCell {TD} at (76,50) size 141x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
     646            RenderTableCell {TD} at (5,50) size 70x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
     647              RenderText {#text} at (2,2) size 27x18
     648                text run at (2,2) width 27: "auto"
     649            RenderTableCell {TD} at (80,50) size 143x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
    650650              RenderText {#text} at (2,2) size 59x18
    651651                text run at (2,2) width 59: "auto-auto"
    652             RenderTableCell {TD} at (222,50) size 217x22 [border: (1px inset #808080)] [r=1 c=2 rs=1 cs=1]
     652            RenderTableCell {TD} at (228,50) size 211x22 [border: (1px inset #808080)] [r=1 c=2 rs=1 cs=1]
    653653              RenderText {#text} at (2,2) size 89x18
    654654                text run at (2,2) width 89: "auto auto auto"
     
    670670                text run at (2,2) width 27: "auto"
    671671          RenderTableRow {TR} at (0,32) size 498x22
    672             RenderTableCell {TD} at (5,32) size 122x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
    673               RenderText {#text} at (2,2) size 27x18
    674                 text run at (2,2) width 27: "auto"
    675             RenderTableCell {TD} at (132,32) size 125x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
     672            RenderTableCell {TD} at (5,32) size 124x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
     673              RenderText {#text} at (2,2) size 27x18
     674                text run at (2,2) width 27: "auto"
     675            RenderTableCell {TD} at (134,32) size 123x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
    676676              RenderText {#text} at (2,2) size 27x18
    677677                text run at (2,2) width 27: "auto"
     
    680680                text run at (2,2) width 27: "auto"
    681681          RenderTableRow {TR} at (0,59) size 498x22
    682             RenderTableCell {TD} at (5,59) size 122x22 [border: (1px inset #808080)] [r=2 c=0 rs=1 cs=1]
    683               RenderText {#text} at (2,2) size 27x18
    684                 text run at (2,2) width 27: "auto"
    685             RenderTableCell {TD} at (132,59) size 361x22 [border: (1px inset #808080)] [r=2 c=1 rs=1 cs=2]
     682            RenderTableCell {TD} at (5,59) size 124x22 [border: (1px inset #808080)] [r=2 c=0 rs=1 cs=1]
     683              RenderText {#text} at (2,2) size 27x18
     684                text run at (2,2) width 27: "auto"
     685            RenderTableCell {TD} at (134,59) size 359x22 [border: (1px inset #808080)] [r=2 c=1 rs=1 cs=2]
    686686              RenderText {#text} at (2,2) size 95x18
    687687                text run at (2,2) width 95: "90% 90% 90%"
     
    797797                text run at (2,2) width 27: "auto"
    798798          RenderTableRow {TR} at (0,32) size 498x22
    799             RenderTableCell {TD} at (5,32) size 139x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
    800               RenderText {#text} at (2,2) size 27x18
    801                 text run at (2,2) width 27: "auto"
    802             RenderTableCell {TD} at (149,32) size 291x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
     799            RenderTableCell {TD} at (5,32) size 142x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
     800              RenderText {#text} at (2,2) size 27x18
     801                text run at (2,2) width 27: "auto"
     802            RenderTableCell {TD} at (152,32) size 288x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
    803803              RenderText {#text} at (2,2) size 59x18
    804804                text run at (2,2) width 59: "auto-auto"
     
    878878        RenderTableSection {TBODY} at (1,1) size 498x59
    879879          RenderTableRow {TR} at (0,5) size 498x22
    880             RenderTableCell {TD} at (5,5) size 435x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=2]
     880            RenderTableCell {TD} at (5,5) size 434x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=2]
    881881              RenderText {#text} at (2,2) size 194x18
    882882                text run at (2,2) width 194: "90% 90% 90% 90% 90% 90%"
    883             RenderTableCell {TD} at (445,5) size 48x22 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
     883            RenderTableCell {TD} at (444,5) size 49x22 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
    884884              RenderText {#text} at (2,2) size 27x18
    885885                text run at (2,2) width 27: "auto"
    886886          RenderTableRow {TR} at (0,32) size 498x22
    887             RenderTableCell {TD} at (5,32) size 191x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
     887            RenderTableCell {TD} at (5,32) size 195x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
    888888              RenderText {#text} at (2,2) size 16x18
    889889                text run at (2,2) width 16: "10"
    890             RenderTableCell {TD} at (201,32) size 239x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
     890            RenderTableCell {TD} at (205,32) size 234x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
    891891              RenderText {#text} at (2,2) size 16x18
    892892                text run at (2,2) width 16: "20"
    893             RenderTableCell {TD} at (445,32) size 48x22 [border: (1px inset #808080)] [r=1 c=2 rs=1 cs=1]
     893            RenderTableCell {TD} at (444,32) size 49x22 [border: (1px inset #808080)] [r=1 c=2 rs=1 cs=1]
    894894              RenderText {#text} at (2,2) size 27x18
    895895                text run at (2,2) width 27: "auto"
     
    921921        RenderTableSection {TBODY} at (1,1) size 498x59
    922922          RenderTableRow {TR} at (0,5) size 498x22
    923             RenderTableCell {TD} at (5,5) size 434x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=2]
     923            RenderTableCell {TD} at (5,5) size 435x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=2]
    924924              RenderText {#text} at (2,2) size 161x18
    925925                text run at (2,2) width 161: "90% 50% 50% 50% 50%"
    926             RenderTableCell {TD} at (444,5) size 49x22 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
     926            RenderTableCell {TD} at (445,5) size 48x22 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
    927927              RenderText {#text} at (2,2) size 27x18
    928928                text run at (2,2) width 27: "auto"
    929929          RenderTableRow {TR} at (0,32) size 498x22
    930             RenderTableCell {TD} at (5,32) size 224x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
    931               RenderText {#text} at (2,2) size 24x18
    932                 text run at (2,2) width 24: "100"
    933             RenderTableCell {TD} at (234,32) size 205x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
     930            RenderTableCell {TD} at (5,32) size 227x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
     931              RenderText {#text} at (2,2) size 24x18
     932                text run at (2,2) width 24: "100"
     933            RenderTableCell {TD} at (237,32) size 203x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
    934934              RenderText {#text} at (2,2) size 89x18
    935935                text run at (2,2) width 89: "auto auto auto"
    936             RenderTableCell {TD} at (444,32) size 49x22 [border: (1px inset #808080)] [r=1 c=2 rs=1 cs=1]
     936            RenderTableCell {TD} at (445,32) size 48x22 [border: (1px inset #808080)] [r=1 c=2 rs=1 cs=1]
    937937              RenderText {#text} at (2,2) size 27x18
    938938                text run at (2,2) width 27: "auto"
  • trunk/WebCore/ChangeLog

    r18572 r18574  
     12007-01-03  Mitz Pettel  <mitz@webkit.org>
     2
     3        Reviewed by Hyatt.
     4
     5        - fix http://bugs.webkit.org/show_bug.cgi?id=5164
     6          Non-integer percentages are incorrectly rounded down in Safari
     7
     8        Test: fast/css/percentage-non-integer.html
     9
     10        Added floating point constructor and accessors to Length for use with
     11        Percent lengths only. The raw value of a percent length is the integer
     12        part of a constant multiple of the original double value. The constant
     13        is percentScaleFactor, which is currently 128.
     14       
     15        Added assertions that the correct constructors and accessors are used
     16        depending on the type: the double-based percent(), setValue() and Length()
     17        for the Percent type, and the integer-based value(), setValue() and Length()
     18        for all other types.
     19       
     20        calcValue() and calcMinValue() work the same as before, regardless of the
     21        type.
     22
     23        Added helpers for testing if the value is 0, positive, negative or undefined
     24        without having to check the type first.
     25       
     26        Added raw value accessors. These are useful for doing integer math and
     27        comparisons with scaled percent values or doing Length type-agnostic math.
     28
     29        Changed the rest of the code to use the appropriate accessors and helpers.
     30
     31        * css/CSSComputedStyleDeclaration.cpp:
     32        (WebCore::valueForLength):
     33        (WebCore::primitiveValueFromLength):
     34        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
     35        * css/cssstyleselector.cpp:
     36        (WebCore::convertToLength):
     37        (WebCore::CSSStyleSelector::applyProperty):
     38        (WebCore::CSSStyleSelector::mapBackgroundSize):
     39        (WebCore::CSSStyleSelector::mapBackgroundXPosition):
     40        (WebCore::CSSStyleSelector::mapBackgroundYPosition):
     41        * platform/StringImpl.cpp:
     42        (WebCore::parseLength):
     43        * rendering/AutoTableLayout.cpp:
     44        (WebCore::AutoTableLayout::recalcColumn):
     45        (WebCore::AutoTableLayout::fullRecalc):
     46        (WebCore::AutoTableLayout::calcMinMaxWidth):
     47        (WebCore::AutoTableLayout::calcEffectiveWidth):
     48        (WebCore::AutoTableLayout::layout):
     49        (WebCore::AutoTableLayout::calcPercentages):
     50        * rendering/FixedTableLayout.cpp:
     51        (WebCore::FixedTableLayout::calcWidthArray):
     52        (WebCore::FixedTableLayout::layout):
     53        * rendering/Length.h:
     54        (WebCore::Length::Length):
     55        (WebCore::Length::value):
     56        (WebCore::Length::rawValue):
     57        (WebCore::Length::percent):
     58        (WebCore::Length::setValue):
     59        (WebCore::Length::setRawValue):
     60        (WebCore::Length::calcValue):
     61        (WebCore::Length::calcMinValue):
     62        (WebCore::Length::isUndefined):
     63        (WebCore::Length::isZero):
     64        (WebCore::Length::isPositive):
     65        (WebCore::Length::isNegative):
     66        * rendering/RenderBR.cpp:
     67        (WebCore::RenderBR::lineHeight):
     68        * rendering/RenderBlock.cpp:
     69        (WebCore::RenderBlock::isSelfCollapsingBlock):
     70        * rendering/RenderBox.cpp:
     71        (WebCore::cacluateBackgroundSize):
     72        (WebCore::RenderBox::calcWidth):
     73        (WebCore::RenderBox::calcHeight):
     74        (WebCore::RenderBox::calcReplacedWidth):
     75        (WebCore::RenderBox::calcReplacedHeight):
     76        (WebCore::RenderBox::calcAbsoluteHorizontal):
     77        (WebCore::RenderBox::calcAbsoluteVertical):
     78        * rendering/RenderFlexibleBox.cpp:
     79        (WebCore::RenderFlexibleBox::allowedChildFlex):
     80        * rendering/RenderFlow.cpp:
     81        (WebCore::RenderFlow::lineHeight):
     82        * rendering/RenderImage.cpp:
     83        (WebCore::RenderImage::calcReplacedWidth):
     84        (WebCore::RenderImage::calcReplacedHeight):
     85        * rendering/RenderLayer.cpp:
     86        (WebCore::Marquee::direction):
     87        (WebCore::Marquee::start):
     88        * rendering/RenderObject.cpp:
     89        (WebCore::RenderObject::mustRepaintBackgroundOrBorder):
     90        (WebCore::RenderObject::lineHeight):
     91        * rendering/RenderSlider.cpp:
     92        (WebCore::RenderSlider::layout): Added FIXMEs.
     93        * rendering/RenderStyle.h:
     94        (WebCore::LengthBox::nonZero):
     95        (WebCore::RenderStyle::initialLineHeight):
     96        * rendering/RenderTable.cpp:
     97        (WebCore::RenderTable::calcWidth):
     98        * rendering/RenderTableSection.cpp:
     99        (WebCore::RenderTableSection::addCell):
     100        (WebCore::RenderTableSection::layoutRows):
     101
    11022007-01-03  Mitz Pettel  <mitz@webkit.org>
    2103
  • trunk/WebCore/css/CSSComputedStyleDeclaration.cpp

    r18557 r18574  
    169169            return new CSSPrimitiveValue(CSS_VAL_MIN_INTRINSIC);
    170170        case Percent:
    171             return new CSSPrimitiveValue(length.value(), CSSPrimitiveValue::CSS_PERCENTAGE);
     171            return new CSSPrimitiveValue(length.percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
    172172        case Relative:
    173173        case Static:
     
    339339    String string;
    340340    if (length.isPercent())
    341         string = numberAsString(length.value()) + "%";
     341        string = numberAsString(length.percent()) + "%";
    342342    else if (length.isFixed())
    343343        string = numberAsString(length.calcMinValue(0));
     
    445445        Length length(style->backgroundXPosition());
    446446        if (length.isPercent())
    447             string = numberAsString(length.value()) + "%";
     447            string = numberAsString(length.percent()) + "%";
    448448        else
    449449            string = numberAsString(length.calcMinValue(renderer->contentWidth()));
     
    451451        length = style->backgroundYPosition();
    452452        if (length.isPercent())
    453             string += numberAsString(length.value()) + "%";
     453            string += numberAsString(length.percent()) + "%";
    454454        else
    455455            string += numberAsString(length.calcMinValue(renderer->contentWidth()));
     
    858858    case CSS_PROP_LINE_HEIGHT: {
    859859        Length length(style->lineHeight());
    860         if (length.value() < 0)
     860        if (length.isNegative())
    861861            return new CSSPrimitiveValue(CSS_VAL_NORMAL);
    862862        if (length.isPercent()) {
     
    866866            // that here either.
    867867            float fontSize = style->fontDescription().specifiedSize();
    868             return new CSSPrimitiveValue((int)(length.value() * fontSize) / 100, CSSPrimitiveValue::CSS_PX);
     868            return new CSSPrimitiveValue((int)(length.percent() * fontSize) / 100, CSSPrimitiveValue::CSS_PX);
    869869        }
    870870        else {
  • trunk/WebCore/css/cssstyleselector.cpp

    r18557 r18574  
    17791779            l = Length(primitiveValue->computeLengthIntForLength(style), Fixed);
    17801780        else if(type == CSSPrimitiveValue::CSS_PERCENTAGE)
    1781             l = Length(int(primitiveValue->getFloatValue()), Percent);
     1781            l = Length(primitiveValue->getFloatValue(), Percent);
    17821782        else if(type == CSSPrimitiveValue::CSS_NUMBER)
    1783             l = Length(int(primitiveValue->getFloatValue() * 100), Percent);
     1783            l = Length(primitiveValue->getFloatValue() * 100.0, Percent);
    17841784        else if (ok)
    17851785            *ok = false;
     
    28562856                           primitiveValue->isQuirkValue());
    28572857            else if(type == CSSPrimitiveValue::CSS_PERCENTAGE)
    2858                 l = Length((int)primitiveValue->getFloatValue(), Percent);
     2858                l = Length(primitiveValue->getFloatValue(), Percent);
    28592859            else
    28602860                return;
     
    29392939                l = Length(primitiveValue->computeLengthIntForLength(style), Fixed);
    29402940            else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
    2941                 l = Length((int)primitiveValue->getFloatValue(), Percent);
     2941                l = Length(primitiveValue->getFloatValue(), Percent);
    29422942            else
    29432943                return;
     
    29952995            l = Length(primitiveValue->computeLengthIntForLength(style), Fixed);
    29962996          else if(type == CSSPrimitiveValue::CSS_PERCENTAGE)
    2997             l = Length(int(primitiveValue->getFloatValue()), Percent);
     2997            l = Length(primitiveValue->getFloatValue(), Percent);
    29982998
    29992999          style->setVerticalAlign(LENGTH);
     
    31233123        int type = primitiveValue->primitiveType();
    31243124        if (primitiveValue->getIdent() == CSS_VAL_NORMAL)
    3125             lineHeight = Length(-100, Percent);
     3125            lineHeight = Length(-100.0, Percent);
    31263126        else if (type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG) {
    31273127            double multiplier = 1.0;
     
    31353135            lineHeight = Length((style->fontSize() * int(primitiveValue->getFloatValue())) / 100, Fixed);
    31363136        else if (type == CSSPrimitiveValue::CSS_NUMBER)
    3137             lineHeight = Length(int(primitiveValue->getFloatValue() * 100), Percent);
     3137            lineHeight = Length(primitiveValue->getFloatValue() * 100.0, Percent);
    31383138        else
    31393139            return;
     
    36343634            RectImpl* r = borderImage->m_imageSliceRect.get();
    36353635            if (r->top()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
    3636                 l.top = Length((int)r->top()->getFloatValue(), Percent);
     3636                l.top = Length(r->top()->getFloatValue(), Percent);
    36373637            else
    36383638                l.top = Length((int)r->top()->getFloatValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
    36393639            if (r->bottom()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
    3640                 l.bottom = Length((int)r->bottom()->getFloatValue(), Percent);
     3640                l.bottom = Length(r->bottom()->getFloatValue(), Percent);
    36413641            else
    36423642                l.bottom = Length((int)r->bottom()->getFloatValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
    36433643            if (r->left()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
    3644                 l.left = Length((int)r->left()->getFloatValue(), Percent);
     3644                l.left = Length(r->left()->getFloatValue(), Percent);
    36453645            else
    36463646                l.left = Length((int)r->left()->getFloatValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
    36473647            if (r->right()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
    3648                 l.right = Length((int)r->right()->getFloatValue(), Percent);
     3648                l.right = Length(r->right()->getFloatValue(), Percent);
    36493649            else
    36503650                l.right = Length((int)r->right()->getFloatValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
     
    44144414        firstLength = Length(first->computeLengthIntForLength(style), Fixed);
    44154415    else if (firstType == CSSPrimitiveValue::CSS_PERCENTAGE)
    4416         firstLength = Length((int)first->getFloatValue(), Percent);
     4416        firstLength = Length(first->getFloatValue(), Percent);
    44174417    else
    44184418        return;
     
    44234423        secondLength = Length(second->computeLengthIntForLength(style), Fixed);
    44244424    else if (secondType == CSSPrimitiveValue::CSS_PERCENTAGE)
    4425         secondLength = Length((int)second->getFloatValue(), Percent);
     4425        secondLength = Length(second->getFloatValue(), Percent);
    44264426    else
    44274427        return;
     
    44474447        l = Length(primitiveValue->computeLengthIntForLength(style), Fixed);
    44484448    else if(type == CSSPrimitiveValue::CSS_PERCENTAGE)
    4449         l = Length((int)primitiveValue->getFloatValue(), Percent);
     4449        l = Length(primitiveValue->getFloatValue(), Percent);
    44504450    else
    44514451        return;
     
    44684468        l = Length(primitiveValue->computeLengthIntForLength(style), Fixed);
    44694469    else if(type == CSSPrimitiveValue::CSS_PERCENTAGE)
    4470         l = Length((int)primitiveValue->getFloatValue(), Percent);
     4470        l = Length(primitiveValue->getFloatValue(), Percent);
    44714471    else
    44724472        return;
  • trunk/WebCore/platform/StringImpl.cpp

    r18453 r18574  
    302302            UChar next = m_data[i];
    303303            if (next == '%')
    304                 return Length(r, Percent);
     304                return Length(static_cast<double>(r), Percent);
    305305            if (next == '*')
    306306                return Length(r, Relative);
  • trunk/WebCore/rendering/AutoTableLayout.cpp

    r17338 r18574  
    8787
    8888                    Length w = cell->styleOrColWidth();
    89                     if (w.value() > 32760)
    90                         w.setValue(32760);
    91                     if (w.value() < 0)
     89                    // FIXME: What is this arbitrary value?
     90                    if (w.rawValue() > 32760)
     91                        w.setRawValue(32760);
     92                    if (w.isNegative())
    9293                        w.setValue(0);
    9394                    switch(w.type()) {
     
    111112                    case Percent:
    112113                        m_hasPercent = true;
    113                         if (w.value() > 0 && (!l.width.isPercent() || w.value() > l.width.value()))
     114                        if (w.isPositive() && (!l.width.isPercent() || w.rawValue() > l.width.rawValue()))
    114115                            l.width = w;
    115116                        break;
    116117                    case Relative:
    117                         if (w.isAuto() || (w.isRelative() && w.value() > l.width.value()))
     118                        // FIXME: Need to understand this case and whether it makes sense to compare values
     119                        // which are not necessarily of the same type.
     120                        if (w.isAuto() || (w.isRelative() && w.value() > l.width.rawValue()))
    118121                            l.width = w;
    119122                    default:
     
    175178                if (w.isAuto())
    176179                    w = grpWidth;
    177                 if ((w.isFixed() && w.value() == 0) || (w.isPercent() && w.value() == 0))
     180                if ((w.isFixed() || w.isPercent()) && w.isZero())
    178181                    w = Length();
    179182                int cEffCol = m_table->colToEffCol(cCol);
     
    255258    int maxNonPercent = 0;
    256259
    257     int remainingPercent = 100;
     260    int remainingPercent = 100 * percentScaleFactor;
    258261    for (unsigned int i = 0; i < m_layoutStruct.size(); i++) {
    259262        minWidth += m_layoutStruct[i].effMinWidth;
    260263        maxWidth += m_layoutStruct[i].effMaxWidth;
    261264        if (m_layoutStruct[i].effWidth.isPercent()) {
    262             int percent = min(m_layoutStruct[i].effWidth.value(), remainingPercent);
    263             int pw = (m_layoutStruct[i].effMaxWidth * 100) / max(percent, 1);
     265            int percent = min(m_layoutStruct[i].effWidth.rawValue(), remainingPercent);
     266            int pw = (m_layoutStruct[i].effMaxWidth * 100 * percentScaleFactor) / max(percent, percentScaleFactor);
    264267            remainingPercent -= percent;
    265268            maxPercent = max(pw,  maxPercent);
     
    270273
    271274    if (shouldScaleColumns(m_table)) {
    272         maxNonPercent = (maxNonPercent * 100 + 50) / max(remainingPercent, 1);
     275        // FIXME: Why 50?
     276        maxNonPercent = (maxNonPercent * 100 + 50) * percentScaleFactor / max(remainingPercent, percentScaleFactor);
    273277        maxWidth = max(maxNonPercent,  maxWidth);
    274278        maxWidth = max(maxWidth, maxPercent);
     
    320324
    321325        Length w = cell->styleOrColWidth();
    322         if (!w.isRelative() && w.value() == 0)
     326        if (!w.isRelative() && w.isZero())
    323327            w = Length(); // make it Auto
    324328
     
    340344            switch (m_layoutStruct[lastCol].width.type()) {
    341345            case Percent:
    342                 totalPercent += m_layoutStruct[lastCol].width.value();
     346                totalPercent += m_layoutStruct[lastCol].width.rawValue();
    343347                allColsAreFixed = false;
    344348                break;
     
    368372                }
    369373                else
    370                     totalPercent += m_layoutStruct[lastCol].effWidth.value();
     374                    totalPercent += m_layoutStruct[lastCol].effWidth.rawValue();
    371375                allColsAreFixed = false;
    372376            }
     
    384388        // adjust table max width if needed
    385389        if (w.isPercent()) {
    386             if (totalPercent > w.value() || allColsArePercent) {
     390            if (totalPercent > w.rawValue() || allColsArePercent) {
    387391                // can't satify this condition, treat as variable
    388392                w = Length();
     
    392396                qDebug("    adjusting tMaxWidth (%d): spanMax=%d, value=%d, totalPercent=%d", tMaxWidth, spanMax, w.value, totalPercent);
    393397#endif
    394                 tMaxWidth = max(tMaxWidth, spanMax * 100 / w.value());
     398                tMaxWidth = max(tMaxWidth, spanMax * 100 * percentScaleFactor / w.rawValue());
    395399
    396400                // all non percent columns in the span get percent vlaues to sum up correctly.
    397                 int percentMissing = w.value() - totalPercent;
     401                int percentMissing = w.rawValue() - totalPercent;
    398402                int totalWidth = 0;
    399403                for (unsigned int pos = col; pos < lastCol; pos++) {
     
    411415                        percentMissing -= percent;
    412416                        if (percent > 0)
    413                             m_layoutStruct[pos].effWidth = Length(percent, Percent);
     417                            m_layoutStruct[pos].effWidth.setRawValue(Percent, percent);
    414418                        else
    415419                            m_layoutStruct[pos].effWidth = Length();
     
    574578        case Percent:
    575579            havePercent = true;
    576             totalPercent += width.value();
     580            totalPercent += width.rawValue();
    577581            break;
    578582        case Relative:
     
    605609            }
    606610        }
    607         if (totalPercent > 100) {
     611        if (totalPercent > 100 * percentScaleFactor) {
    608612            // remove overallocated space from the last columns
    609             int excess = tableWidth*(totalPercent-100)/100;
     613            int excess = tableWidth*(totalPercent - 100 * percentScaleFactor) / (100 * percentScaleFactor);
    610614            for (int i = nEffCols-1; i >= 0; i--) {
    611615                if (m_layoutStruct[i].effWidth.isPercent()) {
     
    688692   
    689693    // spread over percent colums
    690     if (available > 0 && m_hasPercent && totalPercent < 100) {
     694    if (available > 0 && m_hasPercent && totalPercent < 100 * percentScaleFactor) {
    691695        // still have some width to spread, distribute weighted to percent columns
    692696        for (int i = 0; i < nEffCols; i++) {
    693697            Length &width = m_layoutStruct[i].effWidth;
    694698            if (width.isPercent()) {
    695                 int w = available * width.value() / totalPercent;
     699                int w = available * width.rawValue() / totalPercent;
    696700                available -= w;
    697                 totalPercent -= width.value();
     701                totalPercent -= width.rawValue();
    698702                m_layoutStruct[i].calcWidth += w;
    699703                if (!available || !totalPercent) break;
     
    834838void AutoTableLayout::calcPercentages() const
    835839{
    836     m_totalPercent = 0;
     840    unsigned totalPercent = 0;
    837841    for (unsigned i = 0; i < m_layoutStruct.size(); i++) {
    838842        if (m_layoutStruct[i].width.isPercent())
    839             m_totalPercent += m_layoutStruct[i].width.value();
    840     }
     843            totalPercent += m_layoutStruct[i].width.rawValue();
     844    }
     845    m_totalPercent = totalPercent / percentScaleFactor;
    841846    m_percentagesDirty = false;
    842847}
  • trunk/WebCore/rendering/FixedTableLayout.cpp

    r17338 r18574  
    136136                    }
    137137                    int eSpan = m_table->spanOfEffCol(cCol+i);
    138                     if ((w.isFixed() || w.isPercent()) && w.value() > 0) {
    139                         m_width[cCol+i] = Length(w.value() * eSpan, w.type());
     138                    if ((w.isFixed() || w.isPercent()) && w.isPositive()) {
     139                        m_width[cCol+i].setRawValue(w.type(), w.rawValue() * eSpan);
    140140                        usedWidth += effWidth * eSpan;
    141141#ifdef DEBUG_LAYOUT
     
    184184                int span = cell->colSpan();
    185185                int effWidth = 0;
    186                 if ((w.isFixed() || w.isPercent()) && w.value() > 0)
    187                     effWidth = w.value();
     186                // FIXME: This does not make sense (mixing percentages with absolute length)
     187                if ((w.isFixed() || w.isPercent()) && w.isPositive())
     188                    effWidth = w.isPercent() ? w.rawValue() / percentScaleFactor : w.value();
    188189               
    189190#ifdef DEBUG_LAYOUT
     
    197198                    // only set if no col element has already set it.
    198199                    if (m_width[cCol+i].isAuto() && w.type() != Auto) {
    199                         m_width[cCol+i] = Length(w.value() * eSpan, w.type());
     200                        m_width[cCol+i].setRawValue(w.type(), w.rawValue() * eSpan);
    200201                        usedWidth += effWidth*eSpan;
    201202#ifdef DEBUG_LAYOUT
     
    260261        for (int i = 0; i < nEffCols; i++)
    261262            if (m_width[i].isPercent())
    262                 totalPercent += m_width[i].value();
     263                totalPercent += m_width[i].rawValue();
    263264
    264265        // calculate how much to distribute to percent cells.
    265         int base = tableWidth * totalPercent / 100;
     266        int base = tableWidth * totalPercent / (100 * percentScaleFactor);
    266267        if (base > available)
    267268            base = available;
    268269        else
    269             totalPercent = 100;
     270            totalPercent = 100 * percentScaleFactor;
    270271
    271272#ifdef DEBUG_LAYOUT
     
    274275        for (int i = 0; available > 0 && i < nEffCols; i++) {
    275276            if (m_width[i].isPercent()) {
    276                 int w = base * m_width[i].value() / totalPercent;
     277                int w = base * m_width[i].rawValue() / totalPercent;
    277278                available -= w;
    278279                calcWidth[i] = w;
  • trunk/WebCore/rendering/Length.h

    r17338 r18574  
    2424#define Length_H
    2525
     26#include <wtf/Assertions.h>
     27
    2628namespace WebCore {
    2729
    2830    const int undefinedLength = -1;
     31    const int percentScaleFactor = 128;
    2932
    3033    enum LengthType { Auto, Relative, Percent, Fixed, Static, Intrinsic, MinIntrinsic };
     
    4447            : m_value((v * 16) | (q << 3) | t) // FIXME: Doesn't work if the passed-in value is very large!
    4548        {
     49            ASSERT(t != Percent);
     50        }
     51
     52        Length(double v, LengthType t, bool q = false)
     53            : m_value(static_cast<int>(v * percentScaleFactor) * 16 | (q << 3) | t)
     54        {
     55            ASSERT(t == Percent);
    4656        }
    4757
     
    4959        bool operator!=(const Length& o) const { return m_value != o.m_value; }
    5060
    51         int value() const { return (m_value & ~0xF) / 16; }
     61        int value() const {
     62            ASSERT(type() != Percent);
     63            return rawValue();
     64        }
     65
     66        int rawValue() const { return (m_value & ~0xF) / 16; }
     67
     68        double percent() const
     69        {
     70            ASSERT(type() == Percent);
     71            return static_cast<double>(rawValue()) / percentScaleFactor;
     72        }
     73
    5274        LengthType type() const { return static_cast<LengthType>(m_value & 7); }
    5375        bool quirk() const { return (m_value >> 3) & 1; }
    5476
    55         void setValue(LengthType t, int value) { m_value = value * 16 | (m_value & 0x8) | t; }
    56         void setValue(int value) { m_value = value * 16 | (m_value & 0xF); }
     77        void setValue(LengthType t, int value)
     78        {
     79            ASSERT(t != Percent);
     80            setRawValue(t, value);
     81        }
     82
     83        void setRawValue(LengthType t, int value) { m_value = value * 16 | (m_value & 0x8) | t; }
     84
     85        void setValue(int value)
     86        {
     87            ASSERT(!value || type() != Percent);
     88            setRawValue(value);
     89        }
     90
     91        void setRawValue(int value) { m_value = value * 16 | (m_value & 0xF); }
     92
     93        void setValue(LengthType t, double value)
     94        {
     95            ASSERT(t == Percent);
     96            m_value = static_cast<int>(value * percentScaleFactor) * 16 | (m_value & 0x8) | t;
     97        }
     98
     99        void setValue(double value)
     100        {
     101            ASSERT(type() == Percent);
     102            m_value = static_cast<int>(value * percentScaleFactor) * 16 | (m_value & 0xF);
     103        }
    57104
    58105        // note: works only for certain types, returns undefinedLength otherwise
     
    63110                    return value();
    64111                case Percent:
    65                     return maxValue * value() / 100;
     112                    return maxValue * rawValue() / (100 * percentScaleFactor);
    66113                case Auto:
    67114                    return maxValue;
     
    77124                    return value();
    78125                case Percent:
    79                     return maxValue * value() / 100;
     126                    return maxValue * rawValue() / (100 * percentScaleFactor);
    80127                case Auto:
    81128                default:
     
    83130            }
    84131        }
     132
     133        bool isUndefined() const { return rawValue() == undefinedLength; }
     134        bool isZero() const { return !(m_value & ~0xF); }
     135        bool isPositive() const { return rawValue() > 0; }
     136        bool isNegative() const { return rawValue() < 0; }
    85137
    86138        bool isAuto() const { return type() == Auto; }
  • trunk/WebCore/rendering/RenderBR.cpp

    r17448 r18574  
    6565        RenderStyle* s = style(firstLine);
    6666        Length lh = s->lineHeight();
    67         if (lh.value() < 0) {
     67        if (lh.isNegative()) {
    6868            if (s == style()) {
    6969                if (m_lineHeight == -1)
  • trunk/WebCore/rendering/RenderBlock.cpp

    r18559 r18574  
    393393    if (m_height > 0 ||
    394394        isTable() || (borderBottom() + paddingBottom() + borderTop() + paddingTop()) != 0 ||
    395         style()->minHeight().value() > 0 ||
     395        style()->minHeight().isPositive() ||
    396396        style()->marginTopCollapse() == MSEPARATE || style()->marginBottomCollapse() == MSEPARATE)
    397397        return false;
     
    408408    // If the height is 0 or auto, then whether or not we are a self-collapsing block depends
    409409    // on whether we have content that is all self-collapsing or not.
    410     if (hasAutoHeight || ((style()->height().isFixed() || style()->height().isPercent()) && style()->height().value() == 0)) {
     410    if (hasAutoHeight || ((style()->height().isFixed() || style()->height().isPercent()) && style()->height().isZero())) {
    411411        // If the block has inline children, see if we generated any line boxes.  If we have any
    412412        // line boxes, then we can't be self-collapsing, since we have content.
  • trunk/WebCore/rendering/RenderBox.cpp

    r18490 r18574  
    401401       
    402402        if (bgWidth.isPercent())
    403             scaledWidth = scaledWidth * bgWidth.value() / 100;
     403            scaledWidth = bgWidth.calcValue(scaledWidth);
    404404        else if (bgWidth.isFixed())
    405405            scaledWidth = bgWidth.value();
     
    408408            // scale to maintain our aspect ratio.
    409409            if (bgHeight.isPercent()) {
    410                 int scaledH = scaledHeight * bgHeight.value() / 100;
     410                int scaledH = bgHeight.calcValue(scaledHeight);
    411411                scaledWidth = bg->imageSize().width() * scaledH / bg->imageSize().height();
    412412            } else if (bgHeight.isFixed())
     
    415415           
    416416        if (bgHeight.isPercent())
    417             scaledHeight = scaledHeight * bgHeight.value() / 100;
     417            scaledHeight = bgHeight.calcValue(scaledHeight);
    418418        else if (bgHeight.isFixed())
    419419            scaledHeight = bgHeight.value();
     
    10471047       
    10481048        // Calculate MaxWidth
    1049         if (style()->maxWidth().value() != undefinedLength) {
     1049        if (!style()->maxWidth().isUndefined()) {
    10501050            int maxW = calcWidthUsing(MaxWidth, containerWidth);
    10511051            if (m_width > maxW) {
     
    12281228                height = m_height;
    12291229            int minH = calcHeightUsing(style()->minHeight()); // Leave as -1 if unset.
    1230             int maxH = style()->maxHeight().value() == undefinedLength ? height : calcHeightUsing(style()->maxHeight());
     1230            int maxH = style()->maxHeight().isUndefined() ? height : calcHeightUsing(style()->maxHeight());
    12311231            if (maxH == -1)
    12321232                maxH = height;
     
    13561356    int width = calcReplacedWidthUsing(style()->width());
    13571357    int minW = calcReplacedWidthUsing(style()->minWidth());
    1358     int maxW = style()->maxWidth().value() == undefinedLength ? width : calcReplacedWidthUsing(style()->maxWidth());
     1358    int maxW = style()->maxWidth().isUndefined() ? width : calcReplacedWidthUsing(style()->maxWidth());
    13591359
    13601360    return max(minW, min(width, maxW));
     
    13811381    int height = calcReplacedHeightUsing(style()->height());
    13821382    int minH = calcReplacedHeightUsing(style()->minHeight());
    1383     int maxH = style()->maxHeight().value() == undefinedLength ? height : calcReplacedHeightUsing(style()->maxHeight());
     1383    int maxH = style()->maxHeight().isUndefined() ? height : calcReplacedHeightUsing(style()->maxHeight());
    13841384
    13851385    return max(minH, min(height, maxH));
     
    15971597
    15981598    // Calculate constraint equation values for 'max-width' case.calcContentBoxWidth(width.calcValue(containerWidth));
    1599     if (style()->maxWidth().value() != undefinedLength) {
     1599    if (!style()->maxWidth().isUndefined()) {
    16001600        int maxWidth;
    16011601        int maxMarginLeft;
     
    16171617
    16181618    // Calculate constraint equation values for 'min-width' case.
    1619     if (style()->minWidth().value()) {
     1619    if (!style()->minWidth().isZero()) {
    16201620        int minWidth;
    16211621        int minMarginLeft;
     
    18781878
    18791879    // Calculate constraint equation values for 'max-height' case.
    1880     if (style()->maxHeight().value() != undefinedLength) {
     1880    if (!style()->maxHeight().isUndefined()) {
    18811881        int maxHeight;
    18821882        int maxMarginTop;
     
    18971897
    18981898    // Calculate constraint equation values for 'min-height' case.
    1899     if (style()->minHeight().value()) {
     1899    if (!style()->minHeight().isZero()) {
    19001900        int minHeight;
    19011901        int minMarginTop;
  • trunk/WebCore/rendering/RenderFlexibleBox.cpp

    r17824 r18574  
    10791079            int maxW = INT_MAX;
    10801080            int w = child->overrideWidth() - (child->borderLeft() + child->borderRight() + child->paddingLeft() + child->paddingRight());
    1081             if (child->style()->maxWidth().value() != undefinedLength &&
     1081            if (!child->style()->maxWidth().isUndefined() &&
    10821082                child->style()->maxWidth().isFixed())
    10831083                maxW = child->style()->maxWidth().value();
     
    10931093            int maxH = INT_MAX;
    10941094            int h = child->overrideHeight() - (child->borderTop() + child->borderBottom() + child->paddingTop() + child->paddingBottom());
    1095             if (child->style()->maxHeight().value() != undefinedLength &&
     1095            if (!child->style()->maxHeight().isUndefined() &&
    10961096                child->style()->maxHeight().isFixed())
    10971097                maxH = child->style()->maxHeight().value();
  • trunk/WebCore/rendering/RenderFlow.cpp

    r17782 r18574  
    282282        RenderStyle* s = style(firstLine);
    283283        Length lh = s->lineHeight();
    284         if (lh.value() < 0) {
     284        if (lh.isNegative()) {
    285285            if (s == style()) {
    286286                if (m_lineHeight == -1)
  • trunk/WebCore/rendering/RenderImage.cpp

    r18446 r18574  
    380380
    381381    int minW = calcReplacedWidthUsing(style()->minWidth());
    382     int maxW = style()->maxWidth().value() == undefinedLength ? width : calcReplacedWidthUsing(style()->maxWidth());
     382    int maxW = style()->maxWidth().isUndefined() ? width : calcReplacedWidthUsing(style()->maxWidth());
    383383
    384384    return max(minW, min(width, maxW));
     
    394394
    395395    int minH = calcReplacedHeightUsing(style()->minHeight());
    396     int maxH = style()->maxHeight().value() == undefinedLength ? height : calcReplacedHeightUsing(style()->maxHeight());
     396    int maxH = style()->maxHeight().isUndefined() ? height : calcReplacedHeightUsing(style()->maxHeight());
    397397
    398398    return max(minH, min(height, maxH));
  • trunk/WebCore/rendering/RenderLayer.cpp

    r18491 r18574  
    20802080    // If so, then we reverse the direction.
    20812081    Length increment = m_layer->renderer()->style()->marqueeIncrement();
    2082     if (increment.value() < 0)
     2082    if (increment.isNegative())
    20832083        result = static_cast<EMarqueeDirection>(-result);
    20842084   
     
    21452145void Marquee::start()
    21462146{
    2147     if (m_timer.isActive() || m_layer->renderer()->style()->marqueeIncrement().value() == 0)
     2147    if (m_timer.isActive() || m_layer->renderer()->style()->marqueeIncrement().isZero())
    21482148        return;
    21492149   
  • trunk/WebCore/rendering/RenderObject.cpp

    r18534 r18574  
    837837    // These are always percents or auto.
    838838    if (shouldPaintBackgroundImage &&
    839             (bgLayer->backgroundXPosition().value() != 0 || bgLayer->backgroundYPosition().value() != 0 ||
     839            (!bgLayer->backgroundXPosition().isZero() || !bgLayer->backgroundYPosition().isZero() ||
    840840             bgLayer->backgroundSize().width.isPercent() || bgLayer->backgroundSize().height.isPercent()))
    841841        // The background image will shift unpredictably if the size changes.
     
    26632663
    26642664    // its "unset", choose nice default
    2665     if (lh.value() < 0)
     2665    if (lh.isNegative())
    26662666        return s->font().lineSpacing();
    26672667
  • trunk/WebCore/rendering/RenderSlider.cpp

    r18293 r18574  
    212212            theme()->adjustSliderThumbSize(m_thumb->renderer());
    213213
    214         if (style()->appearance() == SliderVerticalAppearance)
     214        if (style()->appearance() == SliderVerticalAppearance) {
     215            // FIXME: Handle percentage widths correctly. See http://bugs.webkit.org/show_bug.cgi?id=12104
    215216            m_thumb->renderer()->style()->setLeft(Length(m_width / 2 - m_thumb->renderer()->style()->width().value() / 2, Fixed));
    216         else
     217        } else {
     218            // FIXME: Handle percentage heights correctly. See http://bugs.webkit.org/show_bug.cgi?id=12104
    217219            m_thumb->renderer()->style()->setTop(Length(m_height / 2 - m_thumb->renderer()->style()->height().value() / 2, Fixed));
     220        }
    218221
    219222        if (relayoutChildren)
  • trunk/WebCore/rendering/RenderStyle.h

    r18557 r18574  
    108108
    109109
    110     bool nonZero() const { return left.value() || right.value() || top.value() || bottom.value(); }
     110    bool nonZero() const { return !(left.isZero() && right.isZero() && top.isZero() && bottom.isZero()); }
    111111};
    112112
     
    17711771    static int initialWidows() { return 2; }
    17721772    static int initialOrphans() { return 2; }
    1773     static Length initialLineHeight() { return Length(-100, Percent); }
     1773    static Length initialLineHeight() { return Length(-100.0, Percent); }
    17741774    static ETextAlign initialTextAlign() { return TAAUTO; }
    17751775    static ETextDecoration initialTextDecoration() { return TDNONE; }
  • trunk/WebCore/rendering/RenderTable.cpp

    r18294 r18574  
    210210
    211211    LengthType widthType = style()->width().type();
    212     if (widthType > Relative && style()->width().value() > 0) {
     212    if (widthType > Relative && style()->width().isPositive()) {
    213213        // Percent or fixed table
    214214        m_width = style()->width().calcMinValue(availableWidth);
  • trunk/WebCore/rendering/RenderTableSection.cpp

    r17824 r18574  
    191191        // we ignore height settings on rowspan cells
    192192        Length height = cell->style()->height();
    193         if (height.value() > 0 || (height.isRelative() && height.value() >= 0)) {
     193        if (height.isPositive() || (height.isRelative() && height.value() >= 0)) {
    194194            Length cRowHeight = grid[cRow].height;
    195195            switch (height.type()) {
    196196                case Percent:
    197197                    if (!(cRowHeight.isPercent()) ||
    198                         (cRowHeight.isPercent() && cRowHeight.value() < height.value()))
     198                        (cRowHeight.isPercent() && cRowHeight.rawValue() < height.rawValue()))
    199199                        grid[cRow].height = height;
    200200                        break;
     
    398398                numAuto++;
    399399            else if (grid[r].height.isPercent())
    400                 totalPercent += grid[r].height.value();
     400                totalPercent += grid[r].height.rawValue();
    401401        }
    402402        if (totalPercent) {
    403403            // try to satisfy percent
    404404            int add = 0;
    405             if (totalPercent > 100)
    406                 totalPercent = 100;
     405            if (totalPercent > 100 * percentScaleFactor)
     406                totalPercent = 100 * percentScaleFactor;
    407407            int rh = rowPos[1] - rowPos[0];
    408408            for (int r = 0; r < totalRows; r++) {
    409409                if (totalPercent > 0 && grid[r].height.isPercent()) {
    410                     int toAdd = min(dh, (totalHeight * grid[r].height.value() / 100) - rh);
     410                    int toAdd = min(dh, (totalHeight * grid[r].height.rawValue() / (100 * percentScaleFactor)) - rh);
    411411                    // If toAdd is negative, then we don't want to shrink the row (this bug
    412412                    // affected Outlook Web Access).
     
    414414                    add += toAdd;
    415415                    dh -= toAdd;
    416                     totalPercent -= grid[r].height.value();
     416                    totalPercent -= grid[r].height.rawValue();
    417417                }
    418418                if (r < totalRows - 1)
Note: See TracChangeset for help on using the changeset viewer.