2020-01-18 05:38:21 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 05:38:21 -03:00
|
|
|
*/
|
|
|
|
|
|
2019-10-03 10:20:13 -03:00
|
|
|
#pragma once
|
|
|
|
|
|
2020-06-10 05:42:29 -03:00
|
|
|
#include <AK/NonnullOwnPtrVector.h>
|
2019-10-03 10:20:13 -03:00
|
|
|
#include <AK/Vector.h>
|
2020-03-07 06:32:51 -03:00
|
|
|
#include <LibWeb/Layout/LineBoxFragment.h>
|
2019-10-03 10:20:13 -03:00
|
|
|
|
2020-11-22 11:53:01 -03:00
|
|
|
namespace Web::Layout {
|
2020-03-07 06:27:02 -03:00
|
|
|
|
2019-10-03 10:20:13 -03:00
|
|
|
class LineBox {
|
|
|
|
|
public:
|
2020-06-10 05:42:29 -03:00
|
|
|
LineBox() { }
|
2019-10-03 10:20:13 -03:00
|
|
|
|
2019-10-20 07:30:25 -03:00
|
|
|
float width() const { return m_width; }
|
2019-10-03 10:20:13 -03:00
|
|
|
|
2020-12-04 17:06:27 -03:00
|
|
|
void add_fragment(Node& layout_node, int start, int length, float width, float height, LineBoxFragment::Type = LineBoxFragment::Type::Normal);
|
2019-10-03 10:20:13 -03:00
|
|
|
|
2020-06-10 05:42:29 -03:00
|
|
|
const NonnullOwnPtrVector<LineBoxFragment>& fragments() const { return m_fragments; }
|
|
|
|
|
NonnullOwnPtrVector<LineBoxFragment>& fragments() { return m_fragments; }
|
2019-10-03 10:20:13 -03:00
|
|
|
|
2019-10-20 12:18:28 -03:00
|
|
|
void trim_trailing_whitespace();
|
2020-06-10 05:42:29 -03:00
|
|
|
|
2020-12-17 16:17:29 -03:00
|
|
|
bool is_empty_or_ends_in_whitespace() const;
|
2020-06-13 09:59:17 -03:00
|
|
|
|
2019-10-03 10:20:13 -03:00
|
|
|
private:
|
2020-11-22 11:53:01 -03:00
|
|
|
friend class BlockBox;
|
|
|
|
|
friend class InlineFormattingContext;
|
2020-06-10 05:42:29 -03:00
|
|
|
NonnullOwnPtrVector<LineBoxFragment> m_fragments;
|
2019-10-20 07:30:25 -03:00
|
|
|
float m_width { 0 };
|
2019-10-03 10:20:13 -03:00
|
|
|
};
|
2020-03-07 06:27:02 -03:00
|
|
|
|
|
|
|
|
}
|