| 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 2406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2417 | 2417 |
| 2418 return true; | 2418 return true; |
| 2419 } | 2419 } |
| 2420 | 2420 |
| 2421 bool EventHandler::handleGestureScrollUpdate(const PlatformGestureEvent& gesture
Event) | 2421 bool EventHandler::handleGestureScrollUpdate(const PlatformGestureEvent& gesture
Event) |
| 2422 { | 2422 { |
| 2423 FloatSize delta(gestureEvent.deltaX(), gestureEvent.deltaY()); | 2423 FloatSize delta(gestureEvent.deltaX(), gestureEvent.deltaY()); |
| 2424 if (delta.isZero()) | 2424 if (delta.isZero()) |
| 2425 return false; | 2425 return false; |
| 2426 | 2426 |
| 2427 const float scaleFactor = m_frame->pageZoomFactor(); | |
| 2428 delta.scale(1 / scaleFactor, 1 / scaleFactor); | |
| 2429 | |
| 2430 Node* node = m_scrollGestureHandlingNode.get(); | 2427 Node* node = m_scrollGestureHandlingNode.get(); |
| 2431 if (!node) | 2428 if (!node) |
| 2432 return sendScrollEventToView(gestureEvent, delta); | 2429 return sendScrollEventToView(gestureEvent, delta); |
| 2433 | 2430 |
| 2434 // Ignore this event if the targeted node does not have a valid renderer. | 2431 // Ignore this event if the targeted node does not have a valid renderer. |
| 2435 RenderObject* renderer = node->renderer(); | 2432 RenderObject* renderer = node->renderer(); |
| 2436 if (!renderer) | 2433 if (!renderer) |
| 2437 return false; | 2434 return false; |
| 2438 | 2435 |
| 2439 RefPtr<FrameView> protector(m_frame->view()); | 2436 RefPtr<FrameView> protector(m_frame->view()); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2462 | 2459 |
| 2463 if (horizontalScroll || verticalScroll) { | 2460 if (horizontalScroll || verticalScroll) { |
| 2464 setFrameWasScrolledByUser(); | 2461 setFrameWasScrolledByUser(); |
| 2465 return true; | 2462 return true; |
| 2466 } | 2463 } |
| 2467 | 2464 |
| 2468 // Otherwise try to scroll the view. | 2465 // Otherwise try to scroll the view. |
| 2469 return sendScrollEventToView(gestureEvent, delta); | 2466 return sendScrollEventToView(gestureEvent, delta); |
| 2470 } | 2467 } |
| 2471 | 2468 |
| 2472 bool EventHandler::sendScrollEventToView(const PlatformGestureEvent& gestureEven
t, const FloatSize& scaledDelta) | 2469 bool EventHandler::sendScrollEventToView(const PlatformGestureEvent& gestureEven
t, const FloatSize& delta) |
| 2473 { | 2470 { |
| 2474 FrameView* view = m_frame->view(); | 2471 FrameView* view = m_frame->view(); |
| 2475 if (!view) | 2472 if (!view) |
| 2476 return false; | 2473 return false; |
| 2477 | 2474 |
| 2478 const float tickDivisor = static_cast<float>(WheelEvent::TickMultiplier); | 2475 const float tickDivisor = static_cast<float>(WheelEvent::TickMultiplier); |
| 2479 IntPoint point(gestureEvent.position().x(), gestureEvent.position().y()); | 2476 IntPoint point(gestureEvent.position().x(), gestureEvent.position().y()); |
| 2480 IntPoint globalPoint(gestureEvent.globalPosition().x(), gestureEvent.globalP
osition().y()); | 2477 IntPoint globalPoint(gestureEvent.globalPosition().x(), gestureEvent.globalP
osition().y()); |
| 2481 PlatformWheelEvent syntheticWheelEvent(point, globalPoint, | 2478 PlatformWheelEvent syntheticWheelEvent(point, globalPoint, |
| 2482 scaledDelta.width(), scaledDelta.height(), | 2479 delta.width(), delta.height(), |
| 2483 scaledDelta.width() / tickDivisor, scaledDelta.height() / tickDivisor, | 2480 delta.width() / tickDivisor, delta.height() / tickDivisor, |
| 2484 ScrollByPixelWheelEvent, | 2481 ScrollByPixelWheelEvent, |
| 2485 gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey(),
gestureEvent.metaKey()); | 2482 gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey(),
gestureEvent.metaKey()); |
| 2486 syntheticWheelEvent.setHasPreciseScrollingDeltas(true); | 2483 syntheticWheelEvent.setHasPreciseScrollingDeltas(true); |
| 2487 | 2484 |
| 2488 bool scrolledFrame = view->wheelEvent(syntheticWheelEvent); | 2485 bool scrolledFrame = view->wheelEvent(syntheticWheelEvent); |
| 2489 if (scrolledFrame) | 2486 if (scrolledFrame) |
| 2490 setFrameWasScrolledByUser(); | 2487 setFrameWasScrolledByUser(); |
| 2491 | 2488 |
| 2492 return scrolledFrame; | 2489 return scrolledFrame; |
| 2493 } | 2490 } |
| (...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3877 unsigned EventHandler::accessKeyModifiers() | 3874 unsigned EventHandler::accessKeyModifiers() |
| 3878 { | 3875 { |
| 3879 #if OS(MACOSX) | 3876 #if OS(MACOSX) |
| 3880 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3877 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
| 3881 #else | 3878 #else |
| 3882 return PlatformEvent::AltKey; | 3879 return PlatformEvent::AltKey; |
| 3883 #endif | 3880 #endif |
| 3884 } | 3881 } |
| 3885 | 3882 |
| 3886 } // namespace blink | 3883 } // namespace blink |
| OLD | NEW |