| 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 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 Node* container = focus_candidate.enclosing_scrollable_box; | 1335 Node* container = focus_candidate.enclosing_scrollable_box; |
| 1336 ScrollInDirection(container, type); | 1336 ScrollInDirection(container, type); |
| 1337 return true; | 1337 return true; |
| 1338 } | 1338 } |
| 1339 | 1339 |
| 1340 // We found a new focus node, navigate to it. | 1340 // We found a new focus node, navigate to it. |
| 1341 Element* element = ToElement(focus_candidate.focusable_node); | 1341 Element* element = ToElement(focus_candidate.focusable_node); |
| 1342 DCHECK(element); | 1342 DCHECK(element); |
| 1343 | 1343 |
| 1344 if (!element->IsTextControl() && !HasEditableStyle(*element->ToNode())) { | 1344 if (!element->IsTextControl() && !HasEditableStyle(*element->ToNode())) { |
| 1345 // To fulfill the expectation of spatial-navigation/snav-input.html | 1345 // To fulfill the expectation of spatial-navigation/snav-textarea.html |
| 1346 // we clear selection when spatnav moves focus away from a text-field. | 1346 // we clear selection when spatnav moves focus away from a text-field. |
| 1347 FocusedFrame()->Selection().Clear(); | 1347 // TODO(hugoh@opera.com): crbug.com/734552 remove Selection.Clear() |
| 1348 if (FocusedFrame()) |
| 1349 FocusedFrame()->Selection().Clear(); |
| 1348 } | 1350 } |
| 1349 element->focus(FocusParams(SelectionBehaviorOnFocus::kReset, type, nullptr)); | 1351 element->focus(FocusParams(SelectionBehaviorOnFocus::kReset, type, nullptr)); |
| 1350 return true; | 1352 return true; |
| 1351 } | 1353 } |
| 1352 | 1354 |
| 1353 bool FocusController::AdvanceFocusDirectionally(WebFocusType type) { | 1355 bool FocusController::AdvanceFocusDirectionally(WebFocusType type) { |
| 1354 // FIXME: Directional focus changes don't yet work with RemoteFrames. | 1356 // FIXME: Directional focus changes don't yet work with RemoteFrames. |
| 1355 if (!FocusedOrMainFrame()->IsLocalFrame()) | 1357 if (!FocusedOrMainFrame()->IsLocalFrame()) |
| 1356 return false; | 1358 return false; |
| 1357 LocalFrame* cur_frame = ToLocalFrame(FocusedOrMainFrame()); | 1359 LocalFrame* cur_frame = ToLocalFrame(FocusedOrMainFrame()); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1410 it->FocusedFrameChanged(); | 1412 it->FocusedFrameChanged(); |
| 1411 } | 1413 } |
| 1412 | 1414 |
| 1413 DEFINE_TRACE(FocusController) { | 1415 DEFINE_TRACE(FocusController) { |
| 1414 visitor->Trace(page_); | 1416 visitor->Trace(page_); |
| 1415 visitor->Trace(focused_frame_); | 1417 visitor->Trace(focused_frame_); |
| 1416 visitor->Trace(focus_changed_observers_); | 1418 visitor->Trace(focus_changed_observers_); |
| 1417 } | 1419 } |
| 1418 | 1420 |
| 1419 } // namespace blink | 1421 } // namespace blink |
| OLD | NEW |