New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 767388
Owner: ----
Closed: May 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment
link

Issue 842863: Incorrect viewport dimensions and scroll in Android WebView

Reported by alex.po...@moat.com, May 14 2018

Issue description

Steps to reproduce the problem:
See attached test app (build from source).

The app consists of a single WebView that loads some simple HTML within the WebView.

This HTML page shows a bug in how the WebView calculates the dimensions of the window (innerHeight
and innerWidth) and the coordinates of the elements relative to the window perhaps as a sideeffect.

1. innerWidth and innerHeight: the width and height of the WebView are natively hardcoded to be
360dp x 400dp. Yet innerWidth and innerHeight will report significantly larger values.

2. scrollY is frozen at a value of 0 even after scrolling in the WebView until a certain point is
reached (did not investigate at WHAT point exactly) and then starts incrementing. Note scrollY
does not exceed 0 until well after the red <div> is scrolled completely out of the viewport.

3. Related to 2, getBoundingClientRect() on the <img> element returns incorrect values that do not
update as the viewport is scrolled.

4. IntersectionObserver is broken as a result. Notice it does not update as we scroll through the
WebView and the position of the <img> element changes.

The above can be confirmed by attaching an inspector to the WebView.

This issue appears to be related to https://bugs.chromium.org/p/chromium/issues/detail?id=767388 though exhibits more extensive problems. Any code that requires on accurate coordinate and positioning information will get inaccurate results. This is a significant issue for, for example, ad measurement code.

What is the expected behavior?
The scroll position and coordinates should be reported correctly.

What went wrong?
The expected behavior is not met.

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 66.0.3359.158  Channel: stable
OS Version: 7.0
Flash Version: N/A
 
CoordinateBug.zip
12.4 MB Download

Comment 1 by sandeepkumars@chromium.org, May 15 2018

Labels: Needs-triage-Mobile

Comment 2 by sandeepkumars@chromium.org, May 15 2018

Cc: sandeepkumars@chromium.org
Labels: Triaged-Mobile
Mergedinto: 767388
Status: Duplicate (was: Unconfirmed)
@alex.popov: Thanks for the report!!

This issue seems to be a dupe of issue 767388. Hence merging into this issue, please feel free to undo if not the case.

Thanks!!

Comment 3 by alex.po...@moat.com, May 15 2018

Hi Sandeep, thanks for the feedback.

I think the issue is related but is not a duplicate. 

Note that there are significant additional issues reported here that are outside the scope of of 767388 that are not resolved by the use of the new VisualViewport API (as recommended in 767388). These issues are:

1. Element geometry (getBoundingClientRect) is inaccurate.
2. Intersection observer calculations are inaccurate.
3. Scroll position is not calculated correctly.

Therefore I think this warrants reviewing and hopefully addressing independent of 767388.

Comment 4 by alex.po...@moat.com, May 22 2018

Hi Sandeep, any updates on the above? It seems like we should reopen this issue because it reports additional breaking behavior and is not resolved by the workarounds suggested in the other issue.

Sign in to add a comment