summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Layout/LayoutState.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-07-17 18:46:38 +0200
committerAndreas Kling <kling@serenityos.org>2022-07-26 01:53:41 +0200
commit71a707480c6c580dbf88a88dde8d0c3d7898d930 (patch)
treece4300cc2ff3a8db0f3561283aad9fb7f3febb2b /Userland/Libraries/LibWeb/Layout/LayoutState.h
parent25e6ad8d3e294b231658dbdb47ab156c05982fff (diff)
downloadserenity-71a707480c6c580dbf88a88dde8d0c3d7898d930.zip
LibWeb: Move "has-definite-width/height" flags to UsedValues
This state is less static than we originally assumed, and there are special formatting context-specific rules that say certain sizes are definite in special circumstances. To be able to support this, we move the has-definite-size flags from the layout node to the UsedValues struct instead.
Diffstat (limited to 'Userland/Libraries/LibWeb/Layout/LayoutState.h')
-rw-r--r--Userland/Libraries/LibWeb/Layout/LayoutState.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/LayoutState.h b/Userland/Libraries/LibWeb/Layout/LayoutState.h
index 837845554e..b315068348 100644
--- a/Userland/Libraries/LibWeb/Layout/LayoutState.h
+++ b/Userland/Libraries/LibWeb/Layout/LayoutState.h
@@ -42,14 +42,19 @@ struct LayoutState {
}
struct UsedValues {
- Layout::NodeWithStyleAndBoxModelMetrics* node { nullptr };
+ NodeWithStyleAndBoxModelMetrics const& node() const { return *m_node; }
+ void set_node(NodeWithStyleAndBoxModelMetrics&, UsedValues const* containing_block_used_values);
float content_width() const { return m_content_width; }
float content_height() const { return m_content_height; }
-
void set_content_width(float);
void set_content_height(float);
+ bool has_definite_width() const { return m_has_definite_width && width_constraint == SizeConstraint::None; }
+ bool has_definite_height() const { return m_has_definite_height && height_constraint == SizeConstraint::None; }
+ void set_has_definite_width(bool value) { m_has_definite_width = value; }
+ void set_has_definite_height(bool value) { m_has_definite_height = value; }
+
Gfx::FloatPoint offset;
SizeConstraint width_constraint { SizeConstraint::None };
@@ -105,8 +110,13 @@ struct LayoutState {
Optional<LineBoxFragmentCoordinate> containing_line_box_fragment;
private:
+ Layout::NodeWithStyleAndBoxModelMetrics* m_node { nullptr };
+
float m_content_width { 0 };
float m_content_height { 0 };
+
+ bool m_has_definite_width { false };
+ bool m_has_definite_height { false };
};
void commit();