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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 // We cannot compute geometry without a parent or layoutObject. | 436 // We cannot compute geometry without a parent or layoutObject. |
438 if (!parent() || !m_element || !m_element->layoutObject()) | 437 if (!parent() || !m_element || !m_element->layoutObject()) |
439 return; | 438 return; |
440 | 439 |
441 IntRect windowRect, clipRect, unobscuredRect; | 440 IntRect windowRect, clipRect, unobscuredRect; |
442 Vector<IntRect> cutOutRects; | 441 Vector<IntRect> cutOutRects; |
443 calculateGeometry(windowRect, clipRect, unobscuredRect, cutOutRects); | 442 calculateGeometry(windowRect, clipRect, unobscuredRect, cutOutRects); |
444 m_webPlugin->updateGeometry(windowRect, clipRect, unobscuredRect, cutOutRect
s, isVisible()); | 443 m_webPlugin->updateGeometry(windowRect, clipRect, unobscuredRect, cutOutRect
s, isVisible()); |
445 } | 444 } |
446 | 445 |
447 void WebPluginContainerImpl::allowScriptObjects() | |
448 { | |
449 } | |
450 | |
451 void WebPluginContainerImpl::clearScriptObjects() | |
452 { | |
453 if (!frame()) | |
454 return; | |
455 | |
456 frame()->script().cleanupScriptObjectsForPlugin(this); | |
457 } | |
458 | |
459 NPObject* WebPluginContainerImpl::scriptableObjectForElement() | |
460 { | |
461 return m_element->getNPObject(); | |
462 } | |
463 | |
464 v8::Local<v8::Object> WebPluginContainerImpl::v8ObjectForElement() | 446 v8::Local<v8::Object> WebPluginContainerImpl::v8ObjectForElement() |
465 { | 447 { |
466 LocalFrame* frame = m_element->document().frame(); | 448 LocalFrame* frame = m_element->document().frame(); |
467 if (!frame) | 449 if (!frame) |
468 return v8::Local<v8::Object>(); | 450 return v8::Local<v8::Object>(); |
469 | 451 |
470 if (!frame->script().canExecuteScripts(NotAboutToExecuteScript)) | 452 if (!frame->script().canExecuteScripts(NotAboutToExecuteScript)) |
471 return v8::Local<v8::Object>(); | 453 return v8::Local<v8::Object>(); |
472 | 454 |
473 ScriptState* scriptState = ScriptState::forMainWorld(frame); | 455 ScriptState* scriptState = ScriptState::forMainWorld(frame); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 | 630 |
649 // If the plugin has been destroyed and the reference on the stack is the | 631 // If the plugin has been destroyed and the reference on the stack is the |
650 // only one left, then don't return the scriptable object. | 632 // only one left, then don't return the scriptable object. |
651 #if ENABLE(OILPAN) | 633 #if ENABLE(OILPAN) |
652 if (!m_webPlugin) | 634 if (!m_webPlugin) |
653 #else | 635 #else |
654 if (hasOneRef()) | 636 if (hasOneRef()) |
655 #endif | 637 #endif |
656 return v8::Local<v8::Object>(); | 638 return v8::Local<v8::Object>(); |
657 | 639 |
658 if (!object.IsEmpty()) { | 640 return object; |
659 // WebPlugin implementation can't provide the obsolete NPObject at the s
ame time: | |
660 ASSERT(!m_webPlugin->scriptableObject()); | |
661 return object; | |
662 } | |
663 | |
664 NPObject* npObject = m_webPlugin->scriptableObject(); | |
665 if (npObject) | |
666 return createV8ObjectForNPObject(isolate, npObject, 0); | |
667 return v8::Local<v8::Object>(); | |
668 } | 641 } |
669 | 642 |
670 bool WebPluginContainerImpl::getFormValue(String& value) | 643 bool WebPluginContainerImpl::getFormValue(String& value) |
671 { | 644 { |
672 WebString webValue; | 645 WebString webValue; |
673 if (m_webPlugin->getFormValue(webValue)) { | 646 if (m_webPlugin->getFormValue(webValue)) { |
674 value = webValue; | 647 value = webValue; |
675 return true; | 648 return true; |
676 } | 649 } |
677 return false; | 650 return false; |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 // frame view. | 959 // frame view. |
987 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec
t); | 960 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec
t); |
988 } | 961 } |
989 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); | 962 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); |
990 // Convert to the plugin position. | 963 // Convert to the plugin position. |
991 for (size_t i = 0; i < cutOutRects.size(); i++) | 964 for (size_t i = 0; i < cutOutRects.size(); i++) |
992 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); | 965 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); |
993 } | 966 } |
994 | 967 |
995 } // namespace blink | 968 } // namespace blink |
OLD | NEW |