OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2008, The Android Open Source Project | 2 * Copyright 2008, The Android Open Source Project |
3 * Copyright (C) 2012 Research In Motion Limited. All rights reserved. | 3 * Copyright (C) 2012 Research In Motion Limited. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above copyright | 10 * * Redistributions in binary form must reproduce the above copyright |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
253 | 253 |
254 // A common developer error is to wait too long before attempting to stop | 254 // A common developer error is to wait too long before attempting to stop |
255 // scrolling by consuming a touchmove event. Generate a warning if this | 255 // scrolling by consuming a touchmove event. Generate a warning if this |
256 // event is uncancelable. | 256 // event is uncancelable. |
257 MessageSource message_source = kJSMessageSource; | 257 MessageSource message_source = kJSMessageSource; |
258 String warning_message; | 258 String warning_message; |
259 switch (HandlingPassive()) { | 259 switch (HandlingPassive()) { |
260 case PassiveMode::kNotPassive: | 260 case PassiveMode::kNotPassive: |
261 case PassiveMode::kNotPassiveDefault: | 261 case PassiveMode::kNotPassiveDefault: |
262 if (!cancelable()) { | 262 if (!cancelable()) { |
263 if (view() && view()->GetFrame()) { | 263 if (view() && view()->IsLocalDOMWindow() && view()->GetFrame()) { |
dcheng
2017/05/12 22:15:18
This makes me a little sad, but unfortunately, I s
Rick Byers
2017/05/25 15:32:31
Yeah I can't imagine a use case, but it would also
| |
264 UseCounter::Count( | 264 UseCounter::Count( |
265 view()->GetFrame(), | 265 ToLocalFrame(view()->GetFrame()), |
266 UseCounter::kUncancelableTouchEventPreventDefaulted); | 266 UseCounter::kUncancelableTouchEventPreventDefaulted); |
267 } | 267 } |
268 | 268 |
269 if (native_event_ && | 269 if (native_event_ && |
270 native_event_->dispatch_type == | 270 native_event_->dispatch_type == |
271 WebInputEvent:: | 271 WebInputEvent:: |
272 kListenersForcedNonBlockingDueToMainThreadResponsiveness) { | 272 kListenersForcedNonBlockingDueToMainThreadResponsiveness) { |
273 // Non blocking due to main thread responsiveness. | 273 // Non blocking due to main thread responsiveness. |
274 if (view() && view()->GetFrame()) { | 274 if (view() && view()->IsLocalDOMWindow() && view()->GetFrame()) { |
275 UseCounter::Count( | 275 UseCounter::Count( |
276 view()->GetFrame(), | 276 ToLocalFrame(view()->GetFrame()), |
277 UseCounter:: | 277 UseCounter:: |
278 kUncancelableTouchEventDueToMainThreadResponsivenessPreventD efaulted); | 278 kUncancelableTouchEventDueToMainThreadResponsivenessPreventD efaulted); |
279 } | 279 } |
280 message_source = kInterventionMessageSource; | 280 message_source = kInterventionMessageSource; |
281 warning_message = | 281 warning_message = |
282 "Ignored attempt to cancel a " + type() + | 282 "Ignored attempt to cancel a " + type() + |
283 " event with cancelable=false. This event was forced to be " | 283 " event with cancelable=false. This event was forced to be " |
284 "non-cancellable because the page was too busy to handle the " | 284 "non-cancellable because the page was too busy to handle the " |
285 "event promptly."; | 285 "event promptly."; |
286 } else { | 286 } else { |
(...skipping 23 matching lines...) Expand all Loading... | |
310 | 310 |
311 if (!warning_message.IsEmpty() && view() && view()->IsLocalDOMWindow() && | 311 if (!warning_message.IsEmpty() && view() && view()->IsLocalDOMWindow() && |
312 view()->GetFrame()) { | 312 view()->GetFrame()) { |
313 ToLocalDOMWindow(view())->GetFrame()->Console().AddMessage( | 313 ToLocalDOMWindow(view())->GetFrame()->Console().AddMessage( |
314 ConsoleMessage::Create(message_source, kWarningMessageLevel, | 314 ConsoleMessage::Create(message_source, kWarningMessageLevel, |
315 warning_message)); | 315 warning_message)); |
316 } | 316 } |
317 | 317 |
318 if ((type() == EventTypeNames::touchstart || | 318 if ((type() == EventTypeNames::touchstart || |
319 type() == EventTypeNames::touchmove) && | 319 type() == EventTypeNames::touchmove) && |
320 view() && view()->GetFrame() && | 320 view() && view()->IsLocalDOMWindow() && view()->GetFrame() && |
321 current_touch_action_ == TouchAction::kTouchActionAuto) { | 321 current_touch_action_ == TouchAction::kTouchActionAuto) { |
322 switch (HandlingPassive()) { | 322 switch (HandlingPassive()) { |
323 case PassiveMode::kNotPassiveDefault: | 323 case PassiveMode::kNotPassiveDefault: |
324 UseCounter::Count(view()->GetFrame(), | 324 UseCounter::Count(ToLocalFrame(view()->GetFrame()), |
325 UseCounter::kTouchEventPreventedNoTouchAction); | 325 UseCounter::kTouchEventPreventedNoTouchAction); |
326 break; | 326 break; |
327 case PassiveMode::kPassiveForcedDocumentLevel: | 327 case PassiveMode::kPassiveForcedDocumentLevel: |
328 UseCounter::Count( | 328 UseCounter::Count( |
329 view()->GetFrame(), | 329 ToLocalFrame(view()->GetFrame()), |
330 UseCounter::kTouchEventPreventedForcedDocumentPassiveNoTouchAction); | 330 UseCounter::kTouchEventPreventedForcedDocumentPassiveNoTouchAction); |
331 break; | 331 break; |
332 default: | 332 default: |
333 break; | 333 break; |
334 } | 334 } |
335 } | 335 } |
336 } | 336 } |
337 | 337 |
338 bool TouchEvent::IsTouchStartOrFirstTouchMove() const { | 338 bool TouchEvent::IsTouchStartOrFirstTouchMove() const { |
339 if (!native_event_) | 339 if (!native_event_) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
378 return ToTouchEvent(EventDispatchMediator::GetEvent()); | 378 return ToTouchEvent(EventDispatchMediator::GetEvent()); |
379 } | 379 } |
380 | 380 |
381 DispatchEventResult TouchEventDispatchMediator::DispatchEvent( | 381 DispatchEventResult TouchEventDispatchMediator::DispatchEvent( |
382 EventDispatcher& dispatcher) const { | 382 EventDispatcher& dispatcher) const { |
383 Event().GetEventPath().AdjustForTouchEvent(Event()); | 383 Event().GetEventPath().AdjustForTouchEvent(Event()); |
384 return dispatcher.Dispatch(); | 384 return dispatcher.Dispatch(); |
385 } | 385 } |
386 | 386 |
387 } // namespace blink | 387 } // namespace blink |
OLD | NEW |