Index: Source/bindings/dart/DartNativeUtilities.cpp |
diff --git a/Source/bindings/dart/DartNativeUtilities.cpp b/Source/bindings/dart/DartNativeUtilities.cpp |
index 3adb0dce7d6efc889fb1f3bf0495eb59ed3fff8e..730d5c4f2847117046d4af9b86dcce264d3af658 100644 |
--- a/Source/bindings/dart/DartNativeUtilities.cpp |
+++ b/Source/bindings/dart/DartNativeUtilities.cpp |
@@ -237,6 +237,36 @@ fail: |
ASSERT_NOT_REACHED(); |
} |
+void changeElementWrapper(Dart_NativeArguments args) |
+{ |
+ Dart_Handle exception = 0; |
+ { |
+ Dart_Handle elementWrapper = Dart_GetNativeArgument(args, 0); |
+ if (!DartDOMWrapper::subtypeOf(elementWrapper, DartHTMLElement::dartClassId)) { |
+ exception = Dart_NewStringFromCString("Invalid class: expected instance of HtmlElement"); |
+ goto fail; |
+ } |
+ |
+ Dart_Handle wrapperType = Dart_GetNativeArgument(args, 1); |
+ if (!Dart_IsType(wrapperType)) { |
+ exception = Dart_NewStringFromCString("Expected instance of Type"); |
+ goto fail; |
+ } |
+ |
+ Dart_Handle newWrapper = DartCustomElementWrapper<HTMLElement>::changeElementWrapper(elementWrapper, wrapperType); |
+ if (Dart_IsError(newWrapper)) { |
+ exception = newWrapper; |
+ goto fail; |
+ } |
+ Dart_SetReturnValue(args, newWrapper); |
+ return; |
+ } |
+ |
+fail: |
+ Dart_ThrowException(exception); |
+ ASSERT_NOT_REACHED(); |
+} |
+ |
} // namespace DartNativeUtilitiesInternal |
namespace DartWindowInternal { |
@@ -274,6 +304,8 @@ Dart_NativeFunction domIsolateHtmlResolver(Dart_Handle name, int argumentCount, |
return DartNativeUtilitiesInternal::createElement; |
if (argumentCount == 1 && str == "Utils_initializeCustomElement") |
return DartNativeUtilitiesInternal::initializeCustomElement; |
+ if (argumentCount == 2 && str == "Utils_changeElementWrapper") |
+ return DartNativeUtilitiesInternal::changeElementWrapper; |
if (argumentCount == 1 && str == "Utils_spawnDomUri") |
return DartNativeUtilitiesInternal::spawnDomUri; |
if (argumentCount == 1 && str == "Window_history_cross_frame_Getter") |