| 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 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 event->setDefaultHandled(); | 915 event->setDefaultHandled(); |
| 916 // FIXME: Can a plugin change the cursor from a touch-event callback? | 916 // FIXME: Can a plugin change the cursor from a touch-event callback? |
| 917 return; | 917 return; |
| 918 } | 918 } |
| 919 case TouchEventRequestTypeSynthesizedMouse: | 919 case TouchEventRequestTypeSynthesizedMouse: |
| 920 synthesizeMouseEventIfPossible(event); | 920 synthesizeMouseEventIfPossible(event); |
| 921 return; | 921 return; |
| 922 } | 922 } |
| 923 } | 923 } |
| 924 | 924 |
| 925 static inline bool gestureScrollHelper(ScrollbarGroup* scrollbarGroup, ScrollDir
ection positiveDirection, ScrollDirection negativeDirection, float delta) | 925 static inline bool gestureScrollHelper(ScrollbarGroup* scrollbarGroup, ScrollDir
ectionPhysical positiveDirection, ScrollDirectionPhysical negativeDirection, flo
at delta) |
| 926 { | 926 { |
| 927 if (!delta) | 927 if (!delta) |
| 928 return false; | 928 return false; |
| 929 float absDelta = delta > 0 ? delta : -delta; | 929 float absDelta = delta > 0 ? delta : -delta; |
| 930 return scrollbarGroup->scroll(delta < 0 ? negativeDirection : positiveDirect
ion, ScrollByPrecisePixel, absDelta); | 930 return scrollbarGroup->scroll(delta < 0 ? negativeDirection : positiveDirect
ion, ScrollByPrecisePixel, absDelta); |
| 931 } | 931 } |
| 932 | 932 |
| 933 void WebPluginContainerImpl::handleGestureEvent(GestureEvent* event) | 933 void WebPluginContainerImpl::handleGestureEvent(GestureEvent* event) |
| 934 { | 934 { |
| 935 WebGestureEventBuilder webEvent(m_element->layoutObject(), *event); | 935 WebGestureEventBuilder webEvent(m_element->layoutObject(), *event); |
| 936 if (webEvent.type == WebInputEvent::Undefined) | 936 if (webEvent.type == WebInputEvent::Undefined) |
| 937 return; | 937 return; |
| 938 if (event->type() == EventTypeNames::gesturetapdown) | 938 if (event->type() == EventTypeNames::gesturetapdown) |
| 939 focusPlugin(); | 939 focusPlugin(); |
| 940 WebCursorInfo cursorInfo; | 940 WebCursorInfo cursorInfo; |
| 941 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) { | 941 if (m_webPlugin->handleInputEvent(webEvent, cursorInfo)) { |
| 942 event->setDefaultHandled(); | 942 event->setDefaultHandled(); |
| 943 return; | 943 return; |
| 944 } | 944 } |
| 945 | 945 |
| 946 if (webEvent.type == WebInputEvent::GestureScrollUpdate) { | 946 if (webEvent.type == WebInputEvent::GestureScrollUpdate) { |
| 947 if (!m_scrollbarGroup) | 947 if (!m_scrollbarGroup) |
| 948 return; | 948 return; |
| 949 if (gestureScrollHelper(m_scrollbarGroup.get(), ScrollLeft, ScrollRight,
webEvent.data.scrollUpdate.deltaX)) | 949 if (gestureScrollHelper(m_scrollbarGroup.get(), ScrollPhysicalLeft, Scro
llPhysicalRight, webEvent.data.scrollUpdate.deltaX)) |
| 950 event->setDefaultHandled(); | 950 event->setDefaultHandled(); |
| 951 if (gestureScrollHelper(m_scrollbarGroup.get(), ScrollUp, ScrollDown, we
bEvent.data.scrollUpdate.deltaY)) | 951 if (gestureScrollHelper(m_scrollbarGroup.get(), ScrollPhysicalUp, Scroll
PhysicalDown, webEvent.data.scrollUpdate.deltaY)) |
| 952 event->setDefaultHandled(); | 952 event->setDefaultHandled(); |
| 953 } | 953 } |
| 954 // FIXME: Can a plugin change the cursor from a touch-event callback? | 954 // FIXME: Can a plugin change the cursor from a touch-event callback? |
| 955 } | 955 } |
| 956 | 956 |
| 957 void WebPluginContainerImpl::synthesizeMouseEventIfPossible(TouchEvent* event) | 957 void WebPluginContainerImpl::synthesizeMouseEventIfPossible(TouchEvent* event) |
| 958 { | 958 { |
| 959 WebMouseEventBuilder webEvent(this, m_element->layoutObject(), *event); | 959 WebMouseEventBuilder webEvent(this, m_element->layoutObject(), *event); |
| 960 if (webEvent.type == WebInputEvent::Undefined) | 960 if (webEvent.type == WebInputEvent::Undefined) |
| 961 return; | 961 return; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1015 for (size_t i = 0; i < cutOutRects.size(); i++) | 1015 for (size_t i = 0; i < cutOutRects.size(); i++) |
| 1016 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); | 1016 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); |
| 1017 } | 1017 } |
| 1018 | 1018 |
| 1019 bool WebPluginContainerImpl::pluginShouldPersist() const | 1019 bool WebPluginContainerImpl::pluginShouldPersist() const |
| 1020 { | 1020 { |
| 1021 return m_webPlugin->shouldPersist(); | 1021 return m_webPlugin->shouldPersist(); |
| 1022 } | 1022 } |
| 1023 | 1023 |
| 1024 } // namespace blink | 1024 } // namespace blink |
| OLD | NEW |