Diff
Modified: branches/chromium/1180/LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer-expected.txt (122852 => 122853)
--- branches/chromium/1180/LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer-expected.txt 2012-07-17 17:32:59 UTC (rev 122852)
+++ branches/chromium/1180/LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer-expected.txt 2012-07-17 17:35:25 UTC (rev 122853)
@@ -49,6 +49,10 @@
PASS input.min = "0"; stepUp("9", "10", "") is "10"
PASS stepDown("19", "10", "0") is "10"
PASS stepUp("89", "10", "99") is "90"
+PASS stepUp("7", "300", "") is "300"
+PASS stepUp("-7", "300", "") is "0"
+PASS stepDown("7", "300", "") is "0"
+PASS stepDown("-7", "300", "") is "-300"
Huge value and small step
PASS input.min = ""; stepUp("1e+38", "1", "", 999) is "1e+38"
PASS input.max = ""; stepDown("1e+38", "1", "", 999) is "1e+38"
Modified: branches/chromium/1180/LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer.html (122852 => 122853)
--- branches/chromium/1180/LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer.html 2012-07-17 17:32:59 UTC (rev 122852)
+++ branches/chromium/1180/LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer.html 2012-07-17 17:35:25 UTC (rev 122853)
@@ -131,6 +131,10 @@
shouldBe('input.min = "0"; stepUp("9", "10", "")', '"10"');
shouldBe('stepDown("19", "10", "0")', '"10"');
shouldBe('stepUp("89", "10", "99")', '"90"');
+shouldBe('stepUp("7", "300", "")', '"300"');
+shouldBe('stepUp("-7", "300", "")', '"0"');
+shouldBe('stepDown("7", "300", "")', '"0"');
+shouldBe('stepDown("-7", "300", "")', '"-300"');
debug('Huge value and small step');
shouldBe('input.min = ""; stepUp("1e+38", "1", "", 999)', '"1e+38"');
shouldBe('input.max = ""; stepDown("1e+38", "1", "", 999)', '"1e+38"');
Modified: branches/chromium/1180/Source/WebCore/platform/Decimal.cpp (122852 => 122853)
--- branches/chromium/1180/Source/WebCore/platform/Decimal.cpp 2012-07-17 17:32:59 UTC (rev 122852)
+++ branches/chromium/1180/Source/WebCore/platform/Decimal.cpp 2012-07-17 17:35:25 UTC (rev 122853)
@@ -628,7 +628,7 @@
const int numberOfDigits = countDigits(result);
const int numberOfDropDigits = -exponent();
if (numberOfDigits < numberOfDropDigits)
- return zero(Positive);
+ return isPositive() ? Decimal(1) : zero(Positive);
result = scaleDown(result, numberOfDropDigits - 1);
if (sign() == Positive && result % 10 > 0)
@@ -670,7 +670,7 @@
const int numberOfDigits = countDigits(result);
const int numberOfDropDigits = -exponent();
if (numberOfDigits < numberOfDropDigits)
- return zero(Positive);
+ return isPositive() ? zero(Positive) : Decimal(-1);
result = scaleDown(result, numberOfDropDigits - 1);
if (isNegative() && result % 10 > 0)
Modified: branches/chromium/1180/Source/WebKit/chromium/tests/DecimalTest.cpp (122852 => 122853)
--- branches/chromium/1180/Source/WebKit/chromium/tests/DecimalTest.cpp 2012-07-17 17:32:59 UTC (rev 122852)
+++ branches/chromium/1180/Source/WebKit/chromium/tests/DecimalTest.cpp 2012-07-17 17:35:25 UTC (rev 122853)
@@ -211,12 +211,14 @@
TEST_F(DecimalTest, Ceiling)
{
EXPECT_EQ(Decimal(1), Decimal(1).ceiling());
+ EXPECT_EQ(Decimal(1), encode(1, -10, Positive).ceiling());
EXPECT_EQ(Decimal(2), encode(11, -1, Positive).ceiling());
EXPECT_EQ(Decimal(2), encode(13, -1, Positive).ceiling());
EXPECT_EQ(Decimal(2), encode(15, -1, Positive).ceiling());
EXPECT_EQ(Decimal(2), encode(19, -1, Positive).ceiling());
EXPECT_EQ(Decimal(-1), Decimal(-1).ceiling());
+ EXPECT_EQ(Decimal(0), encode(1, -10, Negative).ceiling());
EXPECT_EQ(Decimal(-1), encode(11, -1, Negative).ceiling());
EXPECT_EQ(Decimal(-1), encode(13, -1, Negative).ceiling());
EXPECT_EQ(Decimal(-1), encode(15, -1, Negative).ceiling());
@@ -525,12 +527,14 @@
TEST_F(DecimalTest, Floor)
{
EXPECT_EQ(Decimal(1), Decimal(1).floor());
+ EXPECT_EQ(Decimal(0), encode(1, -10, Positive).floor());
EXPECT_EQ(Decimal(1), encode(11, -1, Positive).floor());
EXPECT_EQ(Decimal(1), encode(13, -1, Positive).floor());
EXPECT_EQ(Decimal(1), encode(15, -1, Positive).floor());
EXPECT_EQ(Decimal(1), encode(19, -1, Positive).floor());
EXPECT_EQ(Decimal(-1), Decimal(-1).floor());
+ EXPECT_EQ(Decimal(-1), encode(1, -10, Negative).floor());
EXPECT_EQ(Decimal(-2), encode(11, -1, Negative).floor());
EXPECT_EQ(Decimal(-2), encode(13, -1, Negative).floor());
EXPECT_EQ(Decimal(-2), encode(15, -1, Negative).floor());