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 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 syntheticWheel.hasPreciseScrollingDeltas = true; | 646 syntheticWheel.hasPreciseScrollingDeltas = true; |
647 syntheticWheel.x = m_positionOnFlingStart.x; | 647 syntheticWheel.x = m_positionOnFlingStart.x; |
648 syntheticWheel.y = m_positionOnFlingStart.y; | 648 syntheticWheel.y = m_positionOnFlingStart.y; |
649 syntheticWheel.globalX = m_globalPositionOnFlingStart.x; | 649 syntheticWheel.globalX = m_globalPositionOnFlingStart.x; |
650 syntheticWheel.globalY = m_globalPositionOnFlingStart.y; | 650 syntheticWheel.globalY = m_globalPositionOnFlingStart.y; |
651 syntheticWheel.modifiers = m_flingModifier; | 651 syntheticWheel.modifiers = m_flingModifier; |
652 | 652 |
653 if (m_page && m_page->mainFrame() && m_page->mainFrame()->isLocalFrame()
&& m_page->deprecatedLocalMainFrame()->view()) | 653 if (m_page && m_page->mainFrame() && m_page->mainFrame()->isLocalFrame()
&& m_page->deprecatedLocalMainFrame()->view()) |
654 return handleMouseWheel(*m_page->deprecatedLocalMainFrame(), synthet
icWheel); | 654 return handleMouseWheel(*m_page->deprecatedLocalMainFrame(), synthet
icWheel); |
655 } else { | 655 } else { |
| 656 m_lastScrollVelocity = velocity; |
656 WebGestureEvent syntheticGestureEvent; | 657 WebGestureEvent syntheticGestureEvent; |
657 | 658 |
658 syntheticGestureEvent.type = WebInputEvent::GestureScrollUpdate; | 659 syntheticGestureEvent.type = WebInputEvent::GestureScrollUpdate; |
659 syntheticGestureEvent.data.scrollUpdate.preventPropagation = true; | 660 syntheticGestureEvent.data.scrollUpdate.preventPropagation = true; |
660 syntheticGestureEvent.data.scrollUpdate.deltaX = delta.width; | 661 syntheticGestureEvent.data.scrollUpdate.deltaX = delta.width; |
661 syntheticGestureEvent.data.scrollUpdate.deltaY = delta.height; | 662 syntheticGestureEvent.data.scrollUpdate.deltaY = delta.height; |
| 663 syntheticGestureEvent.data.scrollUpdate.velocityX = velocity.width; |
| 664 syntheticGestureEvent.data.scrollUpdate.velocityY = velocity.height; |
662 syntheticGestureEvent.x = m_positionOnFlingStart.x; | 665 syntheticGestureEvent.x = m_positionOnFlingStart.x; |
663 syntheticGestureEvent.y = m_positionOnFlingStart.y; | 666 syntheticGestureEvent.y = m_positionOnFlingStart.y; |
664 syntheticGestureEvent.globalX = m_globalPositionOnFlingStart.x; | 667 syntheticGestureEvent.globalX = m_globalPositionOnFlingStart.x; |
665 syntheticGestureEvent.globalY = m_globalPositionOnFlingStart.y; | 668 syntheticGestureEvent.globalY = m_globalPositionOnFlingStart.y; |
666 syntheticGestureEvent.modifiers = m_flingModifier; | 669 syntheticGestureEvent.modifiers = m_flingModifier; |
667 syntheticGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; | 670 syntheticGestureEvent.sourceDevice = WebGestureDeviceTouchscreen; |
| 671 syntheticGestureEvent.data.scrollUpdate.inertial = true; |
668 | 672 |
669 if (m_page && m_page->mainFrame() && m_page->mainFrame()->isLocalFrame()
&& m_page->deprecatedLocalMainFrame()->view()) | 673 if (m_page && m_page->mainFrame() && m_page->mainFrame()->isLocalFrame()
&& m_page->deprecatedLocalMainFrame()->view()) |
670 return handleGestureEvent(syntheticGestureEvent); | 674 return handleGestureEvent(syntheticGestureEvent); |
671 } | 675 } |
672 return false; | 676 return false; |
673 } | 677 } |
674 | 678 |
675 bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) | 679 bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) |
676 { | 680 { |
677 bool eventSwallowed = false; | 681 bool eventSwallowed = false; |
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1928 // Create synthetic wheel events as necessary for fling. | 1932 // Create synthetic wheel events as necessary for fling. |
1929 if (m_gestureAnimation) { | 1933 if (m_gestureAnimation) { |
1930 if (m_gestureAnimation->animate(validFrameTime.lastFrameTimeMonotonic)) | 1934 if (m_gestureAnimation->animate(validFrameTime.lastFrameTimeMonotonic)) |
1931 scheduleAnimation(); | 1935 scheduleAnimation(); |
1932 else { | 1936 else { |
1933 endActiveFlingAnimation(); | 1937 endActiveFlingAnimation(); |
1934 | 1938 |
1935 PlatformGestureEvent endScrollEvent(PlatformEvent::GestureScrollEnd, | 1939 PlatformGestureEvent endScrollEvent(PlatformEvent::GestureScrollEnd, |
1936 m_positionOnFlingStart, m_globalPositionOnFlingStart, | 1940 m_positionOnFlingStart, m_globalPositionOnFlingStart, |
1937 IntSize(), 0, false, false, false, false, | 1941 IntSize(), 0, false, false, false, false, |
1938 0, 0, 0, 0, false); | 1942 0, 0, m_lastScrollVelocity.width, m_lastScrollVelocity.height, f
alse, true); |
| 1943 m_lastScrollVelocity = FloatSize(0, 0); |
1939 | 1944 |
1940 mainFrameImpl()->frame()->eventHandler().handleGestureScrollEnd(endS
crollEvent); | 1945 mainFrameImpl()->frame()->eventHandler().handleGestureScrollEnd(endS
crollEvent); |
1941 } | 1946 } |
1942 } | 1947 } |
1943 | 1948 |
1944 if (!m_page) | 1949 if (!m_page) |
1945 return; | 1950 return; |
1946 | 1951 |
1947 // FIXME: This should probably be using the local root? | 1952 // FIXME: This should probably be using the local root? |
1948 if (m_page->mainFrame()->isLocalFrame()) | 1953 if (m_page->mainFrame()->isLocalFrame()) |
(...skipping 2722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4671 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4676 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
4672 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4677 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
4673 } | 4678 } |
4674 | 4679 |
4675 void WebViewImpl::forceNextWebGLContextCreationToFail() | 4680 void WebViewImpl::forceNextWebGLContextCreationToFail() |
4676 { | 4681 { |
4677 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); | 4682 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); |
4678 } | 4683 } |
4679 | 4684 |
4680 } // namespace blink | 4685 } // namespace blink |
OLD | NEW |