| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
| 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) | 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 2191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2202 if (!eventSwallowed) | 2202 if (!eventSwallowed) |
| 2203 eventSwallowed = eventTarget->dispatchGestureEvent(gestureEvent); | 2203 eventSwallowed = eventTarget->dispatchGestureEvent(gestureEvent); |
| 2204 if (eventSwallowed) | 2204 if (eventSwallowed) |
| 2205 return true; | 2205 return true; |
| 2206 } | 2206 } |
| 2207 | 2207 |
| 2208 switch (gestureEvent.type()) { | 2208 switch (gestureEvent.type()) { |
| 2209 case PlatformEvent::GestureScrollBegin: | 2209 case PlatformEvent::GestureScrollBegin: |
| 2210 return handleGestureScrollBegin(gestureEvent); | 2210 return handleGestureScrollBegin(gestureEvent); |
| 2211 case PlatformEvent::GestureScrollUpdate: | 2211 case PlatformEvent::GestureScrollUpdate: |
| 2212 case PlatformEvent::GestureScrollUpdateWithoutPropagation: | |
| 2213 return handleGestureScrollUpdate(gestureEvent); | 2212 return handleGestureScrollUpdate(gestureEvent); |
| 2214 case PlatformEvent::GestureScrollEnd: | 2213 case PlatformEvent::GestureScrollEnd: |
| 2215 return handleGestureScrollEnd(gestureEvent); | 2214 return handleGestureScrollEnd(gestureEvent); |
| 2216 case PlatformEvent::GestureFlingStart: | 2215 case PlatformEvent::GestureFlingStart: |
| 2217 case PlatformEvent::GesturePinchBegin: | 2216 case PlatformEvent::GesturePinchBegin: |
| 2218 case PlatformEvent::GesturePinchEnd: | 2217 case PlatformEvent::GesturePinchEnd: |
| 2219 case PlatformEvent::GesturePinchUpdate: | 2218 case PlatformEvent::GesturePinchUpdate: |
| 2220 return false; | 2219 return false; |
| 2221 default: | 2220 default: |
| 2222 ASSERT_NOT_REACHED(); | 2221 ASSERT_NOT_REACHED(); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2372 bool EventHandler::handleScrollGestureOnResizer(Node* eventTarget, const Platfor
mGestureEvent& gestureEvent) { | 2371 bool EventHandler::handleScrollGestureOnResizer(Node* eventTarget, const Platfor
mGestureEvent& gestureEvent) { |
| 2373 if (gestureEvent.type() == PlatformEvent::GestureScrollBegin) { | 2372 if (gestureEvent.type() == PlatformEvent::GestureScrollBegin) { |
| 2374 RenderLayer* layer = eventTarget->renderer() ? eventTarget->renderer()->
enclosingLayer() : nullptr; | 2373 RenderLayer* layer = eventTarget->renderer() ? eventTarget->renderer()->
enclosingLayer() : nullptr; |
| 2375 IntPoint p = m_frame->view()->windowToContents(gestureEvent.position()); | 2374 IntPoint p = m_frame->view()->windowToContents(gestureEvent.position()); |
| 2376 if (layer && layer->scrollableArea() && layer->scrollableArea()->isPoint
InResizeControl(p, ResizerForTouch)) { | 2375 if (layer && layer->scrollableArea() && layer->scrollableArea()->isPoint
InResizeControl(p, ResizerForTouch)) { |
| 2377 m_resizeScrollableArea = layer->scrollableArea(); | 2376 m_resizeScrollableArea = layer->scrollableArea(); |
| 2378 m_resizeScrollableArea->setInResizeMode(true); | 2377 m_resizeScrollableArea->setInResizeMode(true); |
| 2379 m_offsetFromResizeCorner = LayoutSize(m_resizeScrollableArea->offset
FromResizeCorner(p)); | 2378 m_offsetFromResizeCorner = LayoutSize(m_resizeScrollableArea->offset
FromResizeCorner(p)); |
| 2380 return true; | 2379 return true; |
| 2381 } | 2380 } |
| 2382 } else if (gestureEvent.type() == PlatformEvent::GestureScrollUpdate || | 2381 } else if (gestureEvent.type() == PlatformEvent::GestureScrollUpdate) { |
| 2383 gestureEvent.type() == PlatformEvent::GestureScrollUpdateWithoutP
ropagation) { | |
| 2384 if (m_resizeScrollableArea && m_resizeScrollableArea->inResizeMode()) { | 2382 if (m_resizeScrollableArea && m_resizeScrollableArea->inResizeMode()) { |
| 2385 m_resizeScrollableArea->resize(gestureEvent, m_offsetFromResizeCorne
r); | 2383 m_resizeScrollableArea->resize(gestureEvent, m_offsetFromResizeCorne
r); |
| 2386 return true; | 2384 return true; |
| 2387 } | 2385 } |
| 2388 } else if (gestureEvent.type() == PlatformEvent::GestureScrollEnd) { | 2386 } else if (gestureEvent.type() == PlatformEvent::GestureScrollEnd) { |
| 2389 if (m_resizeScrollableArea && m_resizeScrollableArea->inResizeMode()) { | 2387 if (m_resizeScrollableArea && m_resizeScrollableArea->inResizeMode()) { |
| 2390 m_resizeScrollableArea->setInResizeMode(false); | 2388 m_resizeScrollableArea->setInResizeMode(false); |
| 2391 m_resizeScrollableArea = nullptr; | 2389 m_resizeScrollableArea = nullptr; |
| 2392 return false; | 2390 return false; |
| 2393 } | 2391 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2449 | 2447 |
| 2450 static bool scrollAreaOnBothAxes(const FloatSize& delta, ScrollableArea& view) | 2448 static bool scrollAreaOnBothAxes(const FloatSize& delta, ScrollableArea& view) |
| 2451 { | 2449 { |
| 2452 bool scrolledHorizontal = view.scroll(ScrollLeft, ScrollByPrecisePixel, delt
a.width()); | 2450 bool scrolledHorizontal = view.scroll(ScrollLeft, ScrollByPrecisePixel, delt
a.width()); |
| 2453 bool scrolledVertical = view.scroll(ScrollUp, ScrollByPrecisePixel, delta.he
ight()); | 2451 bool scrolledVertical = view.scroll(ScrollUp, ScrollByPrecisePixel, delta.he
ight()); |
| 2454 return scrolledHorizontal || scrolledVertical; | 2452 return scrolledHorizontal || scrolledVertical; |
| 2455 } | 2453 } |
| 2456 | 2454 |
| 2457 bool EventHandler::handleGestureScrollUpdate(const PlatformGestureEvent& gesture
Event) | 2455 bool EventHandler::handleGestureScrollUpdate(const PlatformGestureEvent& gesture
Event) |
| 2458 { | 2456 { |
| 2457 ASSERT(gestureEvent.type() == PlatformEvent::GestureScrollUpdate); |
| 2458 |
| 2459 FloatSize delta(gestureEvent.deltaX(), gestureEvent.deltaY()); | 2459 FloatSize delta(gestureEvent.deltaX(), gestureEvent.deltaY()); |
| 2460 if (delta.isZero()) | 2460 if (delta.isZero()) |
| 2461 return false; | 2461 return false; |
| 2462 | 2462 |
| 2463 Node* node = m_scrollGestureHandlingNode.get(); | 2463 Node* node = m_scrollGestureHandlingNode.get(); |
| 2464 if (node) { | 2464 if (node) { |
| 2465 RenderObject* renderer = node->renderer(); | 2465 RenderObject* renderer = node->renderer(); |
| 2466 if (!renderer) | 2466 if (!renderer) |
| 2467 return false; | 2467 return false; |
| 2468 | 2468 |
| 2469 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); | 2469 RefPtrWillBeRawPtr<FrameView> protector(m_frame->view()); |
| 2470 | 2470 |
| 2471 Node* stopNode = nullptr; | 2471 Node* stopNode = nullptr; |
| 2472 bool scrollShouldNotPropagate = gestureEvent.type() == PlatformEvent::Ge
stureScrollUpdateWithoutPropagation | |
| 2473 || (gestureEvent.type() == PlatformEvent::GestureScrollUpdate && ges
tureEvent.preventPropagation()); | |
| 2474 | 2472 |
| 2475 // Try to send the event to the correct view. | 2473 // Try to send the event to the correct view. |
| 2476 if (passScrollGestureEventToWidget(gestureEvent, renderer)) { | 2474 if (passScrollGestureEventToWidget(gestureEvent, renderer)) { |
| 2477 if (scrollShouldNotPropagate) | 2475 if (gestureEvent.preventPropagation()) |
| 2478 m_previousGestureScrolledNode = m_scrollGestureHandlingNode; | 2476 m_previousGestureScrolledNode = m_scrollGestureHandlingNode; |
| 2479 | 2477 |
| 2480 return true; | 2478 return true; |
| 2481 } | 2479 } |
| 2482 | 2480 |
| 2483 if (scrollShouldNotPropagate) | 2481 |
| 2482 if (gestureEvent.preventPropagation()) |
| 2484 stopNode = m_previousGestureScrolledNode.get(); | 2483 stopNode = m_previousGestureScrolledNode.get(); |
| 2485 | 2484 |
| 2486 // First try to scroll the closest scrollable RenderBox ancestor of |nod
e|. | 2485 // First try to scroll the closest scrollable RenderBox ancestor of |nod
e|. |
| 2487 ScrollGranularity granularity = ScrollByPixel; | 2486 ScrollGranularity granularity = ScrollByPixel; |
| 2488 bool horizontalScroll = scroll(ScrollLeft, granularity, node, &stopNode,
delta.width()); | 2487 bool horizontalScroll = scroll(ScrollLeft, granularity, node, &stopNode,
delta.width()); |
| 2489 bool verticalScroll = scroll(ScrollUp, granularity, node, &stopNode, del
ta.height()); | 2488 bool verticalScroll = scroll(ScrollUp, granularity, node, &stopNode, del
ta.height()); |
| 2490 | 2489 |
| 2491 if (scrollShouldNotPropagate) | 2490 if (gestureEvent.preventPropagation()) |
| 2492 m_previousGestureScrolledNode = stopNode; | 2491 m_previousGestureScrolledNode = stopNode; |
| 2493 | 2492 |
| 2494 if (horizontalScroll || verticalScroll) { | 2493 if (horizontalScroll || verticalScroll) { |
| 2495 setFrameWasScrolledByUser(); | 2494 setFrameWasScrolledByUser(); |
| 2496 return true; | 2495 return true; |
| 2497 } | 2496 } |
| 2498 } | 2497 } |
| 2499 | 2498 |
| 2500 // Try to scroll the frame view. | 2499 // Try to scroll the frame view. |
| 2501 FrameView* view = m_frame->view(); | 2500 FrameView* view = m_frame->view(); |
| (...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3863 unsigned EventHandler::accessKeyModifiers() | 3862 unsigned EventHandler::accessKeyModifiers() |
| 3864 { | 3863 { |
| 3865 #if OS(MACOSX) | 3864 #if OS(MACOSX) |
| 3866 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3865 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
| 3867 #else | 3866 #else |
| 3868 return PlatformEvent::AltKey; | 3867 return PlatformEvent::AltKey; |
| 3869 #endif | 3868 #endif |
| 3870 } | 3869 } |
| 3871 | 3870 |
| 3872 } // namespace blink | 3871 } // namespace blink |
| OLD | NEW |