| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 #include "web/WebInputEventConversion.h" | 105 #include "web/WebInputEventConversion.h" |
| 106 #include "web/WebLocalFrameImpl.h" | 106 #include "web/WebLocalFrameImpl.h" |
| 107 #include "web/WebViewImpl.h" | 107 #include "web/WebViewImpl.h" |
| 108 #include "wtf/Assertions.h" | 108 #include "wtf/Assertions.h" |
| 109 | 109 |
| 110 namespace blink { | 110 namespace blink { |
| 111 | 111 |
| 112 // Public methods -------------------------------------------------------------- | 112 // Public methods -------------------------------------------------------------- |
| 113 | 113 |
| 114 void WebPluginContainerImpl::setFrameRect(const IntRect& frameRect) { | 114 void WebPluginContainerImpl::setFrameRect(const IntRect& frameRect) { |
| 115 Widget::setFrameRect(frameRect); | 115 FrameViewBase::setFrameRect(frameRect); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void WebPluginContainerImpl::updateAllLifecyclePhases() { | 118 void WebPluginContainerImpl::updateAllLifecyclePhases() { |
| 119 if (!m_webPlugin) | 119 if (!m_webPlugin) |
| 120 return; | 120 return; |
| 121 | 121 |
| 122 m_webPlugin->updateAllLifecyclePhases(); | 122 m_webPlugin->updateAllLifecyclePhases(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void WebPluginContainerImpl::paint(GraphicsContext& context, | 125 void WebPluginContainerImpl::paint(GraphicsContext& context, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 dirtyRect.move( | 178 dirtyRect.move( |
| 179 (layoutObject->borderLeft() + layoutObject->paddingLeft()).toInt(), | 179 (layoutObject->borderLeft() + layoutObject->paddingLeft()).toInt(), |
| 180 (layoutObject->borderTop() + layoutObject->paddingTop()).toInt()); | 180 (layoutObject->borderTop() + layoutObject->paddingTop()).toInt()); |
| 181 | 181 |
| 182 m_pendingInvalidationRect.unite(dirtyRect); | 182 m_pendingInvalidationRect.unite(dirtyRect); |
| 183 | 183 |
| 184 layoutObject->setMayNeedPaintInvalidation(); | 184 layoutObject->setMayNeedPaintInvalidation(); |
| 185 } | 185 } |
| 186 | 186 |
| 187 void WebPluginContainerImpl::setFocused(bool focused, WebFocusType focusType) { | 187 void WebPluginContainerImpl::setFocused(bool focused, WebFocusType focusType) { |
| 188 Widget::setFocused(focused, focusType); | 188 FrameViewBase::setFocused(focused, focusType); |
| 189 m_webPlugin->updateFocus(focused, focusType); | 189 m_webPlugin->updateFocus(focused, focusType); |
| 190 } | 190 } |
| 191 | 191 |
| 192 void WebPluginContainerImpl::show() { | 192 void WebPluginContainerImpl::show() { |
| 193 setSelfVisible(true); | 193 setSelfVisible(true); |
| 194 m_webPlugin->updateVisibility(true); | 194 m_webPlugin->updateVisibility(true); |
| 195 | 195 |
| 196 Widget::show(); | 196 FrameViewBase::show(); |
| 197 } | 197 } |
| 198 | 198 |
| 199 void WebPluginContainerImpl::hide() { | 199 void WebPluginContainerImpl::hide() { |
| 200 setSelfVisible(false); | 200 setSelfVisible(false); |
| 201 m_webPlugin->updateVisibility(false); | 201 m_webPlugin->updateVisibility(false); |
| 202 | 202 |
| 203 Widget::hide(); | 203 FrameViewBase::hide(); |
| 204 } | 204 } |
| 205 | 205 |
| 206 void WebPluginContainerImpl::handleEvent(Event* event) { | 206 void WebPluginContainerImpl::handleEvent(Event* event) { |
| 207 // The events we pass are defined at: | 207 // The events we pass are defined at: |
| 208 // http://devedge-temp.mozilla.org/library/manuals/2002/plugin/1.0/structur
es5.html#1000000 | 208 // http://devedge-temp.mozilla.org/library/manuals/2002/plugin/1.0/structur
es5.html#1000000 |
| 209 // Don't take the documentation as truth, however. There are many cases | 209 // Don't take the documentation as truth, however. There are many cases |
| 210 // where mozilla behaves differently than the spec. | 210 // where mozilla behaves differently than the spec. |
| 211 if (event->isMouseEvent()) | 211 if (event->isMouseEvent()) |
| 212 handleMouseEvent(toMouseEvent(event)); | 212 handleMouseEvent(toMouseEvent(event)); |
| 213 else if (event->isWheelEvent()) | 213 else if (event->isWheelEvent()) |
| 214 handleWheelEvent(toWheelEvent(event)); | 214 handleWheelEvent(toWheelEvent(event)); |
| 215 else if (event->isKeyboardEvent()) | 215 else if (event->isKeyboardEvent()) |
| 216 handleKeyboardEvent(toKeyboardEvent(event)); | 216 handleKeyboardEvent(toKeyboardEvent(event)); |
| 217 else if (event->isTouchEvent()) | 217 else if (event->isTouchEvent()) |
| 218 handleTouchEvent(toTouchEvent(event)); | 218 handleTouchEvent(toTouchEvent(event)); |
| 219 else if (event->isGestureEvent()) | 219 else if (event->isGestureEvent()) |
| 220 handleGestureEvent(toGestureEvent(event)); | 220 handleGestureEvent(toGestureEvent(event)); |
| 221 else if (event->isDragEvent() && m_webPlugin->canProcessDrag()) | 221 else if (event->isDragEvent() && m_webPlugin->canProcessDrag()) |
| 222 handleDragEvent(toDragEvent(event)); | 222 handleDragEvent(toDragEvent(event)); |
| 223 | 223 |
| 224 // FIXME: it would be cleaner if Widget::handleEvent returned true/false and | 224 // FIXME: it would be cleaner if FrameViewBase::handleEvent returned |
| 225 // HTMLPluginElement called setDefaultHandled or defaultEventHandler. | 225 // true/false and HTMLPluginElement called setDefaultHandled or |
| 226 // defaultEventHandler. |
| 226 if (!event->defaultHandled()) | 227 if (!event->defaultHandled()) |
| 227 m_element->Node::defaultEventHandler(event); | 228 m_element->Node::defaultEventHandler(event); |
| 228 } | 229 } |
| 229 | 230 |
| 230 void WebPluginContainerImpl::frameRectsChanged() { | 231 void WebPluginContainerImpl::frameRectsChanged() { |
| 231 Widget::frameRectsChanged(); | 232 FrameViewBase::frameRectsChanged(); |
| 232 reportGeometry(); | 233 reportGeometry(); |
| 233 } | 234 } |
| 234 | 235 |
| 235 void WebPluginContainerImpl::widgetGeometryMayHaveChanged() { | 236 void WebPluginContainerImpl::widgetGeometryMayHaveChanged() { |
| 236 Widget::widgetGeometryMayHaveChanged(); | 237 FrameViewBase::widgetGeometryMayHaveChanged(); |
| 237 reportGeometry(); | 238 reportGeometry(); |
| 238 } | 239 } |
| 239 | 240 |
| 240 void WebPluginContainerImpl::eventListenersRemoved() { | 241 void WebPluginContainerImpl::eventListenersRemoved() { |
| 241 // We're no longer registered to receive touch events, so don't try to remove | 242 // We're no longer registered to receive touch events, so don't try to remove |
| 242 // the touch event handlers in our destructor. | 243 // the touch event handlers in our destructor. |
| 243 m_touchEventRequestType = TouchEventRequestTypeNone; | 244 m_touchEventRequestType = TouchEventRequestTypeNone; |
| 244 } | 245 } |
| 245 | 246 |
| 246 void WebPluginContainerImpl::setParentVisible(bool parentVisible) { | 247 void WebPluginContainerImpl::setParentVisible(bool parentVisible) { |
| 247 // We override this function to make sure that geometry updates are sent | 248 // We override this function to make sure that geometry updates are sent |
| 248 // over to the plugin. For e.g. when a plugin is instantiated it does not | 249 // over to the plugin. For e.g. when a plugin is instantiated it does not |
| 249 // have a valid parent. As a result the first geometry update from webkit | 250 // have a valid parent. As a result the first geometry update from webkit |
| 250 // is ignored. This function is called when the plugin eventually gets a | 251 // is ignored. This function is called when the plugin eventually gets a |
| 251 // parent. | 252 // parent. |
| 252 | 253 |
| 253 if (isParentVisible() == parentVisible) | 254 if (isParentVisible() == parentVisible) |
| 254 return; // No change. | 255 return; // No change. |
| 255 | 256 |
| 256 Widget::setParentVisible(parentVisible); | 257 FrameViewBase::setParentVisible(parentVisible); |
| 257 if (!isSelfVisible()) | 258 if (!isSelfVisible()) |
| 258 return; // This widget has explicitely been marked as not visible. | 259 return; // This widget has explicitely been marked as not visible. |
| 259 | 260 |
| 260 if (m_webPlugin) | 261 if (m_webPlugin) |
| 261 m_webPlugin->updateVisibility(isVisible()); | 262 m_webPlugin->updateVisibility(isVisible()); |
| 262 } | 263 } |
| 263 | 264 |
| 264 void WebPluginContainerImpl::setPlugin(WebPlugin* plugin) { | 265 void WebPluginContainerImpl::setPlugin(WebPlugin* plugin) { |
| 265 if (plugin == m_webPlugin) | 266 if (plugin == m_webPlugin) |
| 266 return; | 267 return; |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 m_element->dispatchEvent(event); | 405 m_element->dispatchEvent(event); |
| 405 } | 406 } |
| 406 | 407 |
| 407 void WebPluginContainerImpl::enqueueMessageEvent( | 408 void WebPluginContainerImpl::enqueueMessageEvent( |
| 408 const WebDOMMessageEvent& event) { | 409 const WebDOMMessageEvent& event) { |
| 409 static_cast<Event*>(event)->setTarget(m_element); | 410 static_cast<Event*>(event)->setTarget(m_element); |
| 410 m_element->getExecutionContext()->getEventQueue()->enqueueEvent(event); | 411 m_element->getExecutionContext()->getEventQueue()->enqueueEvent(event); |
| 411 } | 412 } |
| 412 | 413 |
| 413 void WebPluginContainerImpl::invalidate() { | 414 void WebPluginContainerImpl::invalidate() { |
| 414 Widget::invalidate(); | 415 FrameViewBase::invalidate(); |
| 415 } | 416 } |
| 416 | 417 |
| 417 void WebPluginContainerImpl::invalidateRect(const WebRect& rect) { | 418 void WebPluginContainerImpl::invalidateRect(const WebRect& rect) { |
| 418 invalidateRect(static_cast<IntRect>(rect)); | 419 invalidateRect(static_cast<IntRect>(rect)); |
| 419 } | 420 } |
| 420 | 421 |
| 421 void WebPluginContainerImpl::scrollRect(const WebRect& rect) { | 422 void WebPluginContainerImpl::scrollRect(const WebRect& rect) { |
| 422 invalidateRect(rect); | 423 invalidateRect(rect); |
| 423 } | 424 } |
| 424 | 425 |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 985 // frame view. | 986 // frame view. |
| 986 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRect); | 987 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRect); |
| 987 } | 988 } |
| 988 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); | 989 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); |
| 989 // Convert to the plugin position. | 990 // Convert to the plugin position. |
| 990 for (size_t i = 0; i < cutOutRects.size(); i++) | 991 for (size_t i = 0; i < cutOutRects.size(); i++) |
| 991 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); | 992 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); |
| 992 } | 993 } |
| 993 | 994 |
| 994 } // namespace blink | 995 } // namespace blink |
| OLD | NEW |