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 2558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2569 } else if (gestureEvent.type() == PlatformEvent::GestureTap) { | 2569 } else if (gestureEvent.type() == PlatformEvent::GestureTap) { |
2570 // If the Tap is received very shortly after ShowPress, we want to | 2570 // If the Tap is received very shortly after ShowPress, we want to |
2571 // delay clearing of the active state so that it's visible to the user | 2571 // delay clearing of the active state so that it's visible to the user |
2572 // for at least a couple of frames. | 2572 // for at least a couple of frames. |
2573 activeInterval = WTF::currentTime() - m_lastShowPressTimestamp; | 2573 activeInterval = WTF::currentTime() - m_lastShowPressTimestamp; |
2574 shouldKeepActiveForMinInterval = m_lastShowPressTimestamp && activeInter
val < minimumActiveInterval; | 2574 shouldKeepActiveForMinInterval = m_lastShowPressTimestamp && activeInter
val < minimumActiveInterval; |
2575 if (shouldKeepActiveForMinInterval) | 2575 if (shouldKeepActiveForMinInterval) |
2576 hitType |= HitTestRequest::ReadOnly; | 2576 hitType |= HitTestRequest::ReadOnly; |
2577 } | 2577 } |
2578 | 2578 |
2579 // Perform the rect-based hit-test. Note that we don't yet apply hover/activ
e state here | 2579 // Perform the rect-based hit-test (or point-based if adjustment is disabled
). Note that |
2580 // because we need to resolve touch adjustment first so that we apply hover/
active it to | 2580 // we don't yet apply hover/active state here because we need to resolve tou
ch adjustment |
2581 // the final adjusted node. | 2581 // first so that we apply hover/active it to the final adjusted node. |
2582 IntPoint hitTestPoint = m_frame->view()->windowToContents(gestureEvent.posit
ion()); | 2582 IntPoint hitTestPoint = m_frame->view()->windowToContents(gestureEvent.posit
ion()); |
2583 IntSize touchRadius = gestureEvent.area(); | 2583 LayoutSize padding; |
2584 touchRadius.scale(1.f / 2); | 2584 if (shouldApplyTouchAdjustment(gestureEvent)) { |
2585 // FIXME: We should not do a rect-based hit-test if touch adjustment is disa
bled. | 2585 padding = gestureEvent.area(); |
2586 HitTestResult hitTestResult = hitTestResultAtPoint(hitTestPoint, hitType | H
itTestRequest::ReadOnly, touchRadius); | 2586 padding.scale(1.f / 2); |
| 2587 } |
| 2588 HitTestResult hitTestResult = hitTestResultAtPoint(hitTestPoint, hitType | H
itTestRequest::ReadOnly, padding); |
2587 | 2589 |
2588 // Hit-test the main frame scrollbars (in addition to the child-frame and Re
nderLayer | 2590 // Hit-test the main frame scrollbars (in addition to the child-frame and Re
nderLayer |
2589 // scroll bars checked by the hit-test code. | 2591 // scroll bars checked by the hit-test code. |
2590 if (!hitTestResult.scrollbar()) { | 2592 if (!hitTestResult.scrollbar()) { |
2591 if (FrameView* view = m_frame->view()) { | 2593 if (FrameView* view = m_frame->view()) { |
2592 hitTestResult.setScrollbar(view->scrollbarAtPoint(gestureEvent.posit
ion())); | 2594 hitTestResult.setScrollbar(view->scrollbarAtPoint(gestureEvent.posit
ion())); |
2593 } | 2595 } |
2594 } | 2596 } |
2595 | 2597 |
2596 // Adjust the location of the gesture to the most likely nearby node, as app
ropriate for the | 2598 // Adjust the location of the gesture to the most likely nearby node, as app
ropriate for the |
(...skipping 11 matching lines...) Expand all Loading... |
2608 hitFrame = m_frame; | 2610 hitFrame = m_frame; |
2609 hitTestResult = hitTestResultInFrame(hitFrame, hitFrame->view()->windowT
oContents(adjustedEvent.position()), hitType | HitTestRequest::ReadOnly); | 2611 hitTestResult = hitTestResultInFrame(hitFrame, hitFrame->view()->windowT
oContents(adjustedEvent.position()), hitType | HitTestRequest::ReadOnly); |
2610 // FIXME: HitTest entry points should really check for main frame scroll
bars themselves. | 2612 // FIXME: HitTest entry points should really check for main frame scroll
bars themselves. |
2611 if (!hitTestResult.scrollbar()) { | 2613 if (!hitTestResult.scrollbar()) { |
2612 if (FrameView* view = m_frame->view()) { | 2614 if (FrameView* view = m_frame->view()) { |
2613 hitTestResult.setScrollbar(view->scrollbarAtPoint(gestureEvent.p
osition())); | 2615 hitTestResult.setScrollbar(view->scrollbarAtPoint(gestureEvent.p
osition())); |
2614 } | 2616 } |
2615 } | 2617 } |
2616 } | 2618 } |
2617 | 2619 |
| 2620 // If we did a rect-based hit test it must be resolved to the best single no
de by now to |
| 2621 // ensure consumers don't accidentally use one of the other candidates. |
| 2622 ASSERT(!hitTestResult.isRectBasedTest()); |
| 2623 |
2618 // Now apply hover/active state to the final target. | 2624 // Now apply hover/active state to the final target. |
2619 // FIXME: This is supposed to send mouseenter/mouseleave events, but doesn't
because we | 2625 // FIXME: This is supposed to send mouseenter/mouseleave events, but doesn't
because we |
2620 // aren't passing a PlatformMouseEvent. | 2626 // aren't passing a PlatformMouseEvent. |
2621 HitTestRequest request(hitType | HitTestRequest::AllowChildFrameContent); | 2627 HitTestRequest request(hitType | HitTestRequest::AllowChildFrameContent); |
2622 if (!request.readOnly()) | 2628 if (!request.readOnly()) |
2623 m_frame->document()->updateHoverActiveState(request, hitTestResult.inner
Element()); | 2629 m_frame->document()->updateHoverActiveState(request, hitTestResult.inner
Element()); |
2624 | 2630 |
2625 if (shouldKeepActiveForMinInterval) { | 2631 if (shouldKeepActiveForMinInterval) { |
2626 m_lastDeferredTapElement = hitTestResult.innerElement(); | 2632 m_lastDeferredTapElement = hitTestResult.innerElement(); |
2627 m_activeIntervalTimer.startOneShot(minimumActiveInterval - activeInterva
l, FROM_HERE); | 2633 m_activeIntervalTimer.startOneShot(minimumActiveInterval - activeInterva
l, FROM_HERE); |
(...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3882 unsigned EventHandler::accessKeyModifiers() | 3888 unsigned EventHandler::accessKeyModifiers() |
3883 { | 3889 { |
3884 #if OS(MACOSX) | 3890 #if OS(MACOSX) |
3885 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3891 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
3886 #else | 3892 #else |
3887 return PlatformEvent::AltKey; | 3893 return PlatformEvent::AltKey; |
3888 #endif | 3894 #endif |
3889 } | 3895 } |
3890 | 3896 |
3891 } // namespace blink | 3897 } // namespace blink |
OLD | NEW |