Commit fac45743 authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Add SizeBounds::is_bounded() as sugar for "width and height both set".

This is called a few places now and will add a few more in future CLs.

Bug: none
Change-Id: I83f17f4b981781a649c00aa2cf23f63994093d5d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2026414
Commit-Queue: Dana Fried <dfried@chromium.org>
Reviewed-by: default avatarDana Fried <dfried@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737546}
parent 1c33adc8
......@@ -86,8 +86,7 @@ views::ProposedLayout InterpolatingLayoutManager::CalculateProposedLayout(
const views::SizeBounds& size_bounds) const {
// For interpolating layout we will never call this method for unbounded
// sizes.
DCHECK(size_bounds.width());
DCHECK(size_bounds.height());
DCHECK(size_bounds.is_fully_bounded());
const gfx::Size size(*size_bounds.width(), *size_bounds.height());
const LayoutInterpolation interpolation = GetInterpolation(size_bounds);
......
......@@ -33,8 +33,7 @@ ProposedLayout FillLayout::CalculateProposedLayout(
// Because we explicitly override GetPreferredSize and
// GetPreferredHeightForWidth(), we should always call this method with well-
// defined bounds.
DCHECK(size_bounds.width().has_value());
DCHECK(size_bounds.height().has_value());
DCHECK(size_bounds.is_fully_bounded());
ProposedLayout layout;
layout.host_size = host_view()->size();
......
......@@ -54,6 +54,8 @@ class VIEWS_EXPORT SizeBounds {
height_ = std::move(height);
}
constexpr bool is_fully_bounded() const { return width_ && height_; }
// Enlarges (or shrinks, if negative) each upper bound that is present by the
// specified amounts.
void Enlarge(int width, int height);
......
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