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

Issue 630737 link

Starred by 3 users

Issue metadata

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



Sign in to add a comment

Select element is not shown correctly in a popup window

Project Member Reported by sgu...@chromium.org, Jul 22 2016

Issue description

On phone devices:

1. Load a long web page with a select element at the bottom, for example 
https://jsbin.com/penade

2. load the page in a popup window

3. see the bottom is cut

Repro on nexus 5x

Sample code:

import android.os.Bundle;
import android.os.Message;
import android.util.Log;
import android.view.Gravity;
import android.view.ViewGroup.LayoutParams;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.LinearLayout;
import android.widget.PopupWindow;

public class MainActivity extends Activity  {

    private final String TAG = "PopUpWindow";
    private PopupWindow mPopUp;
    private LinearLayout mLayout;
    private LayoutParams mParams;
    private LinearLayout mMainLayout;
    private WebView mWebView;


    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mLayout = new LinearLayout(this);
        mMainLayout = new LinearLayout(this);

        mWebView = new WebView(this);
        mWebView.getSettings().setJavaScriptEnabled(true);
        mWebView.getSettings().setSupportMultipleWindows(true);

        mWebView.setWebChromeClient(new WebChromeClient() {
            @Override
            public boolean onCreateWindow(WebView view, boolean dialog, boolean userGesture, Message resultMsg) {
                if (mPopUp != null && mPopUp.isShowing()) {
                    mPopUp.dismiss();
                    mPopUp = null;
                    return false;
                }
                WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj;
                final WebView popupWebView = new WebView(view.getContext());
                popupWebView.setWebViewClient(new WebViewClient() {
                    @Override
                    public boolean shouldOverrideUrlLoading(WebView view, String url) {
                        android.util.Log.w(TAG, "popup webview ShouldOverride" + url);
                        return false;
                    }
                    @Override
                    public void onPageFinished(WebView view, String url) {
                        android.util.Log.w(TAG, "popup webview onPageFinished" + url);
                    }
                });
                popupWebView.getSettings().setJavaScriptEnabled(true);
                mLayout.addView(popupWebView);
                mPopUp = new PopupWindow(view.getContext());
                mPopUp.setContentView(mLayout);
                mPopUp.showAtLocation(mMainLayout, Gravity.BOTTOM, 0, 0);
                mPopUp.update(0,0,800,800);
                transport.setWebView(popupWebView);
                resultMsg.sendToTarget();
                return true;
            }
        });
        mWebView.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                Log.d(TAG, "ShouldOverrideUrlLoading main Webview" + url);
                return false;
            }
        });

        final String url = "https://output.jsbin.com/penade";
        String customHtml = "<html><body><h1>Hello, Test</h1>" +
                "<button type=\"button\" onclick=\"window.open('"+ url + "');\">" +
                "Clicking here to create a popup</button>" +
                "</body></html>";
        mWebView.loadData(customHtml, "text/html", "UTF-8");
        mParams = new LayoutParams(LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT);
        mLayout.setOrientation(LinearLayout.VERTICAL);
        mMainLayout.addView(mWebView, mParams);
        setContentView(mMainLayout);
    }
}


 
Screenshot_20160722-134254.png
118 KB View Download

Comment 1 by sgu...@chromium.org, Jul 22 2016

webview version: 52.0.2743.66. 

Comment 2 by hush@chromium.org, Jul 27 2016

This feels more like an N problem instead of webview problem.
I tried m51, m52, m53 on M and the bottom of the popup window is not cut.
The bottom is only cut on N.

Comment 3 by boliu@chromium.org, Jul 27 2016

uhh, the select element itself, or the pop up? from the screenshot, it looks like page should be scrollable?

Comment 4 by hush@chromium.org, Jul 27 2016

The page is scrollable, but it could not be scrolled down enough to show the select element.

I have reproduced the problem with the popupwindow with a TextView in it. So I don't think it is related to WebView

Comment 5 by hush@chromium.org, Jul 27 2016

This is tracked internally b/30445010

Comment 6 by hush@chromium.org, Aug 3 2016

Status: WontFix (was: Assigned)
Close because internal bug is being worked on

Sign in to add a comment