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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 1738603002: Sequential focus navigation staring point: Fix a case where clicked Text node has focusable sibling… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months 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 | « third_party/WebKit/LayoutTests/fast/events/sequential-focus-navigation-starting-point.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 26eaa9784d595e6208066fc7919d128cfd9b555a..03338a756a267a2cf3f1eddee32e5f176d7bd0fb 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -3729,7 +3729,7 @@ void Document::setSequentialFocusNavigationStartingPoint(Node* node)
ASSERT(node->document() == this);
if (!m_sequentialFocusNavigationStartingPoint)
m_sequentialFocusNavigationStartingPoint = Range::create(*this);
- m_sequentialFocusNavigationStartingPoint->selectNodeContents(node->isElementNode() ? node : node->parentOrShadowHostElement(), ASSERT_NO_EXCEPTION);
+ m_sequentialFocusNavigationStartingPoint->selectNodeContents(node, ASSERT_NO_EXCEPTION);
}
Element* Document::sequentialFocusNavigationStartingPoint(WebFocusType type) const
@@ -3741,7 +3741,11 @@ Element* Document::sequentialFocusNavigationStartingPoint(WebFocusType type) con
if (!m_sequentialFocusNavigationStartingPoint->collapsed()) {
Node* node = m_sequentialFocusNavigationStartingPoint->startContainer();
ASSERT(node == m_sequentialFocusNavigationStartingPoint->endContainer());
- return node->isElementNode() ? toElement(node) : node->parentOrShadowHostElement();
+ if (node->isElementNode())
+ return toElement(node);
+ if (Element* neighborElement = type == WebFocusTypeForward ? ElementTraversal::previous(*node) : ElementTraversal::next(*node))
+ return neighborElement;
+ return node->parentOrShadowHostElement();
}
// Range::selectNodeContents didn't select contents because the element had
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/events/sequential-focus-navigation-starting-point.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698