2011-03-21 Rik Cabanier <cabanier@gmail.com>
Reviewed by James Robinson.
bug 56052: percentages are incorrectly rounded in WebKit
https://bugs.webkit.org/show_bug.cgi?id=56052
* platform/mac/fast/css/percentage-non-integer-expected.txt:
2011-03-21 Rik Cabanier <cabanier@adobe.com>
Reviewed by James Robinson.
bug 56052: percentages are incorrectly rounded in WebKit
https://bugs.webkit.org/show_bug.cgi?id=56052
test: fast/css/percentage-non-integer.html
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::applyProperty):
* page/PrintContext.cpp:
(WebCore::PrintContext::pageProperty):
* platform/Length.h:
(WebCore::Length::Length):
(WebCore::Length::operator*=):
(WebCore::Length::value):
(WebCore::Length::percent):
(WebCore::Length::setValue):
(WebCore::Length::calcValue):
(WebCore::Length::calcMinValue):
(WebCore::Length::isUndefined):
(WebCore::Length::isZero):
(WebCore::Length::isPositive):
(WebCore::Length::isNegative):
* rendering/AutoTableLayout.cpp:
(WebCore::AutoTableLayout::recalcColumn):
(WebCore::AutoTableLayout::computePreferredLogicalWidths):
(WebCore::AutoTableLayout::calcEffectiveLogicalWidth):
(WebCore::AutoTableLayout::layout):
* rendering/FixedTableLayout.cpp:
(WebCore::FixedTableLayout::calcWidthArray):
(WebCore::FixedTableLayout::layout):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::addCell):
(WebCore::RenderTableSection::layoutRows):
* rendering/style/BorderData.h:
(WebCore::BorderData::hasBorderRadius):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@81625 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/rendering/RenderTableSection.cpp b/Source/WebCore/rendering/RenderTableSection.cpp
index 825529e..8f80c6f 100644
--- a/Source/WebCore/rendering/RenderTableSection.cpp
+++ b/Source/WebCore/rendering/RenderTableSection.cpp
@@ -199,7 +199,7 @@
switch (logicalHeight.type()) {
case Percent:
if (!(cRowLogicalHeight.isPercent()) ||
- (cRowLogicalHeight.isPercent() && cRowLogicalHeight.rawValue() < logicalHeight.rawValue()))
+ (cRowLogicalHeight.isPercent() && cRowLogicalHeight.percent() < logicalHeight.percent()))
m_grid[m_cRow].logicalHeight = logicalHeight;
break;
case Fixed:
@@ -434,22 +434,22 @@
if (m_grid[r].logicalHeight.isAuto())
numAuto++;
else if (m_grid[r].logicalHeight.isPercent())
- totalPercent += m_grid[r].logicalHeight.rawValue();
+ totalPercent += m_grid[r].logicalHeight.percent();
}
if (totalPercent) {
// try to satisfy percent
int add = 0;
- totalPercent = min(totalPercent, 100 * percentScaleFactor);
+ totalPercent = min(totalPercent, 100);
int rh = m_rowPos[1] - m_rowPos[0];
for (int r = 0; r < totalRows; r++) {
if (totalPercent > 0 && m_grid[r].logicalHeight.isPercent()) {
- int toAdd = min(dh, (totalHeight * m_grid[r].logicalHeight.rawValue() / (100 * percentScaleFactor)) - rh);
+ int toAdd = min(dh, static_cast<int>((totalHeight * m_grid[r].logicalHeight.percent() / 100) - 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 -= m_grid[r].logicalHeight.rawValue();
+ totalPercent -= m_grid[r].logicalHeight.percent();
}
if (r < totalRows - 1)
rh = m_rowPos[r + 2] - m_rowPos[r + 1];