Diff
Modified: trunk/LayoutTests/ChangeLog (129957 => 129958)
--- trunk/LayoutTests/ChangeLog 2012-09-28 23:08:09 UTC (rev 129957)
+++ trunk/LayoutTests/ChangeLog 2012-09-28 23:12:56 UTC (rev 129958)
@@ -1,3 +1,15 @@
+2012-09-28 Emil A Eklund <e...@chromium.org>
+
+ Improve saturation arithmetic support in FractionalLayoutUnit
+ https://bugs.webkit.org/show_bug.cgi?id=97938
+
+ Reviewed by Levi Weintraub.
+
+ Update large sizes test to better cover values near limit.
+
+ * fast/sub-pixel/large-sizes-expected.txt:
+ * fast/sub-pixel/large-sizes.html:
+
2012-09-28 Julien Chaffraix <jchaffr...@webkit.org>
REGRESSION(r124168): Null crash in RenderLayer::createScrollbar
Modified: trunk/LayoutTests/fast/sub-pixel/large-sizes-expected.txt (129957 => 129958)
--- trunk/LayoutTests/fast/sub-pixel/large-sizes-expected.txt 2012-09-28 23:08:09 UTC (rev 129957)
+++ trunk/LayoutTests/fast/sub-pixel/large-sizes-expected.txt 2012-09-28 23:12:56 UTC (rev 129958)
@@ -1,13 +1,16 @@
-PASS element.width = 5000px, returns offsetWidth 5000, rect.width 5000 and computed width 5000px as expected.
-PASS element.width = 50000px, returns offsetWidth 50000, rect.width 50000 and computed width 50000px as expected.
-PASS element.width = 500000px, returns offsetWidth 500000, rect.width 500000 and computed width 500000px as expected.
-PASS element.width = 5000000px, returns offsetWidth 5000000, rect.width 5000000 and computed width 5000000px as expected.
-PASS element.width = 50000000px, returns offsetWidth 0, rect.width 0 and computed width 0px as expected.
-PASS element.width = 33554424px, returns offsetWidth 33554424, rect.width 33554424 and computed width 33554424px as expected.
-PASS element.width = 33554425px, returns offsetWidth 33554424, rect.width 33554424 and computed width 33554424px as expected.
-PASS element.width = 33554428px, returns offsetWidth 33554428, rect.width 33554428 and computed width 33554428px as expected.
-PASS element.width = 33554431px, returns offsetWidth 0, rect.width 0 and computed width 0px as expected.
-PASS element.width = 33554435px, returns offsetWidth 0, rect.width 0 and computed width 0px as expected.
-PASS element.width = 35791395px, returns offsetWidth 0, rect.width 0 and computed width 0px as expected.
-PASS element.width = 35791396px, returns offsetWidth 0, rect.width 0 and computed width 0px as expected.
+PASS element.width = 5000px, returns offsetWidth, rect.width and computed width as expected.
+PASS element.width = 50000px, returns offsetWidth, rect.width and computed width as expected.
+PASS element.width = 500000px, returns offsetWidth, rect.width and computed width as expected.
+PASS element.width = 5000000px, returns offsetWidth, rect.width and computed width as expected.
+PASS element.width = 50000000px, returns offsetWidth, rect.width and computed width as expected.
+PASS element.width = 33554424px, returns offsetWidth, rect.width and computed width as expected.
+PASS element.width = 33554425px, returns offsetWidth, rect.width and computed width as expected.
+PASS element.width = 33554426px, returns offsetWidth, rect.width and computed width as expected.
+PASS element.width = 33554427px, returns offsetWidth, rect.width and computed width as expected.
+PASS element.width = 33554428px, returns offsetWidth, rect.width and computed width as expected.
+PASS element.width = 33554429px, returns offsetWidth, rect.width and computed width as expected.
+PASS element.width = 33554430px, returns offsetWidth, rect.width and computed width as expected.
+PASS element.width = 33554432px, returns offsetWidth, rect.width and computed width as expected.
+PASS element.width = 35791395px, returns offsetWidth, rect.width and computed width as expected.
+PASS element.width = 35791396px, returns offsetWidth, rect.width and computed width as expected.
Test handling of sizes exceeding the maximum supported value.
Modified: trunk/LayoutTests/fast/sub-pixel/large-sizes.html (129957 => 129958)
--- trunk/LayoutTests/fast/sub-pixel/large-sizes.html 2012-09-28 23:08:09 UTC (rev 129957)
+++ trunk/LayoutTests/fast/sub-pixel/large-sizes.html 2012-09-28 23:12:56 UTC (rev 129958)
@@ -8,14 +8,14 @@
Test handling of sizes exceeding the maximum supported value.
</p>
<script>
- function testSize(width, expectedWidth)
+ function testSize(width, expectedWidth, opt_tolerance)
{
el.style.width = width + 'px';
var style = window.getComputedStyle(el, null);
var rect = el.getBoundingClientRect();
- if (el.offsetWidth == expectedWidth && rect.width == expectedWidth && style.width == expectedWidth + 'px')
- //testPassed('Element given a width of ' + width + ' returns
- testPassed('element.width = ' + width + 'px, returns offsetWidth ' + el.offsetWidth + ', rect.width ' + rect.width + ' and computed width ' + style.width + ' as expected.');
+ var tolerance = opt_tolerance || 0;
+ if (Math.abs(el.offsetWidth - expectedWidth) <= tolerance && Math.abs(rect.width - expectedWidth) <= tolerance && Math.abs(parseInt(style.width, 10) - expectedWidth) <= tolerance)
+ testPassed('element.width = ' + width + 'px, returns offsetWidth, rect.width and computed width as expected.');
else
testFailed('element.width = ' + width + 'px, returns offsetWidth ' + el.offsetWidth + ', rect.width ' + rect.width + ' and computed width ' + style.width + ', expected ' + expectedWidth + '.');
}
@@ -29,10 +29,13 @@
testSize(5000000, 5000000);
testSize(50000000, 0);
testSize(33554424, 33554424);
- testSize(33554425, 33554424); // float impression
- testSize(33554428, 33554428);
- testSize(33554431, 0);
- testSize(33554435, 0);
+ testSize(33554425, 33554425, 2); // float imprecision
+ testSize(33554426, 33554426, 2);
+ testSize(33554427, 33554427, 2);
+ testSize(33554428, 33554428, 2);
+ testSize(33554429, 33554429, 2);
+ testSize(33554430, 33554430, 2);
+ testSize(33554432, 0);
testSize(35791395, 0);
testSize(35791396, 0);
Modified: trunk/Source/WebCore/ChangeLog (129957 => 129958)
--- trunk/Source/WebCore/ChangeLog 2012-09-28 23:08:09 UTC (rev 129957)
+++ trunk/Source/WebCore/ChangeLog 2012-09-28 23:12:56 UTC (rev 129958)
@@ -1,3 +1,21 @@
+2012-09-28 Emil A Eklund <e...@chromium.org>
+
+ Improve saturation arithmetic support in FractionalLayoutUnit
+ https://bugs.webkit.org/show_bug.cgi?id=97938
+
+ Reviewed by Levi Weintraub.
+
+ Fix bug in FractionalLayoutUnit::setValue where greater than or
+ equals is used instead of greater than to clamp the values.
+ Add SATURATED_LAYOUT_ARITHMETIC support to round preventing it
+ from overflowing when adding the fraction.
+
+ Test: fast/sub-pixel/large-sizes.html
+
+ * platform/FractionalLayoutUnit.h:
+ (WebCore::FractionalLayoutUnit::round):
+ (WebCore::FractionalLayoutUnit::setValue):
+
2012-09-28 Luiz Agostini <luiz.agost...@nokia.com>
TextureMapperGL destructor crashes
Modified: trunk/Source/WebCore/platform/FractionalLayoutUnit.h (129957 => 129958)
--- trunk/Source/WebCore/platform/FractionalLayoutUnit.h 2012-09-28 23:08:09 UTC (rev 129957)
+++ trunk/Source/WebCore/platform/FractionalLayoutUnit.h 2012-09-28 23:12:56 UTC (rev 129958)
@@ -207,8 +207,12 @@
}
int round() const
{
-#if ENABLE(SUBPIXEL_LAYOUT)
+#if ENABLE(SUBPIXEL_LAYOUT) && ENABLE(SATURATED_LAYOUT_ARITHMETIC)
if (m_value > 0)
+ return saturatedAddition(rawValue(), kFixedPointDenominator / 2) / kFixedPointDenominator;
+ return saturatedSubtraction(rawValue(), kFixedPointDenominator / 2) / kFixedPointDenominator;
+#elif ENABLE(SUBPIXEL_LAYOUT)
+ if (m_value > 0)
return (m_value + (kFixedPointDenominator / 2)) / kFixedPointDenominator;
return (m_value - (kFixedPointDenominator / 2)) / kFixedPointDenominator;
#else
@@ -290,9 +294,9 @@
inline void setValue(int value)
{
#if ENABLE(SATURATED_LAYOUT_ARITHMETIC)
- if (value >= intMaxForLayoutUnit)
+ if (value > intMaxForLayoutUnit)
m_value = std::numeric_limits<int>::max();
- else if (value <= intMinForLayoutUnit)
+ else if (value < intMinForLayoutUnit)
m_value = std::numeric_limits<int>::min();
else
m_value = value * kFixedPointDenominator;