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

Unified Diff: Source/bindings/core/dart/shared_lib/DartNativeExtensions.cpp

Issue 1532413002: Added Dartium changes onto 45.0.2454.104 (Closed) Base URL: http://src.chromium.org/blink/branches/chromium/2454
Patch Set: Created 5 years 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
Index: Source/bindings/core/dart/shared_lib/DartNativeExtensions.cpp
diff --git a/Source/core/svg/SVGPointTearOff.cpp b/Source/bindings/core/dart/shared_lib/DartNativeExtensions.cpp
similarity index 54%
copy from Source/core/svg/SVGPointTearOff.cpp
copy to Source/bindings/core/dart/shared_lib/DartNativeExtensions.cpp
index 706d26dab6c52256d253def792931381f8ebb77b..742722d49681e665f325c38d61ee36a5a12e3b29 100644
--- a/Source/core/svg/SVGPointTearOff.cpp
+++ b/Source/bindings/core/dart/shared_lib/DartNativeExtensions.cpp
@@ -30,46 +30,54 @@
#include "config.h"
-#include "core/svg/SVGPointTearOff.h"
+#include "bindings/core/dart/shared_lib/DartNativeExtensions.h"
-#include "bindings/core/v8/ExceptionState.h"
-#include "core/dom/ExceptionCode.h"
-#include "core/svg/SVGElement.h"
-#include "core/svg/SVGMatrixTearOff.h"
+#include "bindings/core/dart/DartUtilities.h"
namespace blink {
-SVGPointTearOff::SVGPointTearOff(PassRefPtrWillBeRawPtr<SVGPoint> target, SVGElement* contextElement, PropertyIsAnimValType propertyIsAnimVal, const QualifiedName& attributeName)
- : SVGPropertyTearOff<SVGPoint>(target, contextElement, propertyIsAnimVal, attributeName)
+#if defined(ENABLE_DART_NATIVE_EXTENSIONS)
+Dart_Handle DartNativeExtensions::loadExtension(const String& url, Dart_Handle parentLibrary)
{
-}
+ String userUri = url.substring(String("dart-ext:").length());
-void SVGPointTearOff::setX(float f, ExceptionState& exceptionState)
-{
- if (isImmutable()) {
- exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
- return;
+ String name;
+ String path;
+ size_t index = userUri.reverseFind('/');
+ if (index == kNotFound) {
+ name = userUri;
+ path = "./";
+ } else if (index == userUri.length() - 1) {
+ return Dart_NewApiError("Extension name missing.");
+ } else {
+ name = userUri.substring(index + 1);
+ path = userUri.substring(0, index + 1);
}
- target()->setX(f);
- commitChange();
-}
+ void* libraryHandle = 0;
+ Dart_Handle result = loadExtensionLibrary(path, name, &libraryHandle);
+ if (Dart_IsError(result)) {
+ return result;
+ }
-void SVGPointTearOff::setY(float f, ExceptionState& exceptionState)
-{
- if (isImmutable()) {
- exceptionState.throwDOMException(NoModificationAllowedError, "The attribute is read-only.");
- return;
+ String initFunctionName = name + "_Init";
+
+ typedef Dart_Handle (*InitFunctionType)(Dart_Handle library);
+ InitFunctionType fn;
+ result = resolveSymbol(libraryHandle, initFunctionName, reinterpret_cast<void**>(&fn));
+ if (Dart_IsError(result)) {
+ return result;
}
- target()->setY(f);
- commitChange();
+ return (*fn)(parentLibrary);
}
-
-PassRefPtrWillBeRawPtr<SVGPointTearOff> SVGPointTearOff::matrixTransform(PassRefPtrWillBeRawPtr<SVGMatrixTearOff> matrix)
+#else
+Dart_Handle DartNativeExtensions::loadExtension(const String& url, Dart_Handle parentLibrary)
{
- FloatPoint point = target()->matrixTransform(matrix->value());
- return SVGPointTearOff::create(SVGPoint::create(point), 0, PropertyIsNotAnimVal);
+ return Dart_NewApiError("Native extensions are not enabled.");
}
+#endif // defined(ENABLE_DART_NATIVE_EXTENSIONS)
}
+
+

Powered by Google App Engine
This is Rietveld 408576698