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

Unified Diff: Source/bindings/dart/custom/DartDocumentCustom.cpp

Issue 24677002: Revert "Revert "Dartium changes for custom element lifecycle events."" (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/dart/DartUtilities.cpp ('k') | Source/bindings/dart/gyp/overrides.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/bindings/dart/DartUtilities.cpp ('k') | Source/bindings/dart/gyp/overrides.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698