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 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 // Special handling for slow-path fling gestures. | 625 // Special handling for slow-path fling gestures. |
626 switch (event.type) { | 626 switch (event.type) { |
627 case WebInputEvent::GestureFlingStart: { | 627 case WebInputEvent::GestureFlingStart: { |
628 if (mainFrameImpl()->frame()->eventHandler().isScrollbarHandlingGestures
()) | 628 if (mainFrameImpl()->frame()->eventHandler().isScrollbarHandlingGestures
()) |
629 break; | 629 break; |
630 m_client->cancelScheduledContentIntents(); | 630 m_client->cancelScheduledContentIntents(); |
631 m_positionOnFlingStart = WebPoint(event.x / pageScaleFactor(), event.y /
pageScaleFactor()); | 631 m_positionOnFlingStart = WebPoint(event.x / pageScaleFactor(), event.y /
pageScaleFactor()); |
632 m_globalPositionOnFlingStart = WebPoint(event.globalX, event.globalY); | 632 m_globalPositionOnFlingStart = WebPoint(event.globalX, event.globalY); |
633 m_flingModifier = event.modifiers; | 633 m_flingModifier = event.modifiers; |
634 m_flingSourceDevice = event.sourceDevice; | 634 m_flingSourceDevice = event.sourceDevice; |
635 OwnPtr<WebGestureCurve> flingCurve = adoptPtr(Platform::current()->creat
eFlingAnimationCurve(event.sourceDevice, WebFloatPoint(event.data.flingStart.vel
ocityX, event.data.flingStart.velocityY), WebSize())); | 635 OwnPtr<WebGestureCurve> flingCurve = adoptPtr(Platform::current()->creat
eFlingAnimationCurve(static_cast<WebGestureDevice>(event.sourceDevice), WebFloat
Point(event.data.flingStart.velocityX, event.data.flingStart.velocityY), WebSize
())); |
| 636 ASSERT(flingCurve); |
636 m_gestureAnimation = WebActiveGestureAnimation::createAtAnimationStart(f
lingCurve.release(), this); | 637 m_gestureAnimation = WebActiveGestureAnimation::createAtAnimationStart(f
lingCurve.release(), this); |
637 scheduleAnimation(); | 638 scheduleAnimation(); |
638 eventSwallowed = true; | 639 eventSwallowed = true; |
639 | 640 |
640 m_client->didHandleGestureEvent(event, eventCancelled); | 641 m_client->didHandleGestureEvent(event, eventCancelled); |
641 return eventSwallowed; | 642 return eventSwallowed; |
642 } | 643 } |
643 case WebInputEvent::GestureFlingCancel: | 644 case WebInputEvent::GestureFlingCancel: |
644 if (endActiveFlingAnimation()) | 645 if (endActiveFlingAnimation()) |
645 eventSwallowed = true; | 646 eventSwallowed = true; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 return eventSwallowed; | 773 return eventSwallowed; |
773 } | 774 } |
774 | 775 |
775 void WebViewImpl::transferActiveWheelFlingAnimation(const WebActiveWheelFlingPar
ameters& parameters) | 776 void WebViewImpl::transferActiveWheelFlingAnimation(const WebActiveWheelFlingPar
ameters& parameters) |
776 { | 777 { |
777 TRACE_EVENT0("webkit", "WebViewImpl::transferActiveWheelFlingAnimation"); | 778 TRACE_EVENT0("webkit", "WebViewImpl::transferActiveWheelFlingAnimation"); |
778 ASSERT(!m_gestureAnimation); | 779 ASSERT(!m_gestureAnimation); |
779 m_positionOnFlingStart = parameters.point; | 780 m_positionOnFlingStart = parameters.point; |
780 m_globalPositionOnFlingStart = parameters.globalPoint; | 781 m_globalPositionOnFlingStart = parameters.globalPoint; |
781 m_flingModifier = parameters.modifiers; | 782 m_flingModifier = parameters.modifiers; |
782 OwnPtr<WebGestureCurve> curve = adoptPtr(Platform::current()->createFlingAni
mationCurve(parameters.sourceDevice, WebFloatPoint(parameters.delta), parameters
.cumulativeScroll)); | 783 OwnPtr<WebGestureCurve> curve = adoptPtr(Platform::current()->createFlingAni
mationCurve(static_cast<WebGestureDevice>(parameters.sourceDevice), WebFloatPoin
t(parameters.delta), parameters.cumulativeScroll)); |
| 784 ASSERT(curve); |
783 m_gestureAnimation = WebActiveGestureAnimation::createWithTimeOffset(curve.r
elease(), this, parameters.startTime); | 785 m_gestureAnimation = WebActiveGestureAnimation::createWithTimeOffset(curve.r
elease(), this, parameters.startTime); |
784 scheduleAnimation(); | 786 scheduleAnimation(); |
785 } | 787 } |
786 | 788 |
787 bool WebViewImpl::endActiveFlingAnimation() | 789 bool WebViewImpl::endActiveFlingAnimation() |
788 { | 790 { |
789 if (m_gestureAnimation) { | 791 if (m_gestureAnimation) { |
790 m_gestureAnimation.clear(); | 792 m_gestureAnimation.clear(); |
791 if (m_layerTreeView) | 793 if (m_layerTreeView) |
792 m_layerTreeView->didStopFlinging(); | 794 m_layerTreeView->didStopFlinging(); |
(...skipping 3256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4049 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); | 4051 const PageScaleConstraints& constraints = m_pageScaleConstraintsSet.pageDefi
nedConstraints(); |
4050 | 4052 |
4051 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 4053 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
4052 return false; | 4054 return false; |
4053 | 4055 |
4054 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width | 4056 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width |
4055 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); | 4057 || (constraints.minimumScale == constraints.maximumScale && constraints.
minimumScale != -1); |
4056 } | 4058 } |
4057 | 4059 |
4058 } // namespace blink | 4060 } // namespace blink |
OLD | NEW |