diff options
Diffstat (limited to 'libs')
-rw-r--r-- | libs/deviceutillegacy/src/android/webkit/cts/WebViewOnUiThread.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libs/deviceutillegacy/src/android/webkit/cts/WebViewOnUiThread.java b/libs/deviceutillegacy/src/android/webkit/cts/WebViewOnUiThread.java index 2933b0b0f9a..b9ee9878c03 100644 --- a/libs/deviceutillegacy/src/android/webkit/cts/WebViewOnUiThread.java +++ b/libs/deviceutillegacy/src/android/webkit/cts/WebViewOnUiThread.java @@ -807,6 +807,17 @@ public class WebViewOnUiThread { }); } + public void setLayoutToMatchParent() { + runOnUiThread(new Runnable() { + @Override + public void run() { + setMatchParent((View) mWebView.getParent()); + setMatchParent(mWebView); + mWebView.requestLayout(); + } + }); + } + public void setAcceptThirdPartyCookies(final boolean accept) { runOnUiThread(new Runnable() { @Override @@ -978,6 +989,18 @@ public class WebViewOnUiThread { } /** + * Set LayoutParams to MATCH_PARENT. + * + * @param view Target view + */ + private void setMatchParent(View view) { + ViewGroup.LayoutParams params = view.getLayoutParams(); + params.height = ViewGroup.LayoutParams.MATCH_PARENT; + params.width = ViewGroup.LayoutParams.MATCH_PARENT; + view.setLayoutParams(params); + } + + /** * A WebChromeClient used to capture the onProgressChanged for use * in waitFor functions. If a test must override the WebChromeClient, * it can derive from this class or call onProgressChanged |