| Index: Source/bindings/dart/custom/DartDocumentCustom.cpp
|
| diff --git a/Source/bindings/dart/custom/DartDocumentCustom.cpp b/Source/bindings/dart/custom/DartDocumentCustom.cpp
|
| index 362de2277ff7e100797edf2cf12628a1da8ff8fb..deab8b1e2051e7930d893aaed1efa38d1a615acf 100644
|
| --- a/Source/bindings/dart/custom/DartDocumentCustom.cpp
|
| +++ b/Source/bindings/dart/custom/DartDocumentCustom.cpp
|
| @@ -30,10 +30,12 @@
|
| #include "config.h"
|
| #include "DartDocument.h"
|
|
|
| +#include "DartElement.h"
|
| #include "DartHTMLDocument.h"
|
| #include "DartSVGDocument.h"
|
| #include "DartTouchList.h"
|
| #include "bindings/dart/DartDOMWrapper.h"
|
| +#include "core/dom/CustomElementCallbackDispatcher.h"
|
| #include "core/dom/Document.h"
|
|
|
| namespace WebCore {
|
| @@ -59,6 +61,90 @@ void createTouchListCallback(Dart_NativeArguments args)
|
| DartTouchList::returnToDart(args, touchList.release());
|
| }
|
|
|
| +void createElementCallback(Dart_NativeArguments args)
|
| +{
|
| + Dart_Handle exception = 0;
|
| + {
|
| + Document* receiver = DartDOMWrapper::receiver< Document >(args);
|
| +
|
| + DartStringAdapter localName = DartUtilities::dartToString(args, 1, exception);
|
| + if (exception)
|
| + goto fail;
|
| +
|
| + DartStringAdapter typeExtension = DartUtilities::dartToStringWithNullCheck(args, 2, exception);
|
| + if (exception)
|
| + goto fail;
|
| +
|
| + DartExceptionState es;
|
| + RefPtr<Element> result;
|
| + {
|
| + CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
|
| +
|
| + const AtomicString& typeExtensionString = typeExtension;
|
| + if (typeExtensionString.isNull()) {
|
| + result = receiver->createElement(localName, es);
|
| + } else {
|
| + result = receiver->createElement(localName, typeExtensionString, es);
|
| + }
|
| + }
|
| +
|
| + DartElement::returnToDart(args, result);
|
| + if (es.hadException()) {
|
| + exception = DartDOMWrapper::exceptionCodeToDartException(es);
|
| + goto fail;
|
| + }
|
| + return;
|
| + }
|
| +
|
| +fail:
|
| + Dart_ThrowException(exception);
|
| + ASSERT_NOT_REACHED();
|
| }
|
|
|
| +void createElementNSCallback(Dart_NativeArguments args)
|
| +{
|
| + Dart_Handle exception = 0;
|
| + {
|
| + Document* receiver = DartDOMWrapper::receiver< Document >(args);
|
| +
|
| + DartStringAdapter namespaceURI = DartUtilities::dartToString(args, 1, exception);
|
| + if (exception)
|
| + goto fail;
|
| +
|
| + DartStringAdapter qualifiedName = DartUtilities::dartToString(args, 2, exception);
|
| + if (exception)
|
| + goto fail;
|
| +
|
| + DartStringAdapter typeExtension = DartUtilities::dartToStringWithNullCheck(args, 3, exception);
|
| + if (exception)
|
| + goto fail;
|
| +
|
| + DartExceptionState es;
|
| + RefPtr<Element> result;
|
| + {
|
| + CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
|
| +
|
| + const AtomicString& typeExtensionString = typeExtension;
|
| + if (typeExtensionString.isNull()) {
|
| + result = receiver->createElementNS(namespaceURI, qualifiedName, es);
|
| + } else {
|
| + result = receiver->createElementNS(namespaceURI, qualifiedName, typeExtensionString, es);
|
| + }
|
| + }
|
| +
|
| + DartElement::returnToDart(args, result);
|
| + if (es.hadException()) {
|
| + exception = DartDOMWrapper::exceptionCodeToDartException(es);
|
| + goto fail;
|
| + }
|
| + return;
|
| + }
|
| +
|
| +fail:
|
| + Dart_ThrowException(exception);
|
| + ASSERT_NOT_REACHED();
|
| }
|
| +
|
| +} // namespace DartDocumentInternal
|
| +
|
| +} // namespace WebCore
|
|
|