#pragma once
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
#include "InlineFormattingState.h"
#include "InlineItem.h"
namespace WebCore {
namespace Layout {
class InlineTextItem : public InlineItem {
public:
static void createAndAppendTextItems(InlineItems&, const Box&);
static std::unique_ptr<InlineTextItem> createWhitespaceItem(const Box&, unsigned start, unsigned length, Optional<InlineLayoutUnit> width);
static std::unique_ptr<InlineTextItem> createNonWhitespaceItem(const Box&, unsigned start, unsigned length, Optional<InlineLayoutUnit> width);
static std::unique_ptr<InlineTextItem> createEmptyItem(const Box&);
unsigned start() const { return m_start; }
unsigned end() const { return start() + length(); }
unsigned length() const { return m_length; }
bool isWhitespace() const { return m_textItemType == TextItemType::Whitespace; }
bool isCollapsible() const { return isWhitespace() && style().collapseWhiteSpace(); }
Optional<InlineLayoutUnit> width() const { return m_width; }
bool isEmptyContent() const;
std::unique_ptr<InlineTextItem> left(unsigned length) const;
std::unique_ptr<InlineTextItem> right(unsigned length) const;
enum class TextItemType { Undefined, Whitespace, NonWhitespace };
InlineTextItem(const Box&, unsigned start, unsigned length, Optional<InlineLayoutUnit> width, TextItemType);
InlineTextItem(const Box&);
private:
unsigned m_start { 0 };
unsigned m_length { 0 };
Optional<InlineLayoutUnit> m_width;
TextItemType m_textItemType { TextItemType::Undefined };
};
}
}
SPECIALIZE_TYPE_TRAITS_INLINE_ITEM(InlineTextItem, isText())
#endif