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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 void WebViewImpl::transferActiveWheelFlingAnimation(const WebActiveWheelFlingPar
ameters& parameters) | 907 void WebViewImpl::transferActiveWheelFlingAnimation(const WebActiveWheelFlingPar
ameters& parameters) |
907 { | 908 { |
908 TRACE_EVENT0("blink", "WebViewImpl::transferActiveWheelFlingAnimation"); | 909 TRACE_EVENT0("blink", "WebViewImpl::transferActiveWheelFlingAnimation"); |
909 ASSERT(!m_gestureAnimation); | 910 ASSERT(!m_gestureAnimation); |
910 m_positionOnFlingStart = parameters.point; | 911 m_positionOnFlingStart = parameters.point; |
911 m_globalPositionOnFlingStart = parameters.globalPoint; | 912 m_globalPositionOnFlingStart = parameters.globalPoint; |
912 m_flingModifier = parameters.modifiers; | 913 m_flingModifier = parameters.modifiers; |
913 OwnPtr<WebGestureCurve> curve = adoptPtr(Platform::current()->createFlingAni
mationCurve(parameters.sourceDevice, WebFloatPoint(parameters.delta), parameters
.cumulativeScroll)); | 914 OwnPtr<WebGestureCurve> curve = adoptPtr(Platform::current()->createFlingAni
mationCurve(parameters.sourceDevice, WebFloatPoint(parameters.delta), parameters
.cumulativeScroll)); |
914 ASSERT(curve); | 915 ASSERT(curve); |
915 m_gestureAnimation = WebActiveGestureAnimation::createWithTimeOffset(curve.r
elease(), this, parameters.startTime); | 916 m_gestureAnimation = WebActiveGestureAnimation::createWithTimeOffset(curve.r
elease(), this, parameters.startTime); |
| 917 m_flingSourceDevice = parameters.sourceDevice; |
916 scheduleAnimation(); | 918 scheduleAnimation(); |
917 } | 919 } |
918 | 920 |
919 bool WebViewImpl::endActiveFlingAnimation() | 921 bool WebViewImpl::endActiveFlingAnimation() |
920 { | 922 { |
921 if (m_gestureAnimation) { | 923 if (m_gestureAnimation) { |
922 m_gestureAnimation.clear(); | 924 m_gestureAnimation.clear(); |
| 925 m_flingSourceDevice = WebGestureDeviceUninitialized; |
923 if (m_layerTreeView) | 926 if (m_layerTreeView) |
924 m_layerTreeView->didStopFlinging(); | 927 m_layerTreeView->didStopFlinging(); |
925 return true; | 928 return true; |
926 } | 929 } |
927 return false; | 930 return false; |
928 } | 931 } |
929 | 932 |
930 bool WebViewImpl::startPageScaleAnimation(const IntPoint& targetPosition, bool u
seAnchor, float newScale, double durationInSeconds) | 933 bool WebViewImpl::startPageScaleAnimation(const IntPoint& targetPosition, bool u
seAnchor, float newScale, double durationInSeconds) |
931 { | 934 { |
932 VisualViewport& visualViewport = page()->frameHost().visualViewport(); | 935 VisualViewport& visualViewport = page()->frameHost().visualViewport(); |
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1865 TRACE_EVENT1("blink", "WebViewImpl::beginFrame", "frameTime", frameTime.last
FrameTimeMonotonic); | 1868 TRACE_EVENT1("blink", "WebViewImpl::beginFrame", "frameTime", frameTime.last
FrameTimeMonotonic); |
1866 ASSERT(frameTime.lastFrameTimeMonotonic); | 1869 ASSERT(frameTime.lastFrameTimeMonotonic); |
1867 | 1870 |
1868 // Create synthetic wheel events as necessary for fling. | 1871 // Create synthetic wheel events as necessary for fling. |
1869 if (m_gestureAnimation) { | 1872 if (m_gestureAnimation) { |
1870 if (m_gestureAnimation->animate(frameTime.lastFrameTimeMonotonic)) | 1873 if (m_gestureAnimation->animate(frameTime.lastFrameTimeMonotonic)) |
1871 scheduleAnimation(); | 1874 scheduleAnimation(); |
1872 else { | 1875 else { |
1873 endActiveFlingAnimation(); | 1876 endActiveFlingAnimation(); |
1874 | 1877 |
| 1878 ASSERT(m_flingSourceDevice != WebGestureDeviceUninitialized); |
1875 PlatformGestureEvent endScrollEvent(PlatformEvent::GestureScrollEnd, | 1879 PlatformGestureEvent endScrollEvent(PlatformEvent::GestureScrollEnd, |
1876 m_positionOnFlingStart, m_globalPositionOnFlingStart, | 1880 m_positionOnFlingStart, m_globalPositionOnFlingStart, |
1877 IntSize(), 0, PlatformEvent::NoModifiers); | 1881 IntSize(), 0, PlatformEvent::NoModifiers, m_flingSourceDevice ==
WebGestureDeviceTouchpad ? PlatformGestureSourceTouchpad : PlatformGestureSourc
eTouchscreen); |
1878 endScrollEvent.setScrollGestureData(0, 0, 0, 0, true, false, -1 /* n
ull plugin id */); | 1882 endScrollEvent.setScrollGestureData(0, 0, 0, 0, true, false, -1 /* n
ull plugin id */); |
1879 | 1883 |
1880 mainFrameImpl()->frame()->eventHandler().handleGestureScrollEnd(endS
crollEvent); | 1884 mainFrameImpl()->frame()->eventHandler().handleGestureScrollEnd(endS
crollEvent); |
1881 } | 1885 } |
1882 } | 1886 } |
1883 | 1887 |
1884 if (!m_page) | 1888 if (!m_page) |
1885 return; | 1889 return; |
1886 | 1890 |
1887 PageWidgetDelegate::animate(*m_page, frameTime.lastFrameTimeMonotonic); | 1891 PageWidgetDelegate::animate(*m_page, frameTime.lastFrameTimeMonotonic); |
(...skipping 2562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4450 if (m_pageColorOverlay) | 4454 if (m_pageColorOverlay) |
4451 m_pageColorOverlay->update(); | 4455 m_pageColorOverlay->update(); |
4452 if (InspectorOverlay* overlay = inspectorOverlay()) { | 4456 if (InspectorOverlay* overlay = inspectorOverlay()) { |
4453 PageOverlay* inspectorPageOverlay = overlay->pageOverlay(); | 4457 PageOverlay* inspectorPageOverlay = overlay->pageOverlay(); |
4454 if (inspectorPageOverlay) | 4458 if (inspectorPageOverlay) |
4455 inspectorPageOverlay->update(); | 4459 inspectorPageOverlay->update(); |
4456 } | 4460 } |
4457 } | 4461 } |
4458 | 4462 |
4459 } // namespace blink | 4463 } // namespace blink |
OLD | NEW |