OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
680 return handleGestureEvent(syntheticGestureEvent); | 680 return handleGestureEvent(syntheticGestureEvent); |
681 } | 681 } |
682 return false; | 682 return false; |
683 } | 683 } |
684 | 684 |
685 bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) | 685 bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) |
686 { | 686 { |
687 if (!m_client) | 687 if (!m_client) |
688 return false; | 688 return false; |
689 | 689 |
690 | |
tdresser
2015/09/15 13:13:08
Remove space.
wjmaclean
2015/09/15 15:02:48
Done.
| |
690 bool eventSwallowed = false; | 691 bool eventSwallowed = false; |
691 bool eventCancelled = false; // for disambiguation | 692 bool eventCancelled = false; // for disambiguation |
692 | 693 |
693 // Special handling for slow-path fling gestures. | 694 // Special handling for slow-path fling gestures. |
694 switch (event.type) { | 695 switch (event.type) { |
695 case WebInputEvent::GestureFlingStart: { | 696 case WebInputEvent::GestureFlingStart: { |
696 if (mainFrameImpl()->frame()->eventHandler().isScrollbarHandlingGestures ()) | 697 if (mainFrameImpl()->frame()->eventHandler().isScrollbarHandlingGestures ()) |
697 break; | 698 break; |
698 endActiveFlingAnimation(); | 699 endActiveFlingAnimation(); |
699 m_client->cancelScheduledContentIntents(); | 700 m_client->cancelScheduledContentIntents(); |
700 m_positionOnFlingStart = WebPoint(event.x, event.y); | 701 m_positionOnFlingStart = WebPoint(event.x, event.y); |
701 m_globalPositionOnFlingStart = WebPoint(event.globalX, event.globalY); | 702 m_globalPositionOnFlingStart = WebPoint(event.globalX, event.globalY); |
702 m_flingModifier = event.modifiers; | 703 m_flingModifier = event.modifiers; |
703 m_flingSourceDevice = event.sourceDevice; | 704 m_flingSourceDevice = event.sourceDevice; |
704 OwnPtr<WebGestureCurve> flingCurve = adoptPtr(Platform::current()->creat eFlingAnimationCurve(event.sourceDevice, WebFloatPoint(event.data.flingStart.vel ocityX, event.data.flingStart.velocityY), WebSize())); | 705 OwnPtr<WebGestureCurve> flingCurve = adoptPtr(Platform::current()->creat eFlingAnimationCurve(event.sourceDevice, WebFloatPoint(event.data.flingStart.vel ocityX, event.data.flingStart.velocityY), WebSize())); |
705 ASSERT(flingCurve); | 706 ASSERT(flingCurve); |
706 m_gestureAnimation = WebActiveGestureAnimation::createAtAnimationStart(f lingCurve.release(), this); | 707 m_gestureAnimation = WebActiveGestureAnimation::createAtAnimationStart(f lingCurve.release(), this); |
707 scheduleAnimation(); | 708 scheduleAnimation(); |
708 eventSwallowed = true; | 709 eventSwallowed = true; |
709 | 710 |
711 // Plugins may need to see GestureFlingStart to balance | |
712 // GestureScrollBegin (since the former replaces GestureScrollEnd when | |
713 // transitioning to a fling). | |
714 PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event); | |
715 mainFrameImpl()->frame()->eventHandler().handleGestureScrollEvent(platfo rmEvent); | |
tdresser
2015/09/15 13:13:08
Why do we need to explicitly repost the fling? Can
wjmaclean
2015/09/15 15:02:48
No, the GestureFlingStart gets dropped on the floo
tdresser
2015/09/15 15:28:29
I wonder if by not swallowing the event we could a
| |
716 | |
710 m_client->didHandleGestureEvent(event, eventCancelled); | 717 m_client->didHandleGestureEvent(event, eventCancelled); |
711 return eventSwallowed; | 718 return eventSwallowed; |
712 } | 719 } |
713 case WebInputEvent::GestureFlingCancel: | 720 case WebInputEvent::GestureFlingCancel: |
714 if (endActiveFlingAnimation()) | 721 if (endActiveFlingAnimation()) |
715 eventSwallowed = true; | 722 eventSwallowed = true; |
716 | 723 |
717 m_client->didHandleGestureEvent(event, eventCancelled); | 724 m_client->didHandleGestureEvent(event, eventCancelled); |
718 return eventSwallowed; | 725 return eventSwallowed; |
719 default: | 726 default: |
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1857 // Create synthetic wheel events as necessary for fling. | 1864 // Create synthetic wheel events as necessary for fling. |
1858 if (m_gestureAnimation) { | 1865 if (m_gestureAnimation) { |
1859 if (m_gestureAnimation->animate(validFrameTime.lastFrameTimeMonotonic)) | 1866 if (m_gestureAnimation->animate(validFrameTime.lastFrameTimeMonotonic)) |
1860 scheduleAnimation(); | 1867 scheduleAnimation(); |
1861 else { | 1868 else { |
1862 endActiveFlingAnimation(); | 1869 endActiveFlingAnimation(); |
1863 | 1870 |
1864 PlatformGestureEvent endScrollEvent(PlatformEvent::GestureScrollEnd, | 1871 PlatformGestureEvent endScrollEvent(PlatformEvent::GestureScrollEnd, |
1865 m_positionOnFlingStart, m_globalPositionOnFlingStart, | 1872 m_positionOnFlingStart, m_globalPositionOnFlingStart, |
1866 IntSize(), 0, false, false, false, false); | 1873 IntSize(), 0, false, false, false, false); |
1867 endScrollEvent.setScrollGestureData(0, 0, 0, 0, true, false); | 1874 endScrollEvent.setScrollGestureData(0, 0, 0, 0, true, false, 0); |
tdresser
2015/09/15 13:13:08
-1
We might want to define a constant for this, i
wjmaclean
2015/09/15 15:02:48
Done.
| |
1868 | 1875 |
1869 mainFrameImpl()->frame()->eventHandler().handleGestureScrollEnd(endS crollEvent); | 1876 mainFrameImpl()->frame()->eventHandler().handleGestureScrollEnd(endS crollEvent); |
1870 } | 1877 } |
1871 } | 1878 } |
1872 | 1879 |
1873 if (!m_page) | 1880 if (!m_page) |
1874 return; | 1881 return; |
1875 | 1882 |
1876 // FIXME: This should probably be using the local root? | 1883 // FIXME: This should probably be using the local root? |
1877 if (m_page->mainFrame()->isLocalFrame()) | 1884 if (m_page->mainFrame()->isLocalFrame()) |
(...skipping 2533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4411 if (m_pageColorOverlay) | 4418 if (m_pageColorOverlay) |
4412 m_pageColorOverlay->update(); | 4419 m_pageColorOverlay->update(); |
4413 if (InspectorOverlayImpl* overlay = inspectorOverlay()) { | 4420 if (InspectorOverlayImpl* overlay = inspectorOverlay()) { |
4414 PageOverlay* inspectorPageOverlay = overlay->pageOverlay(); | 4421 PageOverlay* inspectorPageOverlay = overlay->pageOverlay(); |
4415 if (inspectorPageOverlay) | 4422 if (inspectorPageOverlay) |
4416 inspectorPageOverlay->update(); | 4423 inspectorPageOverlay->update(); |
4417 } | 4424 } |
4418 } | 4425 } |
4419 | 4426 |
4420 } // namespace blink | 4427 } // namespace blink |
OLD | NEW |