| 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 259 |
| 260 // A common developer error is to wait too long before attempting to stop | 260 // A common developer error is to wait too long before attempting to stop |
| 261 // scrolling by consuming a touchmove event. Generate a warning if this | 261 // scrolling by consuming a touchmove event. Generate a warning if this |
| 262 // event is uncancelable. | 262 // event is uncancelable. |
| 263 MessageSource message_source = kJSMessageSource; | 263 MessageSource message_source = kJSMessageSource; |
| 264 String warning_message; | 264 String warning_message; |
| 265 switch (HandlingPassive()) { | 265 switch (HandlingPassive()) { |
| 266 case PassiveMode::kNotPassive: | 266 case PassiveMode::kNotPassive: |
| 267 case PassiveMode::kNotPassiveDefault: | 267 case PassiveMode::kNotPassiveDefault: |
| 268 if (!cancelable()) { | 268 if (!cancelable()) { |
| 269 if (view() && view()->GetFrame()) { | 269 if (view() && view()->IsLocalDOMWindow() && view()->GetFrame()) { |
| 270 UseCounter::Count( | 270 UseCounter::Count( |
| 271 view()->GetFrame(), | 271 ToLocalFrame(view()->GetFrame()), |
| 272 UseCounter::kUncancelableTouchEventPreventDefaulted); | 272 UseCounter::kUncancelableTouchEventPreventDefaulted); |
| 273 } | 273 } |
| 274 | 274 |
| 275 if (native_event_ && | 275 if (native_event_ && |
| 276 GetWebTouchEvent(*native_event_)->dispatch_type == | 276 GetWebTouchEvent(*native_event_)->dispatch_type == |
| 277 WebInputEvent:: | 277 WebInputEvent:: |
| 278 kListenersForcedNonBlockingDueToMainThreadResponsiveness) { | 278 kListenersForcedNonBlockingDueToMainThreadResponsiveness) { |
| 279 // Non blocking due to main thread responsiveness. | 279 // Non blocking due to main thread responsiveness. |
| 280 if (view() && view()->GetFrame()) { | 280 if (view() && view()->IsLocalDOMWindow() && view()->GetFrame()) { |
| 281 UseCounter::Count( | 281 UseCounter::Count( |
| 282 view()->GetFrame(), | 282 ToLocalFrame(view()->GetFrame()), |
| 283 UseCounter:: | 283 UseCounter:: |
| 284 kUncancelableTouchEventDueToMainThreadResponsivenessPreventD
efaulted); | 284 kUncancelableTouchEventDueToMainThreadResponsivenessPreventD
efaulted); |
| 285 } | 285 } |
| 286 message_source = kInterventionMessageSource; | 286 message_source = kInterventionMessageSource; |
| 287 warning_message = | 287 warning_message = |
| 288 "Ignored attempt to cancel a " + type() + | 288 "Ignored attempt to cancel a " + type() + |
| 289 " event with cancelable=false. This event was forced to be " | 289 " event with cancelable=false. This event was forced to be " |
| 290 "non-cancellable because the page was too busy to handle the " | 290 "non-cancellable because the page was too busy to handle the " |
| 291 "event promptly."; | 291 "event promptly."; |
| 292 } else { | 292 } else { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 316 | 316 |
| 317 if (!warning_message.IsEmpty() && view() && view()->IsLocalDOMWindow() && | 317 if (!warning_message.IsEmpty() && view() && view()->IsLocalDOMWindow() && |
| 318 view()->GetFrame()) { | 318 view()->GetFrame()) { |
| 319 ToLocalDOMWindow(view())->GetFrame()->Console().AddMessage( | 319 ToLocalDOMWindow(view())->GetFrame()->Console().AddMessage( |
| 320 ConsoleMessage::Create(message_source, kWarningMessageLevel, | 320 ConsoleMessage::Create(message_source, kWarningMessageLevel, |
| 321 warning_message)); | 321 warning_message)); |
| 322 } | 322 } |
| 323 | 323 |
| 324 if ((type() == EventTypeNames::touchstart || | 324 if ((type() == EventTypeNames::touchstart || |
| 325 type() == EventTypeNames::touchmove) && | 325 type() == EventTypeNames::touchmove) && |
| 326 view() && view()->GetFrame() && | 326 view() && view()->IsLocalDOMWindow() && view()->GetFrame() && |
| 327 current_touch_action_ == TouchAction::kTouchActionAuto) { | 327 current_touch_action_ == TouchAction::kTouchActionAuto) { |
| 328 switch (HandlingPassive()) { | 328 switch (HandlingPassive()) { |
| 329 case PassiveMode::kNotPassiveDefault: | 329 case PassiveMode::kNotPassiveDefault: |
| 330 UseCounter::Count(view()->GetFrame(), | 330 UseCounter::Count(ToLocalFrame(view()->GetFrame()), |
| 331 UseCounter::kTouchEventPreventedNoTouchAction); | 331 UseCounter::kTouchEventPreventedNoTouchAction); |
| 332 break; | 332 break; |
| 333 case PassiveMode::kPassiveForcedDocumentLevel: | 333 case PassiveMode::kPassiveForcedDocumentLevel: |
| 334 UseCounter::Count( | 334 UseCounter::Count( |
| 335 view()->GetFrame(), | 335 ToLocalFrame(view()->GetFrame()), |
| 336 UseCounter::kTouchEventPreventedForcedDocumentPassiveNoTouchAction); | 336 UseCounter::kTouchEventPreventedForcedDocumentPassiveNoTouchAction); |
| 337 break; | 337 break; |
| 338 default: | 338 default: |
| 339 break; | 339 break; |
| 340 } | 340 } |
| 341 } | 341 } |
| 342 } | 342 } |
| 343 | 343 |
| 344 bool TouchEvent::IsTouchStartOrFirstTouchMove() const { | 344 bool TouchEvent::IsTouchStartOrFirstTouchMove() const { |
| 345 if (!native_event_) | 345 if (!native_event_) |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 return ToTouchEvent(EventDispatchMediator::GetEvent()); | 384 return ToTouchEvent(EventDispatchMediator::GetEvent()); |
| 385 } | 385 } |
| 386 | 386 |
| 387 DispatchEventResult TouchEventDispatchMediator::DispatchEvent( | 387 DispatchEventResult TouchEventDispatchMediator::DispatchEvent( |
| 388 EventDispatcher& dispatcher) const { | 388 EventDispatcher& dispatcher) const { |
| 389 Event().GetEventPath().AdjustForTouchEvent(Event()); | 389 Event().GetEventPath().AdjustForTouchEvent(Event()); |
| 390 return dispatcher.Dispatch(); | 390 return dispatcher.Dispatch(); |
| 391 } | 391 } |
| 392 | 392 |
| 393 } // namespace blink | 393 } // namespace blink |
| OLD | NEW |