| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Nuanti Ltd. | 3 * Copyright (C) 2008 Nuanti Ltd. |
| 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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 if (caretBrowsing) { | 809 if (caretBrowsing) { |
| 810 Position position = firstPositionInOrBeforeNode(element.get()); | 810 Position position = firstPositionInOrBeforeNode(element.get()); |
| 811 VisibleSelection newSelection(position, position); | 811 VisibleSelection newSelection(position, position); |
| 812 frame->selection().setSelection(newSelection); | 812 frame->selection().setSelection(newSelection); |
| 813 } | 813 } |
| 814 | 814 |
| 815 element->focus(FocusParams(SelectionBehaviorOnFocus::Reset, type, sourceCapa
bilities)); | 815 element->focus(FocusParams(SelectionBehaviorOnFocus::Reset, type, sourceCapa
bilities)); |
| 816 return true; | 816 return true; |
| 817 } | 817 } |
| 818 | 818 |
| 819 Element* FocusController::findFocusableElement(WebFocusType type, Node& node) | 819 Element* FocusController::findFocusableElement(WebFocusType type, Element& eleme
nt) |
| 820 { | 820 { |
| 821 // FIXME: No spacial navigation code yet. | 821 // FIXME: No spacial navigation code yet. |
| 822 ASSERT(type == WebFocusTypeForward || type == WebFocusTypeBackward); | 822 ASSERT(type == WebFocusTypeForward || type == WebFocusTypeBackward); |
| 823 Element* found = findFocusableElementAcrossFocusScopes(type, FocusNavigation
Scope::focusNavigationScopeOf(node), &node); | 823 return findFocusableElementAcrossFocusScopes(type, FocusNavigationScope::foc
usNavigationScopeOf(element), &element); |
| 824 return found; | 824 } |
| 825 |
| 826 Element* FocusController::findFocusableElementInShadowHost(const Element& shadow
Host) |
| 827 { |
| 828 ASSERT(shadowHost.authorShadowRoot()); |
| 829 return findFocusableElementAcrossFocusScopes(WebFocusTypeForward, FocusNavig
ationScope::ownedByShadowHost(shadowHost), nullptr); |
| 825 } | 830 } |
| 826 | 831 |
| 827 static bool relinquishesEditingFocus(const Element& element) | 832 static bool relinquishesEditingFocus(const Element& element) |
| 828 { | 833 { |
| 829 ASSERT(element.hasEditableStyle()); | 834 ASSERT(element.hasEditableStyle()); |
| 830 return element.document().frame() && element.rootEditableElement(); | 835 return element.document().frame() && element.rootEditableElement(); |
| 831 } | 836 } |
| 832 | 837 |
| 833 static void clearSelectionIfNeeded(LocalFrame* oldFocusedFrame, LocalFrame* newF
ocusedFrame, Element* newFocusedElement) | 838 static void clearSelectionIfNeeded(LocalFrame* oldFocusedFrame, LocalFrame* newF
ocusedFrame, Element* newFocusedElement) |
| 834 { | 839 { |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 return consumed; | 1122 return consumed; |
| 1118 } | 1123 } |
| 1119 | 1124 |
| 1120 DEFINE_TRACE(FocusController) | 1125 DEFINE_TRACE(FocusController) |
| 1121 { | 1126 { |
| 1122 visitor->trace(m_page); | 1127 visitor->trace(m_page); |
| 1123 visitor->trace(m_focusedFrame); | 1128 visitor->trace(m_focusedFrame); |
| 1124 } | 1129 } |
| 1125 | 1130 |
| 1126 } // namespace blink | 1131 } // namespace blink |
| OLD | NEW |