Commit 40735d1f authored by Yi Su's avatar Yi Su Committed by Commit Bot

Remove highlight delay for FindInPage results out of screen.

In current implementation of find_in_page.js, when user navigates to a
match result out of the screen, the orange highlight will be added to it
with a 250ms delay. In previous version, the callback invoked after
250ms will always add orange highlight to the current selected match
result, and the CL(http://crrev/c/1347363) accidently changed the logic
and created a bug. If user clicks "goNext" fast enough, selected match
result may get highlighted permanently.

However, after deeper investigation, the delayed highlight seems to be
buggy from the begining. Navigating backward to a match result that is
inside the screen will also meets the condition and trigger the delay,
but the 250ms is just too short to be noticed.
Besides, why we need the delay is also mysterious, and here is my guess:
In ancient time the find_in_page.js do two things, first scroll to the
match result and then do the highlight, and somehow UIWebView requires
us to add a delay(see the comments in old version code). Then the
scrolling work moved from Js into OC, so there are two lines about
scrolling that are commented out.

Since UX has also confirmed that delay on highlight is not necessary, it
should be removed now.

Bug: 911611
Change-Id: If0fef219b33954e243e527f3b50dbe836f753ede
Reviewed-on: https://chromium-review.googlesource.com/c/1365610Reviewed-by: default avatarPeter Lee <pkl@chromium.org>
Commit-Queue: Yi Su <mrsuyi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#614353}
parent a52806d0
......@@ -731,16 +731,7 @@ function findScrollDimensions_() {
// Perform the scroll.
// window.scrollTo(xPos, yPos);
if (xPos < window.pageXOffset ||
xPos >= (window.pageXOffset + window.innerWidth) ||
yPos < window.pageYOffset ||
yPos >= (window.pageYOffset + window.innerHeight)) {
// If it's off the screen. Wait a bit to start the highlight animation so
// that scrolling can get there first.
window.setTimeout(() => match.addSelectHighlight(), 250);
} else {
match.addSelectHighlight();
}
match.addSelectHighlight();
let scaled = scaleCoordinates_(normalized);
let index = match.visibleIndex;
scaled.unshift(index);
......
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