mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +00:00
LibWeb: Move css_clamp function to FormattingContext
Since we need it in the FlexFormattingContext and GridFormatting context now.
This commit is contained in:
parent
4d78c66b3d
commit
de84e6f93a
Notes:
github-actions[bot]
2024-07-25 11:13:37 +00:00
Author: https://github.com/EdwinHoksberg Commit: https://github.com/LadybirdBrowser/ladybird/commit/de84e6f93ac Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/815 Reviewed-by: https://github.com/kalenikaliaksandr ✅
2 changed files with 8 additions and 8 deletions
|
@ -19,14 +19,6 @@
|
|||
|
||||
namespace Web::Layout {
|
||||
|
||||
// NOTE: We use a custom clamping function here instead of AK::clamp(), since the AK version
|
||||
// will VERIFY(max >= min) and CSS explicitly allows that (see css-values-4.)
|
||||
template<typename T>
|
||||
[[nodiscard]] constexpr T css_clamp(T const& value, T const& min, T const& max)
|
||||
{
|
||||
return ::max(min, ::min(value, max));
|
||||
}
|
||||
|
||||
CSSPixels FlexFormattingContext::get_pixel_width(Box const& box, CSS::Size const& size) const
|
||||
{
|
||||
return calculate_inner_width(box, containing_block_width_as_available_size(box), size);
|
||||
|
|
|
@ -13,6 +13,14 @@
|
|||
|
||||
namespace Web::Layout {
|
||||
|
||||
// NOTE: We use a custom clamping function here instead of AK::clamp(), since the AK version
|
||||
// will VERIFY(max >= min) and CSS explicitly allows that (see css-values-4.)
|
||||
template<typename T>
|
||||
[[nodiscard]] constexpr T css_clamp(T const& value, T const& min, T const& max)
|
||||
{
|
||||
return ::max(min, ::min(value, max));
|
||||
}
|
||||
|
||||
class FormattingContext {
|
||||
public:
|
||||
virtual ~FormattingContext();
|
||||
|
|
Loading…
Reference in a new issue