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

Unified Diff: Source/web/WebBindings.cpp

Issue 449683002: Blink API to convert v8::Object to WebNode (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 | « no previous file | public/web/WebBindings.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebBindings.cpp
diff --git a/Source/web/WebBindings.cpp b/Source/web/WebBindings.cpp
index 75b047f70aebf2425a862da89958291c40e7b0e9..48bf15d64543a7dbfc62d98063031b572351666f 100644
--- a/Source/web/WebBindings.cpp
+++ b/Source/web/WebBindings.cpp
@@ -254,6 +254,20 @@ static bool getNodeImpl(NPObject* object, WebNode* webNode, v8::Isolate* isolate
return true;
}
+static bool getNodeFromV8ObjectImpl(v8::Handle<v8::Object> obj, blink::WebNode* node)
+{
+ if (obj.IsEmpty())
+ return false;
+
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ Element* native = V8Element::hasInstance(obj, isolate) ? V8Element::toNative(obj) : 0;
+ if (!native)
+ return false;
+
+ *node = WebNode(native);
+ return true;
+}
+
static bool getElementImpl(NPObject* object, WebElement* webElement, v8::Isolate* isolate)
{
if (!object)
@@ -359,6 +373,11 @@ bool WebBindings::getNode(NPObject* node, WebNode* webNode)
return getNodeImpl(node, webNode, v8::Isolate::GetCurrent());
}
+bool WebBindings::getNodeFromV8Object(v8::Handle<v8::Object> obj, WebNode* webNode)
+{
+ return getNodeFromV8ObjectImpl(obj, webNode);
+}
+
bool WebBindings::getElement(NPObject* element, WebElement* webElement)
{
return getElementImpl(element, webElement, v8::Isolate::GetCurrent());
« no previous file with comments | « no previous file | public/web/WebBindings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698