views: use CalculatePreferredSize(SizeBounds) in //apps.
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: I039deb4151cef1837cdcf01689a636bc477e5429 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5464278 Commit-Queue: Weidong Liu <weidongliu@chromium.org> Reviewed-by: Stefan Kuhne <skuhne@chromium.org> Cr-Commit-Position: refs/heads/main@{#1291007}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
8a9278668c
commit
bc9b7adcf5
apps/ui/views
@@ -239,8 +239,9 @@ void AppWindowFrameView::SizeConstraintsChanged() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::Size AppWindowFrameView::CalculatePreferredSize() const {
|
gfx::Size AppWindowFrameView::CalculatePreferredSize(
|
||||||
gfx::Size pref = widget_->client_view()->GetPreferredSize({});
|
const views::SizeBounds& available_size) const {
|
||||||
|
gfx::Size pref = widget_->client_view()->GetPreferredSize(available_size);
|
||||||
gfx::Rect bounds(0, 0, pref.width(), pref.height());
|
gfx::Rect bounds(0, 0, pref.width(), pref.height());
|
||||||
return widget_->non_client_view()
|
return widget_->non_client_view()
|
||||||
->GetWindowBoundsForClientBounds(bounds)
|
->GetWindowBoundsForClientBounds(bounds)
|
||||||
|
@@ -70,7 +70,8 @@ class AppWindowFrameView : public views::NonClientFrameView {
|
|||||||
void SizeConstraintsChanged() override;
|
void SizeConstraintsChanged() override;
|
||||||
|
|
||||||
// views::View implementation.
|
// views::View implementation.
|
||||||
gfx::Size CalculatePreferredSize() const override;
|
gfx::Size CalculatePreferredSize(
|
||||||
|
const views::SizeBounds& available_size) const override;
|
||||||
void Layout(PassKey) override;
|
void Layout(PassKey) override;
|
||||||
void OnPaint(gfx::Canvas* canvas) override;
|
void OnPaint(gfx::Canvas* canvas) override;
|
||||||
gfx::Size GetMinimumSize() const override;
|
gfx::Size GetMinimumSize() const override;
|
||||||
|
Reference in New Issue
Block a user