summaryrefslogtreecommitdiffstats
path: root/gin
diff options
context:
space:
mode:
authorhajimehoshi@chromium.org <hajimehoshi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-16 11:30:01 +0000
committerhajimehoshi@chromium.org <hajimehoshi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-16 11:30:01 +0000
commitf53eba128d2e455b0c827b08eeeb91b45c295515 (patch)
tree91d6548be70bb064115a6de2e1ea15207df3f24a /gin
parent32a5a3bd590584e6ff5d8730ab79ff387f05e5e3 (diff)
downloadchromium_src-f53eba128d2e455b0c827b08eeeb91b45c295515.zip
chromium_src-f53eba128d2e455b0c827b08eeeb91b45c295515.tar.gz
chromium_src-f53eba128d2e455b0c827b08eeeb91b45c295515.tar.bz2
gin: Stop converting float values into integers implicitly
This CL is basically revert of https://codereview.chromium.org/195893017/. TEST=layout tests, gin_unittests Review URL: https://codereview.chromium.org/236883002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@264170 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gin')
-rw-r--r--gin/converter.cc4
-rw-r--r--gin/converter_unittest.cc2
2 files changed, 3 insertions, 3 deletions
diff --git a/gin/converter.cc b/gin/converter.cc
index 29da322..07437b7 100644
--- a/gin/converter.cc
+++ b/gin/converter.cc
@@ -35,7 +35,7 @@ Handle<Value> Converter<int32_t>::ToV8(Isolate* isolate, int32_t val) {
bool Converter<int32_t>::FromV8(Isolate* isolate, Handle<Value> val,
int32_t* out) {
- if (!val->IsNumber())
+ if (!val->IsInt32())
return false;
*out = val->Int32Value();
return true;
@@ -47,7 +47,7 @@ Handle<Value> Converter<uint32_t>::ToV8(Isolate* isolate, uint32_t val) {
bool Converter<uint32_t>::FromV8(Isolate* isolate, Handle<Value> val,
uint32_t* out) {
- if (!val->IsNumber())
+ if (!val->IsUint32())
return false;
*out = val->Uint32Value();
return true;
diff --git a/gin/converter_unittest.cc b/gin/converter_unittest.cc
index cf1affc..791d7e6 100644
--- a/gin/converter_unittest.cc
+++ b/gin/converter_unittest.cc
@@ -89,7 +89,7 @@ TEST_F(ConverterTest, Int32) {
{ Integer::New(instance_->isolate(), 0).As<Value>(), true, 0 },
{ Integer::New(instance_->isolate(), 1).As<Value>(), true, 1 },
{ Number::New(instance_->isolate(), -1).As<Value>(), true, -1 },
- { Number::New(instance_->isolate(), 1.1).As<Value>(), true, 1 },
+ { Number::New(instance_->isolate(), 1.1).As<Value>(), false, 0 },
{ String::NewFromUtf8(instance_->isolate(), "42").As<Value>(), false, 0 },
{ String::NewFromUtf8(instance_->isolate(), "foo").As<Value>(), false, 0 },
{ Object::New(instance_->isolate()).As<Value>(), false, 0 },