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

Unified Diff: webkit/api/src/WebBindings.cpp

Issue 243032: First implementation of PlainTextController. (Closed)
Patch Set: '' Created 11 years, 1 month 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 | « webkit/api/public/WebRange.h ('k') | webkit/api/src/WebRange.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/api/src/WebBindings.cpp
===================================================================
--- webkit/api/src/WebBindings.cpp (revision 31188)
+++ webkit/api/src/WebBindings.cpp (working copy)
@@ -34,6 +34,7 @@
#include "npruntime_impl.h"
#include "npruntime_priv.h"
#include "webkit/api/public/WebDragData.h"
+#include "webkit/api/public/WebRange.h"
#if USE(V8)
#include "ChromiumDataObject.h"
@@ -41,6 +42,8 @@
#include "EventNames.h"
#include "MouseEvent.h"
#include "NPV8Object.h" // for PrivateIdentifier
+#include "Range.h"
+#include "V8DOMWrapper.h"
#include "V8Helpers.h"
#include "V8Proxy.h"
#elif USE(JSC)
@@ -273,6 +276,21 @@
return dataObject != NULL;
}
+static bool getRangeImpl(NPObject* npobj, WebRange* range)
+{
+ V8NPObject* v8npobject = reinterpret_cast<V8NPObject*>(npobj);
+ v8::Handle<v8::Object> v8object(v8npobject->v8Object);
+ if (V8ClassIndex::RANGE != V8DOMWrapper::domWrapperType(v8object))
+ return false;
+
+ Range* native = V8DOMWrapper::convertToNativeObject<WebCore::Range>(V8ClassIndex::RANGE, v8object);
+ if (!native)
+ return false;
+
+ *range = WebRange(native);
+ return true;
+}
+
#endif
bool WebBindings::getDragData(NPObject* event, int* eventId, WebDragData* data)
@@ -291,4 +309,14 @@
return getDragData(event, &eventId, NULL);
}
+bool WebBindings::getRange(NPObject* range, WebRange* webrange)
+{
+#if USE(V8)
+ return getRangeImpl(range, webrange);
+#else
+ // Not supported on other ports (JSC, etc).
+ return false;
+#endif
+}
+
} // namespace WebKit
« no previous file with comments | « webkit/api/public/WebRange.h ('k') | webkit/api/src/WebRange.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698