Skip to content

Commit 16e25e6

Browse files
author
Victoria Lease
committed
scroll relative to visibleRect in spawnContentScrollTo()
WebKit calculates its scrolling destination coordinates relative to the visibleRect that WebCoreViewBridge provides it. That visibleRect is stored in WebViewClassic as mScrollOffset. When a titlebar is displaying, the coordinate conversion from content to view fails. This conversion is used in many other places and seems to function perfectly fine for them, so I've concluded that while it may be the wrong tool for this particular job, it is the correct tool for many others. As a result, I've left the conversion as it is and simply fixed the function that WebKit calls to programatically scroll the content. This fixes all of the programmatic scrolling issues I've been seeing with find-on-page without breaking anything else. Bug: 5470588 Change-Id: I50d3af4dd8a7fbd2d04bbb41e38f3e6947fbb46a
1 parent dbaf2cc commit 16e25e6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

core/java/android/webkit/WebViewClassic.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4361,9 +4361,9 @@ private void spawnContentScrollTo(int cx, int cy) {
43614361
// is used in the view system.
43624362
return;
43634363
}
4364-
int vx = contentToViewX(cx);
4365-
int vy = contentToViewY(cy);
4366-
pinScrollTo(vx, vy, true, 0);
4364+
int vx = contentToViewDimension(cx - mScrollOffset.x);
4365+
int vy = contentToViewDimension(cy - mScrollOffset.y);
4366+
pinScrollBy(vx, vy, true, 0);
43674367
}
43684368

43694369
/**

0 commit comments

Comments
 (0)