Commit ed7da143 authored by Abhijeet Singh's avatar Abhijeet Singh Committed by Commit Bot

Fix rendering for Quick Answers consent-view

This CL fixes the bug where the User-Consent view for Quick-Answers
feature incorrectly displays the label-buttons by shrinking them for
words of certain lengths.

Bug: b:151294161
Test: Tested on Chrome OS VM
Change-Id: I3b24abebd42ddbf735998360538f1cec76cc91e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2100487Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Abhijeet Singh <siabhijeet@google.com>
Cr-Commit-Position: refs/heads/master@{#749958}
parent 04311ac1
...@@ -201,10 +201,10 @@ void UserConsentView::InitLayout() { ...@@ -201,10 +201,10 @@ void UserConsentView::InitLayout() {
views::BoxLayout::CrossAxisAlignment::kStart); views::BoxLayout::CrossAxisAlignment::kStart);
// Assistant icon. // Assistant icon.
assistant_icon_ = AddChildView(std::make_unique<views::ImageView>()); auto* assistant_icon = AddChildView(std::make_unique<views::ImageView>());
assistant_icon_->SetBorder(views::CreateEmptyBorder( assistant_icon->SetBorder(views::CreateEmptyBorder(
(kLineHeightDip - kAssistantIconSizeDip) / 2, 0, 0, 0)); (kLineHeightDip - kAssistantIconSizeDip) / 2, 0, 0, 0));
assistant_icon_->SetImage(gfx::CreateVectorIcon( assistant_icon->SetImage(gfx::CreateVectorIcon(
kAssistantIcon, kAssistantIconSizeDip, gfx::kPlaceholderColor)); kAssistantIcon, kAssistantIconSizeDip, gfx::kPlaceholderColor));
// Content. // Content.
...@@ -236,7 +236,7 @@ void UserConsentView::InitContent() { ...@@ -236,7 +236,7 @@ void UserConsentView::InitContent() {
// width as the anchor, so its preferred size will be calculated correctly. // width as the anchor, so its preferred size will be calculated correctly.
int desc_desired_width = anchor_view_bounds_.width() - int desc_desired_width = anchor_view_bounds_.width() -
kMainViewInsets.width() - kContentInsets.width() - kMainViewInsets.width() - kContentInsets.width() -
assistant_icon_->width(); kAssistantIconSizeDip;
desc->SizeToFit(desc_desired_width); desc->SizeToFit(desc_desired_width);
// Button bar. // Button bar.
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "ui/views/view.h" #include "ui/views/view.h"
namespace views { namespace views {
class ImageView;
class LabelButton; class LabelButton;
} // namespace views } // namespace views
...@@ -55,7 +54,6 @@ class UserConsentView : public views::View, public views::ButtonListener { ...@@ -55,7 +54,6 @@ class UserConsentView : public views::View, public views::ButtonListener {
QuickAnswersUiController* const ui_controller_; QuickAnswersUiController* const ui_controller_;
// Owned by view hierarchy. // Owned by view hierarchy.
views::ImageView* assistant_icon_ = nullptr;
views::View* content_ = nullptr; views::View* content_ = nullptr;
views::LabelButton* settings_button_ = nullptr; views::LabelButton* settings_button_ = nullptr;
views::LabelButton* consent_button_ = nullptr; views::LabelButton* consent_button_ = nullptr;
......
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