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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 void WebPluginContainerImpl::hide() | 192 void WebPluginContainerImpl::hide() |
193 { | 193 { |
194 setSelfVisible(false); | 194 setSelfVisible(false); |
195 m_webPlugin->updateVisibility(false); | 195 m_webPlugin->updateVisibility(false); |
196 | 196 |
197 Widget::hide(); | 197 Widget::hide(); |
198 } | 198 } |
199 | 199 |
200 void WebPluginContainerImpl::handleEvent(Event* event) | 200 void WebPluginContainerImpl::handleEvent(Event* event) |
201 { | 201 { |
202 RawPtr<WebPluginContainerImpl> protector(this); | |
203 // The events we pass are defined at: | 202 // The events we pass are defined at: |
204 // http://devedge-temp.mozilla.org/library/manuals/2002/plugin/1.0/struct
ures5.html#1000000 | 203 // http://devedge-temp.mozilla.org/library/manuals/2002/plugin/1.0/struct
ures5.html#1000000 |
205 // Don't take the documentation as truth, however. There are many cases | 204 // Don't take the documentation as truth, however. There are many cases |
206 // where mozilla behaves differently than the spec. | 205 // where mozilla behaves differently than the spec. |
207 if (event->isMouseEvent()) | 206 if (event->isMouseEvent()) |
208 handleMouseEvent(toMouseEvent(event)); | 207 handleMouseEvent(toMouseEvent(event)); |
209 else if (event->isWheelEvent()) | 208 else if (event->isWheelEvent()) |
210 handleWheelEvent(toWheelEvent(event)); | 209 handleWheelEvent(toWheelEvent(event)); |
211 else if (event->isKeyboardEvent()) | 210 else if (event->isKeyboardEvent()) |
212 handleKeyboardEvent(toKeyboardEvent(event)); | 211 handleKeyboardEvent(toKeyboardEvent(event)); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 return m_webPlugin->executeEditCommand(name, value); | 390 return m_webPlugin->executeEditCommand(name, value); |
392 } | 391 } |
393 | 392 |
394 WebElement WebPluginContainerImpl::element() | 393 WebElement WebPluginContainerImpl::element() |
395 { | 394 { |
396 return WebElement(m_element); | 395 return WebElement(m_element); |
397 } | 396 } |
398 | 397 |
399 void WebPluginContainerImpl::dispatchProgressEvent(const WebString& type, bool l
engthComputable, unsigned long long loaded, unsigned long long total, const WebS
tring& url) | 398 void WebPluginContainerImpl::dispatchProgressEvent(const WebString& type, bool l
engthComputable, unsigned long long loaded, unsigned long long total, const WebS
tring& url) |
400 { | 399 { |
401 RawPtr<ProgressEvent> event; | 400 ProgressEvent* event; |
402 if (url.isEmpty()) { | 401 if (url.isEmpty()) { |
403 event = ProgressEvent::create(type, lengthComputable, loaded, total); | 402 event = ProgressEvent::create(type, lengthComputable, loaded, total); |
404 } else { | 403 } else { |
405 event = ResourceProgressEvent::create(type, lengthComputable, loaded, to
tal, url); | 404 event = ResourceProgressEvent::create(type, lengthComputable, loaded, to
tal, url); |
406 } | 405 } |
407 m_element->dispatchEvent(event.release()); | 406 m_element->dispatchEvent(event); |
408 } | 407 } |
409 | 408 |
410 void WebPluginContainerImpl::invalidate() | 409 void WebPluginContainerImpl::invalidate() |
411 { | 410 { |
412 Widget::invalidate(); | 411 Widget::invalidate(); |
413 } | 412 } |
414 | 413 |
415 void WebPluginContainerImpl::invalidateRect(const WebRect& rect) | 414 void WebPluginContainerImpl::invalidateRect(const WebRect& rect) |
416 { | 415 { |
417 invalidateRect(static_cast<IntRect>(rect)); | 416 invalidateRect(static_cast<IntRect>(rect)); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 { | 609 { |
611 #if ENABLE(OILPAN) | 610 #if ENABLE(OILPAN) |
612 // With Oilpan, on plugin element detach dispose() will be called to safely | 611 // With Oilpan, on plugin element detach dispose() will be called to safely |
613 // clear out references, including the pre-emptive destruction of the plugin
. | 612 // clear out references, including the pre-emptive destruction of the plugin
. |
614 // | 613 // |
615 // It clearly has no scriptable object if in such a disposed state. | 614 // It clearly has no scriptable object if in such a disposed state. |
616 if (!m_webPlugin) | 615 if (!m_webPlugin) |
617 return v8::Local<v8::Object>(); | 616 return v8::Local<v8::Object>(); |
618 #endif | 617 #endif |
619 | 618 |
620 // The plugin may be destroyed due to re-entrancy when calling | |
621 // v8ScriptableObject below. crbug.com/458776. Hold a reference to the | |
622 // plugin container to prevent this from happening. For Oilpan, 'this' | |
623 // is already stack reachable, so redundant. | |
624 RawPtr<WebPluginContainerImpl> protector(this); | |
625 | |
626 v8::Local<v8::Object> object = m_webPlugin->v8ScriptableObject(isolate); | 619 v8::Local<v8::Object> object = m_webPlugin->v8ScriptableObject(isolate); |
627 | 620 |
628 // If the plugin has been destroyed and the reference on the stack is the | 621 // If the plugin has been destroyed and the reference on the stack is the |
629 // only one left, then don't return the scriptable object. | 622 // only one left, then don't return the scriptable object. |
630 #if ENABLE(OILPAN) | 623 #if ENABLE(OILPAN) |
631 if (!m_webPlugin) | 624 if (!m_webPlugin) |
632 #else | 625 #else |
633 if (hasOneRef()) | 626 if (hasOneRef()) |
634 #endif | 627 #endif |
635 return v8::Local<v8::Object>(); | 628 return v8::Local<v8::Object>(); |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 // frame view. | 939 // frame view. |
947 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec
t); | 940 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec
t); |
948 } | 941 } |
949 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); | 942 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); |
950 // Convert to the plugin position. | 943 // Convert to the plugin position. |
951 for (size_t i = 0; i < cutOutRects.size(); i++) | 944 for (size_t i = 0; i < cutOutRects.size(); i++) |
952 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); | 945 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); |
953 } | 946 } |
954 | 947 |
955 } // namespace blink | 948 } // namespace blink |
OLD | NEW |