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

Side by Side Diff: Source/bindings/dart/custom/DartHTMLOptionsCollectionCustom.cpp

Issue 26789007: Add a native subtype of function that uses the native C++ class hierarchy to check if an element (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit/
Patch Set: Created 7 years, 2 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 HTMLSelectElement* base = static_cast<HTMLSelectElement*>(receiver->owne rNode()); 50 HTMLSelectElement* base = static_cast<HTMLSelectElement*>(receiver->owne rNode());
51 51
52 // Note: as of now HTMLSelect element doesn't implement List and therefo re I inline v8's 52 // Note: as of now HTMLSelect element doesn't implement List and therefo re I inline v8's
53 // toOptionsCollectionSetter right here. If situation changes later, thi s piece of code should 53 // toOptionsCollectionSetter right here. If situation changes later, thi s piece of code should
54 // be refactored into helper method. 54 // be refactored into helper method.
55 unsigned index = DartUtilities::dartToUnsigned(Dart_GetNativeArgument(ar gs, 1), exception); 55 unsigned index = DartUtilities::dartToUnsigned(Dart_GetNativeArgument(ar gs, 1), exception);
56 if (exception) 56 if (exception)
57 goto fail; 57 goto fail;
58 58
59 Dart_Handle elementArgument = Dart_GetNativeArgument(args, 2); 59 Dart_Handle elementArgument = Dart_GetNativeArgument(args, 2);
60 DartDOMData* domData = static_cast<DartDOMData*>(Dart_GetNativeIsolateDa ta(args)); 60 if (!DartDOMWrapper::subtypeOf(elementArgument, DartHTMLOptionElement::d artClassId)) {
61 if (!DartDOMWrapper::instanceOf<DartHTMLOptionElement>(domData, elementA rgument)) {
62 exception = DartDOMWrapper::exceptionCodeToDartException(TypeMismatc hError); 61 exception = DartDOMWrapper::exceptionCodeToDartException(TypeMismatc hError);
63 goto fail; 62 goto fail;
64 } 63 }
65 HTMLOptionElement* element = DartHTMLOptionElement::toNative(elementArgu ment, exception); 64 HTMLOptionElement* element = DartHTMLOptionElement::toNative(elementArgu ment, exception);
66 if (exception) 65 if (exception)
67 goto fail; 66 goto fail;
68 67
69 DartExceptionState es; 68 DartExceptionState es;
70 base->setOption(index, element, es); 69 base->setOption(index, element, es);
71 if (es.hadException()) { 70 if (es.hadException()) {
72 exception = DartDOMWrapper::exceptionCodeToDartException(es); 71 exception = DartDOMWrapper::exceptionCodeToDartException(es);
73 goto fail; 72 goto fail;
74 } 73 }
75 74
76 return; 75 return;
77 } 76 }
78 77
79 fail: 78 fail:
80 Dart_ThrowException(exception); 79 Dart_ThrowException(exception);
81 ASSERT_NOT_REACHED(); 80 ASSERT_NOT_REACHED();
82 } 81 }
83 82
84 } 83 }
85 84
86 } 85 }
OLDNEW
« no previous file with comments | « Source/bindings/dart/custom/DartDOMStringListCustom.cpp ('k') | Source/bindings/dart/custom/DartWebSocketCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698