mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Add CSS::Size::is_intrinsic_sizing_constraint()
This commit is contained in:
parent
8d81421526
commit
f9b4fa9702
Notes:
github-actions[bot]
2025-11-05 11:02:54 +00:00
Author: https://github.com/gmta
Commit: f9b4fa9702
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6695
Reviewed-by: https://github.com/awesomekling ✅
3 changed files with 4 additions and 5 deletions
|
|
@ -47,6 +47,7 @@ public:
|
|||
bool is_none() const { return m_type == Type::None; }
|
||||
Type type() const { return m_type; }
|
||||
|
||||
bool is_intrinsic_sizing_constraint() const { return is_min_content() || is_max_content() || is_fit_content(); }
|
||||
bool is_length_percentage() const { return is_length() || is_percentage() || is_calculated(); }
|
||||
|
||||
[[nodiscard]] CSSPixels to_px(Layout::Node const&, CSSPixels reference_value) const;
|
||||
|
|
|
|||
|
|
@ -618,7 +618,7 @@ void FlexFormattingContext::determine_flex_base_size(FlexItem& item)
|
|||
if (!flex_basis.has<CSS::Size>())
|
||||
return false;
|
||||
auto const& size = flex_basis.get<CSS::Size>();
|
||||
if (size.is_auto() || size.is_min_content() || size.is_max_content() || size.is_fit_content())
|
||||
if (size.is_auto() || size.is_intrinsic_sizing_constraint())
|
||||
return false;
|
||||
if (size.is_length())
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -1711,8 +1711,7 @@ bool FormattingContext::should_treat_width_as_auto(Box const& box, AvailableSpac
|
|||
return true;
|
||||
}
|
||||
// AD-HOC: If the box has a preferred aspect ratio and an intrinsic keyword for width...
|
||||
if (box.has_preferred_aspect_ratio()
|
||||
&& (computed_width.is_min_content() || computed_width.is_max_content() || computed_width.is_fit_content())) {
|
||||
if (box.has_preferred_aspect_ratio() && computed_width.is_intrinsic_sizing_constraint()) {
|
||||
// If the box has no natural height to resolve the aspect ratio, we treat the width as auto.
|
||||
if (!box.has_natural_height())
|
||||
return true;
|
||||
|
|
@ -1744,8 +1743,7 @@ bool FormattingContext::should_treat_height_as_auto(Box const& box, AvailableSpa
|
|||
}
|
||||
|
||||
// AD-HOC: If the box has a preferred aspect ratio and an intrinsic keyword for height...
|
||||
if (box.has_preferred_aspect_ratio()
|
||||
&& (computed_height.is_min_content() || computed_height.is_max_content() || computed_height.is_fit_content())) {
|
||||
if (box.has_preferred_aspect_ratio() && computed_height.is_intrinsic_sizing_constraint()) {
|
||||
// If the box has no natural width to resolve the aspect ratio, we treat the height as auto.
|
||||
if (!box.has_natural_width())
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue