Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(413)

Side by Side Diff: third_party/WebKit/Source/core/page/FocusController.cpp

Issue 1420693006: Introduce a struct to store arguments of Element::focus(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 } 766 }
767 767
768 setFocusedFrame(newDocument.frame()); 768 setFocusedFrame(newDocument.frame());
769 769
770 if (caretBrowsing) { 770 if (caretBrowsing) {
771 Position position = firstPositionInOrBeforeNode(element.get()); 771 Position position = firstPositionInOrBeforeNode(element.get());
772 VisibleSelection newSelection(position, position); 772 VisibleSelection newSelection(position, position);
773 frame->selection().setSelection(newSelection); 773 frame->selection().setSelection(newSelection);
774 } 774 }
775 775
776 element->focus(false, type, sourceCapabilities); 776 element->focus(FocusParams(SelectionBehaviorOnFocus::Reset, type, sourceCapa bilities));
777 return true; 777 return true;
778 } 778 }
779 779
780 Element* FocusController::findFocusableElement(WebFocusType type, Node& node) 780 Element* FocusController::findFocusableElement(WebFocusType type, Node& node)
781 { 781 {
782 // FIXME: No spacial navigation code yet. 782 // FIXME: No spacial navigation code yet.
783 ASSERT(type == WebFocusTypeForward || type == WebFocusTypeBackward); 783 ASSERT(type == WebFocusTypeForward || type == WebFocusTypeBackward);
784 Element* found = findFocusableElementAcrossFocusScopes(type, FocusNavigation Scope::focusNavigationScopeOf(node), &node); 784 Element* found = findFocusableElementAcrossFocusScopes(type, FocusNavigation Scope::focusNavigationScopeOf(node), &node);
785 return found; 785 return found;
786 } 786 }
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 if (focusCandidate.isOffscreenAfterScrolling) { 1019 if (focusCandidate.isOffscreenAfterScrolling) {
1020 Node* container = focusCandidate.enclosingScrollableBox; 1020 Node* container = focusCandidate.enclosingScrollableBox;
1021 scrollInDirection(container, type); 1021 scrollInDirection(container, type);
1022 return true; 1022 return true;
1023 } 1023 }
1024 1024
1025 // We found a new focus node, navigate to it. 1025 // We found a new focus node, navigate to it.
1026 Element* element = toElement(focusCandidate.focusableNode); 1026 Element* element = toElement(focusCandidate.focusableNode);
1027 ASSERT(element); 1027 ASSERT(element);
1028 1028
1029 element->focus(false, type); 1029 element->focus(FocusParams(SelectionBehaviorOnFocus::Reset, type, nullptr));
1030 return true; 1030 return true;
1031 } 1031 }
1032 1032
1033 bool FocusController::advanceFocusDirectionally(WebFocusType type) 1033 bool FocusController::advanceFocusDirectionally(WebFocusType type)
1034 { 1034 {
1035 // FIXME: Directional focus changes don't yet work with RemoteFrames. 1035 // FIXME: Directional focus changes don't yet work with RemoteFrames.
1036 if (!focusedOrMainFrame()->isLocalFrame()) 1036 if (!focusedOrMainFrame()->isLocalFrame())
1037 return false; 1037 return false;
1038 LocalFrame* curFrame = toLocalFrame(focusedOrMainFrame()); 1038 LocalFrame* curFrame = toLocalFrame(focusedOrMainFrame());
1039 ASSERT(curFrame); 1039 ASSERT(curFrame);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 return consumed; 1073 return consumed;
1074 } 1074 }
1075 1075
1076 DEFINE_TRACE(FocusController) 1076 DEFINE_TRACE(FocusController)
1077 { 1077 {
1078 visitor->trace(m_page); 1078 visitor->trace(m_page);
1079 visitor->trace(m_focusedFrame); 1079 visitor->trace(m_focusedFrame);
1080 } 1080 }
1081 1081
1082 } // namespace blink 1082 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/input/EventHandler.cpp ('k') | third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698