|
@@ -1,5 +1,6 @@
|
|
|
/*
|
|
|
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
|
|
+ * Copyright (c) 2023, Sam Atkins <atkinssj@serenityos.org>
|
|
|
*
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
*/
|
|
@@ -15,6 +16,7 @@ class Size {
|
|
|
public:
|
|
|
enum class Type {
|
|
|
Auto,
|
|
|
+ Calculated,
|
|
|
Length,
|
|
|
Percentage,
|
|
|
MinContent,
|
|
@@ -27,12 +29,14 @@ public:
|
|
|
static Size make_px(CSSPixels);
|
|
|
static Size make_length(Length);
|
|
|
static Size make_percentage(Percentage);
|
|
|
+ static Size make_calculated(NonnullRefPtr<CalculatedStyleValue>);
|
|
|
static Size make_min_content();
|
|
|
static Size make_max_content();
|
|
|
static Size make_fit_content(Length available_space);
|
|
|
static Size make_none();
|
|
|
|
|
|
bool is_auto() const { return m_type == Type::Auto; }
|
|
|
+ bool is_calculated() const { return m_type == Type::Calculated; }
|
|
|
bool is_length() const { return m_type == Type::Length; }
|
|
|
bool is_percentage() const { return m_type == Type::Percentage; }
|
|
|
bool is_min_content() const { return m_type == Type::MinContent; }
|
|
@@ -45,6 +49,12 @@ public:
|
|
|
|
|
|
bool contains_percentage() const;
|
|
|
|
|
|
+ CalculatedStyleValue const& calculated() const
|
|
|
+ {
|
|
|
+ VERIFY(is_calculated());
|
|
|
+ return m_length_percentage.calculated();
|
|
|
+ }
|
|
|
+
|
|
|
CSS::Length const& length() const
|
|
|
{
|
|
|
VERIFY(is_length());
|