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 3511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3522 bool EventHandler::isKeyboardOptionTab(KeyboardEvent* event) | 3522 bool EventHandler::isKeyboardOptionTab(KeyboardEvent* event) |
3523 { | 3523 { |
3524 return event | 3524 return event |
3525 && (event->type() == eventNames().keydownEvent || event->type() == event
Names().keypressEvent) | 3525 && (event->type() == eventNames().keydownEvent || event->type() == event
Names().keypressEvent) |
3526 && event->altKey() | 3526 && event->altKey() |
3527 && event->keyIdentifier() == "U+0009"; | 3527 && event->keyIdentifier() == "U+0009"; |
3528 } | 3528 } |
3529 | 3529 |
3530 bool EventHandler::eventInvertsTabsToLinksClientCallResult(KeyboardEvent* event) | 3530 bool EventHandler::eventInvertsTabsToLinksClientCallResult(KeyboardEvent* event) |
3531 { | 3531 { |
3532 #if PLATFORM(MAC) || PLATFORM(QT) | |
3533 return EventHandler::isKeyboardOptionTab(event); | |
3534 #else | |
3535 return false; | 3532 return false; |
3536 #endif | |
3537 } | 3533 } |
3538 | 3534 |
3539 bool EventHandler::tabsToLinks(KeyboardEvent* event) const | 3535 bool EventHandler::tabsToLinks(KeyboardEvent* event) const |
3540 { | 3536 { |
3541 // FIXME: This function needs a better name. It can be called for keypresses
other than Tab when spatial navigation is enabled. | 3537 // FIXME: This function needs a better name. It can be called for keypresses
other than Tab when spatial navigation is enabled. |
3542 | 3538 |
3543 Page* page = m_frame->page(); | 3539 Page* page = m_frame->page(); |
3544 if (!page) | 3540 if (!page) |
3545 return false; | 3541 return false; |
3546 | 3542 |
3547 bool tabsToLinksClientCallResult = page->chrome()->client()->keyboardUIMode(
) & KeyboardAccessTabsToLinks; | 3543 bool tabsToLinksClientCallResult = page->chrome()->client()->keyboardUIMode(
) & KeyboardAccessTabsToLinks; |
3548 return eventInvertsTabsToLinksClientCallResult(event) ? !tabsToLinksClientCa
llResult : tabsToLinksClientCallResult; | 3544 return eventInvertsTabsToLinksClientCallResult(event) ? !tabsToLinksClientCa
llResult : tabsToLinksClientCallResult; |
3549 } | 3545 } |
3550 | 3546 |
3551 void EventHandler::defaultTextInputEventHandler(TextEvent* event) | 3547 void EventHandler::defaultTextInputEventHandler(TextEvent* event) |
3552 { | 3548 { |
3553 if (m_frame->editor()->handleTextEvent(event)) | 3549 if (m_frame->editor()->handleTextEvent(event)) |
3554 event->setDefaultHandled(); | 3550 event->setDefaultHandled(); |
3555 } | 3551 } |
3556 | 3552 |
3557 #if PLATFORM(QT) | |
3558 // Qt handles the space event in platform-specific WebKit code. | |
3559 // Eventually it would be good to eliminate that and use the code here instead. | |
3560 void EventHandler::defaultSpaceEventHandler(KeyboardEvent*) | |
3561 { | |
3562 } | |
3563 #else | |
3564 | |
3565 void EventHandler::defaultSpaceEventHandler(KeyboardEvent* event) | 3553 void EventHandler::defaultSpaceEventHandler(KeyboardEvent* event) |
3566 { | 3554 { |
3567 ASSERT(event->type() == eventNames().keypressEvent); | 3555 ASSERT(event->type() == eventNames().keypressEvent); |
3568 | 3556 |
3569 if (event->ctrlKey() || event->metaKey() || event->altKey() || event->altGra
phKey()) | 3557 if (event->ctrlKey() || event->metaKey() || event->altKey() || event->altGra
phKey()) |
3570 return; | 3558 return; |
3571 | 3559 |
3572 ScrollLogicalDirection direction = event->shiftKey() ? ScrollBlockDirectionB
ackward : ScrollBlockDirectionForward; | 3560 ScrollLogicalDirection direction = event->shiftKey() ? ScrollBlockDirectionB
ackward : ScrollBlockDirectionForward; |
3573 if (logicalScrollOverflow(direction, ScrollByPage)) { | 3561 if (logicalScrollOverflow(direction, ScrollByPage)) { |
3574 event->setDefaultHandled(); | 3562 event->setDefaultHandled(); |
3575 return; | 3563 return; |
3576 } | 3564 } |
3577 | 3565 |
3578 FrameView* view = m_frame->view(); | 3566 FrameView* view = m_frame->view(); |
3579 if (!view) | 3567 if (!view) |
3580 return; | 3568 return; |
3581 | 3569 |
3582 if (view->logicalScroll(direction, ScrollByPage)) | 3570 if (view->logicalScroll(direction, ScrollByPage)) |
3583 event->setDefaultHandled(); | 3571 event->setDefaultHandled(); |
3584 } | 3572 } |
3585 | 3573 |
3586 #endif | |
3587 | |
3588 void EventHandler::defaultBackspaceEventHandler(KeyboardEvent* event) | 3574 void EventHandler::defaultBackspaceEventHandler(KeyboardEvent* event) |
3589 { | 3575 { |
3590 ASSERT(event->type() == eventNames().keydownEvent); | 3576 ASSERT(event->type() == eventNames().keydownEvent); |
3591 | 3577 |
3592 if (event->ctrlKey() || event->metaKey() || event->altKey() || event->altGra
phKey()) | 3578 if (event->ctrlKey() || event->metaKey() || event->altKey() || event->altGra
phKey()) |
3593 return; | 3579 return; |
3594 | 3580 |
3595 if (!m_frame->editor()->behavior().shouldNavigateBackOnBackspace()) | 3581 if (!m_frame->editor()->behavior().shouldNavigateBackOnBackspace()) |
3596 return; | 3582 return; |
3597 | 3583 |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3989 #endif | 3975 #endif |
3990 | 3976 |
3991 void EventHandler::setLastKnownMousePosition(const PlatformMouseEvent& event) | 3977 void EventHandler::setLastKnownMousePosition(const PlatformMouseEvent& event) |
3992 { | 3978 { |
3993 m_mousePositionIsUnknown = false; | 3979 m_mousePositionIsUnknown = false; |
3994 m_lastKnownMousePosition = event.position(); | 3980 m_lastKnownMousePosition = event.position(); |
3995 m_lastKnownMouseGlobalPosition = event.globalPosition(); | 3981 m_lastKnownMouseGlobalPosition = event.globalPosition(); |
3996 } | 3982 } |
3997 | 3983 |
3998 } // namespace WebCore | 3984 } // namespace WebCore |
OLD | NEW |