views: use CalculatePreferredSize(SizeBounds) in //ash/capture_mode.
In order to ensure implementation consistency and avoid oversights, we should unify CalculatePreferredSize() and GetHeightForWidth(). Replace them with the CalculatePreferredSize(SizeBounds) overload. Bug: 40232718 Change-Id: Iab28cedc2c9244de9d6d63bea70a1168e099e9f7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5476887 Reviewed-by: Xiyuan Xia <xiyuan@chromium.org> Commit-Queue: Weidong Liu <weidongliu@chromium.org> Cr-Commit-Position: refs/heads/main@{#1291941}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
9fccfa9793
commit
909d669996
@ -339,7 +339,8 @@ void CaptureLabelView::Layout(PassKey) {
|
||||
LayoutSuperclass<views::View>(this);
|
||||
}
|
||||
|
||||
gfx::Size CaptureLabelView::CalculatePreferredSize() const {
|
||||
gfx::Size CaptureLabelView::CalculatePreferredSize(
|
||||
const views::SizeBounds& available_size) const {
|
||||
if (countdown_finished_callback_)
|
||||
return gfx::Size(kCaptureLabelRadius * 2, kCaptureLabelRadius * 2);
|
||||
|
||||
|
@ -76,7 +76,8 @@ class ASH_EXPORT CaptureLabelView : public views::View,
|
||||
void AddedToWidget() override;
|
||||
void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
|
||||
void Layout(PassKey) override;
|
||||
gfx::Size CalculatePreferredSize() const override;
|
||||
gfx::Size CalculatePreferredSize(
|
||||
const views::SizeBounds& available_size) const override;
|
||||
void OnThemeChanged() override;
|
||||
|
||||
// gfx::AnimationDelegate:
|
||||
|
@ -98,7 +98,8 @@ void KeyItemView::Layout(PassKey) {
|
||||
}
|
||||
}
|
||||
|
||||
gfx::Size KeyItemView::CalculatePreferredSize() const {
|
||||
gfx::Size KeyItemView::CalculatePreferredSize(
|
||||
const views::SizeBounds& available_size) const {
|
||||
// Return the fixed size if the key item contains icon or label with a single
|
||||
// character.
|
||||
if (icon_ || (label_ && label_->GetText().length() == 1)) {
|
||||
|
@ -33,7 +33,8 @@ class KeyItemView : public views::View {
|
||||
void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
|
||||
void OnThemeChanged() override;
|
||||
void Layout(PassKey) override;
|
||||
gfx::Size CalculatePreferredSize() const override;
|
||||
gfx::Size CalculatePreferredSize(
|
||||
const views::SizeBounds& available_size) const override;
|
||||
|
||||
void SetIcon(const gfx::VectorIcon& icon);
|
||||
void SetText(const std::u16string& text);
|
||||
|
Reference in New Issue
Block a user