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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
430 , m_isTransparent(false) | 430 , m_isTransparent(false) |
431 , m_tabsToLinks(false) | 431 , m_tabsToLinks(false) |
432 , m_layerTreeView(0) | 432 , m_layerTreeView(0) |
433 , m_rootLayer(0) | 433 , m_rootLayer(0) |
434 , m_rootGraphicsLayer(0) | 434 , m_rootGraphicsLayer(0) |
435 , m_rootTransformLayer(0) | 435 , m_rootTransformLayer(0) |
436 , m_graphicsLayerFactory(adoptPtr(new GraphicsLayerFactoryChromium(this))) | 436 , m_graphicsLayerFactory(adoptPtr(new GraphicsLayerFactoryChromium(this))) |
437 , m_matchesHeuristicsForGpuRasterization(false) | 437 , m_matchesHeuristicsForGpuRasterization(false) |
438 , m_recreatingGraphicsContext(false) | 438 , m_recreatingGraphicsContext(false) |
439 , m_flingModifier(0) | 439 , m_flingModifier(0) |
440 , m_flingSourceDevice(false) | 440 , m_flingSourceDevice(WebGestureDeviceUninitialized) |
441 , m_fullscreenController(FullscreenController::create(this)) | 441 , m_fullscreenController(FullscreenController::create(this)) |
442 , m_showFPSCounter(false) | 442 , m_showFPSCounter(false) |
443 , m_baseBackgroundColor(Color::white) | 443 , m_baseBackgroundColor(Color::white) |
444 , m_backgroundColorOverride(Color::transparent) | 444 , m_backgroundColorOverride(Color::transparent) |
445 , m_zoomFactorOverride(0) | 445 , m_zoomFactorOverride(0) |
446 , m_userGestureObserved(false) | 446 , m_userGestureObserved(false) |
447 , m_shouldDispatchFirstVisuallyNonEmptyLayout(false) | 447 , m_shouldDispatchFirstVisuallyNonEmptyLayout(false) |
448 , m_shouldDispatchFirstLayoutAfterFinishedParsing(false) | 448 , m_shouldDispatchFirstLayoutAfterFinishedParsing(false) |
449 , m_displayMode(WebDisplayModeBrowser) | 449 , m_displayMode(WebDisplayModeBrowser) |
450 , m_elasticOverscroll(FloatSize()) | 450 , m_elasticOverscroll(FloatSize()) |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
635 } | 635 } |
636 | 636 |
637 bool WebViewImpl::handleMouseWheel(LocalFrame& mainFrame, const WebMouseWheelEve nt& event) | 637 bool WebViewImpl::handleMouseWheel(LocalFrame& mainFrame, const WebMouseWheelEve nt& event) |
638 { | 638 { |
639 hidePopups(); | 639 hidePopups(); |
640 return PageWidgetEventHandler::handleMouseWheel(mainFrame, event); | 640 return PageWidgetEventHandler::handleMouseWheel(mainFrame, event); |
641 } | 641 } |
642 | 642 |
643 bool WebViewImpl::scrollBy(const WebFloatSize& delta, const WebFloatSize& veloci ty) | 643 bool WebViewImpl::scrollBy(const WebFloatSize& delta, const WebFloatSize& veloci ty) |
644 { | 644 { |
645 ASSERT(m_flingSourceDevice != WebGestureDeviceUninitialized); | |
645 if (m_flingSourceDevice == WebGestureDeviceTouchpad) { | 646 if (m_flingSourceDevice == WebGestureDeviceTouchpad) { |
646 WebMouseWheelEvent syntheticWheel; | 647 WebMouseWheelEvent syntheticWheel; |
647 const float tickDivisor = WheelEvent::TickMultiplier; | 648 const float tickDivisor = WheelEvent::TickMultiplier; |
648 | 649 |
649 syntheticWheel.deltaX = delta.width; | 650 syntheticWheel.deltaX = delta.width; |
650 syntheticWheel.deltaY = delta.height; | 651 syntheticWheel.deltaY = delta.height; |
651 syntheticWheel.wheelTicksX = delta.width / tickDivisor; | 652 syntheticWheel.wheelTicksX = delta.width / tickDivisor; |
652 syntheticWheel.wheelTicksY = delta.height / tickDivisor; | 653 syntheticWheel.wheelTicksY = delta.height / tickDivisor; |
653 syntheticWheel.hasPreciseScrollingDeltas = true; | 654 syntheticWheel.hasPreciseScrollingDeltas = true; |
654 syntheticWheel.x = m_positionOnFlingStart.x; | 655 syntheticWheel.x = m_positionOnFlingStart.x; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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; |
705 ASSERT(m_flingSourceDevice != WebGestureDeviceUninitialized); | |
704 OwnPtr<WebGestureCurve> flingCurve = adoptPtr(Platform::current()->creat eFlingAnimationCurve(event.sourceDevice, WebFloatPoint(event.data.flingStart.vel ocityX, event.data.flingStart.velocityY), WebSize())); | 706 OwnPtr<WebGestureCurve> flingCurve = adoptPtr(Platform::current()->creat eFlingAnimationCurve(event.sourceDevice, WebFloatPoint(event.data.flingStart.vel ocityX, event.data.flingStart.velocityY), WebSize())); |
705 ASSERT(flingCurve); | 707 ASSERT(flingCurve); |
706 m_gestureAnimation = WebActiveGestureAnimation::createAtAnimationStart(f lingCurve.release(), this); | 708 m_gestureAnimation = WebActiveGestureAnimation::createAtAnimationStart(f lingCurve.release(), this); |
707 scheduleAnimation(); | 709 scheduleAnimation(); |
708 eventSwallowed = true; | 710 eventSwallowed = true; |
709 | 711 |
710 // Plugins may need to see GestureFlingStart to balance | 712 // Plugins may need to see GestureFlingStart to balance |
711 // GestureScrollBegin (since the former replaces GestureScrollEnd when | 713 // GestureScrollBegin (since the former replaces GestureScrollEnd when |
712 // transitioning to a fling). | 714 // transitioning to a fling). |
713 PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event); | 715 PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
906 void WebViewImpl::transferActiveWheelFlingAnimation(const WebActiveWheelFlingPar ameters& parameters) | 908 void WebViewImpl::transferActiveWheelFlingAnimation(const WebActiveWheelFlingPar ameters& parameters) |
907 { | 909 { |
908 TRACE_EVENT0("blink", "WebViewImpl::transferActiveWheelFlingAnimation"); | 910 TRACE_EVENT0("blink", "WebViewImpl::transferActiveWheelFlingAnimation"); |
909 ASSERT(!m_gestureAnimation); | 911 ASSERT(!m_gestureAnimation); |
910 m_positionOnFlingStart = parameters.point; | 912 m_positionOnFlingStart = parameters.point; |
911 m_globalPositionOnFlingStart = parameters.globalPoint; | 913 m_globalPositionOnFlingStart = parameters.globalPoint; |
912 m_flingModifier = parameters.modifiers; | 914 m_flingModifier = parameters.modifiers; |
913 OwnPtr<WebGestureCurve> curve = adoptPtr(Platform::current()->createFlingAni mationCurve(parameters.sourceDevice, WebFloatPoint(parameters.delta), parameters .cumulativeScroll)); | 915 OwnPtr<WebGestureCurve> curve = adoptPtr(Platform::current()->createFlingAni mationCurve(parameters.sourceDevice, WebFloatPoint(parameters.delta), parameters .cumulativeScroll)); |
914 ASSERT(curve); | 916 ASSERT(curve); |
915 m_gestureAnimation = WebActiveGestureAnimation::createWithTimeOffset(curve.r elease(), this, parameters.startTime); | 917 m_gestureAnimation = WebActiveGestureAnimation::createWithTimeOffset(curve.r elease(), this, parameters.startTime); |
918 ASSERT(parameters.sourceDevice != WebGestureDeviceUninitialized); | |
919 m_flingSourceDevice = parameters.sourceDevice; | |
916 scheduleAnimation(); | 920 scheduleAnimation(); |
917 } | 921 } |
918 | 922 |
919 bool WebViewImpl::endActiveFlingAnimation() | 923 bool WebViewImpl::endActiveFlingAnimation() |
920 { | 924 { |
921 if (m_gestureAnimation) { | 925 if (m_gestureAnimation) { |
922 m_gestureAnimation.clear(); | 926 m_gestureAnimation.clear(); |
927 m_flingSourceDevice = WebGestureDeviceUninitialized; | |
923 if (m_layerTreeView) | 928 if (m_layerTreeView) |
924 m_layerTreeView->didStopFlinging(); | 929 m_layerTreeView->didStopFlinging(); |
925 return true; | 930 return true; |
926 } | 931 } |
927 return false; | 932 return false; |
928 } | 933 } |
929 | 934 |
930 bool WebViewImpl::startPageScaleAnimation(const IntPoint& targetPosition, bool u seAnchor, float newScale, double durationInSeconds) | 935 bool WebViewImpl::startPageScaleAnimation(const IntPoint& targetPosition, bool u seAnchor, float newScale, double durationInSeconds) |
931 { | 936 { |
932 VisualViewport& visualViewport = page()->frameHost().visualViewport(); | 937 VisualViewport& visualViewport = page()->frameHost().visualViewport(); |
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1863 void WebViewImpl::beginFrame(const WebBeginFrameArgs& frameTime) | 1868 void WebViewImpl::beginFrame(const WebBeginFrameArgs& frameTime) |
1864 { | 1869 { |
1865 TRACE_EVENT1("blink", "WebViewImpl::beginFrame", "frameTime", frameTime.last FrameTimeMonotonic); | 1870 TRACE_EVENT1("blink", "WebViewImpl::beginFrame", "frameTime", frameTime.last FrameTimeMonotonic); |
1866 ASSERT(frameTime.lastFrameTimeMonotonic); | 1871 ASSERT(frameTime.lastFrameTimeMonotonic); |
1867 | 1872 |
1868 // Create synthetic wheel events as necessary for fling. | 1873 // Create synthetic wheel events as necessary for fling. |
1869 if (m_gestureAnimation) { | 1874 if (m_gestureAnimation) { |
1870 if (m_gestureAnimation->animate(frameTime.lastFrameTimeMonotonic)) | 1875 if (m_gestureAnimation->animate(frameTime.lastFrameTimeMonotonic)) |
1871 scheduleAnimation(); | 1876 scheduleAnimation(); |
1872 else { | 1877 else { |
1878 ASSERT(m_flingSourceDevice != WebGestureDeviceUninitialized); | |
1879 WebGestureDevice lastFlingSourceDevice = m_flingSourceDevice; | |
1873 endActiveFlingAnimation(); | 1880 endActiveFlingAnimation(); |
1874 | 1881 |
1875 PlatformGestureEvent endScrollEvent(PlatformEvent::GestureScrollEnd, | 1882 PlatformGestureEvent endScrollEvent(PlatformEvent::GestureScrollEnd, |
1876 m_positionOnFlingStart, m_globalPositionOnFlingStart, | 1883 m_positionOnFlingStart, m_globalPositionOnFlingStart, |
1877 IntSize(), 0, PlatformEvent::NoModifiers); | 1884 IntSize(), 0, PlatformEvent::NoModifiers, lastFlingSourceDevice == WebGestureDeviceTouchpad ? PlatformGestureSourceTouchpad : PlatformGestureSou rceTouchscreen); |
1878 endScrollEvent.setScrollGestureData(0, 0, 0, 0, true, false, -1 /* n ull plugin id */); | 1885 endScrollEvent.setScrollGestureData(0, 0, 0, 0, true, false, -1 /* n ull plugin id */); |
1879 | 1886 |
1880 mainFrameImpl()->frame()->eventHandler().handleGestureScrollEnd(endS crollEvent); | 1887 mainFrameImpl()->frame()->eventHandler().handleGestureScrollEnd(endS crollEvent); |
1881 } | 1888 } |
1882 } | 1889 } |
1883 | 1890 |
1884 if (!m_page) | 1891 if (!m_page) |
1885 return; | 1892 return; |
1886 | 1893 |
1887 PageWidgetDelegate::animate(*m_page, frameTime.lastFrameTimeMonotonic); | 1894 PageWidgetDelegate::animate(*m_page, frameTime.lastFrameTimeMonotonic); |
(...skipping 2211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4099 | 4106 |
4100 WebHitTestResult WebViewImpl::hitTestResultForTap(const WebPoint& tapPointWindow Pos, const WebSize& tapArea) | 4107 WebHitTestResult WebViewImpl::hitTestResultForTap(const WebPoint& tapPointWindow Pos, const WebSize& tapArea) |
4101 { | 4108 { |
4102 if (!m_page->mainFrame()->isLocalFrame()) | 4109 if (!m_page->mainFrame()->isLocalFrame()) |
4103 return HitTestResult(); | 4110 return HitTestResult(); |
4104 | 4111 |
4105 WebGestureEvent tapEvent; | 4112 WebGestureEvent tapEvent; |
4106 tapEvent.x = tapPointWindowPos.x; | 4113 tapEvent.x = tapPointWindowPos.x; |
4107 tapEvent.y = tapPointWindowPos.y; | 4114 tapEvent.y = tapPointWindowPos.y; |
4108 tapEvent.type = WebInputEvent::GestureTap; | 4115 tapEvent.type = WebInputEvent::GestureTap; |
4116 // For a synthetic event, should be ok to use touchpad. | |
4117 tapEvent.sourceDevice = WebGestureDeviceTouchpad; | |
tdresser
2015/10/19 12:52:39
Let's make this touch, as we never dispatch tap ev
wjmaclean
2015/10/19 15:26:55
Done.
| |
4109 tapEvent.data.tap.tapCount = 1; | 4118 tapEvent.data.tap.tapCount = 1; |
4110 tapEvent.data.tap.width = tapArea.width; | 4119 tapEvent.data.tap.width = tapArea.width; |
4111 tapEvent.data.tap.height = tapArea.height; | 4120 tapEvent.data.tap.height = tapArea.height; |
4112 | 4121 |
4113 PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), tapE vent); | 4122 PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), tapE vent); |
4114 | 4123 |
4115 HitTestResult result = m_page->deprecatedLocalMainFrame()->eventHandler().hi tTestResultForGestureEvent(platformEvent, HitTestRequest::ReadOnly | HitTestRequ est::Active).hitTestResult(); | 4124 HitTestResult result = m_page->deprecatedLocalMainFrame()->eventHandler().hi tTestResultForGestureEvent(platformEvent, HitTestRequest::ReadOnly | HitTestRequ est::Active).hitTestResult(); |
4116 | 4125 |
4117 result.setToShadowHostIfInUserAgentShadowRoot(); | 4126 result.setToShadowHostIfInUserAgentShadowRoot(); |
4118 return result; | 4127 return result; |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4450 if (m_pageColorOverlay) | 4459 if (m_pageColorOverlay) |
4451 m_pageColorOverlay->update(); | 4460 m_pageColorOverlay->update(); |
4452 if (InspectorOverlay* overlay = inspectorOverlay()) { | 4461 if (InspectorOverlay* overlay = inspectorOverlay()) { |
4453 PageOverlay* inspectorPageOverlay = overlay->pageOverlay(); | 4462 PageOverlay* inspectorPageOverlay = overlay->pageOverlay(); |
4454 if (inspectorPageOverlay) | 4463 if (inspectorPageOverlay) |
4455 inspectorPageOverlay->update(); | 4464 inspectorPageOverlay->update(); |
4456 } | 4465 } |
4457 } | 4466 } |
4458 | 4467 |
4459 } // namespace blink | 4468 } // namespace blink |
OLD | NEW |