Commit 8f39f54f authored by David Black's avatar David Black Committed by Commit Bot

Fix DCHECK in AssistantCardElementView.

When the Assistant response's first UI element is a card, the card is
given an empty top border for spacing. When this occurs, DCHECK fails
because we were previously expecting local bounds when we should be
expecting contents bounds.

Bug: b:153904177
Change-Id: I7f28149cb6317836c76f566827526c8220f0e5a9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2148221Reviewed-by: default avatarTao Wu <wutao@chromium.org>
Commit-Queue: David Black <dmblack@google.com>
Cr-Commit-Position: refs/heads/master@{#759068}
parent 69df9de9
...@@ -146,10 +146,10 @@ void AssistantCardElementView::OnGestureEvent(ui::GestureEvent* event) { ...@@ -146,10 +146,10 @@ void AssistantCardElementView::OnGestureEvent(ui::GestureEvent* event) {
} }
void AssistantCardElementView::ScrollRectToVisible(const gfx::Rect& rect) { void AssistantCardElementView::ScrollRectToVisible(const gfx::Rect& rect) {
// We expect this method is called outside this class to show its local // We expect this method is called outside this class to show its contents
// bounds. Inside this class, should call views::View::ScrollRectToVisible() // bounds. Inside this class, should call views::View::ScrollRectToVisible()
// to show the focused node in the web contents. // to show the focused node in the web contents.
DCHECK(rect == GetLocalBounds()); DCHECK(rect == GetContentsBounds());
// When this view is focused, View::Focus() calls ScrollViewToVisible(), which // When this view is focused, View::Focus() calls ScrollViewToVisible(), which
// calls ScrollRectToVisible(). But we don't want that call to do anything, // calls ScrollRectToVisible(). But we don't want that call to do anything,
...@@ -204,7 +204,6 @@ void AssistantCardElementView::DidChangeFocusedNode( ...@@ -204,7 +204,6 @@ void AssistantCardElementView::DidChangeFocusedNode(
void AssistantCardElementView::InitLayout( void AssistantCardElementView::InitLayout(
const AssistantCardElement* card_element) { const AssistantCardElement* card_element) {
SetFocusBehavior(FocusBehavior::ALWAYS);
SetLayoutManager(std::make_unique<views::FillLayout>()); SetLayoutManager(std::make_unique<views::FillLayout>());
// Contents view. // Contents view.
......
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