Commit dfbfd505 authored by David Black's avatar David Black Committed by Commit Bot

Fix AssistantWebView.

AssistantWebView's child view for embedded WebContents was not being
sized during initialization due to a failed initialization condition
check.

Bug: b:135215741
Change-Id: I470daf60466baa3435c431f6256468c0cbc641ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1665776Reviewed-by: default avatarTao Wu <wutao@chromium.org>
Commit-Queue: David Black <dmblack@google.com>
Cr-Commit-Position: refs/heads/master@{#670278}
parent 6cd769a4
...@@ -145,6 +145,8 @@ void AssistantWebView::DidStopLoading() { ...@@ -145,6 +145,8 @@ void AssistantWebView::DidStopLoading() {
if (contents_view_initialized_) if (contents_view_initialized_)
return; return;
contents_view_initialized_ = true;
UpdateContentSize(); UpdateContentSize();
AddChildView(contents_->GetView()->view()); AddChildView(contents_->GetView()->view());
SetFocusBehavior(FocusBehavior::ALWAYS); SetFocusBehavior(FocusBehavior::ALWAYS);
...@@ -153,8 +155,6 @@ void AssistantWebView::DidStopLoading() { ...@@ -153,8 +155,6 @@ void AssistantWebView::DidStopLoading() {
contents_->GetView()->native_view()->layer()->SetRoundedCornerRadius( contents_->GetView()->native_view()->layer()->SetRoundedCornerRadius(
{/*top_left=*/0, /*top_right=*/0, /*bottom_right=*/kCornerRadiusDip, {/*top_left=*/0, /*top_right=*/0, /*bottom_right=*/kCornerRadiusDip,
/*bottom_left=*/kCornerRadiusDip}); /*bottom_left=*/kCornerRadiusDip});
contents_view_initialized_ = true;
} }
void AssistantWebView::DidSuppressNavigation(const GURL& url, void AssistantWebView::DidSuppressNavigation(const GURL& url,
...@@ -190,8 +190,7 @@ void AssistantWebView::OnUiVisibilityChanged( ...@@ -190,8 +190,7 @@ void AssistantWebView::OnUiVisibilityChanged(
void AssistantWebView::OnUsableWorkAreaChanged( void AssistantWebView::OnUsableWorkAreaChanged(
const gfx::Rect& usable_work_area) { const gfx::Rect& usable_work_area) {
if (contents_) UpdateContentSize();
UpdateContentSize();
} }
void AssistantWebView::RemoveContents() { void AssistantWebView::RemoveContents() {
...@@ -209,7 +208,7 @@ void AssistantWebView::RemoveContents() { ...@@ -209,7 +208,7 @@ void AssistantWebView::RemoveContents() {
} }
void AssistantWebView::UpdateContentSize() { void AssistantWebView::UpdateContentSize() {
if (!contents_view_initialized_) if (!contents_ || !contents_view_initialized_)
return; return;
const gfx::Size preferred_size = gfx::Size( const gfx::Size preferred_size = gfx::Size(
......
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