2021-01-18 17:33:46 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2021-01-18 17:33:46 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <LibWeb/Layout/FormattingContext.h>
|
|
|
|
|
|
|
|
|
|
namespace Web::Layout {
|
|
|
|
|
|
2021-10-13 19:57:26 +02:00
|
|
|
struct FlexItem;
|
|
|
|
|
|
2021-01-18 17:33:46 +01:00
|
|
|
class FlexFormattingContext final : public FormattingContext {
|
|
|
|
|
public:
|
2021-10-13 19:59:15 +02:00
|
|
|
FlexFormattingContext(Box& flex_container, FormattingContext* parent);
|
2021-01-18 17:33:46 +01:00
|
|
|
~FlexFormattingContext();
|
|
|
|
|
|
2021-09-15 12:19:42 +01:00
|
|
|
virtual bool inhibits_floating() const override { return true; }
|
|
|
|
|
|
2021-01-18 17:33:46 +01:00
|
|
|
virtual void run(Box&, LayoutMode) override;
|
2021-10-13 19:57:26 +02:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void generate_anonymous_flex_items(Box& flex_container, Vector<FlexItem>&);
|
|
|
|
|
|
|
|
|
|
bool is_row_layout() const { return m_flex_direction == CSS::FlexDirection::Row || m_flex_direction == CSS::FlexDirection::RowReverse; }
|
|
|
|
|
|
|
|
|
|
CSS::FlexDirection m_flex_direction {};
|
2021-01-18 17:33:46 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|