Commit f8ab87ab authored by Clark DuVall's avatar Clark DuVall Committed by Commit Bot

[WebLayer] Fix fullscreen videos having black bar on the bottom

The top bar was still taking up space even though it is not needed in
fullscreen. This also fixes a bug where pressing the back button did not
exit fullscreen in the shell.

Bug: 1029894
Change-Id: I215e8e1066670ba2e57d83114537b95c70186d99
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1946629Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#720761}
parent abf93b0b
...@@ -290,6 +290,8 @@ void TabImpl::RunFileChooser( ...@@ -290,6 +290,8 @@ void TabImpl::RunFileChooser(
} }
int TabImpl::GetTopControlsHeight() { int TabImpl::GetTopControlsHeight() {
if (is_fullscreen_)
return 0;
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
return top_controls_container_view_ return top_controls_container_view_
? top_controls_container_view_->GetTopControlsHeight() ? top_controls_container_view_->GetTopControlsHeight()
......
...@@ -62,6 +62,7 @@ public class WebLayerShellActivity extends FragmentActivity { ...@@ -62,6 +62,7 @@ public class WebLayerShellActivity extends FragmentActivity {
private int mMainViewId; private int mMainViewId;
private ViewGroup mTopContentsContainer; private ViewGroup mTopContentsContainer;
private List<Tab> mPreviousTabList = new ArrayList<>(); private List<Tab> mPreviousTabList = new ArrayList<>();
private Runnable mExitFullscreenRunnable;
@Override @Override
protected void onCreate(final Bundle savedInstanceState) { protected void onCreate(final Bundle savedInstanceState) {
...@@ -181,6 +182,7 @@ public class WebLayerShellActivity extends FragmentActivity { ...@@ -181,6 +182,7 @@ public class WebLayerShellActivity extends FragmentActivity {
@Override @Override
public void onEnterFullscreen(Runnable exitFullscreenRunnable) { public void onEnterFullscreen(Runnable exitFullscreenRunnable) {
mExitFullscreenRunnable = exitFullscreenRunnable;
// This comes from Chrome code to avoid an extra resize. // This comes from Chrome code to avoid an extra resize.
final WindowManager.LayoutParams attrs = getWindow().getAttributes(); final WindowManager.LayoutParams attrs = getWindow().getAttributes();
attrs.flags |= WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS; attrs.flags |= WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
...@@ -200,6 +202,7 @@ public class WebLayerShellActivity extends FragmentActivity { ...@@ -200,6 +202,7 @@ public class WebLayerShellActivity extends FragmentActivity {
@Override @Override
public void onExitFullscreen() { public void onExitFullscreen() {
mExitFullscreenRunnable = null;
View decorView = getWindow().getDecorView(); View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(mSystemVisibilityToRestore); decorView.setSystemUiVisibility(mSystemVisibilityToRestore);
...@@ -311,6 +314,10 @@ public class WebLayerShellActivity extends FragmentActivity { ...@@ -311,6 +314,10 @@ public class WebLayerShellActivity extends FragmentActivity {
@Override @Override
public void onBackPressed() { public void onBackPressed() {
if (mExitFullscreenRunnable != null) {
mExitFullscreenRunnable.run();
return;
}
if (mBrowser != null) { if (mBrowser != null) {
NavigationController controller = mBrowser.getActiveTab().getNavigationController(); NavigationController controller = mBrowser.getActiveTab().getNavigationController();
if (controller.canGoBack()) { if (controller.canGoBack()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment