Reviewed by Hyatt.
- test and updated results for http://bugs.webkit.org/show_bug.cgi?id=5164
Non-integer percentages are incorrectly rounded down in Safari
* 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.
- fix http://bugs.webkit.org/show_bug.cgi?id=5164
Non-integer percentages are incorrectly rounded down in Safari
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):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@18574
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-01-03 Mitz Pettel <mitz@webkit.org>
+
+ Reviewed by Hyatt.
+
+ - test and updated results for http://bugs.webkit.org/show_bug.cgi?id=5164
+ Non-integer percentages are incorrectly rounded down in Safari
+
+ * 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:
+
2007-01-03 Mitz Pettel <mitz@webkit.org>
Reviewed by Hyatt.
-7711ab1b2502c95d804d4dfba8796ae0
\ No newline at end of file
+7f7132b79b97bb2b06e2727a324edecc
\ No newline at end of file
RenderText {#text} at (48,0) size 10x10
text run at (48,0) width 10: "x"
RenderBlock {P} at (0,80) size 106x10 [bgcolor=#000080]
- RenderText {#text} at (49,0) size 10x10
- text run at (49,0) width 10: "x"
+ RenderText {#text} at (48,0) size 10x10
+ text run at (48,0) width 10: "x"
-2b7595d0d1513f162454186d04d583bd
\ No newline at end of file
+7f7132b79b97bb2b06e2727a324edecc
\ No newline at end of file
RenderText {#text} at (48,0) size 10x10
text run at (48,0) width 10: "x"
RenderBlock {P} at (0,80) size 106x10 [bgcolor=#000080]
- RenderText {#text} at (47,0) size 10x10
- text run at (47,0) width 10: "x"
+ RenderText {#text} at (48,0) size 10x10
+ text run at (48,0) width 10: "x"
-9d0299b6d59c126fb7c9c410f535e55f
\ No newline at end of file
+25ed9975af1d56ff395d80fc87bacaac
\ No newline at end of file
RenderBlock {HTML} at (0,0) size 800x420 [color=#FFFFFF] [bgcolor=#0000FF]
RenderBody {BODY} at (15,15) size 490x390 [bgcolor=#FFFFFF] [border: (5px solid #000000)]
RenderBlock {DL} at (5,5) size 480x10
- RenderBlock (floating) {DT} at (5,5) size 77x310 [bgcolor=#CC0000] [border: (5px solid #000000)]
+ RenderBlock (floating) {DT} at (5,5) size 79x310 [bgcolor=#CC0000] [border: (5px solid #000000)]
RenderText {#text} at (15,14) size 31x12
text run at (15,14) width 31: "toggle"
RenderBlock (floating) {DD} at (95,5) size 380x310 [border: (10px solid #000000)]
-dc8e164fe2bf66b76a68b84faea8a7e7
\ No newline at end of file
+7b35526e2db3a84ab2cf05332f3c1c12
\ No newline at end of file
RenderBlock {HTML} at (0,0) size 800x420 [color=#FFFFFF] [bgcolor=#0000FF]
RenderBody {BODY} at (15,15) size 490x390 [bgcolor=#FFFFFF] [border: (5px solid #000000)]
RenderBlock {DL} at (5,5) size 480x10
- RenderBlock (floating) {DT} at (5,5) size 77x310 [bgcolor=#CC0000] [border: (5px solid #000000)]
+ RenderBlock (floating) {DT} at (5,5) size 79x310 [bgcolor=#CC0000] [border: (5px solid #000000)]
RenderText {#text} at (15,14) size 31x12
text run at (15,14) width 31: "toggle"
RenderBlock (floating) {DD} at (95,5) size 380x310 [border: (10px solid #000000)]
--- /dev/null
+894253a73fdcd593dbb354e032c879ed
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 1013x585
+ RenderView at (0,0) size 800x585
+layer at (0,0) size 1013x585
+ RenderBlock {HTML} at (0,0) size 800x585
+ RenderBody {BODY} at (8,8) size 784x569
+ RenderBlock {DIV} at (0,0) size 100x100 [bgcolor=#00FF00]
+ RenderBlock {DIV} at (0,0) size 100x4
+ RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
+ RenderBlock {DIV} at (0,4) size 1005x4
+ RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
+ RenderBlock {DIV} at (0,8) size 995x4
+ RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
+ RenderBlock {DIV} at (0,12) size 985x4
+ RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
+ RenderBlock {DIV} at (0,16) size 975x4
+ RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
+ RenderBlock {DIV} at (0,20) size 965x4
+ RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
+ RenderBlock {DIV} at (0,24) size 955x4
+ RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
+ RenderBlock {DIV} at (0,28) size 945x4
+ RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
+ RenderBlock {DIV} at (0,32) size 935x4
+ RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
+ RenderBlock {DIV} at (0,36) size 930x4
+ RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
+ RenderBlock {DIV} at (0,40) size 920x4
+ RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
+ RenderBlock {DIV} at (0,44) size 910x4
+ RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
+ RenderBlock {DIV} at (0,48) size 910x4
+ RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
+ RenderBlock {DIV} at (0,52) size 900x4
+ RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
+ RenderBlock {DIV} at (0,56) size 890x4
+ RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
+ RenderBlock {DIV} at (0,60) size 885x4
+ RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
+ RenderBlock {DIV} at (0,64) size 875x4
+ RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
+ RenderBlock {DIV} at (0,68) size 870x4
+ RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
+ RenderBlock {DIV} at (0,72) size 860x4
+ RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
+ RenderBlock {DIV} at (0,76) size 850x4
+ RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
+ RenderBlock {DIV} at (0,80) size 845x4
+ RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
+ RenderBlock {DIV} at (0,84) size 840x4
+ RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
+ RenderBlock {DIV} at (0,88) size 835x4
+ RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
+ RenderBlock {DIV} at (0,92) size 825x4
+ RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
+ RenderBlock {DIV} at (0,96) size 815x4
+ RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F]
+ RenderBlock (anonymous) at (0,100) size 784x18
+ RenderBR {BR} at (0,0) size 0x18
+layer at (8,126) size 293x10
+ RenderTable {TABLE} at (0,0) size 293x10
+ RenderTableSection {TBODY} at (0,0) size 293x10
+ RenderTableRow {TR} at (0,0) size 293x10
+ RenderTableCell {TD} at (0,5) size 11x0 [bgcolor=#00FF00] [r=0 c=0 rs=1 cs=1]
+ RenderTableCell {TD} at (11,5) size 10x0 [bgcolor=#000000] [r=0 c=1 rs=1 cs=1]
+ RenderTableCell {TD} at (21,5) size 13x0 [bgcolor=#00FF00] [r=0 c=2 rs=1 cs=1]
+ RenderTableCell {TD} at (34,5) size 10x0 [bgcolor=#000000] [r=0 c=3 rs=1 cs=1]
+ RenderTableCell {TD} at (44,5) size 15x0 [bgcolor=#00FF00] [r=0 c=4 rs=1 cs=1]
+ RenderTableCell {TD} at (59,5) size 10x0 [bgcolor=#000000] [r=0 c=5 rs=1 cs=1]
+ RenderTableCell {TD} at (69,5) size 17x0 [bgcolor=#00FF00] [r=0 c=6 rs=1 cs=1]
+ RenderTableCell {TD} at (86,5) size 10x0 [bgcolor=#000000] [r=0 c=7 rs=1 cs=1]
+ RenderTableCell {TD} at (96,5) size 20x0 [bgcolor=#00FF00] [r=0 c=8 rs=1 cs=1]
+ RenderTableCell {TD} at (116,5) size 10x0 [bgcolor=#000000] [r=0 c=9 rs=1 cs=1]
+ RenderTableCell {TD} at (126,5) size 21x0 [bgcolor=#00FF00] [r=0 c=10 rs=1 cs=1]
+ RenderTableCell {TD} at (147,5) size 10x0 [bgcolor=#000000] [r=0 c=11 rs=1 cs=1]
+ RenderTableCell {TD} at (157,5) size 23x0 [bgcolor=#00FF00] [r=0 c=12 rs=1 cs=1]
+ RenderTableCell {TD} at (180,5) size 10x0 [bgcolor=#000000] [r=0 c=13 rs=1 cs=1]
+ RenderTableCell {TD} at (190,5) size 25x0 [bgcolor=#00FF00] [r=0 c=14 rs=1 cs=1]
+ RenderTableCell {TD} at (215,5) size 10x0 [bgcolor=#000000] [r=0 c=15 rs=1 cs=1]
+ RenderTableCell {TD} at (225,5) size 27x0 [bgcolor=#00FF00] [r=0 c=16 rs=1 cs=1]
+ RenderTableCell {TD} at (252,5) size 10x0 [bgcolor=#000000] [r=0 c=17 rs=1 cs=1]
+ RenderTableCell {TD} at (262,5) size 30x0 [bgcolor=#00FF00] [r=0 c=18 rs=1 cs=1]
+ RenderTableCell {TD} at (292,5) size 1x0 [r=0 c=19 rs=1 cs=1]
+layer at (8,126) size 1000x10
+ RenderTable {TABLE} at (0,0) size 1000x10
+ RenderTableSection {TBODY} at (0,0) size 1000x10
+ RenderTableRow {TR} at (0,0) size 1000x10
+ RenderTableCell {TD} at (0,5) size 11x0 [bgcolor=#0000007F] [r=0 c=0 rs=1 cs=1]
+ RenderTableCell {TD} at (11,5) size 10x0 [bgcolor=#00FF007F] [r=0 c=1 rs=1 cs=1]
+ RenderTableCell {TD} at (21,5) size 13x0 [bgcolor=#0000007F] [r=0 c=2 rs=1 cs=1]
+ RenderTableCell {TD} at (34,5) size 10x0 [bgcolor=#00FF007F] [r=0 c=3 rs=1 cs=1]
+ RenderTableCell {TD} at (44,5) size 15x0 [bgcolor=#0000007F] [r=0 c=4 rs=1 cs=1]
+ RenderTableCell {TD} at (59,5) size 10x0 [bgcolor=#00FF007F] [r=0 c=5 rs=1 cs=1]
+ RenderTableCell {TD} at (69,5) size 17x0 [bgcolor=#0000007F] [r=0 c=6 rs=1 cs=1]
+ RenderTableCell {TD} at (86,5) size 10x0 [bgcolor=#00FF007F] [r=0 c=7 rs=1 cs=1]
+ RenderTableCell {TD} at (96,5) size 20x0 [bgcolor=#0000007F] [r=0 c=8 rs=1 cs=1]
+ RenderTableCell {TD} at (116,5) size 10x0 [bgcolor=#00FF007F] [r=0 c=9 rs=1 cs=1]
+ RenderTableCell {TD} at (126,5) size 21x0 [bgcolor=#0000007F] [r=0 c=10 rs=1 cs=1]
+ RenderTableCell {TD} at (147,5) size 10x0 [bgcolor=#00FF007F] [r=0 c=11 rs=1 cs=1]
+ RenderTableCell {TD} at (157,5) size 23x0 [bgcolor=#0000007F] [r=0 c=12 rs=1 cs=1]
+ RenderTableCell {TD} at (180,5) size 10x0 [bgcolor=#00FF007F] [r=0 c=13 rs=1 cs=1]
+ RenderTableCell {TD} at (190,5) size 25x0 [bgcolor=#0000007F] [r=0 c=14 rs=1 cs=1]
+ RenderTableCell {TD} at (215,5) size 10x0 [bgcolor=#00FF007F] [r=0 c=15 rs=1 cs=1]
+ RenderTableCell {TD} at (225,5) size 27x0 [bgcolor=#0000007F] [r=0 c=16 rs=1 cs=1]
+ RenderTableCell {TD} at (252,5) size 10x0 [bgcolor=#00FF007F] [r=0 c=17 rs=1 cs=1]
+ RenderTableCell {TD} at (262,5) size 30x0 [bgcolor=#0000007F] [r=0 c=18 rs=1 cs=1]
+ RenderTableCell {TD} at (292,5) size 708x0 [r=0 c=19 rs=1 cs=1]
--- /dev/null
+<head>
+ <title>Test for http://bugs.webkit.org/show_bug.cgi?id=5164</title>
+ <style type="text/css">
+ div.bar { height: 4px; background-color: rgba(0, 0, 0, 0.5); }
+ td.green { background-color: green; }
+ td.black { background-color: black; }
+ td.red { background-color: #0f0; }
+ td.greenOverlay { background-color: rgba(0, 255, 0, 0.5); }
+ td.blackOverlay { background-color: rgba(0, 0, 0, 0.5); }
+ td.sep { width: 10px; }
+ </style>
+</head>
+<body>
+ <div style="background-color: #0f0; width: 100px; height: 100px;">
+ <div><div class="bar" style="width: 100px"></div></div>
+ <div style="width: 1005px"><div class="bar" style="width: 10%"></div></div>
+ <div style="width: 995px"><div class="bar" style="width: 10.1%"></div></div>
+ <div style="width: 985px"><div class="bar" style="width: 10.2%"></div></div>
+ <div style="width: 975px"><div class="bar" style="width: 10.3%"></div></div>
+ <div style="width: 965px"><div class="bar" style="width: 10.4%"></div></div>
+ <div style="width: 955px"><div class="bar" style="width: 10.5%"></div></div>
+ <div style="width: 945px"><div class="bar" style="width: 10.6%"></div></div>
+ <div style="width: 935px"><div class="bar" style="width: 10.7%"></div></div>
+ <div style="width: 930px"><div class="bar" style="width: 10.8%"></div></div>
+ <div style="width: 920px"><div class="bar" style="width: 10.9%"></div></div>
+ <div style="width: 910px"><div class="bar" style="width: 11%"></div></div>
+ <div style="width: 910px"><div class="bar" style="width: 11.1%"></div></div>
+ <div style="width: 900px"><div class="bar" style="width: 11.2%"></div></div>
+ <div style="width: 890px"><div class="bar" style="width: 11.3%"></div></div>
+ <div style="width: 885px"><div class="bar" style="width: 11.4%"></div></div>
+ <div style="width: 875px"><div class="bar" style="width: 11.5%"></div></div>
+ <div style="width: 870px"><div class="bar" style="width: 11.6%"></div></div>
+ <div style="width: 860px"><div class="bar" style="width: 11.7%"></div></div>
+ <div style="width: 850px"><div class="bar" style="width: 11.8%"></div></div>
+ <div style="width: 845px"><div class="bar" style="width: 11.9%"></div></div>
+ <div style="width: 840px"><div class="bar" style="width: 12%"></div></div>
+ <div style="width: 835px"><div class="bar" style="width: 12.1%"></div></div>
+ <div style="width: 825px"><div class="bar" style="width: 12.2%"></div></div>
+ <div style="width: 815px"><div class="bar" style="width: 12.3%"></div></div>
+ </div>
+ <br>
+ <div style="position: relative;">
+ <table style="position: absolute; top: 0; left: 0; " cellpadding="0" cellspacing="0">
+ <tr style="height: 10px;">
+ <td class="red" style="width: 11px;"></td>
+ <td class="black sep"></td>
+ <td class="red" style="width: 13px;"></td>
+ <td class="black sep"></td>
+ <td class="red" style="width: 15px;"></td>
+ <td class="black sep"></td>
+ <td class="red" style="width: 17px;"></td>
+ <td class="black sep"></td>
+ <td class="red" style="width: 20px;"></td>
+ <td class="black sep"></td>
+ <td class="red" style="width: 21px;"></td>
+ <td class="black sep"></td>
+ <td class="red" style="width: 23px;"></td>
+ <td class="black sep"></td>
+ <td class="red" style="width: 25px;"></td>
+ <td class="black sep"></td>
+ <td class="red" style="width: 27px;"></td>
+ <td class="black sep"></td>
+ <td class="red" style="width: 30px;"></td>
+ <td></td>
+ </tr>
+ </table>
+ <table style="position: absolute; top: 0; left: 0; width: 1000px;" cellpadding="0" cellspacing="0">
+ <tr style="height: 10px;">
+ <td class="blackOverlay" style="width: 1.2%;"></td>
+ <td class="greenOverlay sep"></td>
+ <td class="blackOverlay" style="width: 1.4%;"></td>
+ <td class="greenOverlay sep"></td>
+ <td class="blackOverlay" style="width: 1.6%;"></td>
+ <td class="greenOverlay sep"></td>
+ <td class="blackOverlay" style="width: 1.8%;"></td>
+ <td class="greenOverlay sep"></td>
+ <td class="blackOverlay" style="width: 2%;"></td>
+ <td class="greenOverlay sep"></td>
+ <td class="blackOverlay" style="width: 2.2%;"></td>
+ <td class="greenOverlay sep"></td>
+ <td class="blackOverlay" style="width: 2.4%;"></td>
+ <td class="greenOverlay sep"></td>
+ <td class="blackOverlay" style="width: 2.6%;"></td>
+ <td class="greenOverlay sep"></td>
+ <td class="blackOverlay" style="width: 2.8%;"></td>
+ <td class="greenOverlay sep"></td>
+ <td class="blackOverlay" style="width: 3%;"></td>
+ <td></td>
+ </tr>
+ </table>
+ </div>
+</body>
+</html>
-ff5c33d0a2ce20927f83a1b91b20c392
\ No newline at end of file
+6707f72f5237fc83cb3b9964a9d36a65
\ No newline at end of file
RenderText {#text} at (2,2) size 12x18
text run at (2,2) width 12: "A"
RenderTableRow {TR} at (0,26) size 782x22
- RenderTableCell {TD} at (2,35) size 8x4 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
- RenderTableCell {TD} at (12,26) size 768x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
+ RenderTableCell {TD} at (2,35) size 16x4 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
+ RenderTableCell {TD} at (20,26) size 760x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
RenderText {#text} at (2,2) size 195x18
text run at (2,2) width 195: "This text is invariably wrapped"
-c73a41b72a58b7019bf7365514617012
\ No newline at end of file
+2a4b3675cb2c398069a47c7fb891d24a
\ No newline at end of file
RenderText {#text} at (2,2) size 27x18
text run at (2,2) width 27: "auto"
RenderTableRow {TR} at (0,32) size 498x22
- RenderTableCell {TD} at (5,32) size 291x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
+ RenderTableCell {TD} at (5,32) size 294x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
RenderText {#text} at (2,2) size 24x18
text run at (2,2) width 24: "100"
- RenderTableCell {TD} at (301,32) size 90x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
+ RenderTableCell {TD} at (304,32) size 87x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
RenderText {#text} at (2,2) size 27x18
text run at (2,2) width 27: "auto"
RenderTableCell {TD} at (396,32) size 97x22 [border: (1px inset #808080)] [r=1 c=2 rs=1 cs=1]
RenderText {#text} at (2,2) size 27x18
text run at (2,2) width 27: "auto"
RenderTableRow {TR} at (0,32) size 498x22
- RenderTableCell {TD} at (5,32) size 95x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
+ RenderTableCell {TD} at (5,32) size 97x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
RenderText {#text} at (2,2) size 24x18
text run at (2,2) width 24: "100"
- RenderTableCell {TD} at (105,32) size 286x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
+ RenderTableCell {TD} at (107,32) size 284x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
RenderText {#text} at (2,2) size 24x18
text run at (2,2) width 24: "300"
RenderTableCell {TD} at (396,32) size 97x22 [border: (1px inset #808080)] [r=1 c=2 rs=1 cs=1]
RenderText {#text} at (2,2) size 27x18
text run at (2,2) width 27: "auto"
RenderTableRow {TR} at (0,32) size 498x58
- RenderTableCell {TD} at (5,50) size 66x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
+ RenderTableCell {TD} at (5,50) size 70x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
RenderText {#text} at (2,2) size 27x18
text run at (2,2) width 27: "auto"
- RenderTableCell {TD} at (76,50) size 141x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
+ RenderTableCell {TD} at (80,50) size 143x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
RenderText {#text} at (2,2) size 59x18
text run at (2,2) width 59: "auto-auto"
- RenderTableCell {TD} at (222,50) size 217x22 [border: (1px inset #808080)] [r=1 c=2 rs=1 cs=1]
+ RenderTableCell {TD} at (228,50) size 211x22 [border: (1px inset #808080)] [r=1 c=2 rs=1 cs=1]
RenderText {#text} at (2,2) size 89x18
text run at (2,2) width 89: "auto auto auto"
RenderTableCell {TD} at (444,32) size 49x58 [border: (1px inset #808080)] [r=1 c=3 rs=1 cs=1]
RenderText {#text} at (2,2) size 27x18
text run at (2,2) width 27: "auto"
RenderTableRow {TR} at (0,32) size 498x22
- RenderTableCell {TD} at (5,32) size 122x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
+ RenderTableCell {TD} at (5,32) size 124x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
RenderText {#text} at (2,2) size 27x18
text run at (2,2) width 27: "auto"
- RenderTableCell {TD} at (132,32) size 125x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
+ RenderTableCell {TD} at (134,32) size 123x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
RenderText {#text} at (2,2) size 27x18
text run at (2,2) width 27: "auto"
RenderTableCell {TD} at (262,32) size 231x22 [border: (1px inset #808080)] [r=1 c=2 rs=1 cs=1]
RenderText {#text} at (2,2) size 27x18
text run at (2,2) width 27: "auto"
RenderTableRow {TR} at (0,59) size 498x22
- RenderTableCell {TD} at (5,59) size 122x22 [border: (1px inset #808080)] [r=2 c=0 rs=1 cs=1]
+ RenderTableCell {TD} at (5,59) size 124x22 [border: (1px inset #808080)] [r=2 c=0 rs=1 cs=1]
RenderText {#text} at (2,2) size 27x18
text run at (2,2) width 27: "auto"
- RenderTableCell {TD} at (132,59) size 361x22 [border: (1px inset #808080)] [r=2 c=1 rs=1 cs=2]
+ RenderTableCell {TD} at (134,59) size 359x22 [border: (1px inset #808080)] [r=2 c=1 rs=1 cs=2]
RenderText {#text} at (2,2) size 95x18
text run at (2,2) width 95: "90% 90% 90%"
RenderBlock (anonymous) at (0,2725) size 769x18
RenderText {#text} at (2,2) size 27x18
text run at (2,2) width 27: "auto"
RenderTableRow {TR} at (0,32) size 498x22
- RenderTableCell {TD} at (5,32) size 139x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
+ RenderTableCell {TD} at (5,32) size 142x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
RenderText {#text} at (2,2) size 27x18
text run at (2,2) width 27: "auto"
- RenderTableCell {TD} at (149,32) size 291x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
+ RenderTableCell {TD} at (152,32) size 288x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
RenderText {#text} at (2,2) size 59x18
text run at (2,2) width 59: "auto-auto"
RenderTableCell {TD} at (445,32) size 48x22 [border: (1px inset #808080)] [r=1 c=2 rs=1 cs=1]
RenderTable {TABLE} at (0,3519) size 500x61 [border: (1px outset #808080)]
RenderTableSection {TBODY} at (1,1) size 498x59
RenderTableRow {TR} at (0,5) size 498x22
- RenderTableCell {TD} at (5,5) size 435x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=2]
+ RenderTableCell {TD} at (5,5) size 434x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=2]
RenderText {#text} at (2,2) size 194x18
text run at (2,2) width 194: "90% 90% 90% 90% 90% 90%"
- RenderTableCell {TD} at (445,5) size 48x22 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
+ RenderTableCell {TD} at (444,5) size 49x22 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
RenderText {#text} at (2,2) size 27x18
text run at (2,2) width 27: "auto"
RenderTableRow {TR} at (0,32) size 498x22
- RenderTableCell {TD} at (5,32) size 191x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
+ RenderTableCell {TD} at (5,32) size 195x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
RenderText {#text} at (2,2) size 16x18
text run at (2,2) width 16: "10"
- RenderTableCell {TD} at (201,32) size 239x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
+ RenderTableCell {TD} at (205,32) size 234x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
RenderText {#text} at (2,2) size 16x18
text run at (2,2) width 16: "20"
- RenderTableCell {TD} at (445,32) size 48x22 [border: (1px inset #808080)] [r=1 c=2 rs=1 cs=1]
+ RenderTableCell {TD} at (444,32) size 49x22 [border: (1px inset #808080)] [r=1 c=2 rs=1 cs=1]
RenderText {#text} at (2,2) size 27x18
text run at (2,2) width 27: "auto"
RenderBlock (anonymous) at (0,3580) size 769x18
RenderTable {TABLE} at (0,3695) size 500x61 [border: (1px outset #808080)]
RenderTableSection {TBODY} at (1,1) size 498x59
RenderTableRow {TR} at (0,5) size 498x22
- RenderTableCell {TD} at (5,5) size 434x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=2]
+ RenderTableCell {TD} at (5,5) size 435x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=2]
RenderText {#text} at (2,2) size 161x18
text run at (2,2) width 161: "90% 50% 50% 50% 50%"
- RenderTableCell {TD} at (444,5) size 49x22 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
+ RenderTableCell {TD} at (445,5) size 48x22 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
RenderText {#text} at (2,2) size 27x18
text run at (2,2) width 27: "auto"
RenderTableRow {TR} at (0,32) size 498x22
- RenderTableCell {TD} at (5,32) size 224x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
+ RenderTableCell {TD} at (5,32) size 227x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
RenderText {#text} at (2,2) size 24x18
text run at (2,2) width 24: "100"
- RenderTableCell {TD} at (234,32) size 205x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
+ RenderTableCell {TD} at (237,32) size 203x22 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
RenderText {#text} at (2,2) size 89x18
text run at (2,2) width 89: "auto auto auto"
- RenderTableCell {TD} at (444,32) size 49x22 [border: (1px inset #808080)] [r=1 c=2 rs=1 cs=1]
+ RenderTableCell {TD} at (445,32) size 48x22 [border: (1px inset #808080)] [r=1 c=2 rs=1 cs=1]
RenderText {#text} at (2,2) size 27x18
text run at (2,2) width 27: "auto"
RenderBlock (anonymous) at (0,3756) size 769x36
+2007-01-03 Mitz Pettel <mitz@webkit.org>
+
+ Reviewed by Hyatt.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=5164
+ Non-integer percentages are incorrectly rounded down in Safari
+
+ 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):
+
2007-01-03 Mitz Pettel <mitz@webkit.org>
Reviewed by Hyatt.
case MinIntrinsic:
return new CSSPrimitiveValue(CSS_VAL_MIN_INTRINSIC);
case Percent:
- return new CSSPrimitiveValue(length.value(), CSSPrimitiveValue::CSS_PERCENTAGE);
+ return new CSSPrimitiveValue(length.percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
case Relative:
case Static:
// Should never be reached.
{
String string;
if (length.isPercent())
- string = numberAsString(length.value()) + "%";
+ string = numberAsString(length.percent()) + "%";
else if (length.isFixed())
string = numberAsString(length.calcMinValue(0));
else if (length.isAuto())
String string;
Length length(style->backgroundXPosition());
if (length.isPercent())
- string = numberAsString(length.value()) + "%";
+ string = numberAsString(length.percent()) + "%";
else
string = numberAsString(length.calcMinValue(renderer->contentWidth()));
string += " ";
length = style->backgroundYPosition();
if (length.isPercent())
- string += numberAsString(length.value()) + "%";
+ string += numberAsString(length.percent()) + "%";
else
string += numberAsString(length.calcMinValue(renderer->contentWidth()));
return new CSSPrimitiveValue(string, CSSPrimitiveValue::CSS_STRING);
return new CSSPrimitiveValue(style->lineClamp(), CSSPrimitiveValue::CSS_PERCENTAGE);
case CSS_PROP_LINE_HEIGHT: {
Length length(style->lineHeight());
- if (length.value() < 0)
+ if (length.isNegative())
return new CSSPrimitiveValue(CSS_VAL_NORMAL);
if (length.isPercent()) {
// This is imperfect, because it doesn't include the zoom factor and the real computation
// On the other hand, since font-size doesn't include the zoom factor, we really can't do
// that here either.
float fontSize = style->fontDescription().specifiedSize();
- return new CSSPrimitiveValue((int)(length.value() * fontSize) / 100, CSSPrimitiveValue::CSS_PX);
+ return new CSSPrimitiveValue((int)(length.percent() * fontSize) / 100, CSSPrimitiveValue::CSS_PX);
}
else {
return new CSSPrimitiveValue(length.value(), CSSPrimitiveValue::CSS_PX);
if(type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG)
l = Length(primitiveValue->computeLengthIntForLength(style), Fixed);
else if(type == CSSPrimitiveValue::CSS_PERCENTAGE)
- l = Length(int(primitiveValue->getFloatValue()), Percent);
+ l = Length(primitiveValue->getFloatValue(), Percent);
else if(type == CSSPrimitiveValue::CSS_NUMBER)
- l = Length(int(primitiveValue->getFloatValue() * 100), Percent);
+ l = Length(primitiveValue->getFloatValue() * 100.0, Percent);
else if (ok)
*ok = false;
}
l = Length(primitiveValue->computeLengthIntForLength(style), Fixed,
primitiveValue->isQuirkValue());
else if(type == CSSPrimitiveValue::CSS_PERCENTAGE)
- l = Length((int)primitiveValue->getFloatValue(), Percent);
+ l = Length(primitiveValue->getFloatValue(), Percent);
else
return;
if (id == CSS_PROP_PADDING_LEFT || id == CSS_PROP_PADDING_RIGHT ||
if (type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG)
l = Length(primitiveValue->computeLengthIntForLength(style), Fixed);
else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
- l = Length((int)primitiveValue->getFloatValue(), Percent);
+ l = Length(primitiveValue->getFloatValue(), Percent);
else
return;
apply = true;
if(type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG)
l = Length(primitiveValue->computeLengthIntForLength(style), Fixed);
else if(type == CSSPrimitiveValue::CSS_PERCENTAGE)
- l = Length(int(primitiveValue->getFloatValue()), Percent);
+ l = Length(primitiveValue->getFloatValue(), Percent);
style->setVerticalAlign(LENGTH);
style->setVerticalAlignLength(l);
Length lineHeight;
int type = primitiveValue->primitiveType();
if (primitiveValue->getIdent() == CSS_VAL_NORMAL)
- lineHeight = Length(-100, Percent);
+ lineHeight = Length(-100.0, Percent);
else if (type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG) {
double multiplier = 1.0;
// Scale for the font zoom factor only for types other than "em" and "ex", since those are
} else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
lineHeight = Length((style->fontSize() * int(primitiveValue->getFloatValue())) / 100, Fixed);
else if (type == CSSPrimitiveValue::CSS_NUMBER)
- lineHeight = Length(int(primitiveValue->getFloatValue() * 100), Percent);
+ lineHeight = Length(primitiveValue->getFloatValue() * 100.0, Percent);
else
return;
style->setLineHeight(lineHeight);
LengthBox& l = image.m_slices;
RectImpl* r = borderImage->m_imageSliceRect.get();
if (r->top()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
- l.top = Length((int)r->top()->getFloatValue(), Percent);
+ l.top = Length(r->top()->getFloatValue(), Percent);
else
l.top = Length((int)r->top()->getFloatValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
if (r->bottom()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
- l.bottom = Length((int)r->bottom()->getFloatValue(), Percent);
+ l.bottom = Length(r->bottom()->getFloatValue(), Percent);
else
l.bottom = Length((int)r->bottom()->getFloatValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
if (r->left()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
- l.left = Length((int)r->left()->getFloatValue(), Percent);
+ l.left = Length(r->left()->getFloatValue(), Percent);
else
l.left = Length((int)r->left()->getFloatValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
if (r->right()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
- l.right = Length((int)r->right()->getFloatValue(), Percent);
+ l.right = Length(r->right()->getFloatValue(), Percent);
else
l.right = Length((int)r->right()->getFloatValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
else if (firstType > CSSPrimitiveValue::CSS_PERCENTAGE && firstType < CSSPrimitiveValue::CSS_DEG)
firstLength = Length(first->computeLengthIntForLength(style), Fixed);
else if (firstType == CSSPrimitiveValue::CSS_PERCENTAGE)
- firstLength = Length((int)first->getFloatValue(), Percent);
+ firstLength = Length(first->getFloatValue(), Percent);
else
return;
else if (secondType > CSSPrimitiveValue::CSS_PERCENTAGE && secondType < CSSPrimitiveValue::CSS_DEG)
secondLength = Length(second->computeLengthIntForLength(style), Fixed);
else if (secondType == CSSPrimitiveValue::CSS_PERCENTAGE)
- secondLength = Length((int)second->getFloatValue(), Percent);
+ secondLength = Length(second->getFloatValue(), Percent);
else
return;
if(type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG)
l = Length(primitiveValue->computeLengthIntForLength(style), Fixed);
else if(type == CSSPrimitiveValue::CSS_PERCENTAGE)
- l = Length((int)primitiveValue->getFloatValue(), Percent);
+ l = Length(primitiveValue->getFloatValue(), Percent);
else
return;
layer->setBackgroundXPosition(l);
if(type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG)
l = Length(primitiveValue->computeLengthIntForLength(style), Fixed);
else if(type == CSSPrimitiveValue::CSS_PERCENTAGE)
- l = Length((int)primitiveValue->getFloatValue(), Percent);
+ l = Length(primitiveValue->getFloatValue(), Percent);
else
return;
layer->setBackgroundYPosition(l);
if (i < m_length) {
UChar next = m_data[i];
if (next == '%')
- return Length(r, Percent);
+ return Length(static_cast<double>(r), Percent);
if (next == '*')
return Length(r, Relative);
}
}
Length w = cell->styleOrColWidth();
- if (w.value() > 32760)
- w.setValue(32760);
- if (w.value() < 0)
+ // FIXME: What is this arbitrary value?
+ if (w.rawValue() > 32760)
+ w.setRawValue(32760);
+ if (w.isNegative())
w.setValue(0);
switch(w.type()) {
case Fixed:
break;
case Percent:
m_hasPercent = true;
- if (w.value() > 0 && (!l.width.isPercent() || w.value() > l.width.value()))
+ if (w.isPositive() && (!l.width.isPercent() || w.rawValue() > l.width.rawValue()))
l.width = w;
break;
case Relative:
- if (w.isAuto() || (w.isRelative() && w.value() > l.width.value()))
+ // FIXME: Need to understand this case and whether it makes sense to compare values
+ // which are not necessarily of the same type.
+ if (w.isAuto() || (w.isRelative() && w.value() > l.width.rawValue()))
l.width = w;
default:
break;
Length w = col->style()->width();
if (w.isAuto())
w = grpWidth;
- if ((w.isFixed() && w.value() == 0) || (w.isPercent() && w.value() == 0))
+ if ((w.isFixed() || w.isPercent()) && w.isZero())
w = Length();
int cEffCol = m_table->colToEffCol(cCol);
#ifdef DEBUG_LAYOUT
int maxPercent = 0;
int maxNonPercent = 0;
- int remainingPercent = 100;
+ int remainingPercent = 100 * percentScaleFactor;
for (unsigned int i = 0; i < m_layoutStruct.size(); i++) {
minWidth += m_layoutStruct[i].effMinWidth;
maxWidth += m_layoutStruct[i].effMaxWidth;
if (m_layoutStruct[i].effWidth.isPercent()) {
- int percent = min(m_layoutStruct[i].effWidth.value(), remainingPercent);
- int pw = (m_layoutStruct[i].effMaxWidth * 100) / max(percent, 1);
+ int percent = min(m_layoutStruct[i].effWidth.rawValue(), remainingPercent);
+ int pw = (m_layoutStruct[i].effMaxWidth * 100 * percentScaleFactor) / max(percent, percentScaleFactor);
remainingPercent -= percent;
maxPercent = max(pw, maxPercent);
} else {
}
if (shouldScaleColumns(m_table)) {
- maxNonPercent = (maxNonPercent * 100 + 50) / max(remainingPercent, 1);
+ // FIXME: Why 50?
+ maxNonPercent = (maxNonPercent * 100 + 50) * percentScaleFactor / max(remainingPercent, percentScaleFactor);
maxWidth = max(maxNonPercent, maxWidth);
maxWidth = max(maxWidth, maxPercent);
}
int span = cell->colSpan();
Length w = cell->styleOrColWidth();
- if (!w.isRelative() && w.value() == 0)
+ if (!w.isRelative() && w.isZero())
w = Length(); // make it Auto
int col = m_table->colToEffCol(cell->col());
while (lastCol < nEffCols && span > 0) {
switch (m_layoutStruct[lastCol].width.type()) {
case Percent:
- totalPercent += m_layoutStruct[lastCol].width.value();
+ totalPercent += m_layoutStruct[lastCol].width.rawValue();
allColsAreFixed = false;
break;
case Fixed:
allColsArePercent = false;
}
else
- totalPercent += m_layoutStruct[lastCol].effWidth.value();
+ totalPercent += m_layoutStruct[lastCol].effWidth.rawValue();
allColsAreFixed = false;
}
span -= m_table->spanOfEffCol(lastCol);
// adjust table max width if needed
if (w.isPercent()) {
- if (totalPercent > w.value() || allColsArePercent) {
+ if (totalPercent > w.rawValue() || allColsArePercent) {
// can't satify this condition, treat as variable
w = Length();
} else {
#ifdef DEBUG_LAYOUT
qDebug(" adjusting tMaxWidth (%d): spanMax=%d, value=%d, totalPercent=%d", tMaxWidth, spanMax, w.value, totalPercent);
#endif
- tMaxWidth = max(tMaxWidth, spanMax * 100 / w.value());
+ tMaxWidth = max(tMaxWidth, spanMax * 100 * percentScaleFactor / w.rawValue());
// all non percent columns in the span get percent vlaues to sum up correctly.
- int percentMissing = w.value() - totalPercent;
+ int percentMissing = w.rawValue() - totalPercent;
int totalWidth = 0;
for (unsigned int pos = col; pos < lastCol; pos++) {
if (!(m_layoutStruct[pos].width.isPercent()))
totalWidth -= m_layoutStruct[pos].effMaxWidth;
percentMissing -= percent;
if (percent > 0)
- m_layoutStruct[pos].effWidth = Length(percent, Percent);
+ m_layoutStruct[pos].effWidth.setRawValue(Percent, percent);
else
m_layoutStruct[pos].effWidth = Length();
}
switch (width.type()) {
case Percent:
havePercent = true;
- totalPercent += width.value();
+ totalPercent += width.rawValue();
break;
case Relative:
haveRelative = true;
m_layoutStruct[i].calcWidth = w;
}
}
- if (totalPercent > 100) {
+ if (totalPercent > 100 * percentScaleFactor) {
// remove overallocated space from the last columns
- int excess = tableWidth*(totalPercent-100)/100;
+ int excess = tableWidth*(totalPercent - 100 * percentScaleFactor) / (100 * percentScaleFactor);
for (int i = nEffCols-1; i >= 0; i--) {
if (m_layoutStruct[i].effWidth.isPercent()) {
int w = m_layoutStruct[i].calcWidth;
#endif
// spread over percent colums
- if (available > 0 && m_hasPercent && totalPercent < 100) {
+ if (available > 0 && m_hasPercent && totalPercent < 100 * percentScaleFactor) {
// still have some width to spread, distribute weighted to percent columns
for (int i = 0; i < nEffCols; i++) {
Length &width = m_layoutStruct[i].effWidth;
if (width.isPercent()) {
- int w = available * width.value() / totalPercent;
+ int w = available * width.rawValue() / totalPercent;
available -= w;
- totalPercent -= width.value();
+ totalPercent -= width.rawValue();
m_layoutStruct[i].calcWidth += w;
if (!available || !totalPercent) break;
}
void AutoTableLayout::calcPercentages() const
{
- m_totalPercent = 0;
+ unsigned totalPercent = 0;
for (unsigned i = 0; i < m_layoutStruct.size(); i++) {
if (m_layoutStruct[i].width.isPercent())
- m_totalPercent += m_layoutStruct[i].width.value();
+ totalPercent += m_layoutStruct[i].width.rawValue();
}
+ m_totalPercent = totalPercent / percentScaleFactor;
m_percentagesDirty = false;
}
m_width[nEffCols-1] = Length();
}
int eSpan = m_table->spanOfEffCol(cCol+i);
- if ((w.isFixed() || w.isPercent()) && w.value() > 0) {
- m_width[cCol+i] = Length(w.value() * eSpan, w.type());
+ if ((w.isFixed() || w.isPercent()) && w.isPositive()) {
+ m_width[cCol+i].setRawValue(w.type(), w.rawValue() * eSpan);
usedWidth += effWidth * eSpan;
#ifdef DEBUG_LAYOUT
qDebug(" setting effCol %d (span=%d) to m_width %d(type=%d)",
Length w = cell->styleOrColWidth();
int span = cell->colSpan();
int effWidth = 0;
- if ((w.isFixed() || w.isPercent()) && w.value() > 0)
- effWidth = w.value();
+ // FIXME: This does not make sense (mixing percentages with absolute length)
+ if ((w.isFixed() || w.isPercent()) && w.isPositive())
+ effWidth = w.isPercent() ? w.rawValue() / percentScaleFactor : w.value();
#ifdef DEBUG_LAYOUT
qDebug(" table cell: effCol=%d, span=%d: %d", cCol, span, effWidth);
int eSpan = m_table->spanOfEffCol(cCol+i);
// only set if no col element has already set it.
if (m_width[cCol+i].isAuto() && w.type() != Auto) {
- m_width[cCol+i] = Length(w.value() * eSpan, w.type());
+ m_width[cCol+i].setRawValue(w.type(), w.rawValue() * eSpan);
usedWidth += effWidth*eSpan;
#ifdef DEBUG_LAYOUT
qDebug(" setting effCol %d (span=%d) to m_width %d(type=%d)",
if (available > 0) {
for (int i = 0; i < nEffCols; i++)
if (m_width[i].isPercent())
- totalPercent += m_width[i].value();
+ totalPercent += m_width[i].rawValue();
// calculate how much to distribute to percent cells.
- int base = tableWidth * totalPercent / 100;
+ int base = tableWidth * totalPercent / (100 * percentScaleFactor);
if (base > available)
base = available;
else
- totalPercent = 100;
+ totalPercent = 100 * percentScaleFactor;
#ifdef DEBUG_LAYOUT
qDebug("FixedTableLayout::layout: assigning percent m_width, base=%d, totalPercent=%d", base, totalPercent);
#endif
for (int i = 0; available > 0 && i < nEffCols; i++) {
if (m_width[i].isPercent()) {
- int w = base * m_width[i].value() / totalPercent;
+ int w = base * m_width[i].rawValue() / totalPercent;
available -= w;
calcWidth[i] = w;
}
#ifndef Length_H
#define Length_H
+#include <wtf/Assertions.h>
+
namespace WebCore {
const int undefinedLength = -1;
+ const int percentScaleFactor = 128;
enum LengthType { Auto, Relative, Percent, Fixed, Static, Intrinsic, MinIntrinsic };
Length(int v, LengthType t, bool q = false)
: m_value((v * 16) | (q << 3) | t) // FIXME: Doesn't work if the passed-in value is very large!
{
+ ASSERT(t != Percent);
+ }
+
+ Length(double v, LengthType t, bool q = false)
+ : m_value(static_cast<int>(v * percentScaleFactor) * 16 | (q << 3) | t)
+ {
+ ASSERT(t == Percent);
}
bool operator==(const Length& o) const { return m_value == o.m_value; }
bool operator!=(const Length& o) const { return m_value != o.m_value; }
- int value() const { return (m_value & ~0xF) / 16; }
+ int value() const {
+ ASSERT(type() != Percent);
+ return rawValue();
+ }
+
+ int rawValue() const { return (m_value & ~0xF) / 16; }
+
+ double percent() const
+ {
+ ASSERT(type() == Percent);
+ return static_cast<double>(rawValue()) / percentScaleFactor;
+ }
+
LengthType type() const { return static_cast<LengthType>(m_value & 7); }
bool quirk() const { return (m_value >> 3) & 1; }
- void setValue(LengthType t, int value) { m_value = value * 16 | (m_value & 0x8) | t; }
- void setValue(int value) { m_value = value * 16 | (m_value & 0xF); }
+ void setValue(LengthType t, int value)
+ {
+ ASSERT(t != Percent);
+ setRawValue(t, value);
+ }
+
+ void setRawValue(LengthType t, int value) { m_value = value * 16 | (m_value & 0x8) | t; }
+
+ void setValue(int value)
+ {
+ ASSERT(!value || type() != Percent);
+ setRawValue(value);
+ }
+
+ void setRawValue(int value) { m_value = value * 16 | (m_value & 0xF); }
+
+ void setValue(LengthType t, double value)
+ {
+ ASSERT(t == Percent);
+ m_value = static_cast<int>(value * percentScaleFactor) * 16 | (m_value & 0x8) | t;
+ }
+
+ void setValue(double value)
+ {
+ ASSERT(type() == Percent);
+ m_value = static_cast<int>(value * percentScaleFactor) * 16 | (m_value & 0xF);
+ }
// note: works only for certain types, returns undefinedLength otherwise
int calcValue(int maxValue) const
case Fixed:
return value();
case Percent:
- return maxValue * value() / 100;
+ return maxValue * rawValue() / (100 * percentScaleFactor);
case Auto:
return maxValue;
default:
case Fixed:
return value();
case Percent:
- return maxValue * value() / 100;
+ return maxValue * rawValue() / (100 * percentScaleFactor);
case Auto:
default:
return 0;
}
}
+ bool isUndefined() const { return rawValue() == undefinedLength; }
+ bool isZero() const { return !(m_value & ~0xF); }
+ bool isPositive() const { return rawValue() > 0; }
+ bool isNegative() const { return rawValue() < 0; }
+
bool isAuto() const { return type() == Auto; }
bool isRelative() const { return type() == Relative; }
bool isPercent() const { return type() == Percent; }
if (firstLine) {
RenderStyle* s = style(firstLine);
Length lh = s->lineHeight();
- if (lh.value() < 0) {
+ if (lh.isNegative()) {
if (s == style()) {
if (m_lineHeight == -1)
m_lineHeight = RenderObject::lineHeight(false);
// (e) have specified that one of our margins can't collapse using a CSS extension
if (m_height > 0 ||
isTable() || (borderBottom() + paddingBottom() + borderTop() + paddingTop()) != 0 ||
- style()->minHeight().value() > 0 ||
+ style()->minHeight().isPositive() ||
style()->marginTopCollapse() == MSEPARATE || style()->marginBottomCollapse() == MSEPARATE)
return false;
// If the height is 0 or auto, then whether or not we are a self-collapsing block depends
// on whether we have content that is all self-collapsing or not.
- if (hasAutoHeight || ((style()->height().isFixed() || style()->height().isPercent()) && style()->height().value() == 0)) {
+ if (hasAutoHeight || ((style()->height().isFixed() || style()->height().isPercent()) && style()->height().isZero())) {
// If the block has inline children, see if we generated any line boxes. If we have any
// line boxes, then we can't be self-collapsing, since we have content.
if (childrenInline())
Length bgHeight = bgLayer->backgroundSize().height;
if (bgWidth.isPercent())
- scaledWidth = scaledWidth * bgWidth.value() / 100;
+ scaledWidth = bgWidth.calcValue(scaledWidth);
else if (bgWidth.isFixed())
scaledWidth = bgWidth.value();
else if (bgWidth.isAuto()) {
// If the width is auto and the height is not, we have to use the appropriate
// scale to maintain our aspect ratio.
if (bgHeight.isPercent()) {
- int scaledH = scaledHeight * bgHeight.value() / 100;
+ int scaledH = bgHeight.calcValue(scaledHeight);
scaledWidth = bg->imageSize().width() * scaledH / bg->imageSize().height();
} else if (bgHeight.isFixed())
scaledWidth = bg->imageSize().width() * bgHeight.value() / bg->imageSize().height();
}
if (bgHeight.isPercent())
- scaledHeight = scaledHeight * bgHeight.value() / 100;
+ scaledHeight = bgHeight.calcValue(scaledHeight);
else if (bgHeight.isFixed())
scaledHeight = bgHeight.value();
else if (bgHeight.isAuto()) {
m_width = calcWidthUsing(Width, containerWidth);
// Calculate MaxWidth
- if (style()->maxWidth().value() != undefinedLength) {
+ if (!style()->maxWidth().isUndefined()) {
int maxW = calcWidthUsing(MaxWidth, containerWidth);
if (m_width > maxW) {
m_width = maxW;
if (height == -1)
height = m_height;
int minH = calcHeightUsing(style()->minHeight()); // Leave as -1 if unset.
- int maxH = style()->maxHeight().value() == undefinedLength ? height : calcHeightUsing(style()->maxHeight());
+ int maxH = style()->maxHeight().isUndefined() ? height : calcHeightUsing(style()->maxHeight());
if (maxH == -1)
maxH = height;
height = min(maxH, height);
{
int width = calcReplacedWidthUsing(style()->width());
int minW = calcReplacedWidthUsing(style()->minWidth());
- int maxW = style()->maxWidth().value() == undefinedLength ? width : calcReplacedWidthUsing(style()->maxWidth());
+ int maxW = style()->maxWidth().isUndefined() ? width : calcReplacedWidthUsing(style()->maxWidth());
return max(minW, min(width, maxW));
}
{
int height = calcReplacedHeightUsing(style()->height());
int minH = calcReplacedHeightUsing(style()->minHeight());
- int maxH = style()->maxHeight().value() == undefinedLength ? height : calcReplacedHeightUsing(style()->maxHeight());
+ int maxH = style()->maxHeight().isUndefined() ? height : calcReplacedHeightUsing(style()->maxHeight());
return max(minH, min(height, maxH));
}
m_width, m_marginLeft, m_marginRight, m_x);
// Calculate constraint equation values for 'max-width' case.calcContentBoxWidth(width.calcValue(containerWidth));
- if (style()->maxWidth().value() != undefinedLength) {
+ if (!style()->maxWidth().isUndefined()) {
int maxWidth;
int maxMarginLeft;
int maxMarginRight;
}
// Calculate constraint equation values for 'min-width' case.
- if (style()->minWidth().value()) {
+ if (!style()->minWidth().isZero()) {
int minWidth;
int minMarginLeft;
int minMarginRight;
// see FIXME 3
// Calculate constraint equation values for 'max-height' case.
- if (style()->maxHeight().value() != undefinedLength) {
+ if (!style()->maxHeight().isUndefined()) {
int maxHeight;
int maxMarginTop;
int maxMarginBottom;
}
// Calculate constraint equation values for 'min-height' case.
- if (style()->minHeight().value()) {
+ if (!style()->minHeight().isZero()) {
int minHeight;
int minMarginTop;
int minMarginBottom;
// FIXME: For now just handle fixed values.
int maxW = INT_MAX;
int w = child->overrideWidth() - (child->borderLeft() + child->borderRight() + child->paddingLeft() + child->paddingRight());
- if (child->style()->maxWidth().value() != undefinedLength &&
+ if (!child->style()->maxWidth().isUndefined() &&
child->style()->maxWidth().isFixed())
maxW = child->style()->maxWidth().value();
else if (child->style()->maxWidth().type() == Intrinsic)
// FIXME: For now just handle fixed values.
int maxH = INT_MAX;
int h = child->overrideHeight() - (child->borderTop() + child->borderBottom() + child->paddingTop() + child->paddingBottom());
- if (child->style()->maxHeight().value() != undefinedLength &&
+ if (!child->style()->maxHeight().isUndefined() &&
child->style()->maxHeight().isFixed())
maxH = child->style()->maxHeight().value();
if (maxH == INT_MAX)
if (firstLine) {
RenderStyle* s = style(firstLine);
Length lh = s->lineHeight();
- if (lh.value() < 0) {
+ if (lh.isNegative()) {
if (s == style()) {
if (m_lineHeight == -1)
m_lineHeight = RenderObject::lineHeight(false);
width = calcAspectRatioWidth();
int minW = calcReplacedWidthUsing(style()->minWidth());
- int maxW = style()->maxWidth().value() == undefinedLength ? width : calcReplacedWidthUsing(style()->maxWidth());
+ int maxW = style()->maxWidth().isUndefined() ? width : calcReplacedWidthUsing(style()->maxWidth());
return max(minW, min(width, maxW));
}
height = calcAspectRatioHeight();
int minH = calcReplacedHeightUsing(style()->minHeight());
- int maxH = style()->maxHeight().value() == undefinedLength ? height : calcReplacedHeightUsing(style()->maxHeight());
+ int maxH = style()->maxHeight().isUndefined() ? height : calcReplacedHeightUsing(style()->maxHeight());
return max(minH, min(height, maxH));
}
// Now we have the real direction. Next we check to see if the increment is negative.
// If so, then we reverse the direction.
Length increment = m_layer->renderer()->style()->marqueeIncrement();
- if (increment.value() < 0)
+ if (increment.isNegative())
result = static_cast<EMarqueeDirection>(-result);
return result;
void Marquee::start()
{
- if (m_timer.isActive() || m_layer->renderer()->style()->marqueeIncrement().value() == 0)
+ if (m_timer.isActive() || m_layer->renderer()->style()->marqueeIncrement().isZero())
return;
if (!m_suspended && !m_stopped) {
// These are always percents or auto.
if (shouldPaintBackgroundImage &&
- (bgLayer->backgroundXPosition().value() != 0 || bgLayer->backgroundYPosition().value() != 0 ||
+ (!bgLayer->backgroundXPosition().isZero() || !bgLayer->backgroundYPosition().isZero() ||
bgLayer->backgroundSize().width.isPercent() || bgLayer->backgroundSize().height.isPercent()))
// The background image will shift unpredictably if the size changes.
return true;
Length lh = s->lineHeight();
// its "unset", choose nice default
- if (lh.value() < 0)
+ if (lh.isNegative())
return s->font().lineSpacing();
if (lh.isPercent())
if (m_thumb->renderer()->style()->hasAppearance())
theme()->adjustSliderThumbSize(m_thumb->renderer());
- if (style()->appearance() == SliderVerticalAppearance)
+ if (style()->appearance() == SliderVerticalAppearance) {
+ // FIXME: Handle percentage widths correctly. See http://bugs.webkit.org/show_bug.cgi?id=12104
m_thumb->renderer()->style()->setLeft(Length(m_width / 2 - m_thumb->renderer()->style()->width().value() / 2, Fixed));
- else
+ } else {
+ // FIXME: Handle percentage heights correctly. See http://bugs.webkit.org/show_bug.cgi?id=12104
m_thumb->renderer()->style()->setTop(Length(m_height / 2 - m_thumb->renderer()->style()->height().value() / 2, Fixed));
+ }
if (relayoutChildren)
setPositionFromValue(true);
}
- bool nonZero() const { return left.value() || right.value() || top.value() || bottom.value(); }
+ bool nonZero() const { return !(left.isZero() && right.isZero() && top.isZero() && bottom.isZero()); }
};
enum EPosition {
static EVerticalAlign initialVerticalAlign() { return BASELINE; }
static int initialWidows() { return 2; }
static int initialOrphans() { return 2; }
- static Length initialLineHeight() { return Length(-100, Percent); }
+ static Length initialLineHeight() { return Length(-100.0, Percent); }
static ETextAlign initialTextAlign() { return TAAUTO; }
static ETextDecoration initialTextDecoration() { return TDNONE; }
static int initialOutlineOffset() { return 0; }
int availableWidth = cb->contentWidth();
LengthType widthType = style()->width().type();
- if (widthType > Relative && style()->width().value() > 0) {
+ if (widthType > Relative && style()->width().isPositive()) {
// Percent or fixed table
m_width = style()->width().calcMinValue(availableWidth);
if (m_minWidth > m_width)
if (rSpan == 1) {
// we ignore height settings on rowspan cells
Length height = cell->style()->height();
- if (height.value() > 0 || (height.isRelative() && height.value() >= 0)) {
+ if (height.isPositive() || (height.isRelative() && height.value() >= 0)) {
Length cRowHeight = grid[cRow].height;
switch (height.type()) {
case Percent:
if (!(cRowHeight.isPercent()) ||
- (cRowHeight.isPercent() && cRowHeight.value() < height.value()))
+ (cRowHeight.isPercent() && cRowHeight.rawValue() < height.rawValue()))
grid[cRow].height = height;
break;
case Fixed:
if (grid[r].height.isAuto())
numAuto++;
else if (grid[r].height.isPercent())
- totalPercent += grid[r].height.value();
+ totalPercent += grid[r].height.rawValue();
}
if (totalPercent) {
// try to satisfy percent
int add = 0;
- if (totalPercent > 100)
- totalPercent = 100;
+ if (totalPercent > 100 * percentScaleFactor)
+ totalPercent = 100 * percentScaleFactor;
int rh = rowPos[1] - rowPos[0];
for (int r = 0; r < totalRows; r++) {
if (totalPercent > 0 && grid[r].height.isPercent()) {
- int toAdd = min(dh, (totalHeight * grid[r].height.value() / 100) - rh);
+ int toAdd = min(dh, (totalHeight * grid[r].height.rawValue() / (100 * percentScaleFactor)) - rh);
// If toAdd is negative, then we don't want to shrink the row (this bug
// affected Outlook Web Access).
toAdd = max(0, toAdd);
add += toAdd;
dh -= toAdd;
- totalPercent -= grid[r].height.value();
+ totalPercent -= grid[r].height.rawValue();
}
if (r < totalRows - 1)
rh = rowPos[r + 2] - rowPos[r + 1];