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 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 ScopedFocusNavigation scope = | 970 ScopedFocusNavigation scope = |
971 current ? ScopedFocusNavigation::CreateFor(*current) | 971 current ? ScopedFocusNavigation::CreateFor(*current) |
972 : ScopedFocusNavigation::CreateForDocument(*document); | 972 : ScopedFocusNavigation::CreateForDocument(*document); |
973 Element* element = FindFocusableElementAcrossFocusScopes(type, scope); | 973 Element* element = FindFocusableElementAcrossFocusScopes(type, scope); |
974 if (!element) { | 974 if (!element) { |
975 // If there's a RemoteFrame on the ancestor chain, we need to continue | 975 // If there's a RemoteFrame on the ancestor chain, we need to continue |
976 // searching for focusable elements there. | 976 // searching for focusable elements there. |
977 if (frame->LocalFrameRoot() != frame->Tree().Top()) { | 977 if (frame->LocalFrameRoot() != frame->Tree().Top()) { |
978 document->ClearFocusedElement(); | 978 document->ClearFocusedElement(); |
979 document->SetSequentialFocusNavigationStartingPoint(nullptr); | 979 document->SetSequentialFocusNavigationStartingPoint(nullptr); |
| 980 SetFocusedFrame(nullptr); |
980 ToRemoteFrame(frame->LocalFrameRoot()->Tree().Parent()) | 981 ToRemoteFrame(frame->LocalFrameRoot()->Tree().Parent()) |
981 ->AdvanceFocus(type, frame->LocalFrameRoot()); | 982 ->AdvanceFocus(type, frame->LocalFrameRoot()); |
982 return true; | 983 return true; |
983 } | 984 } |
984 | 985 |
985 // We didn't find an element to focus, so we should try to pass focus to | 986 // We didn't find an element to focus, so we should try to pass focus to |
986 // Chrome. | 987 // Chrome. |
987 if (!initial_focus && page_->GetChromeClient().CanTakeFocus(type)) { | 988 if (!initial_focus && page_->GetChromeClient().CanTakeFocus(type)) { |
988 document->ClearFocusedElement(); | 989 document->ClearFocusedElement(); |
989 document->SetSequentialFocusNavigationStartingPoint(nullptr); | 990 document->SetSequentialFocusNavigationStartingPoint(nullptr); |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1409 it->FocusedFrameChanged(); | 1410 it->FocusedFrameChanged(); |
1410 } | 1411 } |
1411 | 1412 |
1412 DEFINE_TRACE(FocusController) { | 1413 DEFINE_TRACE(FocusController) { |
1413 visitor->Trace(page_); | 1414 visitor->Trace(page_); |
1414 visitor->Trace(focused_frame_); | 1415 visitor->Trace(focused_frame_); |
1415 visitor->Trace(focus_changed_observers_); | 1416 visitor->Trace(focus_changed_observers_); |
1416 } | 1417 } |
1417 | 1418 |
1418 } // namespace blink | 1419 } // namespace blink |
OLD | NEW |