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

Unified Diff: Source/bindings/core/dart/DartUtilities.cpp

Issue 1663753002: Apply all blink changes between @202695 and tip of trunk (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/2454_1
Patch Set: Created 4 years, 11 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/core/dart/DartUtilities.h ('k') | Source/bindings/core/dart/V8Converter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/dart/DartUtilities.cpp
diff --git a/Source/bindings/core/dart/DartUtilities.cpp b/Source/bindings/core/dart/DartUtilities.cpp
index 3c9d86e48921eba12d436629d800e18775d8aa2d..2e091a12028b5671876da1b5081816396b316e2f 100644
--- a/Source/bindings/core/dart/DartUtilities.cpp
+++ b/Source/bindings/core/dart/DartUtilities.cpp
@@ -36,6 +36,7 @@
#include "bindings/core/dart/DartController.h"
#include "bindings/core/dart/DartDOMData.h"
+#include "bindings/core/dart/DartJsInterop.h"
#include "bindings/core/dart/DartScriptDebugServer.h"
#include "bindings/core/dart/DartScriptState.h"
#include "bindings/core/dart/V8Converter.h"
@@ -43,6 +44,7 @@
#include "bindings/core/v8/ScriptController.h"
#include "bindings/core/v8/SerializedScriptValueFactory.h"
#include "bindings/core/v8/V8Binding.h"
+#include "bindings/core/v8/V8Node.h"
#include "bindings/core/v8/V8PerIsolateData.h"
#include "core/dom/DOMArrayBuffer.h"
#include "core/dom/DOMDataView.h"
@@ -565,12 +567,26 @@ Dart_Handle DartUtilities::getDartHtmlType(const char* typeName)
bool DartUtilities::isNode(Dart_Handle handle)
{
Dart_Handle dartType = DartUtilities::getDartHtmlType("Node");
- return objectIsType(handle, dartType);
+ if (!objectIsType(handle, dartType)) {
+ return false;
+ }
+ // Some dart:html Node instances may not really be Node objects.
+ Dart_Handle exception = 0;
+ v8::Handle<v8::Value> v8Node = JsInterop::fromDart(DartDOMData::current(), handle, exception);
+ if (exception) {
+ return false;
+ }
+ return V8Node::hasInstance(v8Node, v8::Isolate::GetCurrent());
}
-Node* DartUtilities::dartNodeToNativeNode(void* value)
+Node* DartUtilities::dartNodeToNativeNode(Dart_Handle handle)
{
- return static_cast<Node*>(value);
+ Dart_Handle exception = 0;
+ v8::Handle<v8::Value> v8Node = JsInterop::fromDart(DartDOMData::current(), handle, exception);
+ ASSERT(!exception);
+ ASSERT(V8Node::hasInstance(v8Node, v8::Isolate::GetCurrent()));
+ Node* node = V8Node::toImpl(v8Node.As<v8::Object>());
+ return node;
}
bool DartUtilities::isMessagePort(Dart_Handle handle)
« no previous file with comments | « Source/bindings/core/dart/DartUtilities.h ('k') | Source/bindings/core/dart/V8Converter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698