| 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 2399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2410 | 2410 |
| 2411 return true; | 2411 return true; |
| 2412 } | 2412 } |
| 2413 | 2413 |
| 2414 bool EventHandler::handleGestureScrollUpdate(const PlatformGestureEvent& gesture
Event) | 2414 bool EventHandler::handleGestureScrollUpdate(const PlatformGestureEvent& gesture
Event) |
| 2415 { | 2415 { |
| 2416 FloatSize delta(gestureEvent.deltaX(), gestureEvent.deltaY()); | 2416 FloatSize delta(gestureEvent.deltaX(), gestureEvent.deltaY()); |
| 2417 if (delta.isZero()) | 2417 if (delta.isZero()) |
| 2418 return false; | 2418 return false; |
| 2419 | 2419 |
| 2420 const float scaleFactor = m_frame->pageZoomFactor(); | |
| 2421 delta.scale(1 / scaleFactor, 1 / scaleFactor); | |
| 2422 | |
| 2423 Node* node = m_scrollGestureHandlingNode.get(); | 2420 Node* node = m_scrollGestureHandlingNode.get(); |
| 2424 if (!node) | 2421 if (!node) |
| 2425 return sendScrollEventToView(gestureEvent, delta); | 2422 return sendScrollEventToView(gestureEvent, delta); |
| 2426 | 2423 |
| 2427 // Ignore this event if the targeted node does not have a valid renderer. | 2424 // Ignore this event if the targeted node does not have a valid renderer. |
| 2428 RenderObject* renderer = node->renderer(); | 2425 RenderObject* renderer = node->renderer(); |
| 2429 if (!renderer) | 2426 if (!renderer) |
| 2430 return false; | 2427 return false; |
| 2431 | 2428 |
| 2432 RefPtr<FrameView> protector(m_frame->view()); | 2429 RefPtr<FrameView> protector(m_frame->view()); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2455 | 2452 |
| 2456 if (horizontalScroll || verticalScroll) { | 2453 if (horizontalScroll || verticalScroll) { |
| 2457 setFrameWasScrolledByUser(); | 2454 setFrameWasScrolledByUser(); |
| 2458 return true; | 2455 return true; |
| 2459 } | 2456 } |
| 2460 | 2457 |
| 2461 // Otherwise try to scroll the view. | 2458 // Otherwise try to scroll the view. |
| 2462 return sendScrollEventToView(gestureEvent, delta); | 2459 return sendScrollEventToView(gestureEvent, delta); |
| 2463 } | 2460 } |
| 2464 | 2461 |
| 2465 bool EventHandler::sendScrollEventToView(const PlatformGestureEvent& gestureEven
t, const FloatSize& scaledDelta) | 2462 bool EventHandler::sendScrollEventToView(const PlatformGestureEvent& gestureEven
t, const FloatSize& delta) |
| 2466 { | 2463 { |
| 2467 FrameView* view = m_frame->view(); | 2464 FrameView* view = m_frame->view(); |
| 2468 if (!view) | 2465 if (!view) |
| 2469 return false; | 2466 return false; |
| 2470 | 2467 |
| 2471 const float tickDivisor = static_cast<float>(WheelEvent::TickMultiplier); | 2468 const float tickDivisor = static_cast<float>(WheelEvent::TickMultiplier); |
| 2472 IntPoint point(gestureEvent.position().x(), gestureEvent.position().y()); | 2469 IntPoint point(gestureEvent.position().x(), gestureEvent.position().y()); |
| 2473 IntPoint globalPoint(gestureEvent.globalPosition().x(), gestureEvent.globalP
osition().y()); | 2470 IntPoint globalPoint(gestureEvent.globalPosition().x(), gestureEvent.globalP
osition().y()); |
| 2474 PlatformWheelEvent syntheticWheelEvent(point, globalPoint, | 2471 PlatformWheelEvent syntheticWheelEvent(point, globalPoint, |
| 2475 scaledDelta.width(), scaledDelta.height(), | 2472 delta.width(), delta.height(), |
| 2476 scaledDelta.width() / tickDivisor, scaledDelta.height() / tickDivisor, | 2473 delta.width() / tickDivisor, delta.height() / tickDivisor, |
| 2477 ScrollByPixelWheelEvent, | 2474 ScrollByPixelWheelEvent, |
| 2478 gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey(),
gestureEvent.metaKey()); | 2475 gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey(),
gestureEvent.metaKey()); |
| 2479 syntheticWheelEvent.setHasPreciseScrollingDeltas(true); | 2476 syntheticWheelEvent.setHasPreciseScrollingDeltas(true); |
| 2480 | 2477 |
| 2481 bool scrolledFrame = view->wheelEvent(syntheticWheelEvent); | 2478 bool scrolledFrame = view->wheelEvent(syntheticWheelEvent); |
| 2482 if (scrolledFrame) | 2479 if (scrolledFrame) |
| 2483 setFrameWasScrolledByUser(); | 2480 setFrameWasScrolledByUser(); |
| 2484 | 2481 |
| 2485 return scrolledFrame; | 2482 return scrolledFrame; |
| 2486 } | 2483 } |
| (...skipping 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3868 unsigned EventHandler::accessKeyModifiers() | 3865 unsigned EventHandler::accessKeyModifiers() |
| 3869 { | 3866 { |
| 3870 #if OS(MACOSX) | 3867 #if OS(MACOSX) |
| 3871 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3868 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
| 3872 #else | 3869 #else |
| 3873 return PlatformEvent::AltKey; | 3870 return PlatformEvent::AltKey; |
| 3874 #endif | 3871 #endif |
| 3875 } | 3872 } |
| 3876 | 3873 |
| 3877 } // namespace blink | 3874 } // namespace blink |
| OLD | NEW |