OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * Copyright (C) 2012 Ericsson AB. All rights reserved. | 3 * Copyright (C) 2012 Ericsson AB. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 | 521 |
522 // Convert a value to a single precision float assuming the conversion cannot fa
il. | 522 // Convert a value to a single precision float assuming the conversion cannot fa
il. |
523 inline float toFloat(v8::Local<v8::Value> value) | 523 inline float toFloat(v8::Local<v8::Value> value) |
524 { | 524 { |
525 return static_cast<float>(value->NumberValue()); | 525 return static_cast<float>(value->NumberValue()); |
526 } | 526 } |
527 | 527 |
528 // Converts a value to a String, throwing if any code unit is outside 0-255. | 528 // Converts a value to a String, throwing if any code unit is outside 0-255. |
529 String toByteString(v8::Handle<v8::Value>, ExceptionState&); | 529 String toByteString(v8::Handle<v8::Value>, ExceptionState&); |
530 | 530 |
| 531 // Converts a value to a String, replacing unmatched UTF-16 surrogates with repl
acement characters. |
| 532 String toScalarValueString(v8::Handle<v8::Value>, ExceptionState&); |
| 533 |
531 inline v8::Handle<v8::Boolean> v8Boolean(bool value, v8::Isolate* isolate) | 534 inline v8::Handle<v8::Boolean> v8Boolean(bool value, v8::Isolate* isolate) |
532 { | 535 { |
533 return value ? v8::True(isolate) : v8::False(isolate); | 536 return value ? v8::True(isolate) : v8::False(isolate); |
534 } | 537 } |
535 | 538 |
536 inline double toCoreDate(v8::Handle<v8::Value> object) | 539 inline double toCoreDate(v8::Handle<v8::Value> object) |
537 { | 540 { |
538 if (object->IsDate()) | 541 if (object->IsDate()) |
539 return v8::Handle<v8::Date>::Cast(object)->ValueOf(); | 542 return v8::Handle<v8::Date>::Cast(object)->ValueOf(); |
540 if (object->IsNumber()) | 543 if (object->IsNumber()) |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 m_block.Reset(); | 966 m_block.Reset(); |
964 } | 967 } |
965 | 968 |
966 private: | 969 private: |
967 v8::TryCatch& m_block; | 970 v8::TryCatch& m_block; |
968 }; | 971 }; |
969 | 972 |
970 } // namespace WebCore | 973 } // namespace WebCore |
971 | 974 |
972 #endif // V8Binding_h | 975 #endif // V8Binding_h |
OLD | NEW |