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 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != | 808 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != |
809 WebInputEventResult::NotHandled) | 809 WebInputEventResult::NotHandled) |
810 event->setDefaultHandled(); | 810 event->setDefaultHandled(); |
811 } | 811 } |
812 | 812 |
813 void WebPluginContainerImpl::handleTouchEvent(TouchEvent* event) { | 813 void WebPluginContainerImpl::handleTouchEvent(TouchEvent* event) { |
814 switch (m_touchEventRequestType) { | 814 switch (m_touchEventRequestType) { |
815 case TouchEventRequestTypeNone: | 815 case TouchEventRequestTypeNone: |
816 return; | 816 return; |
817 case TouchEventRequestTypeRaw: { | 817 case TouchEventRequestTypeRaw: { |
818 WebTouchEventBuilder webEvent(LayoutItem(m_element->layoutObject()), | 818 if (!event->nativeEvent()) |
819 *event); | |
820 if (webEvent.type() == WebInputEvent::Undefined) | |
821 return; | 819 return; |
822 | 820 |
823 if (event->type() == EventTypeNames::touchstart) | 821 if (event->type() == EventTypeNames::touchstart) |
824 focusPlugin(); | 822 focusPlugin(); |
825 | 823 |
| 824 WebTouchEvent transformedEvent = event->nativeEvent()->flattenTransform(); |
| 825 |
| 826 for (unsigned i = 0; i < transformedEvent.touchesLength; ++i) { |
| 827 WebFloatPoint absoluteRootFrameLocation = |
| 828 transformedEvent.touches[i].position; |
| 829 IntPoint localPoint = |
| 830 roundedIntPoint(m_element->layoutObject()->absoluteToLocal( |
| 831 absoluteRootFrameLocation, UseTransforms)); |
| 832 transformedEvent.touches[i].position.x = localPoint.x(); |
| 833 transformedEvent.touches[i].position.y = localPoint.y(); |
| 834 } |
| 835 |
826 WebCursorInfo cursorInfo; | 836 WebCursorInfo cursorInfo; |
827 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo) != | 837 if (m_webPlugin->handleInputEvent(transformedEvent, cursorInfo) != |
828 WebInputEventResult::NotHandled) | 838 WebInputEventResult::NotHandled) |
829 event->setDefaultHandled(); | 839 event->setDefaultHandled(); |
830 // FIXME: Can a plugin change the cursor from a touch-event callback? | 840 // FIXME: Can a plugin change the cursor from a touch-event callback? |
831 return; | 841 return; |
832 } | 842 } |
833 case TouchEventRequestTypeSynthesizedMouse: | 843 case TouchEventRequestTypeSynthesizedMouse: |
834 synthesizeMouseEventIfPossible(event); | 844 synthesizeMouseEventIfPossible(event); |
835 return; | 845 return; |
836 } | 846 } |
837 } | 847 } |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 // frame view. | 983 // frame view. |
974 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRect); | 984 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRect); |
975 } | 985 } |
976 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); | 986 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); |
977 // Convert to the plugin position. | 987 // Convert to the plugin position. |
978 for (size_t i = 0; i < cutOutRects.size(); i++) | 988 for (size_t i = 0; i < cutOutRects.size(); i++) |
979 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); | 989 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); |
980 } | 990 } |
981 | 991 |
982 } // namespace blink | 992 } // namespace blink |
OLD | NEW |