| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. | 3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 */ | 30 */ |
| 31 | 31 |
| 32 #include "web/WebPluginContainerImpl.h" | 32 #include "web/WebPluginContainerImpl.h" |
| 33 | 33 |
| 34 #include "bindings/core/v8/ScriptController.h" | 34 #include "bindings/core/v8/ScriptController.h" |
| 35 #include "bindings/core/v8/ScriptSourceCode.h" | 35 #include "bindings/core/v8/ScriptSourceCode.h" |
| 36 #include "bindings/core/v8/V8Element.h" | 36 #include "bindings/core/v8/V8Element.h" |
| 37 #include "bindings/core/v8/V8NPObject.h" | |
| 38 #include "core/HTMLNames.h" | 37 #include "core/HTMLNames.h" |
| 39 #include "core/clipboard/DataObject.h" | 38 #include "core/clipboard/DataObject.h" |
| 40 #include "core/clipboard/DataTransfer.h" | 39 #include "core/clipboard/DataTransfer.h" |
| 41 #include "core/events/DragEvent.h" | 40 #include "core/events/DragEvent.h" |
| 42 #include "core/events/GestureEvent.h" | 41 #include "core/events/GestureEvent.h" |
| 43 #include "core/events/KeyboardEvent.h" | 42 #include "core/events/KeyboardEvent.h" |
| 44 #include "core/events/MouseEvent.h" | 43 #include "core/events/MouseEvent.h" |
| 45 #include "core/events/ProgressEvent.h" | 44 #include "core/events/ProgressEvent.h" |
| 46 #include "core/events/ResourceProgressEvent.h" | 45 #include "core/events/ResourceProgressEvent.h" |
| 47 #include "core/events/TouchEvent.h" | 46 #include "core/events/TouchEvent.h" |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 // We cannot compute geometry without a parent or layoutObject. | 421 // We cannot compute geometry without a parent or layoutObject. |
| 423 if (!parent() || !m_element || !m_element->layoutObject()) | 422 if (!parent() || !m_element || !m_element->layoutObject()) |
| 424 return; | 423 return; |
| 425 | 424 |
| 426 IntRect windowRect, clipRect, unobscuredRect; | 425 IntRect windowRect, clipRect, unobscuredRect; |
| 427 Vector<IntRect> cutOutRects; | 426 Vector<IntRect> cutOutRects; |
| 428 calculateGeometry(windowRect, clipRect, unobscuredRect, cutOutRects); | 427 calculateGeometry(windowRect, clipRect, unobscuredRect, cutOutRects); |
| 429 m_webPlugin->updateGeometry(windowRect, clipRect, unobscuredRect, cutOutRect
s, isVisible()); | 428 m_webPlugin->updateGeometry(windowRect, clipRect, unobscuredRect, cutOutRect
s, isVisible()); |
| 430 } | 429 } |
| 431 | 430 |
| 432 void WebPluginContainerImpl::allowScriptObjects() | |
| 433 { | |
| 434 } | |
| 435 | |
| 436 void WebPluginContainerImpl::clearScriptObjects() | |
| 437 { | |
| 438 if (!frame()) | |
| 439 return; | |
| 440 | |
| 441 frame()->script().cleanupScriptObjectsForPlugin(this); | |
| 442 } | |
| 443 | |
| 444 NPObject* WebPluginContainerImpl::scriptableObjectForElement() | |
| 445 { | |
| 446 return m_element->getNPObject(); | |
| 447 } | |
| 448 | |
| 449 v8::Local<v8::Object> WebPluginContainerImpl::v8ObjectForElement() | 431 v8::Local<v8::Object> WebPluginContainerImpl::v8ObjectForElement() |
| 450 { | 432 { |
| 451 LocalFrame* frame = m_element->document().frame(); | 433 LocalFrame* frame = m_element->document().frame(); |
| 452 if (!frame) | 434 if (!frame) |
| 453 return v8::Local<v8::Object>(); | 435 return v8::Local<v8::Object>(); |
| 454 | 436 |
| 455 if (!frame->script().canExecuteScripts(NotAboutToExecuteScript)) | 437 if (!frame->script().canExecuteScripts(NotAboutToExecuteScript)) |
| 456 return v8::Local<v8::Object>(); | 438 return v8::Local<v8::Object>(); |
| 457 | 439 |
| 458 ScriptState* scriptState = ScriptState::forMainWorld(frame); | 440 ScriptState* scriptState = ScriptState::forMainWorld(frame); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 | 607 |
| 626 // If the plugin has been destroyed and the reference on the stack is the | 608 // If the plugin has been destroyed and the reference on the stack is the |
| 627 // only one left, then don't return the scriptable object. | 609 // only one left, then don't return the scriptable object. |
| 628 #if ENABLE(OILPAN) | 610 #if ENABLE(OILPAN) |
| 629 if (!m_webPlugin) | 611 if (!m_webPlugin) |
| 630 #else | 612 #else |
| 631 if (hasOneRef()) | 613 if (hasOneRef()) |
| 632 #endif | 614 #endif |
| 633 return v8::Local<v8::Object>(); | 615 return v8::Local<v8::Object>(); |
| 634 | 616 |
| 635 if (!object.IsEmpty()) { | 617 return object; |
| 636 // WebPlugin implementation can't provide the obsolete NPObject at the s
ame time: | |
| 637 ASSERT(!m_webPlugin->scriptableObject()); | |
| 638 return object; | |
| 639 } | |
| 640 | |
| 641 NPObject* npObject = m_webPlugin->scriptableObject(); | |
| 642 if (npObject) | |
| 643 return createV8ObjectForNPObject(isolate, npObject, 0); | |
| 644 return v8::Local<v8::Object>(); | |
| 645 } | 618 } |
| 646 | 619 |
| 647 bool WebPluginContainerImpl::getFormValue(String& value) | 620 bool WebPluginContainerImpl::getFormValue(String& value) |
| 648 { | 621 { |
| 649 WebString webValue; | 622 WebString webValue; |
| 650 if (m_webPlugin->getFormValue(webValue)) { | 623 if (m_webPlugin->getFormValue(webValue)) { |
| 651 value = webValue; | 624 value = webValue; |
| 652 return true; | 625 return true; |
| 653 } | 626 } |
| 654 return false; | 627 return false; |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 // frame view. | 932 // frame view. |
| 960 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec
t); | 933 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec
t); |
| 961 } | 934 } |
| 962 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); | 935 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); |
| 963 // Convert to the plugin position. | 936 // Convert to the plugin position. |
| 964 for (size_t i = 0; i < cutOutRects.size(); i++) | 937 for (size_t i = 0; i < cutOutRects.size(); i++) |
| 965 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); | 938 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); |
| 966 } | 939 } |
| 967 | 940 |
| 968 } // namespace blinkf | 941 } // namespace blinkf |
| OLD | NEW |