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 3274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3285 void EventHandler::defaultTextInputEventHandler(TextEvent* event) | 3285 void EventHandler::defaultTextInputEventHandler(TextEvent* event) |
3286 { | 3286 { |
3287 if (m_frame->editor().handleTextEvent(event)) | 3287 if (m_frame->editor().handleTextEvent(event)) |
3288 event->setDefaultHandled(); | 3288 event->setDefaultHandled(); |
3289 } | 3289 } |
3290 | 3290 |
3291 void EventHandler::defaultSpaceEventHandler(KeyboardEvent* event) | 3291 void EventHandler::defaultSpaceEventHandler(KeyboardEvent* event) |
3292 { | 3292 { |
3293 ASSERT(event->type() == EventTypeNames::keypress); | 3293 ASSERT(event->type() == EventTypeNames::keypress); |
3294 | 3294 |
3295 if (event->ctrlKey() || event->metaKey() || event->altKey() || event->altGra
phKey()) | 3295 if (event->ctrlKey() || event->metaKey() || event->altKey()) |
3296 return; | 3296 return; |
3297 | 3297 |
3298 ScrollDirection direction = event->shiftKey() ? ScrollBlockDirectionBackward
: ScrollBlockDirectionForward; | 3298 ScrollDirection direction = event->shiftKey() ? ScrollBlockDirectionBackward
: ScrollBlockDirectionForward; |
3299 if (scroll(direction, ScrollByPage)) { | 3299 if (scroll(direction, ScrollByPage)) { |
3300 event->setDefaultHandled(); | 3300 event->setDefaultHandled(); |
3301 return; | 3301 return; |
3302 } | 3302 } |
3303 | 3303 |
3304 FrameView* view = m_frame->view(); | 3304 FrameView* view = m_frame->view(); |
3305 if (!view) | 3305 if (!view) |
3306 return; | 3306 return; |
3307 | 3307 |
3308 if (view->scroll(direction, ScrollByPage)) | 3308 if (view->scroll(direction, ScrollByPage)) |
3309 event->setDefaultHandled(); | 3309 event->setDefaultHandled(); |
3310 } | 3310 } |
3311 | 3311 |
3312 void EventHandler::defaultBackspaceEventHandler(KeyboardEvent* event) | 3312 void EventHandler::defaultBackspaceEventHandler(KeyboardEvent* event) |
3313 { | 3313 { |
3314 ASSERT(event->type() == EventTypeNames::keydown); | 3314 ASSERT(event->type() == EventTypeNames::keydown); |
3315 | 3315 |
3316 if (event->ctrlKey() || event->metaKey() || event->altKey() || event->altGra
phKey()) | 3316 if (event->ctrlKey() || event->metaKey() || event->altKey()) |
3317 return; | 3317 return; |
3318 | 3318 |
3319 if (!m_frame->editor().behavior().shouldNavigateBackOnBackspace()) | 3319 if (!m_frame->editor().behavior().shouldNavigateBackOnBackspace()) |
3320 return; | 3320 return; |
3321 | 3321 |
3322 Page* page = m_frame->page(); | 3322 Page* page = m_frame->page(); |
3323 if (!page || !page->mainFrame()->isLocalFrame()) | 3323 if (!page || !page->mainFrame()->isLocalFrame()) |
3324 return; | 3324 return; |
3325 bool handledEvent = page->deprecatedLocalMainFrame()->loader().client()->nav
igateBackForward(event->shiftKey() ? 1 : -1); | 3325 bool handledEvent = page->deprecatedLocalMainFrame()->loader().client()->nav
igateBackForward(event->shiftKey() ? 1 : -1); |
3326 if (handledEvent) | 3326 if (handledEvent) |
3327 event->setDefaultHandled(); | 3327 event->setDefaultHandled(); |
3328 } | 3328 } |
3329 | 3329 |
3330 void EventHandler::defaultArrowEventHandler(FocusType focusType, KeyboardEvent*
event) | 3330 void EventHandler::defaultArrowEventHandler(FocusType focusType, KeyboardEvent*
event) |
3331 { | 3331 { |
3332 ASSERT(event->type() == EventTypeNames::keydown); | 3332 ASSERT(event->type() == EventTypeNames::keydown); |
3333 | 3333 |
3334 if (event->ctrlKey() || event->metaKey() || event->altGraphKey() || event->s
hiftKey()) | 3334 if (event->ctrlKey() || event->metaKey() || event->shiftKey()) |
3335 return; | 3335 return; |
3336 | 3336 |
3337 Page* page = m_frame->page(); | 3337 Page* page = m_frame->page(); |
3338 if (!page) | 3338 if (!page) |
3339 return; | 3339 return; |
3340 | 3340 |
3341 if (!isSpatialNavigationEnabled(m_frame)) | 3341 if (!isSpatialNavigationEnabled(m_frame)) |
3342 return; | 3342 return; |
3343 | 3343 |
3344 // Arrows and other possible directional navigation keys can be used in desi
gn | 3344 // Arrows and other possible directional navigation keys can be used in desi
gn |
3345 // mode editing. | 3345 // mode editing. |
3346 if (m_frame->document()->inDesignMode()) | 3346 if (m_frame->document()->inDesignMode()) |
3347 return; | 3347 return; |
3348 | 3348 |
3349 if (page->focusController().advanceFocus(focusType)) | 3349 if (page->focusController().advanceFocus(focusType)) |
3350 event->setDefaultHandled(); | 3350 event->setDefaultHandled(); |
3351 } | 3351 } |
3352 | 3352 |
3353 void EventHandler::defaultTabEventHandler(KeyboardEvent* event) | 3353 void EventHandler::defaultTabEventHandler(KeyboardEvent* event) |
3354 { | 3354 { |
3355 ASSERT(event->type() == EventTypeNames::keydown); | 3355 ASSERT(event->type() == EventTypeNames::keydown); |
3356 | 3356 |
3357 // We should only advance focus on tabs if no special modifier keys are held
down. | 3357 // We should only advance focus on tabs if no special modifier keys are held
down. |
3358 if (event->ctrlKey() || event->metaKey() || event->altGraphKey()) | 3358 if (event->ctrlKey() || event->metaKey()) |
3359 return; | 3359 return; |
3360 | 3360 |
3361 Page* page = m_frame->page(); | 3361 Page* page = m_frame->page(); |
3362 if (!page) | 3362 if (!page) |
3363 return; | 3363 return; |
3364 if (!page->tabKeyCyclesThroughElements()) | 3364 if (!page->tabKeyCyclesThroughElements()) |
3365 return; | 3365 return; |
3366 | 3366 |
3367 FocusType focusType = event->shiftKey() ? FocusTypeBackward : FocusTypeForwa
rd; | 3367 FocusType focusType = event->shiftKey() ? FocusTypeBackward : FocusTypeForwa
rd; |
3368 | 3368 |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3829 unsigned EventHandler::accessKeyModifiers() | 3829 unsigned EventHandler::accessKeyModifiers() |
3830 { | 3830 { |
3831 #if OS(MACOSX) | 3831 #if OS(MACOSX) |
3832 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3832 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
3833 #else | 3833 #else |
3834 return PlatformEvent::AltKey; | 3834 return PlatformEvent::AltKey; |
3835 #endif | 3835 #endif |
3836 } | 3836 } |
3837 | 3837 |
3838 } // namespace blink | 3838 } // namespace blink |
OLD | NEW |