summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2023-05-01 17:49:31 +0200
committerAndreas Kling <kling@serenityos.org>2023-05-02 11:47:13 +0200
commitdeea7cbc117ba8debe1c54dee1ec3d334b240756 (patch)
tree34caf4e2ff78ad65ee0587c789d8045f9ea6a33b /Userland/Libraries/LibWeb
parente98315de6b290a1cf9ee31bda3d6289bb9bebae5 (diff)
downloadserenity-deea7cbc117ba8debe1c54dee1ec3d334b240756.zip
LibWeb: Remove vestigial resolve_definite_width/height helper functions
These functions no longer do anything interesting and just forward to content_width/content_height. Let's make the callers use those directly instead and remove this indirection layer.
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r--Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp22
-rw-r--r--Userland/Libraries/LibWeb/Layout/FlexFormattingContext.h2
-rw-r--r--Userland/Libraries/LibWeb/Layout/LayoutState.cpp10
-rw-r--r--Userland/Libraries/LibWeb/Layout/LayoutState.h3
4 files changed, 6 insertions, 31 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
index 8b4eb49771..db62b6c526 100644
--- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
@@ -362,16 +362,6 @@ CSSPixels FlexFormattingContext::inner_cross_size(Box const& box) const
return is_row_layout() ? box_state.content_height() : box_state.content_width();
}
-CSSPixels FlexFormattingContext::resolved_definite_cross_size(FlexItem const& item) const
-{
- return !is_row_layout() ? m_state.resolved_definite_width(item.box) : m_state.resolved_definite_height(item.box);
-}
-
-CSSPixels FlexFormattingContext::resolved_definite_main_size(FlexItem const& item) const
-{
- return is_row_layout() ? m_state.resolved_definite_width(item.box) : m_state.resolved_definite_height(item.box);
-}
-
bool FlexFormattingContext::has_main_min_size(Box const& box) const
{
auto const& value = is_row_layout() ? box.computed_values().min_width() : box.computed_values().min_height();
@@ -488,7 +478,7 @@ void FlexFormattingContext::determine_available_space_for_items(AvailableSpace c
Optional<AvailableSize> available_width_for_items;
if (m_flex_container_state.has_definite_width()) {
- available_width_for_items = AvailableSize::make_definite(m_state.resolved_definite_width(flex_container()));
+ available_width_for_items = AvailableSize::make_definite(m_flex_container_state.content_width());
} else {
if (available_space.width.is_intrinsic_sizing_constraint()) {
available_width_for_items = available_space.width;
@@ -510,7 +500,7 @@ void FlexFormattingContext::determine_available_space_for_items(AvailableSpace c
Optional<AvailableSize> available_height_for_items;
if (m_flex_container_state.has_definite_height()) {
- available_height_for_items = AvailableSize::make_definite(m_state.resolved_definite_height(flex_container()));
+ available_height_for_items = AvailableSize::make_definite(m_flex_container_state.content_height());
} else {
if (available_space.height.is_intrinsic_sizing_constraint()) {
available_height_for_items = available_space.height;
@@ -738,8 +728,8 @@ Optional<CSSPixels> FlexFormattingContext::transferred_size_suggestion(FlexItem
auto aspect_ratio = item.box->intrinsic_aspect_ratio().value();
// FIXME: Clamp cross size to min/max cross size before this conversion.
if (is_row_layout())
- return resolved_definite_cross_size(item) * aspect_ratio;
- return resolved_definite_cross_size(item) / aspect_ratio;
+ return inner_cross_size(item.box) * aspect_ratio;
+ return inner_cross_size(item.box) / aspect_ratio;
}
// It is otherwise undefined.
@@ -1100,10 +1090,10 @@ void FlexFormattingContext::determine_hypothetical_cross_size_of_item(FlexItem&
auto cross_size = [&]() {
if (item.box->computed_values().box_sizing() == CSS::BoxSizing::BorderBox && !should_treat_cross_size_as_auto(item.box)) {
- return max(CSSPixels(0.0f), resolved_definite_cross_size(item) - item.padding.cross_before - item.padding.cross_after - item.borders.cross_before - item.borders.cross_after);
+ return max(CSSPixels(0.0f), inner_cross_size(item.box) - item.padding.cross_before - item.padding.cross_after - item.borders.cross_before - item.borders.cross_after);
}
- return resolved_definite_cross_size(item);
+ return inner_cross_size(item.box);
}();
item.hypothetical_cross_size = css_clamp(cross_size, clamp_min, clamp_max);
diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.h b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.h
index 5d36ef3691..5495395ded 100644
--- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.h
+++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.h
@@ -118,8 +118,6 @@ private:
bool has_definite_cross_size(Box const&) const;
CSSPixels inner_main_size(Box const&) const;
CSSPixels inner_cross_size(Box const&) const;
- CSSPixels resolved_definite_main_size(FlexItem const&) const;
- CSSPixels resolved_definite_cross_size(FlexItem const&) const;
bool has_main_min_size(Box const&) const;
bool has_cross_min_size(Box const&) const;
CSSPixels specified_main_max_size(Box const&) const;
diff --git a/Userland/Libraries/LibWeb/Layout/LayoutState.cpp b/Userland/Libraries/LibWeb/Layout/LayoutState.cpp
index f4037278fe..d6d77cab55 100644
--- a/Userland/Libraries/LibWeb/Layout/LayoutState.cpp
+++ b/Userland/Libraries/LibWeb/Layout/LayoutState.cpp
@@ -354,16 +354,6 @@ void LayoutState::UsedValues::set_temporary_content_height(CSSPixels height)
m_content_height = height;
}
-CSSPixels LayoutState::resolved_definite_width(Box const& box) const
-{
- return get(box).content_width();
-}
-
-CSSPixels LayoutState::resolved_definite_height(Box const& box) const
-{
- return get(box).content_height();
-}
-
AvailableSize LayoutState::UsedValues::available_width_inside() const
{
if (width_constraint == SizeConstraint::MinContent)
diff --git a/Userland/Libraries/LibWeb/Layout/LayoutState.h b/Userland/Libraries/LibWeb/Layout/LayoutState.h
index 3d0e5e6c31..e3d7fe94b6 100644
--- a/Userland/Libraries/LibWeb/Layout/LayoutState.h
+++ b/Userland/Libraries/LibWeb/Layout/LayoutState.h
@@ -145,9 +145,6 @@ struct LayoutState {
HashTable<JS::GCPtr<Box const>> m_floating_descendants;
};
- CSSPixels resolved_definite_width(Box const&) const;
- CSSPixels resolved_definite_height(Box const&) const;
-
void commit();
// NOTE: get_mutable() will CoW the UsedValues if it's inherited from an ancestor state;