Changeset 31389
- Timestamp:
- 2008-03-28 01:53:57 (8 months ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 modified
-
ChangeLog (modified) (1 diff)
-
rendering/Length.h (modified) (4 diffs)
-
rendering/RenderBox.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r31387 r31389 1 2008-03-28 David Hyatt <hyatt@apple.com> 2 3 Fix a bug where background-position truncates instead of rounding when it evaluates to fractional 4 pixel values. This matches other browsers. 5 6 Reviewed by maciej 7 8 Added fast/backgrounds/background-position-rounding.html 9 10 * rendering/Length.h: 11 (WebCore::Length::calcValue): 12 (WebCore::Length::calcMinValue): 13 * rendering/RenderBox.cpp: 14 (WebCore::RenderBox::calculateBackgroundImageGeometry): 15 1 16 2008-03-27 Kevin Ollivier <kevino@theolliviers.com> 2 17 -
trunk/WebCore/rendering/Length.h
r27330 r31389 104 104 105 105 // note: works only for certain types, returns undefinedLength otherwise 106 int calcValue(int maxValue ) const106 int calcValue(int maxValue, bool roundPercentages = false) const 107 107 { 108 108 switch (type()) { … … 110 110 return value(); 111 111 case Percent: 112 if (roundPercentages) 113 return static_cast<int>(round(maxValue * percent())); 112 114 return maxValue * rawValue() / (100 * percentScaleFactor); 113 115 case Auto: … … 118 120 } 119 121 120 int calcMinValue(int maxValue ) const122 int calcMinValue(int maxValue, bool roundPercentages = false) const 121 123 { 122 124 switch (type()) { … … 124 126 return value(); 125 127 case Percent: 128 if (roundPercentages) 129 return static_cast<int>(round(maxValue * percent())); 126 130 return maxValue * rawValue() / (100 * percentScaleFactor); 127 131 case Auto: -
trunk/WebCore/rendering/RenderBox.cpp
r31313 r31389 578 578 EBackgroundRepeat backgroundRepeat = bgLayer->backgroundRepeat(); 579 579 580 int xPosition = bgLayer->backgroundXPosition().calcMinValue(pw - scaledImageWidth );580 int xPosition = bgLayer->backgroundXPosition().calcMinValue(pw - scaledImageWidth, true); 581 581 if (backgroundRepeat == REPEAT || backgroundRepeat == REPEAT_X) { 582 582 cw = pw + left + right; … … 588 588 } 589 589 590 int yPosition = bgLayer->backgroundYPosition().calcMinValue(ph - scaledImageHeight );590 int yPosition = bgLayer->backgroundYPosition().calcMinValue(ph - scaledImageHeight, true); 591 591 if (backgroundRepeat == REPEAT || backgroundRepeat == REPEAT_Y) { 592 592 ch = ph + top + bottom;