Attempt to re-implement the clampTo() changes in
https://src.chromium.org/viewvc/blink?view=rev&revision=183172 without
regressing performance.

This allows clampTo() to work with more types, fixes compiler warnings, and adds a variety of tests to catch various edge cases I encountered during the many rounds of implementation attempts.

BUG=81439
TEST=none

Review URL: https://codereview.chromium.org/629323002

git-svn-id: svn://svn.chromium.org/blink/trunk@184032 bbb929c8-8fbe-4397-9dbb-9b2b20218538