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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
260 | 260 |
261 Widget::setParent(widget); | 261 Widget::setParent(widget); |
262 if (widget) | 262 if (widget) |
263 reportGeometry(); | 263 reportGeometry(); |
264 else if (m_webPlugin) | 264 else if (m_webPlugin) |
265 m_webPlugin->containerDidDetachFromParent(); | 265 m_webPlugin->containerDidDetachFromParent(); |
266 } | 266 } |
267 | 267 |
268 void WebPluginContainerImpl::setPlugin(WebPlugin* plugin) | 268 void WebPluginContainerImpl::setPlugin(WebPlugin* plugin) |
269 { | 269 { |
270 RELEASE_ASSERT(!m_inDispose); | 270 if (plugin == m_webPlugin) |
271 if (plugin != m_webPlugin) { | 271 return; |
272 m_element->resetInstance(); | 272 |
273 m_webPlugin = plugin; | 273 m_element->resetInstance(); |
274 } | 274 m_webPlugin = plugin; |
275 m_inDispose = false; | |
275 } | 276 } |
276 | 277 |
277 float WebPluginContainerImpl::deviceScaleFactor() | 278 float WebPluginContainerImpl::deviceScaleFactor() |
278 { | 279 { |
279 Page* page = m_element->document().page(); | 280 Page* page = m_element->document().page(); |
280 if (!page) | 281 if (!page) |
281 return 1.0; | 282 return 1.0; |
282 return page->deviceScaleFactor(); | 283 return page->deviceScaleFactor(); |
283 } | 284 } |
284 | 285 |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
523 LayoutSize padding((documentRect.width() - 1) / 2, (documentRect.height() - 1) / 2); | 524 LayoutSize padding((documentRect.width() - 1) / 2, (documentRect.height() - 1) / 2); |
524 HitTestResult result = frame->eventHandler().hitTestResultAtPoint(center, Hi tTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ListBased, pad ding); | 525 HitTestResult result = frame->eventHandler().hitTestResultAtPoint(center, Hi tTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::ListBased, pad ding); |
525 const HitTestResult::NodeSet& nodes = result.listBasedTestResult(); | 526 const HitTestResult::NodeSet& nodes = result.listBasedTestResult(); |
526 if (nodes.size() != 1) | 527 if (nodes.size() != 1) |
527 return false; | 528 return false; |
528 return nodes.first().get() == m_element; | 529 return nodes.first().get() == m_element; |
529 } | 530 } |
530 | 531 |
531 void WebPluginContainerImpl::requestTouchEventType(TouchEventRequestType request Type) | 532 void WebPluginContainerImpl::requestTouchEventType(TouchEventRequestType request Type) |
532 { | 533 { |
533 if (m_touchEventRequestType == requestType) | 534 if (m_touchEventRequestType == requestType || !m_element) |
534 return; | 535 return; |
535 | 536 |
536 if (m_element->document().frameHost()) { | 537 if (m_element->document().frameHost()) { |
537 EventHandlerRegistry& registry = m_element->document().frameHost()->even tHandlerRegistry(); | 538 EventHandlerRegistry& registry = m_element->document().frameHost()->even tHandlerRegistry(); |
538 if (requestType != TouchEventRequestTypeNone && m_touchEventRequestType == TouchEventRequestTypeNone) | 539 if (requestType != TouchEventRequestTypeNone && m_touchEventRequestType == TouchEventRequestTypeNone) |
539 registry.didAddEventHandler(*m_element, EventHandlerRegistry::TouchE vent); | 540 registry.didAddEventHandler(*m_element, EventHandlerRegistry::TouchE vent); |
540 else if (requestType == TouchEventRequestTypeNone && m_touchEventRequest Type != TouchEventRequestTypeNone) | 541 else if (requestType == TouchEventRequestTypeNone && m_touchEventRequest Type != TouchEventRequestTypeNone) |
541 registry.didRemoveEventHandler(*m_element, EventHandlerRegistry::Tou chEvent); | 542 registry.didRemoveEventHandler(*m_element, EventHandlerRegistry::Tou chEvent); |
542 } | 543 } |
543 m_touchEventRequestType = requestType; | 544 m_touchEventRequestType = requestType; |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
695 #if ENABLE(OILPAN) | 696 #if ENABLE(OILPAN) |
696 // The plugin container must have been disposed of by now. | 697 // The plugin container must have been disposed of by now. |
697 ASSERT(!m_webPlugin); | 698 ASSERT(!m_webPlugin); |
698 #else | 699 #else |
699 dispose(); | 700 dispose(); |
700 #endif | 701 #endif |
701 } | 702 } |
702 | 703 |
703 void WebPluginContainerImpl::dispose() | 704 void WebPluginContainerImpl::dispose() |
704 { | 705 { |
705 m_inDispose = true; | 706 m_inDispose = true; |
haraken
2016/02/02 01:33:51
I'd rename m_inDispose to m_isDisposed.
sof
2016/02/02 06:34:01
Done.
| |
706 | 707 |
707 if (m_element && m_touchEventRequestType != TouchEventRequestTypeNone && m_e lement->document().frameHost()) | 708 requestTouchEventType(TouchEventRequestTypeNone); |
708 m_element->document().frameHost()->eventHandlerRegistry().didRemoveEvent Handler(*m_element, EventHandlerRegistry::TouchEvent); | |
709 | 709 |
710 if (m_webPlugin) { | 710 if (m_webPlugin) { |
711 RELEASE_ASSERT(!m_webPlugin->container() || m_webPlugin->container() == this); | 711 RELEASE_ASSERT(!m_webPlugin->container() || m_webPlugin->container() == this); |
712 m_webPlugin->destroy(); | 712 m_webPlugin->destroy(); |
713 m_webPlugin = nullptr; | 713 m_webPlugin = nullptr; |
714 } | 714 } |
715 | 715 |
716 if (m_webLayer) { | 716 if (m_webLayer) { |
717 GraphicsLayer::unregisterContentsLayer(m_webLayer); | 717 GraphicsLayer::unregisterContentsLayer(m_webLayer); |
718 m_webLayer = nullptr; | 718 m_webLayer = nullptr; |
719 } | 719 } |
720 | |
721 m_element = nullptr; | |
722 } | 720 } |
723 | 721 |
724 DEFINE_TRACE(WebPluginContainerImpl) | 722 DEFINE_TRACE(WebPluginContainerImpl) |
725 { | 723 { |
726 visitor->trace(m_element); | 724 visitor->trace(m_element); |
727 LocalFrameLifecycleObserver::trace(visitor); | 725 LocalFrameLifecycleObserver::trace(visitor); |
728 PluginView::trace(visitor); | 726 PluginView::trace(visitor); |
729 } | 727 } |
730 | 728 |
731 void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event) | 729 void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event) |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
959 // frame view. | 957 // frame view. |
960 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec t); | 958 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec t); |
961 } | 959 } |
962 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); | 960 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); |
963 // Convert to the plugin position. | 961 // Convert to the plugin position. |
964 for (size_t i = 0; i < cutOutRects.size(); i++) | 962 for (size_t i = 0; i < cutOutRects.size(); i++) |
965 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); | 963 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); |
966 } | 964 } |
967 | 965 |
968 } // namespace blink | 966 } // namespace blink |
OLD | NEW |