| 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 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 static_cast<WebDragOperationsMask>(dataTransfer->sourceOperation()); | 754 static_cast<WebDragOperationsMask>(dataTransfer->sourceOperation()); |
| 755 WebPoint dragScreenLocation(event->screenX(), event->screenY()); | 755 WebPoint dragScreenLocation(event->screenX(), event->screenY()); |
| 756 WebPoint dragLocation(event->absoluteLocation().x() - location().x(), | 756 WebPoint dragLocation(event->absoluteLocation().x() - location().x(), |
| 757 event->absoluteLocation().y() - location().y()); | 757 event->absoluteLocation().y() - location().y()); |
| 758 | 758 |
| 759 m_webPlugin->handleDragStatusUpdate(dragStatus, dragData, dragOperationMask, | 759 m_webPlugin->handleDragStatusUpdate(dragStatus, dragData, dragOperationMask, |
| 760 dragLocation, dragScreenLocation); | 760 dragLocation, dragScreenLocation); |
| 761 } | 761 } |
| 762 | 762 |
| 763 void WebPluginContainerImpl::handleWheelEvent(WheelEvent* event) { | 763 void WebPluginContainerImpl::handleWheelEvent(WheelEvent* event) { |
| 764 WebFloatPoint absoluteRootFrameLocation = | 764 WebFloatPoint absoluteLocation = event->nativeEvent().positionInRootFrame(); |
| 765 event->nativeEvent().positionInRootFrame(); | 765 FrameView* view = toFrameView(parent()); |
| 766 // Translate the root frame position to content coordinates. |
| 767 if (view) { |
| 768 absoluteLocation = view->rootFrameToContents(absoluteLocation); |
| 769 } |
| 770 |
| 766 IntPoint localPoint = | 771 IntPoint localPoint = |
| 767 roundedIntPoint(m_element->layoutObject()->absoluteToLocal( | 772 roundedIntPoint(m_element->layoutObject()->absoluteToLocal( |
| 768 absoluteRootFrameLocation, UseTransforms)); | 773 absoluteLocation, UseTransforms)); |
| 769 WebMouseWheelEvent translatedEvent = event->nativeEvent().flattenTransform(); | 774 WebMouseWheelEvent translatedEvent = event->nativeEvent().flattenTransform(); |
| 770 translatedEvent.x = localPoint.x(); | 775 translatedEvent.x = localPoint.x(); |
| 771 translatedEvent.y = localPoint.y(); | 776 translatedEvent.y = localPoint.y(); |
| 772 | 777 |
| 773 WebCursorInfo cursorInfo; | 778 WebCursorInfo cursorInfo; |
| 774 if (m_webPlugin->handleInputEvent(translatedEvent, cursorInfo) != | 779 if (m_webPlugin->handleInputEvent(translatedEvent, cursorInfo) != |
| 775 WebInputEventResult::NotHandled) | 780 WebInputEventResult::NotHandled) |
| 776 event->setDefaultHandled(); | 781 event->setDefaultHandled(); |
| 777 } | 782 } |
| 778 | 783 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 return; | 824 return; |
| 820 case TouchEventRequestTypeRaw: { | 825 case TouchEventRequestTypeRaw: { |
| 821 if (!event->nativeEvent()) | 826 if (!event->nativeEvent()) |
| 822 return; | 827 return; |
| 823 | 828 |
| 824 if (event->type() == EventTypeNames::touchstart) | 829 if (event->type() == EventTypeNames::touchstart) |
| 825 focusPlugin(); | 830 focusPlugin(); |
| 826 | 831 |
| 827 WebTouchEvent transformedEvent = event->nativeEvent()->flattenTransform(); | 832 WebTouchEvent transformedEvent = event->nativeEvent()->flattenTransform(); |
| 828 | 833 |
| 834 FrameView* view = toFrameView(parent()); |
| 835 |
| 829 for (unsigned i = 0; i < transformedEvent.touchesLength; ++i) { | 836 for (unsigned i = 0; i < transformedEvent.touchesLength; ++i) { |
| 830 WebFloatPoint absoluteRootFrameLocation = | 837 WebFloatPoint absoluteLocation = transformedEvent.touches[i].position; |
| 831 transformedEvent.touches[i].position; | 838 // Translate the root frame position to content coordinates. |
| 839 if (view) { |
| 840 absoluteLocation = view->rootFrameToContents(absoluteLocation); |
| 841 } |
| 832 IntPoint localPoint = | 842 IntPoint localPoint = |
| 833 roundedIntPoint(m_element->layoutObject()->absoluteToLocal( | 843 roundedIntPoint(m_element->layoutObject()->absoluteToLocal( |
| 834 absoluteRootFrameLocation, UseTransforms)); | 844 absoluteLocation, UseTransforms)); |
| 835 transformedEvent.touches[i].position.x = localPoint.x(); | 845 transformedEvent.touches[i].position.x = localPoint.x(); |
| 836 transformedEvent.touches[i].position.y = localPoint.y(); | 846 transformedEvent.touches[i].position.y = localPoint.y(); |
| 837 } | 847 } |
| 838 | 848 |
| 839 WebCursorInfo cursorInfo; | 849 WebCursorInfo cursorInfo; |
| 840 if (m_webPlugin->handleInputEvent(transformedEvent, cursorInfo) != | 850 if (m_webPlugin->handleInputEvent(transformedEvent, cursorInfo) != |
| 841 WebInputEventResult::NotHandled) | 851 WebInputEventResult::NotHandled) |
| 842 event->setDefaultHandled(); | 852 event->setDefaultHandled(); |
| 843 // FIXME: Can a plugin change the cursor from a touch-event callback? | 853 // FIXME: Can a plugin change the cursor from a touch-event callback? |
| 844 return; | 854 return; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 // frame view. | 996 // frame view. |
| 987 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRect); | 997 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRect); |
| 988 } | 998 } |
| 989 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); | 999 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); |
| 990 // Convert to the plugin position. | 1000 // Convert to the plugin position. |
| 991 for (size_t i = 0; i < cutOutRects.size(); i++) | 1001 for (size_t i = 0; i < cutOutRects.size(); i++) |
| 992 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); | 1002 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); |
| 993 } | 1003 } |
| 994 | 1004 |
| 995 } // namespace blink | 1005 } // namespace blink |
| OLD | NEW |