blob: 8f36f7048cc2826e5a27275c8a8ea94bdcd0f51e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
/*
* Copyright (c) 2020-2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Types.h>
#include <LibWeb/Forward.h>
#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Layout/FormattingContext.h>
namespace Web::Layout {
class InlineFormattingContext final : public FormattingContext {
public:
InlineFormattingContext(FormattingState&, BlockContainer const& containing_block, BlockFormattingContext& parent);
~InlineFormattingContext();
BlockFormattingContext& parent();
BlockFormattingContext const& parent() const;
BlockContainer const& containing_block() const { return static_cast<BlockContainer const&>(context_box()); }
virtual void run(Box const&, LayoutMode) override;
void dimension_box_on_line(Box const&, LayoutMode);
struct AvailableSpaceForLineInfo {
float left { 0 };
float right { 0 };
};
AvailableSpaceForLineInfo available_space_for_line(float y) const;
private:
void generate_line_boxes(LayoutMode);
void apply_justification_to_fragments(FormattingState::NodeState const& containing_block_state, CSS::TextJustify, LineBox&, bool is_last_line);
};
}
|