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

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

Issue 2392463002: DO NOT SUBMIT: Fix input action type for Android
Patch Set: Created 4 years, 2 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
Index: third_party/WebKit/Source/core/page/FocusController.cpp
diff --git a/third_party/WebKit/Source/core/page/FocusController.cpp b/third_party/WebKit/Source/core/page/FocusController.cpp
index b12d00e65daf5be5c67ba009d8722122e1bcb590..e043a6716ca77230114b53caae4ff6671cf8605f 100644
--- a/third_party/WebKit/Source/core/page/FocusController.cpp
+++ b/third_party/WebKit/Source/core/page/FocusController.cpp
@@ -441,8 +441,10 @@ Element* nextFocusableElement(ScopedFocusNavigation& scope)
{
Element* current = scope.currentElement();
if (current) {
+ LOG(ERROR) << "XXX nextFocusable: " << current->outerHTML();
int tabIndex = adjustedTabIndex(*current);
// If an element is excluded from the normal tabbing cycle, the next focusable element is determined by tree order
+ LOG(ERROR) << "XXX nextFocusable: " << tabIndex;
if (tabIndex < 0) {
for (scope.moveToNext(); scope.currentElement(); scope.moveToNext()) {
current = scope.currentElement();
@@ -533,6 +535,7 @@ Element* findFocusableElementRecursivelyForward(ScopedFocusNavigation& scope)
// Starting element is exclusive.
Element* found = findFocusableElementInternal(WebFocusTypeForward, scope);
while (found) {
+ LOG(ERROR) << "XXX findFocusable: " << found->outerHTML();
if (isShadowHostDelegatesFocus(*found)) {
// If tabindex is positive, find focusable element inside its shadow tree.
if (found->tabIndex() >= 0 && isShadowHostWithoutCustomFocusLogic(*found)) {
@@ -863,6 +866,31 @@ bool FocusController::setInitialFocus(WebFocusType type)
return didAdvanceFocus;
}
+Element* FocusController::getCurrentElementForFocusNavigation(WebFocusType type) {
+ LocalFrame* frame = toLocalFrame(focusedOrMainFrame());
+ Document* document = frame->document();
+ document->updateStyleAndLayoutIgnorePendingStylesheets();
+
+ Element* current = document->sequentialFocusNavigationStartingPoint(type);
+
+ // FIXME: Not quite correct when it comes to focus transitions leaving/entering the WebView itself
+ bool caretBrowsing = frame->settings() && frame->settings()->caretBrowsingEnabled();
+
+ if (caretBrowsing && !current)
+ current = adjustToElement(frame->selection().start().anchorNode(), type);
+ return current;
+}
+
+Element* FocusController::findNextFocusableElementInDocumentOrder() {
+ LocalFrame* frame = toLocalFrame(focusedOrMainFrame());
+ Document* document = frame->document();
+ document->updateStyleAndLayoutIgnorePendingStylesheets();
+ WebFocusType type = WebFocusTypeForward;
+ Element* current = getCurrentElementForFocusNavigation(type);
+ ScopedFocusNavigation scope = current ? ScopedFocusNavigation::createFor(*current) : ScopedFocusNavigation::createForDocument(*document);
+ return findFocusableElementAcrossFocusScopes(type, scope);
+}
+
bool FocusController::advanceFocus(WebFocusType type, bool initialFocus, InputDeviceCapabilities* sourceCapabilities)
{
switch (type) {
« no previous file with comments | « third_party/WebKit/Source/core/page/FocusController.h ('k') | third_party/WebKit/Source/web/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698