summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-03-18 14:39:07 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-18 15:18:48 +0100
commit28642de6ed75133712d9936180874a4bb2ee989e (patch)
tree8af74ccc05f7dce04f3c773986339e15fc87cf52 /Userland
parent915ee66bd6f2aa94c445ac699956e3578beb2e37 (diff)
downloadserenity-28642de6ed75133712d9936180874a4bb2ee989e.zip
LibWeb: Make LineBuilder aware of the current LayoutMode
This will allow us to override the available space correctly when doing intrinsic sizing.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Layout/LineBuilder.cpp3
-rw-r--r--Userland/Libraries/LibWeb/Layout/LineBuilder.h3
3 files changed, 5 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp
index 2fcb5dd5e8..36fd83ae13 100644
--- a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp
@@ -197,7 +197,7 @@ void InlineFormattingContext::generate_line_boxes(LayoutMode layout_mode)
line_boxes.clear_with_capacity();
InlineLevelIterator iterator(*this, m_state, containing_block(), layout_mode);
- LineBuilder line_builder(*this, m_state);
+ LineBuilder line_builder(*this, m_state, layout_mode);
for (;;) {
auto item_opt = iterator.next(line_builder.available_width_for_current_line());
diff --git a/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp b/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp
index 750b73c89b..bfc3aad290 100644
--- a/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp
+++ b/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp
@@ -9,10 +9,11 @@
namespace Web::Layout {
-LineBuilder::LineBuilder(InlineFormattingContext& context, FormattingState& formatting_state)
+LineBuilder::LineBuilder(InlineFormattingContext& context, FormattingState& formatting_state, LayoutMode layout_mode)
: m_context(context)
, m_formatting_state(formatting_state)
, m_containing_block_state(formatting_state.get_mutable(context.containing_block()))
+ , m_layout_mode(layout_mode)
{
begin_new_line(false);
}
diff --git a/Userland/Libraries/LibWeb/Layout/LineBuilder.h b/Userland/Libraries/LibWeb/Layout/LineBuilder.h
index bcadc64dfb..cd0afca6a8 100644
--- a/Userland/Libraries/LibWeb/Layout/LineBuilder.h
+++ b/Userland/Libraries/LibWeb/Layout/LineBuilder.h
@@ -15,7 +15,7 @@ class LineBuilder {
AK_MAKE_NONMOVABLE(LineBuilder);
public:
- LineBuilder(InlineFormattingContext&, FormattingState&);
+ LineBuilder(InlineFormattingContext&, FormattingState&, LayoutMode);
~LineBuilder();
void break_line();
@@ -44,6 +44,7 @@ private:
InlineFormattingContext& m_context;
FormattingState& m_formatting_state;
FormattingState::NodeState& m_containing_block_state;
+ LayoutMode m_layout_mode {};
float m_available_width_for_current_line { 0 };
float m_current_y { 0 };
float m_max_height_on_current_line { 0 };