Chromium Code Reviews| 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 348 m_previousGestureScrolledNode = 0; | 348 m_previousGestureScrolledNode = 0; |
| 349 m_scrollbarHandlingScrollGesture = 0; | 349 m_scrollbarHandlingScrollGesture = 0; |
| 350 m_maxMouseMovedDuration = 0; | 350 m_maxMouseMovedDuration = 0; |
| 351 m_baseEventType = PlatformEvent::NoType; | 351 m_baseEventType = PlatformEvent::NoType; |
| 352 m_didStartDrag = false; | 352 m_didStartDrag = false; |
| 353 m_touchPressed = false; | 353 m_touchPressed = false; |
| 354 m_mouseDownMayStartSelect = false; | 354 m_mouseDownMayStartSelect = false; |
| 355 m_mouseDownMayStartDrag = false; | 355 m_mouseDownMayStartDrag = false; |
| 356 m_lastShowPressTimestamp = 0; | 356 m_lastShowPressTimestamp = 0; |
| 357 m_lastDeferredTapElement = 0; | 357 m_lastDeferredTapElement = 0; |
| 358 m_elementHandlingGestureSequence = 0; | |
| 358 } | 359 } |
| 359 | 360 |
| 360 void EventHandler::nodeWillBeRemoved(Node& nodeToBeRemoved) | 361 void EventHandler::nodeWillBeRemoved(Node& nodeToBeRemoved) |
| 361 { | 362 { |
| 362 if (!nodeToBeRemoved.containsIncludingShadowDOM(m_clickNode.get())) | 363 if (!nodeToBeRemoved.containsIncludingShadowDOM(m_clickNode.get())) |
| 363 return; | 364 return; |
| 364 if (nodeToBeRemoved.isInShadowTree()) { | 365 if (nodeToBeRemoved.isInShadowTree()) { |
| 365 m_clickNode = nodeToBeRemoved.parentOrShadowHostNode(); | 366 m_clickNode = nodeToBeRemoved.parentOrShadowHostNode(); |
| 366 } else { | 367 } else { |
| 367 // We don't dispatch click events if the mousedown node is removed | 368 // We don't dispatch click events if the mousedown node is removed |
| (...skipping 1929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2297 // of the active state so that it's visible to the user for at least one frame. | 2298 // of the active state so that it's visible to the user for at least one frame. |
| 2298 activeInterval = WTF::currentTime() - m_lastShowPressTimestamp; | 2299 activeInterval = WTF::currentTime() - m_lastShowPressTimestamp; |
| 2299 shouldKeepActiveForMinInterval = m_lastShowPressTimestamp && activeInter val < minimumActiveInterval; | 2300 shouldKeepActiveForMinInterval = m_lastShowPressTimestamp && activeInter val < minimumActiveInterval; |
| 2300 if (shouldKeepActiveForMinInterval) | 2301 if (shouldKeepActiveForMinInterval) |
| 2301 hitType |= HitTestRequest::ReadOnly; | 2302 hitType |= HitTestRequest::ReadOnly; |
| 2302 } | 2303 } |
| 2303 else | 2304 else |
| 2304 hitType |= HitTestRequest::Active | HitTestRequest::ReadOnly; | 2305 hitType |= HitTestRequest::Active | HitTestRequest::ReadOnly; |
| 2305 | 2306 |
| 2306 if ((!scrollbar && !eventTarget) || !(hitType & HitTestRequest::ReadOnly)) { | 2307 if ((!scrollbar && !eventTarget) || !(hitType & HitTestRequest::ReadOnly)) { |
| 2307 IntPoint hitTestPoint = m_frame->view()->windowToContents(adjustedPoint) ; | 2308 IntPoint hitTestPoint; |
| 2309 // FIXME: Track element across iframes when out of process iframes have more structure. | |
| 2310 if (m_elementHandlingGestureSequence && gestureEvent.type() != PlatformE vent::GestureTapDown) { | |
| 2311 Element* gestureElement = m_elementHandlingGestureSequence.get(); | |
|
Rick Byers
2014/02/21 03:46:54
I don't think this handles all the cases (or even
| |
| 2312 hitTestPoint.setX((gestureElement->offsetLeft() + gestureElement->of fsetWidth()) / 2); | |
| 2313 hitTestPoint.setY((gestureElement->offsetTop() + gestureElement->off setHeight()) / 2); | |
| 2314 } else { | |
| 2315 hitTestPoint = m_frame->view()->windowToContents(adjustedPoint); | |
| 2316 } | |
| 2317 | |
| 2308 HitTestResult result = hitTestResultAtPoint(hitTestPoint, hitType | HitT estRequest::AllowFrameScrollbars); | 2318 HitTestResult result = hitTestResultAtPoint(hitTestPoint, hitType | HitT estRequest::AllowFrameScrollbars); |
| 2309 | 2319 |
| 2320 if (gestureEvent.type() == PlatformEvent::GestureTapDown) | |
| 2321 m_elementHandlingGestureSequence = result.innerElement(); | |
|
Rick Byers
2014/02/21 03:46:54
you probably don't want to hold on to this indefin
| |
| 2322 | |
| 2310 if (shouldKeepActiveForMinInterval) { | 2323 if (shouldKeepActiveForMinInterval) { |
| 2311 m_lastDeferredTapElement = result.innerElement(); | 2324 m_lastDeferredTapElement = result.innerElement(); |
| 2312 m_activeIntervalTimer.startOneShot(minimumActiveInterval - activeInt erval); | 2325 m_activeIntervalTimer.startOneShot(minimumActiveInterval - activeInt erval); |
| 2313 } | 2326 } |
| 2314 | 2327 |
| 2315 eventTarget = result.targetNode(); | 2328 eventTarget = result.targetNode(); |
| 2316 if (!scrollbar) { | 2329 if (!scrollbar) { |
| 2317 FrameView* view = m_frame->view(); | 2330 FrameView* view = m_frame->view(); |
| 2318 scrollbar = view ? view->scrollbarAtPoint(gestureEvent.position()) : 0; | 2331 scrollbar = view ? view->scrollbarAtPoint(gestureEvent.position()) : 0; |
| 2319 } | 2332 } |
| 2320 if (!scrollbar) | 2333 if (!scrollbar) |
| 2321 scrollbar = result.scrollbar(); | 2334 scrollbar = result.scrollbar(); |
| 2322 } | 2335 } |
| 2323 | 2336 |
| 2324 if (scrollbar) { | 2337 if (scrollbar) { |
| 2338 // If finger was on scrollbar, it will be locked by the scroll handling code. | |
| 2339 m_elementHandlingGestureSequence = 0; | |
| 2325 bool eventSwallowed = scrollbar->gestureEvent(gestureEvent); | 2340 bool eventSwallowed = scrollbar->gestureEvent(gestureEvent); |
| 2326 if (gestureEvent.type() == PlatformEvent::GestureTapDown && eventSwallow ed) { | 2341 if (gestureEvent.type() == PlatformEvent::GestureTapDown && eventSwallow ed) { |
| 2327 m_scrollbarHandlingScrollGesture = scrollbar; | 2342 m_scrollbarHandlingScrollGesture = scrollbar; |
| 2328 } else if (gestureEvent.type() == PlatformEvent::GestureScrollEnd | 2343 } else if (gestureEvent.type() == PlatformEvent::GestureScrollEnd |
| 2329 || gestureEvent.type() == PlatformEvent::GestureFlingStart | 2344 || gestureEvent.type() == PlatformEvent::GestureFlingStart |
| 2330 || !eventSwallowed) { | 2345 || !eventSwallowed) { |
| 2331 m_scrollbarHandlingScrollGesture = 0; | 2346 m_scrollbarHandlingScrollGesture = 0; |
| 2332 } | 2347 } |
| 2333 | 2348 |
| 2334 if (eventSwallowed) | 2349 if (eventSwallowed) |
| (...skipping 1673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4008 unsigned EventHandler::accessKeyModifiers() | 4023 unsigned EventHandler::accessKeyModifiers() |
| 4009 { | 4024 { |
| 4010 #if OS(MACOSX) | 4025 #if OS(MACOSX) |
| 4011 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 4026 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
| 4012 #else | 4027 #else |
| 4013 return PlatformEvent::AltKey; | 4028 return PlatformEvent::AltKey; |
| 4014 #endif | 4029 #endif |
| 4015 } | 4030 } |
| 4016 | 4031 |
| 4017 } // namespace WebCore | 4032 } // namespace WebCore |
| OLD | NEW |