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

Issue 633457 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Aug 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

HTMLSelectElement::elementRectRelativeToViewport doesn't work in Android if minimum-scale > 1

Project Member Reported by tkent@chromium.org, Aug 2 2016

Issue description

If we revert r408903, <select> popup doesn't open in some applications with Android WebView.
See  Issue 632561  for the details.

https://bugs.chromium.org/p/chromium/issues/detail?id=632561#c22 :
>  document().view()->convertToRootFrame(document().view()->boundsRect());
> is  (0, 0, 321,430)
> And document().view()->contentsToViewport(roundedIntRect(layoutObject()->absoluteBoundingBoxFloatRect())) is:
> (398, 251, 350, 51)

The former rect looks wrong.  It should be a viewport size in DIP, and I guess it should be something like (0, 0, 800, 1280) if device scale factor is 2.0.

 

Comment 1 by hush@chromium.org, Aug 2 2016

I logged these values again.
document().view()->convertToRootFrame(document().view()->boundsRect()); is almost always wrong. I got much smaller width and height.

In the cases where the selection dropdown is indeed shown, the selection tag rect (the second rect) merely intersects with the viewport rect (the first rect) with a very small rect, which is wrong too, because the selection tag is completely within the viewport visually.

Comment 2 by hush@chromium.org, Aug 2 2016

For example, I loaded this URL http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_select
onto a webview app on pixel C.
document().view()->convertToRootFrame(document().view()->boundsRect()); is 
(0, 0, 321, 419)
And document().view()->contentsToViewport(roundedIntRect(layoutObject()->absoluteBoundingBoxFloatRect())) is:
(314, 198, 275, 40)

Comment 3 by tkent@chromium.org, Aug 5 2016

Cc: -tkent@chromium.org
Owner: tkent@chromium.org
Status: Assigned (was: Available)
Summary: HTMLSelectElement::elementRectRelativeToViewport doesn't work in Android if minimum-scale > 1 (was: HTMLSelectElement::elementRectRelativeToViewport doesn't work in Android WebView (if device scale factor > 1?))
I found the root cause.

The trigger is WebViewImpl::minimumPageScaleFactor() > 1. This issue is reproducible with Google Chrome for Android by specifying viewport meta like:
    <meta name="viewport" content="minimum-scale=2.0">

blink::WebViewImpl::mainFrameSize() returns viewport size scaled by minimumPageScaleFactor().  So FrameView::boundsRect() is smaller than the DIP size if minimumPageScaleFactor() is larger than 1.

We should use FrameView::visibleContentRect() or VisualViewport::size() instead of FrameView::boundsRect().


Comment 4 by tkent@chromium.org, Aug 8 2016

Status: Started (was: Assigned)
Project Member

Comment 5 by bugdroid1@chromium.org, Aug 9 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/48565e7338d3f8d0cbfdb082f51e609b7bfd4624

commit 48565e7338d3f8d0cbfdb082f51e609b7bfd4624
Author: tkent <tkent@chromium.org>
Date: Tue Aug 09 03:43:07 2016

Fix element visibility check for validation bubbles and SELECT popups.

- Do not use FrameView::boundsRect() for element visibility check
  It's scaled by minimum-scale. We should use VisualViewport::size().

- Introduce Element::visibleBoundsInViewport() to merge duplicated code in
  HTMLSelectElement and ValidationMessageClientImpl.

BUG= 633457 

Review-Url: https://codereview.chromium.org/2215333002
Cr-Commit-Position: refs/heads/master@{#410567}

[modify] https://crrev.com/48565e7338d3f8d0cbfdb082f51e609b7bfd4624/third_party/WebKit/Source/core/dom/Element.cpp
[modify] https://crrev.com/48565e7338d3f8d0cbfdb082f51e609b7bfd4624/third_party/WebKit/Source/core/dom/Element.h
[modify] https://crrev.com/48565e7338d3f8d0cbfdb082f51e609b7bfd4624/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp
[modify] https://crrev.com/48565e7338d3f8d0cbfdb082f51e609b7bfd4624/third_party/WebKit/Source/core/html/HTMLSelectElement.h
[modify] https://crrev.com/48565e7338d3f8d0cbfdb082f51e609b7bfd4624/third_party/WebKit/Source/core/html/HTMLSelectElementTest.cpp
[modify] https://crrev.com/48565e7338d3f8d0cbfdb082f51e609b7bfd4624/third_party/WebKit/Source/web/PopupMenuImpl.cpp
[modify] https://crrev.com/48565e7338d3f8d0cbfdb082f51e609b7bfd4624/third_party/WebKit/Source/web/ValidationMessageClientImpl.cpp
[modify] https://crrev.com/48565e7338d3f8d0cbfdb082f51e609b7bfd4624/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
[add] https://crrev.com/48565e7338d3f8d0cbfdb082f51e609b7bfd4624/third_party/WebKit/Source/web/tests/data/viewport-select.html

Comment 6 by tkent@chromium.org, Aug 9 2016

Status: Fixed (was: Started)

Sign in to add a comment