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 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 syntheticGestureEvent.data.scrollUpdate.deltaY = delta.height; | 659 syntheticGestureEvent.data.scrollUpdate.deltaY = delta.height; |
660 syntheticGestureEvent.data.scrollUpdate.velocityX = velocity.width; | 660 syntheticGestureEvent.data.scrollUpdate.velocityX = velocity.width; |
661 syntheticGestureEvent.data.scrollUpdate.velocityY = velocity.height; | 661 syntheticGestureEvent.data.scrollUpdate.velocityY = velocity.height; |
662 syntheticGestureEvent.x = m_positionOnFlingStart.x; | 662 syntheticGestureEvent.x = m_positionOnFlingStart.x; |
663 syntheticGestureEvent.y = m_positionOnFlingStart.y; | 663 syntheticGestureEvent.y = m_positionOnFlingStart.y; |
664 syntheticGestureEvent.globalX = m_globalPositionOnFlingStart.x; | 664 syntheticGestureEvent.globalX = m_globalPositionOnFlingStart.x; |
665 syntheticGestureEvent.globalY = m_globalPositionOnFlingStart.y; | 665 syntheticGestureEvent.globalY = m_globalPositionOnFlingStart.y; |
666 syntheticGestureEvent.modifiers = m_flingModifier; | 666 syntheticGestureEvent.modifiers = m_flingModifier; |
667 syntheticGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; | 667 syntheticGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; |
668 syntheticGestureEvent.data.scrollUpdate.inertial = true; | 668 syntheticGestureEvent.data.scrollUpdate.inertial = true; |
| 669 syntheticGestureEvent.data.scrollUpdate.railsMode = m_railStateOnFlingSt
art; |
669 | 670 |
670 if (m_page && m_page->mainFrame() && m_page->mainFrame()->isLocalFrame()
&& m_page->deprecatedLocalMainFrame()->view()) | 671 if (m_page && m_page->mainFrame() && m_page->mainFrame()->isLocalFrame()
&& m_page->deprecatedLocalMainFrame()->view()) |
671 return handleGestureEvent(syntheticGestureEvent); | 672 return handleGestureEvent(syntheticGestureEvent); |
672 } | 673 } |
673 return false; | 674 return false; |
674 } | 675 } |
675 | 676 |
676 bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) | 677 bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) |
677 { | 678 { |
678 if (!m_client) | 679 if (!m_client) |
679 return false; | 680 return false; |
680 | 681 |
681 bool eventSwallowed = false; | 682 bool eventSwallowed = false; |
682 bool eventCancelled = false; // for disambiguation | 683 bool eventCancelled = false; // for disambiguation |
683 | 684 |
684 // Special handling for slow-path fling gestures. | 685 // Special handling for slow-path fling gestures. |
685 switch (event.type) { | 686 switch (event.type) { |
686 case WebInputEvent::GestureFlingStart: { | 687 case WebInputEvent::GestureFlingStart: { |
687 if (mainFrameImpl()->frame()->eventHandler().isScrollbarHandlingGestures
()) | 688 if (mainFrameImpl()->frame()->eventHandler().isScrollbarHandlingGestures
()) |
688 break; | 689 break; |
689 m_client->cancelScheduledContentIntents(); | 690 m_client->cancelScheduledContentIntents(); |
690 m_positionOnFlingStart = WebPoint(event.x, event.y); | 691 m_positionOnFlingStart = WebPoint(event.x, event.y); |
691 m_globalPositionOnFlingStart = WebPoint(event.globalX, event.globalY); | 692 m_globalPositionOnFlingStart = WebPoint(event.globalX, event.globalY); |
| 693 m_railStateOnFlingStart = event.data.flingStart.railsMode; |
692 m_flingModifier = event.modifiers; | 694 m_flingModifier = event.modifiers; |
693 m_flingSourceDevice = event.sourceDevice; | 695 m_flingSourceDevice = event.sourceDevice; |
694 OwnPtr<WebGestureCurve> flingCurve = adoptPtr(Platform::current()->creat
eFlingAnimationCurve(event.sourceDevice, WebFloatPoint(event.data.flingStart.vel
ocityX, event.data.flingStart.velocityY), WebSize())); | 696 OwnPtr<WebGestureCurve> flingCurve = adoptPtr(Platform::current()->creat
eFlingAnimationCurve(event.sourceDevice, WebFloatPoint(event.data.flingStart.vel
ocityX, event.data.flingStart.velocityY), WebSize())); |
695 ASSERT(flingCurve); | 697 ASSERT(flingCurve); |
696 m_gestureAnimation = WebActiveGestureAnimation::createAtAnimationStart(f
lingCurve.release(), this); | 698 m_gestureAnimation = WebActiveGestureAnimation::createAtAnimationStart(f
lingCurve.release(), this); |
697 scheduleAnimation(); | 699 scheduleAnimation(); |
698 eventSwallowed = true; | 700 eventSwallowed = true; |
699 | 701 |
700 m_client->didHandleGestureEvent(event, eventCancelled); | 702 m_client->didHandleGestureEvent(event, eventCancelled); |
701 return eventSwallowed; | 703 return eventSwallowed; |
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1888 // Create synthetic wheel events as necessary for fling. | 1890 // Create synthetic wheel events as necessary for fling. |
1889 if (m_gestureAnimation) { | 1891 if (m_gestureAnimation) { |
1890 if (m_gestureAnimation->animate(validFrameTime.lastFrameTimeMonotonic)) | 1892 if (m_gestureAnimation->animate(validFrameTime.lastFrameTimeMonotonic)) |
1891 scheduleAnimation(); | 1893 scheduleAnimation(); |
1892 else { | 1894 else { |
1893 endActiveFlingAnimation(); | 1895 endActiveFlingAnimation(); |
1894 | 1896 |
1895 PlatformGestureEvent endScrollEvent(PlatformEvent::GestureScrollEnd, | 1897 PlatformGestureEvent endScrollEvent(PlatformEvent::GestureScrollEnd, |
1896 m_positionOnFlingStart, m_globalPositionOnFlingStart, | 1898 m_positionOnFlingStart, m_globalPositionOnFlingStart, |
1897 IntSize(), 0, false, false, false, false); | 1899 IntSize(), 0, false, false, false, false); |
1898 endScrollEvent.setScrollGestureData(0, 0, 0, 0, true, false); | 1900 endScrollEvent.setScrollGestureData(0, 0, 0, 0, true, false, |
| 1901 PlatformEvent::RailsModeFree); |
1899 | 1902 |
1900 mainFrameImpl()->frame()->eventHandler().handleGestureScrollEnd(endS
crollEvent); | 1903 mainFrameImpl()->frame()->eventHandler().handleGestureScrollEnd(endS
crollEvent); |
1901 } | 1904 } |
1902 } | 1905 } |
1903 | 1906 |
1904 if (!m_page) | 1907 if (!m_page) |
1905 return; | 1908 return; |
1906 | 1909 |
1907 // FIXME: This should probably be using the local root? | 1910 // FIXME: This should probably be using the local root? |
1908 if (m_page->mainFrame()->isLocalFrame()) | 1911 if (m_page->mainFrame()->isLocalFrame()) |
(...skipping 2604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4513 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4516 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
4514 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4517 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
4515 } | 4518 } |
4516 | 4519 |
4517 void WebViewImpl::forceNextWebGLContextCreationToFail() | 4520 void WebViewImpl::forceNextWebGLContextCreationToFail() |
4518 { | 4521 { |
4519 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); | 4522 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); |
4520 } | 4523 } |
4521 | 4524 |
4522 } // namespace blink | 4525 } // namespace blink |
OLD | NEW |