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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 FrameView* view = document->view(); | 249 FrameView* view = document->view(); |
| 250 if (view && view->isScrollable()) | 250 if (view && view->isScrollable()) |
| 251 result += kTouchTargetHistogramScrollableDocumentOffset; | 251 result += kTouchTargetHistogramScrollableDocumentOffset; |
| 252 } | 252 } |
| 253 | 253 |
| 254 if (dispatchResult != DispatchEventResult::NotCanceled) | 254 if (dispatchResult != DispatchEventResult::NotCanceled) |
| 255 result += kTouchTargetHistogramHandledOffset; | 255 result += kTouchTargetHistogramHandledOffset; |
| 256 return static_cast<TouchTargetAndDispatchResultType>(result); | 256 return static_cast<TouchTargetAndDispatchResultType>(result); |
| 257 } | 257 } |
| 258 | 258 |
| 259 enum TouchEventDispatchResultType { | |
| 260 NotHandledTouches, // Not handled touch events. | |
|
Ilya Sherman
2016/04/26 20:27:11
"Not handled events" -- does that mean "Unhandled
lanwei
2016/04/27 04:43:30
Done.
| |
| 261 HandledTouches, // Handled touch events. | |
| 262 TouchEventDispatchResultTypeMax, | |
| 263 }; | |
| 264 | |
| 259 } // namespace | 265 } // namespace |
| 260 | 266 |
| 261 using namespace HTMLNames; | 267 using namespace HTMLNames; |
| 262 | 268 |
| 263 // The link drag hysteresis is much larger than the others because there | 269 // The link drag hysteresis is much larger than the others because there |
| 264 // needs to be enough space to cancel the link press without starting a link dra g, | 270 // needs to be enough space to cancel the link press without starting a link dra g, |
| 265 // and because dragging links is rare. | 271 // and because dragging links is rare. |
| 266 static const int LinkDragHysteresis = 40; | 272 static const int LinkDragHysteresis = 40; |
| 267 static const int ImageDragHysteresis = 5; | 273 static const int ImageDragHysteresis = 5; |
| 268 static const int TextDragHysteresis = 3; | 274 static const int TextDragHysteresis = 3; |
| (...skipping 3617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3886 eventName, touchEventTarget->toNode()->document().domWindow(), | 3892 eventName, touchEventTarget->toNode()->document().domWindow(), |
| 3887 event.getModifiers(), event.cancelable(), event.causesScrollingI fUncanceled(), event.timestamp()); | 3893 event.getModifiers(), event.cancelable(), event.causesScrollingI fUncanceled(), event.timestamp()); |
| 3888 | 3894 |
| 3889 DispatchEventResult domDispatchResult = touchEventTarget->dispatchEv ent(touchEvent); | 3895 DispatchEventResult domDispatchResult = touchEventTarget->dispatchEv ent(touchEvent); |
| 3890 | 3896 |
| 3891 // Only report for top level documents with a single touch on | 3897 // Only report for top level documents with a single touch on |
| 3892 // touch-start or the first touch-move. | 3898 // touch-start or the first touch-move. |
| 3893 if (touchStartOrFirstTouchMove && touchInfos.size() == 1 && event.ca ncelable() && !m_frame->document()->ownerElement()) { | 3899 if (touchStartOrFirstTouchMove && touchInfos.size() == 1 && event.ca ncelable() && !m_frame->document()->ownerElement()) { |
| 3894 DEFINE_STATIC_LOCAL(EnumerationHistogram, rootDocumentListenerHi stogram, ("Event.Touch.TargetAndDispatchResult", TouchTargetAndDispatchResultTyp eMax)); | 3900 DEFINE_STATIC_LOCAL(EnumerationHistogram, rootDocumentListenerHi stogram, ("Event.Touch.TargetAndDispatchResult", TouchTargetAndDispatchResultTyp eMax)); |
| 3895 rootDocumentListenerHistogram.count(toTouchTargetHistogramValue( eventTarget, domDispatchResult)); | 3901 rootDocumentListenerHistogram.count(toTouchTargetHistogramValue( eventTarget, domDispatchResult)); |
| 3902 | |
| 3903 // Count the canceled touch starts and first touch moves before and after page finishes loading respectively. | |
| 3904 if (m_frame->document()->isLoadCompleted()) { | |
| 3905 DEFINE_STATIC_LOCAL(EnumerationHistogram, touchesCanceledAft erPageLoadHistogram, ("Event.Touch.TouchesCanceledAfterPageLoad", TouchEventDisp atchResultTypeMax)); | |
| 3906 touchesCanceledAfterPageLoadHistogram.count((domDispatchResu lt != DispatchEventResult::NotCanceled) ? HandledTouches : NotHandledTouches); | |
| 3907 } else { | |
| 3908 DEFINE_STATIC_LOCAL(EnumerationHistogram, touchesCanceledBef orePageLoadHistogram, ("Event.Touch.TouchesCanceledBeforePageLoad", TouchEventDi spatchResultTypeMax)); | |
| 3909 touchesCanceledBeforePageLoadHistogram.count((domDispatchRes ult != DispatchEventResult::NotCanceled) ? HandledTouches : NotHandledTouches); | |
| 3910 } | |
| 3896 } | 3911 } |
| 3897 eventResult = mergeEventResult(eventResult, toWebInputEventResult(do mDispatchResult)); | 3912 eventResult = mergeEventResult(eventResult, toWebInputEventResult(do mDispatchResult)); |
| 3898 } | 3913 } |
| 3899 } | 3914 } |
| 3900 | |
| 3901 return eventResult; | 3915 return eventResult; |
| 3902 } | 3916 } |
| 3903 | 3917 |
| 3904 WebInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEvent& eve nt) | 3918 WebInputEventResult EventHandler::handleTouchEvent(const PlatformTouchEvent& eve nt) |
| 3905 { | 3919 { |
| 3906 TRACE_EVENT0("blink", "EventHandler::handleTouchEvent"); | 3920 TRACE_EVENT0("blink", "EventHandler::handleTouchEvent"); |
| 3907 | 3921 |
| 3908 if (event.type() == PlatformEvent::TouchScrollStarted) { | 3922 if (event.type() == PlatformEvent::TouchScrollStarted) { |
| 3909 m_pointerEventManager.blockTouchPointers(); | 3923 m_pointerEventManager.blockTouchPointers(); |
| 3910 return WebInputEventResult::HandledSystem; | 3924 return WebInputEventResult::HandledSystem; |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4170 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() | 4184 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() |
| 4171 { | 4185 { |
| 4172 #if OS(MACOSX) | 4186 #if OS(MACOSX) |
| 4173 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); | 4187 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); |
| 4174 #else | 4188 #else |
| 4175 return PlatformEvent::AltKey; | 4189 return PlatformEvent::AltKey; |
| 4176 #endif | 4190 #endif |
| 4177 } | 4191 } |
| 4178 | 4192 |
| 4179 } // namespace blink | 4193 } // namespace blink |
| OLD | NEW |