| 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 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 #include "DartDOMWrapper.h" | 33 #include "DartDOMWrapper.h" |
| 34 #include "DartHTMLAllCollection.h" | 34 #include "DartHTMLAllCollection.h" |
| 35 #include "DartHTMLCollection.h" | 35 #include "DartHTMLCollection.h" |
| 36 #include "DartNode.h" | 36 #include "DartNode.h" |
| 37 #include "HTMLAllCollection.h" | 37 #include "HTMLAllCollection.h" |
| 38 #include "HTMLCollection.h" | 38 #include "HTMLCollection.h" |
| 39 | 39 |
| 40 namespace WebCore { | 40 namespace WebCore { |
| 41 | 41 |
| 42 namespace DartHTMLCollectionInternal { | |
| 43 | |
| 44 // This method is custom in JavaScript. | |
| 45 void itemCallback(Dart_NativeArguments args) | |
| 46 { | |
| 47 DartApiScope dartApiScope; | |
| 48 Dart_Handle exception = 0; | |
| 49 { | |
| 50 HTMLCollection* receiver = DartDOMWrapper::receiver<HTMLCollection>(args
); | |
| 51 unsigned index = DartUtilities::dartToUnsigned(Dart_GetNativeArgument(ar
gs, 1), exception); | |
| 52 if (exception) | |
| 53 goto fail; | |
| 54 | |
| 55 DartDOMWrapper::returnValue<DartNode>(args, receiver->item(index)); | |
| 56 return; | |
| 57 } | |
| 58 | |
| 59 fail: | |
| 60 Dart_ThrowException(exception); | |
| 61 ASSERT_NOT_REACHED(); | |
| 62 } | |
| 63 | |
| 64 void namedItemCallback(Dart_NativeArguments) | |
| 65 { | |
| 66 // FIXME: proper implementation. | |
| 67 DART_UNIMPLEMENTED(); | |
| 68 } | |
| 69 | |
| 70 } | |
| 71 | |
| 72 Dart_Handle DartHTMLCollection::toDart(HTMLCollection* collection) | 42 Dart_Handle DartHTMLCollection::toDart(HTMLCollection* collection) |
| 73 { | 43 { |
| 74 if (!collection) | 44 if (!collection) |
| 75 return 0; | 45 return 0; |
| 76 | 46 |
| 77 if (collection->type() == DocAll) | 47 if (collection->type() == DocAll) |
| 78 return DartHTMLAllCollection::toDart(static_cast<HTMLAllCollection*>(col
lection)); | 48 return DartHTMLAllCollection::toDart(static_cast<HTMLAllCollection*>(col
lection)); |
| 79 return DartDOMWrapper::toDart<DartHTMLCollection>(collection); | 49 return DartDOMWrapper::toDart<DartHTMLCollection>(collection); |
| 80 } | 50 } |
| 81 | 51 |
| 82 } | 52 } |
| OLD | NEW |