| OLD | NEW |
| 1 // Copyright 2011, Google Inc. | 1 // Copyright 2011, Google Inc. |
| 2 // All rights reserved. | 2 // 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 are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * 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 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 } | 47 } |
| 48 | 48 |
| 49 int start = DartUtilities::dartToInt(Dart_GetNativeArgument(args, 1), ex
ception); | 49 int start = DartUtilities::dartToInt(Dart_GetNativeArgument(args, 1), ex
ception); |
| 50 if (exception) | 50 if (exception) |
| 51 goto fail; | 51 goto fail; |
| 52 | 52 |
| 53 int end = DartUtilities::dartToInt(Dart_GetNativeArgument(args, 2), exce
ption); | 53 int end = DartUtilities::dartToInt(Dart_GetNativeArgument(args, 2), exce
ption); |
| 54 if (exception) | 54 if (exception) |
| 55 goto fail; | 55 goto fail; |
| 56 | 56 |
| 57 const ParameterAdapter<String> direction(Dart_GetNativeArgument(args, 3)
); | 57 DartStringAdapter direction = DartUtilities::dartToString(Dart_GetNative
Argument(args, 3), exception); |
| 58 if (!direction.conversionSuccessful()) { | 58 if (exception) |
| 59 exception = direction.exception(); | |
| 60 goto fail; | 59 goto fail; |
| 61 } | |
| 62 | 60 |
| 63 receiver->setSelectionRange(start, end, direction); | 61 receiver->setSelectionRange(start, end, direction); |
| 64 return; | 62 return; |
| 65 } | 63 } |
| 66 | 64 |
| 67 fail: | 65 fail: |
| 68 Dart_ThrowException(exception); | 66 Dart_ThrowException(exception); |
| 69 ASSERT_NOT_REACHED(); | 67 ASSERT_NOT_REACHED(); |
| 70 } | 68 } |
| 71 | 69 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 95 DartApiScope dartApiScope; | 93 DartApiScope dartApiScope; |
| 96 Dart_Handle exception = 0; | 94 Dart_Handle exception = 0; |
| 97 { | 95 { |
| 98 HTMLInputElement* receiver = DartDOMWrapper::receiver<HTMLInputElement>(
args); | 96 HTMLInputElement* receiver = DartDOMWrapper::receiver<HTMLInputElement>(
args); |
| 99 | 97 |
| 100 if (!receiver->canHaveSelection()) { | 98 if (!receiver->canHaveSelection()) { |
| 101 exception = Dart_NewString("Accessing selectionDirection on an input
element that cannot have a selection."); | 99 exception = Dart_NewString("Accessing selectionDirection on an input
element that cannot have a selection."); |
| 102 goto fail; | 100 goto fail; |
| 103 } | 101 } |
| 104 | 102 |
| 105 const ParameterAdapter<String> value(Dart_GetNativeArgument(args, 1)); | 103 DartStringAdapter value = DartUtilities::dartToString(Dart_GetNativeArgu
ment(args, 1), exception); |
| 106 if (!value.conversionSuccessful()) { | 104 if (exception) |
| 107 exception = value.exception(); | |
| 108 goto fail; | 105 goto fail; |
| 109 } | |
| 110 | 106 |
| 111 receiver->setSelectionDirection(value); | 107 receiver->setSelectionDirection(value); |
| 112 return; | 108 return; |
| 113 } | 109 } |
| 114 | 110 |
| 115 fail: | 111 fail: |
| 116 Dart_ThrowException(exception); | 112 Dart_ThrowException(exception); |
| 117 ASSERT_NOT_REACHED(); | 113 ASSERT_NOT_REACHED(); |
| 118 } | 114 } |
| 119 | 115 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 } | 201 } |
| 206 | 202 |
| 207 fail: | 203 fail: |
| 208 Dart_ThrowException(exception); | 204 Dart_ThrowException(exception); |
| 209 ASSERT_NOT_REACHED(); | 205 ASSERT_NOT_REACHED(); |
| 210 } | 206 } |
| 211 | 207 |
| 212 } | 208 } |
| 213 | 209 |
| 214 } | 210 } |
| OLD | NEW |