Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(436)

Unified Diff: third_party/WebKit/Source/core/html/forms/StepRangeTest.cpp

Issue 2048943002: Fix an assertion failure in InputType::applyStep() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/forms/StepRangeTest.cpp
diff --git a/third_party/WebKit/Source/core/html/forms/StepRangeTest.cpp b/third_party/WebKit/Source/core/html/forms/StepRangeTest.cpp
index cca25cf831039054eca40b9946b8f21499e98e04..3d238c71f4dd5acc3917e21c755ee1a8007a0362 100644
--- a/third_party/WebKit/Source/core/html/forms/StepRangeTest.cpp
+++ b/third_party/WebKit/Source/core/html/forms/StepRangeTest.cpp
@@ -17,4 +17,16 @@ TEST(StepRangeTest, ClampValueWithOutStepMatchedValue)
EXPECT_EQ(Decimal(0), stepRange.clampValue(Decimal(-100)));
}
+TEST(StepRangeTest, StepSnappedMaximum)
+{
+ // <input type=number value="1110" max=100 step="20">
+ StepRange stepRange(Decimal::fromDouble(1110), Decimal(0), Decimal(100), true, Decimal(20), StepRange::StepDescription());
+ EXPECT_EQ(Decimal(90), stepRange.stepSnappedMaximum());
+
+ // crbug.com/617809
+ // <input type=number value="8624024784918570374158793713225864658725102756338798521486349461900449498315865014065406918592181034633618363349807887404915072776534917803019477033072906290735591367789665757384135591225430117374220731087966" min=0 max=100 step="18446744073709551575">
+ StepRange stepRange2(Decimal::fromDouble(8.62402e+207), Decimal(0), Decimal(100), true, Decimal::fromDouble(1.84467e+19), StepRange::StepDescription());
+ EXPECT_FALSE(stepRange2.stepSnappedMaximum().isFinite());
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/html/forms/StepRange.cpp ('k') | third_party/WebKit/Source/platform/Decimal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698