Commit 1b7db534 authored by Sinan Sahin's avatar Sinan Sahin Committed by Commit Bot

[Offline indicator v2] Fix NullPointerException in CompositorViewHolder

Bug: 1048972
Change-Id: I3f06cf95efc9e96679326a41ccf29caa38f0bc9c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2039594
Commit-Queue: Sinan Sahin <sinansahin@google.com>
Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738741}
parent 76a12d06
...@@ -811,7 +811,7 @@ public class CompositorViewHolder extends FrameLayout ...@@ -811,7 +811,7 @@ public class CompositorViewHolder extends FrameLayout
public void onBottomControlsHeightChanged( public void onBottomControlsHeightChanged(
int bottomControlsHeight, int bottomControlsMinHeight) { int bottomControlsHeight, int bottomControlsMinHeight) {
if (mTabVisible == null) return; if (mTabVisible == null) return;
getWebContents().notifyBrowserControlsHeightChanged(); onBrowserControlsHeightChanged();
Point viewportSize = getViewportSize(); Point viewportSize = getViewportSize();
setSize(mTabVisible.getWebContents(), mTabVisible.getContentView(), viewportSize.x, setSize(mTabVisible.getWebContents(), mTabVisible.getContentView(), viewportSize.x,
viewportSize.y); viewportSize.y);
...@@ -821,13 +821,23 @@ public class CompositorViewHolder extends FrameLayout ...@@ -821,13 +821,23 @@ public class CompositorViewHolder extends FrameLayout
@Override @Override
public void onTopControlsHeightChanged(int topControlsHeight, int topControlsMinHeight) { public void onTopControlsHeightChanged(int topControlsHeight, int topControlsMinHeight) {
if (mTabVisible == null) return; if (mTabVisible == null) return;
getWebContents().notifyBrowserControlsHeightChanged(); onBrowserControlsHeightChanged();
Point viewportSize = getViewportSize(); Point viewportSize = getViewportSize();
setSize(mTabVisible.getWebContents(), mTabVisible.getContentView(), viewportSize.x, setSize(mTabVisible.getWebContents(), mTabVisible.getContentView(), viewportSize.x,
viewportSize.y); viewportSize.y);
onViewportChanged(); onViewportChanged();
} }
/**
* Notify the {@link WebContents} of the browser controls height changes. Unlike #setSize, this
* will make sure the renderer's properties are updated even if the size didn't change.
*/
private void onBrowserControlsHeightChanged() {
final WebContents webContents = getWebContents();
if (webContents == null) return;
webContents.notifyBrowserControlsHeightChanged();
}
@Override @Override
public void onToggleOverlayVideoMode(boolean enabled) { public void onToggleOverlayVideoMode(boolean enabled) {
if (mCompositorView != null) { if (mCompositorView != null) {
......
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