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

Unified Diff: Source/bindings/v8/V8Binding.h

Issue 54903014: [EnforceRange] doesn't enforce range of a short (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Extend layout test Created 7 years, 1 month 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: Source/bindings/v8/V8Binding.h
diff --git a/Source/bindings/v8/V8Binding.h b/Source/bindings/v8/V8Binding.h
index 7c02b3f8f91137b98e4edaaf8472a232ddf1e5c9..f33245b685d3da1ac75674daa1a56693e37ecab5 100644
--- a/Source/bindings/v8/V8Binding.h
+++ b/Source/bindings/v8/V8Binding.h
@@ -340,6 +340,32 @@ namespace WebCore {
return toUInt8(value, NormalConversion, ok);
}
+ // Convert a value to a 16-bit signed integer. The conversion fails if the
+ // value cannot be converted to a number or the range violated per WebIDL:
+ // http://www.w3.org/TR/WebIDL/#es-short
+ int16_t toInt16(v8::Handle<v8::Value>, IntegerConversionConfiguration, bool& ok);
+ inline int16_t toInt16(v8::Handle<v8::Value> value, bool& ok) { return toInt16(value, NormalConversion, ok); }
+
+ // Convert a value to a 16-bit integer assuming the conversion cannot fail.
+ inline int16_t toInt16(v8::Handle<v8::Value> value)
+ {
+ bool ok;
+ return toInt16(value, NormalConversion, ok);
+ }
+
+ // Convert a value to a 16-bit unsigned integer. The conversion fails if the
+ // value cannot be converted to a number or the range violated per WebIDL:
+ // http://www.w3.org/TR/WebIDL/#es-unsigned-short
+ uint16_t toUInt16(v8::Handle<v8::Value>, IntegerConversionConfiguration, bool& ok);
+ inline uint16_t toUInt16(v8::Handle<v8::Value> value, bool& ok) { return toUInt16(value, NormalConversion, ok); }
+
+ // Convert a value to a 16-bit unsigned integer assuming the conversion cannot fail.
+ inline uint16_t toUInt16(v8::Handle<v8::Value> value)
+ {
+ bool ok;
+ return toUInt16(value, NormalConversion, ok);
+ }
+
// Convert a value to a 32-bit signed integer. The conversion fails if the
// value cannot be converted to a number or the range violated per WebIDL:
// http://www.w3.org/TR/WebIDL/#es-long

Powered by Google App Engine
This is Rietveld 408576698