| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 if (!getKey(key, v8Value)) | 135 if (!getKey(key, v8Value)) |
| 136 return false; | 136 return false; |
| 137 | 137 |
| 138 v8::Local<v8::Int32> v8Int32 = v8Value->ToInt32(); | 138 v8::Local<v8::Int32> v8Int32 = v8Value->ToInt32(); |
| 139 if (v8Int32.IsEmpty()) | 139 if (v8Int32.IsEmpty()) |
| 140 return false; | 140 return false; |
| 141 value = v8Int32->Value(); | 141 value = v8Int32->Value(); |
| 142 return true; | 142 return true; |
| 143 } | 143 } |
| 144 | 144 |
| 145 bool Dictionary::get(const String& key, double& value) const | 145 bool Dictionary::get(const String& key, double& value, bool& hasValue) const |
| 146 { | 146 { |
| 147 v8::Local<v8::Value> v8Value; | 147 v8::Local<v8::Value> v8Value; |
| 148 if (!getKey(key, v8Value)) | 148 if (!getKey(key, v8Value)) { |
| 149 hasValue = false; |
| 149 return false; | 150 return false; |
| 151 } |
| 150 | 152 |
| 153 hasValue = true; |
| 151 v8::Local<v8::Number> v8Number = v8Value->ToNumber(); | 154 v8::Local<v8::Number> v8Number = v8Value->ToNumber(); |
| 152 if (v8Number.IsEmpty()) | 155 if (v8Number.IsEmpty()) |
| 153 return false; | 156 return false; |
| 154 value = v8Number->Value(); | 157 value = v8Number->Value(); |
| 155 return true; | 158 return true; |
| 156 } | 159 } |
| 157 | 160 |
| 161 bool Dictionary::get(const String& key, double& value) const |
| 162 { |
| 163 bool unused; |
| 164 return get(key, value, unused); |
| 165 } |
| 166 |
| 158 bool Dictionary::get(const String& key, String& value) const | 167 bool Dictionary::get(const String& key, String& value) const |
| 159 { | 168 { |
| 160 v8::Local<v8::Value> v8Value; | 169 v8::Local<v8::Value> v8Value; |
| 161 if (!getKey(key, v8Value)) | 170 if (!getKey(key, v8Value)) |
| 162 return false; | 171 return false; |
| 163 | 172 |
| 164 // FIXME: It is possible for this to throw in which case we'd be getting bac
k | 173 // FIXME: It is possible for this to throw in which case we'd be getting bac
k |
| 165 // an empty string and returning true when we should be returning fal
se. | 174 // an empty string and returning true when we should be returning fal
se. |
| 166 // See fast/dom/Geolocation/script-tests/argument-types.js for a simi
lar | 175 // See fast/dom/Geolocation/script-tests/argument-types.js for a simi
lar |
| 167 // example. | 176 // example. |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 v8::Local<v8::String> key = properties->Get(i)->ToString(); | 609 v8::Local<v8::String> key = properties->Get(i)->ToString(); |
| 601 if (!options->Has(key)) | 610 if (!options->Has(key)) |
| 602 continue; | 611 continue; |
| 603 names.append(toWebCoreString(key)); | 612 names.append(toWebCoreString(key)); |
| 604 } | 613 } |
| 605 | 614 |
| 606 return true; | 615 return true; |
| 607 } | 616 } |
| 608 | 617 |
| 609 } // namespace WebCore | 618 } // namespace WebCore |
| OLD | NEW |