Commit 9e7b5573 authored by AJITH KUMAR V's avatar AJITH KUMAR V Committed by Commit Bot

[Android] Restricting Smart Go Next only in Android

Current implementation of Smart Go Next will execute for
all platforms because of calculation logic touches blink.
Now restricting this logic only in Android platform. Due to
a regression in blink wrt element focus time, currently applying
a threshold of focus calculation.

Bug: 781026
Change-Id: I96c60e15186bddae087345f2d5b25a359dd4ac48
Reviewed-on: https://chromium-review.googlesource.com/758481
Commit-Queue: Takayoshi Kochi <kochi@chromium.org>
Reviewed-by: 's avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: 's avatarChangwan Ryu <changwan@chromium.org>
Reviewed-by: 's avatarNasko Oskov <nasko@chromium.org>
Reviewed-by: 's avatarTakayoshi Kochi <kochi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#516124}
parent 05f818e2
......@@ -1200,6 +1200,7 @@ void RenderWidget::UpdateTextInputStateInternal(bool show_virtual_keyboard,
params.type = new_type;
params.mode = new_mode;
params.flags = new_info.flags;
#if defined(OS_ANDROID)
if (next_previous_flags_ == kInvalidNextPreviousFlagsValue) {
// Due to a focus change, values will be reset by the frame.
// That case we only need fresh NEXT/PREVIOUS information.
......@@ -1214,6 +1215,9 @@ void RenderWidget::UpdateTextInputStateInternal(bool show_virtual_keyboard,
next_previous_flags_ = 0;
}
}
#else
next_previous_flags_ = 0;
#endif
params.flags |= next_previous_flags_;
params.value = new_info.value.Utf8();
params.selection_start = new_info.selection_start;
......
......@@ -1136,6 +1136,10 @@ Element* FocusController::FindFocusableElement(WebFocusType type,
Element* FocusController::NextFocusableElementInForm(Element* element,
WebFocusType focus_type) {
// TODO(ajith.v) Due to crbug.com/781026 when next/previous element is far
// from current element in terms of tabindex, then it's signalling CPU load.
// Will nvestigate further for a proper solution later.
static const int kFocusTraversalThreshold = 50;
element->GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets();
if (!element->IsHTMLElement())
return nullptr;
......@@ -1153,12 +1157,13 @@ Element* FocusController::NextFocusableElementInForm(Element* element,
if (!form_owner)
return nullptr;
Element* next_element = element;
OwnerMap owner_map;
for (next_element =
FindFocusableElement(focus_type, *next_element, owner_map);
next_element; next_element = FindFocusableElement(
focus_type, *next_element, owner_map)) {
Element* next_element = FindFocusableElement(focus_type, *element, owner_map);
int traversal = 0;
for (; next_element && traversal < kFocusTraversalThreshold;
next_element =
FindFocusableElement(focus_type, *next_element, owner_map),
++traversal) {
if (!next_element->IsHTMLElement())
continue;
if (ToHTMLElement(next_element)->isContentEditableForBinding() &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment