2020-11-22 09:38:18 -03:00
|
|
|
/*
|
2024-10-04 08:19:50 -03:00
|
|
|
* Copyright (c) 2020-2024, Andreas Kling <andreas@ladybird.org>
|
2020-11-22 09:38:18 -03:00
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-11-22 09:38:18 -03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2020-12-06 15:48:02 -03:00
|
|
|
#include <AK/Types.h>
|
2020-11-22 09:38:18 -03:00
|
|
|
#include <LibWeb/Forward.h>
|
2021-10-06 16:53:25 -03:00
|
|
|
#include <LibWeb/Layout/BlockContainer.h>
|
2020-11-22 09:38:18 -03:00
|
|
|
#include <LibWeb/Layout/FormattingContext.h>
|
|
|
|
|
|
|
|
|
|
namespace Web::Layout {
|
|
|
|
|
|
|
|
|
|
class InlineFormattingContext final : public FormattingContext {
|
|
|
|
|
public:
|
2024-09-10 20:03:02 -03:00
|
|
|
InlineFormattingContext(LayoutState&, LayoutMode, BlockContainer const& containing_block, LayoutState::UsedValues& containing_block_used_values, BlockFormattingContext& parent);
|
2020-11-22 09:38:18 -03:00
|
|
|
~InlineFormattingContext();
|
|
|
|
|
|
2022-01-23 11:22:18 -03:00
|
|
|
BlockFormattingContext& parent();
|
|
|
|
|
BlockFormattingContext const& parent() const;
|
|
|
|
|
|
2021-10-06 16:53:25 -03:00
|
|
|
BlockContainer const& containing_block() const { return static_cast<BlockContainer const&>(context_box()); }
|
2020-12-06 15:48:02 -03:00
|
|
|
|
2024-09-10 20:03:02 -03:00
|
|
|
virtual void run(AvailableSpace const&) override;
|
2022-11-23 14:46:10 -03:00
|
|
|
virtual CSSPixels automatic_content_height() const override;
|
|
|
|
|
virtual CSSPixels automatic_content_width() const override;
|
2024-10-05 17:18:53 -03:00
|
|
|
StaticPositionRect calculate_static_position_rect(Box const&) const;
|
2020-11-22 09:38:18 -03:00
|
|
|
|
2022-02-20 11:51:24 -03:00
|
|
|
void dimension_box_on_line(Box const&, LayoutMode);
|
2022-01-17 11:07:19 -03:00
|
|
|
|
2024-10-29 08:32:59 -03:00
|
|
|
CSSPixels leftmost_inline_offset_at(CSSPixels y) const;
|
2023-08-12 13:30:18 -03:00
|
|
|
AvailableSize available_space_for_line(CSSPixels y) const;
|
2024-10-29 08:32:59 -03:00
|
|
|
bool any_floats_intrude_at_block_offset(CSSPixels block_offset) const;
|
|
|
|
|
bool can_fit_new_line_at_block_offset(CSSPixels block_offset) const;
|
2022-01-18 07:00:25 -03:00
|
|
|
|
2023-07-29 01:05:45 -03:00
|
|
|
CSSPixels vertical_float_clearance() const;
|
|
|
|
|
void set_vertical_float_clearance(CSSPixels);
|
|
|
|
|
|
2022-01-19 07:59:44 -03:00
|
|
|
private:
|
2024-09-10 20:03:02 -03:00
|
|
|
void generate_line_boxes();
|
2022-07-09 15:56:59 -03:00
|
|
|
void apply_justification_to_fragments(CSS::TextJustify, LineBox&, bool is_last_line);
|
2022-07-09 15:45:55 -03:00
|
|
|
|
2024-03-15 15:25:00 -03:00
|
|
|
LayoutState::UsedValues& m_containing_block_used_values;
|
2022-09-27 10:29:17 -03:00
|
|
|
|
|
|
|
|
Optional<AvailableSpace> m_available_space;
|
|
|
|
|
|
2022-11-03 14:48:46 -03:00
|
|
|
CSSPixels m_automatic_content_width { 0 };
|
|
|
|
|
CSSPixels m_automatic_content_height { 0 };
|
2023-07-29 01:05:45 -03:00
|
|
|
|
|
|
|
|
CSSPixels m_vertical_float_clearance { 0 };
|
2020-11-22 09:38:18 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|