mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:17:45 +00:00
LibWeb: Make LineBuilder aware of the current LayoutMode
This will allow us to override the available space correctly when doing intrinsic sizing.
This commit is contained in:
parent
915ee66bd6
commit
28642de6ed
3 changed files with 5 additions and 3 deletions
|
@ -197,7 +197,7 @@ void InlineFormattingContext::generate_line_boxes(LayoutMode layout_mode)
|
||||||
line_boxes.clear_with_capacity();
|
line_boxes.clear_with_capacity();
|
||||||
|
|
||||||
InlineLevelIterator iterator(*this, m_state, containing_block(), layout_mode);
|
InlineLevelIterator iterator(*this, m_state, containing_block(), layout_mode);
|
||||||
LineBuilder line_builder(*this, m_state);
|
LineBuilder line_builder(*this, m_state, layout_mode);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
auto item_opt = iterator.next(line_builder.available_width_for_current_line());
|
auto item_opt = iterator.next(line_builder.available_width_for_current_line());
|
||||||
|
|
|
@ -9,10 +9,11 @@
|
||||||
|
|
||||||
namespace Web::Layout {
|
namespace Web::Layout {
|
||||||
|
|
||||||
LineBuilder::LineBuilder(InlineFormattingContext& context, FormattingState& formatting_state)
|
LineBuilder::LineBuilder(InlineFormattingContext& context, FormattingState& formatting_state, LayoutMode layout_mode)
|
||||||
: m_context(context)
|
: m_context(context)
|
||||||
, m_formatting_state(formatting_state)
|
, m_formatting_state(formatting_state)
|
||||||
, m_containing_block_state(formatting_state.get_mutable(context.containing_block()))
|
, m_containing_block_state(formatting_state.get_mutable(context.containing_block()))
|
||||||
|
, m_layout_mode(layout_mode)
|
||||||
{
|
{
|
||||||
begin_new_line(false);
|
begin_new_line(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ class LineBuilder {
|
||||||
AK_MAKE_NONMOVABLE(LineBuilder);
|
AK_MAKE_NONMOVABLE(LineBuilder);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LineBuilder(InlineFormattingContext&, FormattingState&);
|
LineBuilder(InlineFormattingContext&, FormattingState&, LayoutMode);
|
||||||
~LineBuilder();
|
~LineBuilder();
|
||||||
|
|
||||||
void break_line();
|
void break_line();
|
||||||
|
@ -44,6 +44,7 @@ private:
|
||||||
InlineFormattingContext& m_context;
|
InlineFormattingContext& m_context;
|
||||||
FormattingState& m_formatting_state;
|
FormattingState& m_formatting_state;
|
||||||
FormattingState::NodeState& m_containing_block_state;
|
FormattingState::NodeState& m_containing_block_state;
|
||||||
|
LayoutMode m_layout_mode {};
|
||||||
float m_available_width_for_current_line { 0 };
|
float m_available_width_for_current_line { 0 };
|
||||||
float m_current_y { 0 };
|
float m_current_y { 0 };
|
||||||
float m_max_height_on_current_line { 0 };
|
float m_max_height_on_current_line { 0 };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue