| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "WebBindings.h" | 32 #include "WebBindings.h" |
| 33 | 33 |
| 34 #include "npruntime_impl.h" | 34 #include "npruntime_impl.h" |
| 35 #include "npruntime_priv.h" | 35 #include "npruntime_priv.h" |
| 36 #include "webkit/api/public/WebDragData.h" | 36 #include "webkit/api/public/WebDragData.h" |
| 37 #include "webkit/api/public/WebRange.h" |
| 37 | 38 |
| 38 #if USE(V8) | 39 #if USE(V8) |
| 39 #include "ChromiumDataObject.h" | 40 #include "ChromiumDataObject.h" |
| 40 #include "ClipboardChromium.h" | 41 #include "ClipboardChromium.h" |
| 41 #include "EventNames.h" | 42 #include "EventNames.h" |
| 42 #include "MouseEvent.h" | 43 #include "MouseEvent.h" |
| 43 #include "NPV8Object.h" // for PrivateIdentifier | 44 #include "NPV8Object.h" // for PrivateIdentifier |
| 45 #include "Range.h" |
| 46 #include "V8DOMWrapper.h" |
| 44 #include "V8Helpers.h" | 47 #include "V8Helpers.h" |
| 45 #include "V8Proxy.h" | 48 #include "V8Proxy.h" |
| 46 #elif USE(JSC) | 49 #elif USE(JSC) |
| 47 #include "bridge/c/c_utility.h" | 50 #include "bridge/c/c_utility.h" |
| 48 #endif | 51 #endif |
| 49 | 52 |
| 50 #if USE(JAVASCRIPTCORE_BINDINGS) | 53 #if USE(JAVASCRIPTCORE_BINDINGS) |
| 51 using JSC::Bindings::PrivateIdentifier; | 54 using JSC::Bindings::PrivateIdentifier; |
| 52 #endif | 55 #endif |
| 53 | 56 |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 if (accessible.isEmpty()) | 269 if (accessible.isEmpty()) |
| 267 return false; | 270 return false; |
| 268 | 271 |
| 269 RefPtr<ChromiumDataObject> dataObject(chrome->dataObject()); | 272 RefPtr<ChromiumDataObject> dataObject(chrome->dataObject()); |
| 270 if (dataObject && data) | 273 if (dataObject && data) |
| 271 *data = WebDragData(dataObject); | 274 *data = WebDragData(dataObject); |
| 272 | 275 |
| 273 return dataObject != NULL; | 276 return dataObject != NULL; |
| 274 } | 277 } |
| 275 | 278 |
| 279 static bool getRangeImpl(NPObject* npobj, WebRange* range) |
| 280 { |
| 281 V8NPObject* v8npobject = reinterpret_cast<V8NPObject*>(npobj); |
| 282 v8::Handle<v8::Object> v8object(v8npobject->v8Object); |
| 283 if (V8ClassIndex::RANGE != V8DOMWrapper::domWrapperType(v8object)) |
| 284 return false; |
| 285 |
| 286 Range* native = V8DOMWrapper::convertToNativeObject<WebCore::Range>(V8ClassIndex::RANGE, v8object); |
| 287 if (!native) |
| 288 return false; |
| 289 |
| 290 *range = WebRange(native); |
| 291 return true; |
| 292 } |
| 293 |
| 276 #endif | 294 #endif |
| 277 | 295 |
| 278 bool WebBindings::getDragData(NPObject* event, int* eventId, WebDragData* data) | 296 bool WebBindings::getDragData(NPObject* event, int* eventId, WebDragData* data) |
| 279 { | 297 { |
| 280 #if USE(V8) | 298 #if USE(V8) |
| 281 return getDragDataImpl(event, eventId, data); | 299 return getDragDataImpl(event, eventId, data); |
| 282 #else | 300 #else |
| 283 // Not supported on other ports (JSC, etc). | 301 // Not supported on other ports (JSC, etc). |
| 284 return false; | 302 return false; |
| 285 #endif | 303 #endif |
| 286 } | 304 } |
| 287 | 305 |
| 288 bool WebBindings::isDragEvent(NPObject* event) | 306 bool WebBindings::isDragEvent(NPObject* event) |
| 289 { | 307 { |
| 290 int eventId; | 308 int eventId; |
| 291 return getDragData(event, &eventId, NULL); | 309 return getDragData(event, &eventId, NULL); |
| 292 } | 310 } |
| 293 | 311 |
| 312 bool WebBindings::getRange(NPObject* range, WebRange* webrange) |
| 313 { |
| 314 #if USE(V8) |
| 315 return getRangeImpl(range, webrange); |
| 316 #else |
| 317 // Not supported on other ports (JSC, etc). |
| 318 return false; |
| 319 #endif |
| 320 } |
| 321 |
| 294 } // namespace WebKit | 322 } // namespace WebKit |
| OLD | NEW |