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

Unified Diff: Source/core/page/FocusController.cpp

Issue 68173014: Have ElementTraversal::firstWithin() take a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/page/FocusController.h ('k') | Source/core/svg/SVGElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/FocusController.cpp
diff --git a/Source/core/page/FocusController.cpp b/Source/core/page/FocusController.cpp
index 6ca0a1a66b1995e3d9249fe66710ae259695830d..cace7b16a7bb85207a7b3ccf867b8b7f11dd2635 100644
--- a/Source/core/page/FocusController.cpp
+++ b/Source/core/page/FocusController.cpp
@@ -767,9 +767,8 @@ static void updateFocusCandidateIfNeeded(FocusDirection direction, const FocusCa
closest = candidate;
}
-void FocusController::findFocusCandidateInContainer(Node* container, const LayoutRect& startingRect, FocusDirection direction, FocusCandidate& closest)
+void FocusController::findFocusCandidateInContainer(Node& container, const LayoutRect& startingRect, FocusDirection direction, FocusCandidate& closest)
{
- ASSERT(container);
Element* focusedElement = (focusedFrame() && focusedFrame()->document()) ? focusedFrame()->document()->focusedElement() : 0;
Element* element = ElementTraversal::firstWithin(container);
@@ -779,8 +778,8 @@ void FocusController::findFocusCandidateInContainer(Node* container, const Layou
current.visibleNode = focusedElement;
for (; element; element = (element->isFrameOwnerElement() || canScrollInDirection(element, direction))
- ? ElementTraversal::nextSkippingChildren(*element, container)
- : ElementTraversal::next(*element, container)) {
+ ? ElementTraversal::nextSkippingChildren(*element, &container)
+ : ElementTraversal::next(*element, &container)) {
if (element == focusedElement)
continue;
@@ -791,7 +790,7 @@ void FocusController::findFocusCandidateInContainer(Node* container, const Layou
if (candidate.isNull())
continue;
- candidate.enclosingScrollableBox = container;
+ candidate.enclosingScrollableBox = &container;
updateFocusCandidateIfNeeded(direction, current, candidate, closest);
}
}
@@ -808,7 +807,7 @@ bool FocusController::advanceFocusDirectionallyInContainer(Node* container, cons
// Find the closest node within current container in the direction of the navigation.
FocusCandidate focusCandidate;
- findFocusCandidateInContainer(container, newStartingRect, direction, focusCandidate);
+ findFocusCandidateInContainer(*container, newStartingRect, direction, focusCandidate);
if (focusCandidate.isNull()) {
// Nothing to focus, scroll if possible.
« no previous file with comments | « Source/core/page/FocusController.h ('k') | Source/core/svg/SVGElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698