Changeset 81097 in webkit
- Timestamp:
- Mar 14, 2011 7:17:53 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r81095 r81097 1 2011-03-14 Rik Cabanier <cabanier@gmail.com> 2 3 Reviewed by David Hyatt. 4 5 bug 56052: percentages are incorrectly rounded in WebKit 6 https://bugs.webkit.org/show_bug.cgi?id=56052 7 8 * platform/mac/fast/css/percentage-non-integer-expected.txt: 9 1 10 2011-03-14 Anton Muhin <antonm@chromium.org> 2 11 -
trunk/LayoutTests/platform/mac/fast/css/percentage-non-integer-expected.checksum
r38008 r81097 1 414caaa2ee09823fcc6b1200d30ec127 1 c6d9055341a9904929ccc49476c7bd9e -
trunk/LayoutTests/platform/mac/fast/css/percentage-non-integer-expected.txt
r73385 r81097 30 30 RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F] 31 31 RenderBlock {DIV} at (0,48) size 910x4 32 RenderBlock {DIV} at (0,0) size 10 0x4 [bgcolor=#0000007F]32 RenderBlock {DIV} at (0,0) size 101x4 [bgcolor=#0000007F] 33 33 RenderBlock {DIV} at (0,52) size 900x4 34 34 RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F] … … 50 50 RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F] 51 51 RenderBlock {DIV} at (0,88) size 835x4 52 RenderBlock {DIV} at (0,0) size 10 0x4 [bgcolor=#0000007F]52 RenderBlock {DIV} at (0,0) size 101x4 [bgcolor=#0000007F] 53 53 RenderBlock {DIV} at (0,92) size 825x4 54 54 RenderBlock {DIV} at (0,0) size 100x4 [bgcolor=#0000007F] … … 85 85 RenderTableSection {TBODY} at (0,0) size 1000x20 86 86 RenderTableRow {TR} at (0,0) size 1000x20 87 RenderTableCell {TD} at (0,1) size 1 1x18 [bgcolor=#0000007F] [r=0 c=0 rs=1 cs=1]87 RenderTableCell {TD} at (0,1) size 12x18 [bgcolor=#0000007F] [r=0 c=0 rs=1 cs=1] 88 88 RenderText {#text} at (0,0) size 4x18 89 89 text run at (0,0) width 4: " " 90 RenderTableCell {TD} at (1 1,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=1 rs=1 cs=1]90 RenderTableCell {TD} at (12,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=1 rs=1 cs=1] 91 91 RenderText {#text} at (0,0) size 4x18 92 92 text run at (0,0) width 4: " " 93 RenderTableCell {TD} at (2 1,1) size 13x18 [bgcolor=#0000007F] [r=0 c=2 rs=1 cs=1]93 RenderTableCell {TD} at (22,1) size 13x18 [bgcolor=#0000007F] [r=0 c=2 rs=1 cs=1] 94 94 RenderText {#text} at (0,0) size 4x18 95 95 text run at (0,0) width 4: " " 96 RenderTableCell {TD} at (3 4,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=3 rs=1 cs=1]96 RenderTableCell {TD} at (35,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=3 rs=1 cs=1] 97 97 RenderText {#text} at (0,0) size 4x18 98 98 text run at (0,0) width 4: " " 99 RenderTableCell {TD} at (4 4,1) size 15x18 [bgcolor=#0000007F] [r=0 c=4 rs=1 cs=1]99 RenderTableCell {TD} at (45,1) size 16x18 [bgcolor=#0000007F] [r=0 c=4 rs=1 cs=1] 100 100 RenderText {#text} at (0,0) size 4x18 101 101 text run at (0,0) width 4: " " 102 RenderTableCell {TD} at ( 59,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=5 rs=1 cs=1]102 RenderTableCell {TD} at (61,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=5 rs=1 cs=1] 103 103 RenderText {#text} at (0,0) size 4x18 104 104 text run at (0,0) width 4: " " 105 RenderTableCell {TD} at ( 69,1) size 17x18 [bgcolor=#0000007F] [r=0 c=6 rs=1 cs=1]105 RenderTableCell {TD} at (71,1) size 17x18 [bgcolor=#0000007F] [r=0 c=6 rs=1 cs=1] 106 106 RenderText {#text} at (0,0) size 4x18 107 107 text run at (0,0) width 4: " " 108 RenderTableCell {TD} at (8 6,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=7 rs=1 cs=1]108 RenderTableCell {TD} at (88,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=7 rs=1 cs=1] 109 109 RenderText {#text} at (0,0) size 4x18 110 110 text run at (0,0) width 4: " " 111 RenderTableCell {TD} at (9 6,1) size 20x18 [bgcolor=#0000007F] [r=0 c=8 rs=1 cs=1]111 RenderTableCell {TD} at (98,1) size 20x18 [bgcolor=#0000007F] [r=0 c=8 rs=1 cs=1] 112 112 RenderText {#text} at (0,0) size 4x18 113 113 text run at (0,0) width 4: " " 114 RenderTableCell {TD} at (11 6,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=9 rs=1 cs=1]114 RenderTableCell {TD} at (118,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=9 rs=1 cs=1] 115 115 RenderText {#text} at (0,0) size 4x18 116 116 text run at (0,0) width 4: " " 117 RenderTableCell {TD} at (12 6,1) size 21x18 [bgcolor=#0000007F] [r=0 c=10 rs=1 cs=1]117 RenderTableCell {TD} at (128,1) size 22x18 [bgcolor=#0000007F] [r=0 c=10 rs=1 cs=1] 118 118 RenderText {#text} at (0,0) size 4x18 119 119 text run at (0,0) width 4: " " 120 RenderTableCell {TD} at (1 47,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=11 rs=1 cs=1]120 RenderTableCell {TD} at (150,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=11 rs=1 cs=1] 121 121 RenderText {#text} at (0,0) size 4x18 122 122 text run at (0,0) width 4: " " 123 RenderTableCell {TD} at (1 57,1) size 23x18 [bgcolor=#0000007F] [r=0 c=12 rs=1 cs=1]123 RenderTableCell {TD} at (160,1) size 24x18 [bgcolor=#0000007F] [r=0 c=12 rs=1 cs=1] 124 124 RenderText {#text} at (0,0) size 4x18 125 125 text run at (0,0) width 4: " " 126 RenderTableCell {TD} at (18 0,10) size 10x0 [bgcolor=#00FF007F] [r=0 c=13 rs=1 cs=1]127 RenderTableCell {TD} at (19 0,1) size 25x18 [bgcolor=#0000007F] [r=0 c=14 rs=1 cs=1]126 RenderTableCell {TD} at (184,10) size 10x0 [bgcolor=#00FF007F] [r=0 c=13 rs=1 cs=1] 127 RenderTableCell {TD} at (194,1) size 25x18 [bgcolor=#0000007F] [r=0 c=14 rs=1 cs=1] 128 128 RenderText {#text} at (0,0) size 4x18 129 129 text run at (0,0) width 4: " " 130 RenderTableCell {TD} at (21 5,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=15 rs=1 cs=1]130 RenderTableCell {TD} at (219,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=15 rs=1 cs=1] 131 131 RenderText {#text} at (0,0) size 4x18 132 132 text run at (0,0) width 4: " " 133 RenderTableCell {TD} at (22 5,1) size 27x18 [bgcolor=#0000007F] [r=0 c=16 rs=1 cs=1]133 RenderTableCell {TD} at (229,1) size 27x18 [bgcolor=#0000007F] [r=0 c=16 rs=1 cs=1] 134 134 RenderText {#text} at (0,0) size 4x18 135 135 text run at (0,0) width 4: " " 136 RenderTableCell {TD} at (25 2,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=17 rs=1 cs=1]136 RenderTableCell {TD} at (256,1) size 10x18 [bgcolor=#00FF007F] [r=0 c=17 rs=1 cs=1] 137 137 RenderText {#text} at (0,0) size 4x18 138 138 text run at (0,0) width 4: " " 139 RenderTableCell {TD} at (26 2,1) size 30x18 [bgcolor=#0000007F] [r=0 c=18 rs=1 cs=1]139 RenderTableCell {TD} at (266,1) size 30x18 [bgcolor=#0000007F] [r=0 c=18 rs=1 cs=1] 140 140 RenderText {#text} at (0,0) size 4x18 141 141 text run at (0,0) width 4: " " 142 RenderTableCell {TD} at (29 2,1) size 708x18 [r=0 c=19 rs=1 cs=1]142 RenderTableCell {TD} at (296,1) size 704x18 [r=0 c=19 rs=1 cs=1] 143 143 RenderText {#text} at (0,0) size 4x18 144 144 text run at (0,0) width 4: " " -
trunk/Source/WebCore/ChangeLog
r81096 r81097 1 2011-03-14 Rik Cabanier <cabanier@adobe.com> 2 3 Reviewed by David Hyatt. 4 5 bug 56052: percentages are incorrectly rounded in WebKit 6 https://bugs.webkit.org/show_bug.cgi?id=56052 7 8 test: fast/css/percentage-non-integer.html 9 10 * css/CSSStyleSelector.cpp: 11 (WebCore::CSSStyleSelector::applyProperty): 12 * page/PrintContext.cpp: 13 (WebCore::PrintContext::pageProperty): 14 * platform/Length.h: 15 (WebCore::Length::Length): 16 (WebCore::Length::operator*=): 17 (WebCore::Length::value): 18 (WebCore::Length::percent): 19 (WebCore::Length::setValue): 20 (WebCore::Length::calcValue): 21 (WebCore::Length::calcMinValue): 22 (WebCore::Length::isUndefined): 23 (WebCore::Length::isZero): 24 (WebCore::Length::isPositive): 25 (WebCore::Length::isNegative): 26 * rendering/AutoTableLayout.cpp: 27 (WebCore::AutoTableLayout::recalcColumn): 28 (WebCore::AutoTableLayout::computePreferredLogicalWidths): 29 (WebCore::AutoTableLayout::calcEffectiveLogicalWidth): 30 (WebCore::AutoTableLayout::layout): 31 * rendering/FixedTableLayout.cpp: 32 (WebCore::FixedTableLayout::calcWidthArray): 33 (WebCore::FixedTableLayout::layout): 34 * rendering/RenderTableSection.cpp: 35 (WebCore::RenderTableSection::addCell): 36 (WebCore::RenderTableSection::layoutRows): 37 * rendering/style/BorderData.h: 38 (WebCore::BorderData::hasBorderRadius): 39 1 40 2011-03-14 Adam Barth <abarth@webkit.org> 2 41 -
trunk/Source/WebCore/css/CSSStyleSelector.cpp
r81049 r81097 5266 5266 else 5267 5267 radiusHeight = Length(max(intMinForLength, min(intMaxForLength, pair->second()->computeLengthInt(style(), m_rootElementStyle, zoomFactor))), Fixed); 5268 int width = radiusWidth. rawValue();5269 int height = radiusHeight. rawValue();5268 int width = radiusWidth.value(); 5269 int height = radiusHeight.value(); 5270 5270 if (width < 0 || height < 0) 5271 5271 return; -
trunk/Source/WebCore/page/PrintContext.cpp
r78434 r81097 283 283 if (style->marginLeft().isAuto()) 284 284 return String("auto"); 285 return String::number(style->marginLeft(). rawValue());285 return String::number(style->marginLeft().value()); 286 286 } 287 287 if (!strcmp(propertyName, "line-height")) 288 return String::number(style->lineHeight(). rawValue());288 return String::number(style->lineHeight().value()); 289 289 if (!strcmp(propertyName, "font-size")) 290 290 return String::number(style->fontDescription().computedPixelSize()); … … 292 292 return style->fontDescription().family().family().string(); 293 293 if (!strcmp(propertyName, "size")) 294 return makeString(String::number(style->pageSize().width(). rawValue()), ' ', String::number(style->pageSize().height().rawValue()));294 return makeString(String::number(style->pageSize().width().value()), ' ', String::number(style->pageSize().height().value())); 295 295 296 296 return makeString("pageProperty() unimplemented for: ", propertyName); -
trunk/Source/WebCore/platform/Length.h
r80806 r81097 2 2 Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 3 Copyright (C) 2006, 2008 Apple Inc. All rights reserved. 4 Copyright (C) 2011 Rik Cabanier (cabanier@adobe.com) 4 5 5 6 This library is free software; you can redistribute it and/or … … 31 32 32 33 const int undefinedLength = -1; 33 const int percentScaleFactor = 128;34 34 const int intMaxForLength = 0x7ffffff; // max value for a 28-bit int 35 35 const int intMinForLength = (-0x7ffffff - 1); // min value for a 28-bit int … … 53 53 : m_intValue(v), m_quirk(q), m_type(t), m_isFloat(false) 54 54 { 55 ASSERT(t != Percent);56 55 } 57 56 58 57 Length(double v, LengthType t, bool q = false) 59 : m_quirk(q), m_type(t), m_isFloat(false) 60 { 61 if (m_type == Percent) 62 m_intValue = static_cast<int>(v*percentScaleFactor); 63 else { 64 m_isFloat = true; 65 m_floatValue = static_cast<float>(v); 66 } 58 : m_quirk(q), m_type(t), m_isFloat(true) 59 { 60 m_floatValue = static_cast<float>(v); 67 61 } 68 62 … … 70 64 bool operator!=(const Length& o) const { return (getFloatValue() != o.getFloatValue()) || (m_type != o.m_type) || (m_quirk != o.m_quirk); } 71 65 66 const Length& operator*=(double v) 67 { 68 if (m_isFloat) 69 m_floatValue *= v; 70 else 71 m_intValue *= v; 72 73 return *this; 74 } 75 72 76 int value() const { 73 ASSERT(type() != Percent); 74 return rawValue(); 75 } 76 77 int rawValue() const { return getIntValue(); } 77 return getIntValue(); 78 } 78 79 79 80 double percent() const 80 81 { 81 82 ASSERT(type() == Percent); 82 return static_cast<double>( rawValue()) / percentScaleFactor;83 return static_cast<double>(getFloatValue()); 83 84 } 84 85 … … 88 89 void setValue(LengthType t, int value) 89 90 { 91 ASSERT(type() != Percent); 90 92 m_type = t; 91 93 m_intValue = value; … … 95 97 void setValue(int value) 96 98 { 97 ASSERT(!value || type() != Percent);98 99 setValue(Fixed, value); 99 100 } … … 120 121 if (roundPercentages) 121 122 return static_cast<int>(round(maxValue * percent() / 100.0)); 122 return maxValue * rawValue() / (100 * percentScaleFactor);123 return static_cast<int>(maxValue * percent() / 100.0); 123 124 case Auto: 124 125 return maxValue; … … 136 137 if (roundPercentages) 137 138 return static_cast<int>(round(maxValue * percent() / 100.0)); 138 return maxValue * rawValue() / (100 * percentScaleFactor);139 return static_cast<int>(maxValue * percent() / 100.0); 139 140 case Auto: 140 141 default: … … 157 158 } 158 159 159 bool isUndefined() const { return rawValue() == undefinedLength; } 160 bool isZero() const { return !getIntValue(); } 161 bool isPositive() const { return rawValue() > 0; } 162 bool isNegative() const { return rawValue() < 0; } 160 bool isUndefined() const { return value() == undefinedLength; } 161 bool isZero() const 162 { 163 if (m_isFloat) 164 return !m_floatValue; 165 166 return !m_intValue; 167 } 168 bool isPositive() const { return getFloatValue() > 0; } 169 bool isNegative() const { return getFloatValue() < 0; } 163 170 164 171 bool isAuto() const { return type() == Auto; } -
trunk/Source/WebCore/rendering/AutoTableLayout.cpp
r80806 r81097 82 82 Length cellLogicalWidth = cell->styleOrColLogicalWidth(); 83 83 // FIXME: What is this arbitrary value? 84 if (cellLogicalWidth. rawValue() > 32760)84 if (cellLogicalWidth.value() > 32760) 85 85 cellLogicalWidth.setValue(32760); 86 86 if (cellLogicalWidth.isNegative()) … … 106 106 case Percent: 107 107 m_hasPercent = true; 108 if (cellLogicalWidth.isPositive() && (!columnLayout.logicalWidth.isPercent() || cellLogicalWidth. rawValue() > columnLayout.logicalWidth.rawValue()))108 if (cellLogicalWidth.isPositive() && (!columnLayout.logicalWidth.isPercent() || cellLogicalWidth.value() > columnLayout.logicalWidth.value())) 109 109 columnLayout.logicalWidth = cellLogicalWidth; 110 110 break; … … 112 112 // FIXME: Need to understand this case and whether it makes sense to compare values 113 113 // which are not necessarily of the same type. 114 if (cellLogicalWidth.isAuto() || (cellLogicalWidth.isRelative() && cellLogicalWidth.value() > columnLayout.logicalWidth. rawValue()))114 if (cellLogicalWidth.isAuto() || (cellLogicalWidth.isRelative() && cellLogicalWidth.value() > columnLayout.logicalWidth.value())) 115 115 columnLayout.logicalWidth = cellLogicalWidth; 116 116 default: … … 233 233 // We substitute 0 percent by (epsilon / percentScaleFactor) percent in two places below to avoid division by zero. 234 234 // FIXME: Handle the 0% cases properly. 235 const int epsilon = 1;236 237 int remainingPercent = 100 * percentScaleFactor;235 const float epsilon = 1 / 128.0; 236 237 float remainingPercent = 100; 238 238 for (size_t i = 0; i < m_layoutStruct.size(); ++i) { 239 239 minWidth += m_layoutStruct[i].effectiveMinLogicalWidth; … … 241 241 if (scaleColumns) { 242 242 if (m_layoutStruct[i].effectiveLogicalWidth.isPercent()) { 243 int percent = min(m_layoutStruct[i].effectiveLogicalWidth.rawValue(), remainingPercent);244 float logicalWidth = static_cast<float>(m_layoutStruct[i].effectiveMaxLogicalWidth) * 100 * percentScaleFactor/ max(percent, epsilon);243 float percent = min(static_cast<float>(m_layoutStruct[i].effectiveLogicalWidth.percent()), remainingPercent); 244 float logicalWidth = static_cast<float>(m_layoutStruct[i].effectiveMaxLogicalWidth) * 100 / max(percent, epsilon); 245 245 maxPercent = max(logicalWidth, maxPercent); 246 246 remainingPercent -= percent; … … 251 251 252 252 if (scaleColumns) { 253 maxNonPercent = maxNonPercent * 100 * percentScaleFactor/ max(remainingPercent, epsilon);253 maxNonPercent = maxNonPercent * 100 / max(remainingPercent, epsilon); 254 254 maxWidth = max(maxWidth, static_cast<int>(min(maxNonPercent, INT_MAX / 2.0f))); 255 255 maxWidth = max(maxWidth, static_cast<int>(min(maxPercent, INT_MAX / 2.0f))); … … 267 267 maxWidth = minWidth; 268 268 } 269 270 // if there was no remaining percent, maxWidth is invalid. 271 if (!remainingPercent && maxNonPercent) 272 maxWidth = intMaxForLength; 269 273 } 270 274 … … 301 305 int cellMinLogicalWidth = cell->minPreferredLogicalWidth() + spacingInRowDirection; 302 306 float cellMaxLogicalWidth = cell->maxPreferredLogicalWidth() + spacingInRowDirection; 303 int totalPercent = 0;307 float totalPercent = 0; 304 308 int spanMinLogicalWidth = 0; 305 309 float spanMaxLogicalWidth = 0; … … 313 317 switch (columnLayout.logicalWidth.type()) { 314 318 case Percent: 315 totalPercent += columnLayout.logicalWidth. rawValue();319 totalPercent += columnLayout.logicalWidth.percent(); 316 320 allColsAreFixed = false; 317 321 break; … … 340 344 allColsArePercent = false; 341 345 } else 342 totalPercent += columnLayout.effectiveLogicalWidth. rawValue();346 totalPercent += columnLayout.effectiveLogicalWidth.percent(); 343 347 allColsAreFixed = false; 344 348 } … … 355 359 // adjust table max width if needed 356 360 if (cellLogicalWidth.isPercent()) { 357 if (totalPercent > cellLogicalWidth. rawValue() || allColsArePercent) {361 if (totalPercent > cellLogicalWidth.percent() || allColsArePercent) { 358 362 // can't satify this condition, treat as variable 359 363 cellLogicalWidth = Length(); 360 364 } else { 361 maxLogicalWidth = max(maxLogicalWidth, max(spanMaxLogicalWidth, cellMaxLogicalWidth) * 100 * percentScaleFactor / cellLogicalWidth.rawValue());365 maxLogicalWidth = max(maxLogicalWidth, static_cast<float>(max(spanMaxLogicalWidth, cellMaxLogicalWidth) * 100 / cellLogicalWidth.percent())); 362 366 363 367 // all non percent columns in the span get percent values to sum up correctly. 364 int percentMissing = cellLogicalWidth.rawValue() - totalPercent;368 float percentMissing = cellLogicalWidth.percent() - totalPercent; 365 369 float totalWidth = 0; 366 370 for (unsigned pos = effCol; pos < lastCol; ++pos) { … … 371 375 for (unsigned pos = effCol; pos < lastCol && totalWidth > 0; ++pos) { 372 376 if (!m_layoutStruct[pos].effectiveLogicalWidth.isPercent()) { 373 int percent = static_cast<int>(percentMissing * static_cast<float>(m_layoutStruct[pos].effectiveMaxLogicalWidth) / totalWidth);377 float percent = percentMissing * static_cast<float>(m_layoutStruct[pos].effectiveMaxLogicalWidth) / totalWidth; 374 378 totalWidth -= m_layoutStruct[pos].effectiveMaxLogicalWidth; 375 379 percentMissing -= percent; … … 492 496 float totalAuto = 0; 493 497 float totalFixed = 0; 494 int totalPercent = 0;498 float totalPercent = 0; 495 499 int allocAuto = 0; 496 500 unsigned numAutoEmptyCellsOnly = 0; … … 505 509 case Percent: 506 510 havePercent = true; 507 totalPercent += logicalWidth. rawValue();511 totalPercent += logicalWidth.percent(); 508 512 break; 509 513 case Relative: … … 539 543 } 540 544 } 541 if (totalPercent > 100 * percentScaleFactor) {545 if (totalPercent > 100) { 542 546 // remove overallocated space from the last columns 543 int excess = tableLogicalWidth * (totalPercent - 100 * percentScaleFactor) / (100 * percentScaleFactor);547 int excess = tableLogicalWidth * (totalPercent - 100) / 100; 544 548 for (int i = nEffCols - 1; i >= 0; --i) { 545 549 if (m_layoutStruct[i].effectiveLogicalWidth.isPercent()) { … … 608 612 609 613 // spread over percent colums 610 if (available > 0 && m_hasPercent && totalPercent < 100 * percentScaleFactor) {614 if (available > 0 && m_hasPercent && totalPercent < 100) { 611 615 for (size_t i = 0; i < nEffCols; ++i) { 612 616 Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth; 613 617 if (logicalWidth.isPercent()) { 614 int cellLogicalWidth = available * logicalWidth. rawValue() / totalPercent;618 int cellLogicalWidth = available * logicalWidth.percent() / totalPercent; 615 619 available -= cellLogicalWidth; 616 totalPercent -= logicalWidth. rawValue();620 totalPercent -= logicalWidth.percent(); 617 621 m_layoutStruct[i].computedLogicalWidth += cellLogicalWidth; 618 622 if (!available || !totalPercent) -
trunk/Source/WebCore/rendering/FixedTableLayout.cpp
r80806 r81097 119 119 } 120 120 if ((w.isFixed() || w.isPercent()) && w.isPositive()) { 121 m_width[currentEffectiveColumn].setValue(w.type(), w.rawValue() * spanInCurrentEffectiveColumn); 121 m_width[currentEffectiveColumn] = w; 122 m_width[currentEffectiveColumn] *= spanInCurrentEffectiveColumn; 122 123 usedWidth += effWidth * spanInCurrentEffectiveColumn; 123 124 } … … 165 166 int i = 0; 166 167 while (usedSpan < span && cCol + i < nEffCols) { 167 int eSpan = m_table->spanOfEffCol(cCol + i);168 float eSpan = m_table->spanOfEffCol(cCol + i); 168 169 // Only set if no col element has already set it. 169 170 if (m_width[cCol + i].isAuto() && w.type() != Auto) { 170 m_width[cCol + i].setValue(w.type(), w.rawValue() * eSpan / span); 171 m_width[cCol + i] = w; 172 m_width[cCol + i] *= eSpan / span; 171 173 usedWidth += effWidth * eSpan / span; 172 174 } … … 235 237 int totalFixedWidth = 0; 236 238 int totalPercentWidth = 0; 237 int totalRawPercent = 0;239 float totalPercent = 0; 238 240 239 241 // Compute requirements and try to satisfy fixed and percent widths. … … 248 250 calcWidth[i] = m_width[i].calcValue(tableLogicalWidth); 249 251 totalPercentWidth += calcWidth[i]; 250 total RawPercent += m_width[i].rawValue();252 totalPercent += m_width[i].percent(); 251 253 } else if (m_width[i].isAuto()) { 252 254 numAuto++; … … 271 273 } 272 274 } 273 if (total RawPercent) {275 if (totalPercent) { 274 276 totalPercentWidth = 0; 275 277 for (int i = 0; i < nEffCols; i++) { 276 278 if (m_width[i].isPercent()) { 277 calcWidth[i] = m_width[i]. rawValue() * (tableLogicalWidth - totalFixedWidth) / totalRawPercent;279 calcWidth[i] = m_width[i].percent() * (tableLogicalWidth - totalFixedWidth) / totalPercent; 278 280 totalPercentWidth += calcWidth[i]; 279 281 } -
trunk/Source/WebCore/rendering/RenderTableSection.cpp
r80878 r81097 200 200 case Percent: 201 201 if (!(cRowLogicalHeight.isPercent()) || 202 (cRowLogicalHeight.isPercent() && cRowLogicalHeight. rawValue() < logicalHeight.rawValue()))202 (cRowLogicalHeight.isPercent() && cRowLogicalHeight.percent() < logicalHeight.percent())) 203 203 m_grid[m_cRow].logicalHeight = logicalHeight; 204 204 break; … … 435 435 numAuto++; 436 436 else if (m_grid[r].logicalHeight.isPercent()) 437 totalPercent += m_grid[r].logicalHeight. rawValue();437 totalPercent += m_grid[r].logicalHeight.percent(); 438 438 } 439 439 if (totalPercent) { 440 440 // try to satisfy percent 441 441 int add = 0; 442 totalPercent = min(totalPercent, 100 * percentScaleFactor);442 totalPercent = min(totalPercent, 100); 443 443 int rh = m_rowPos[1] - m_rowPos[0]; 444 444 for (int r = 0; r < totalRows; r++) { 445 445 if (totalPercent > 0 && m_grid[r].logicalHeight.isPercent()) { 446 int toAdd = min(dh, (totalHeight * m_grid[r].logicalHeight.rawValue() / (100 * percentScaleFactor)) - rh);446 int toAdd = min(dh, static_cast<int>((totalHeight * m_grid[r].logicalHeight.percent() / 100) - rh)); 447 447 // If toAdd is negative, then we don't want to shrink the row (this bug 448 448 // affected Outlook Web Access). … … 450 450 add += toAdd; 451 451 dh -= toAdd; 452 totalPercent -= m_grid[r].logicalHeight. rawValue();452 totalPercent -= m_grid[r].logicalHeight.percent(); 453 453 } 454 454 if (r < totalRows - 1) -
trunk/Source/WebCore/rendering/style/BorderData.h
r76083 r81097 50 50 bool hasBorderRadius() const 51 51 { 52 if ( m_topLeft.width().rawValue() > 0)52 if (!m_topLeft.width().isZero()) 53 53 return true; 54 if ( m_topRight.width().rawValue() > 0)54 if (!m_topRight.width().isZero()) 55 55 return true; 56 if ( m_bottomLeft.width().rawValue() > 0)56 if (!m_bottomLeft.width().isZero()) 57 57 return true; 58 if ( m_bottomRight.width().rawValue() > 0)58 if (!m_bottomRight.width().isZero()) 59 59 return true; 60 60 return false;
Note: See TracChangeset
for help on using the changeset viewer.