SimpleLineLayout.h [plain text]
#ifndef SimpleLineLayout_h
#define SimpleLineLayout_h
#include "TextFlags.h"
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
#if COMPILER(MSVC)
#pragma warning(push)
#pragma warning(disable: 4200) // Disable "zero-sized array in struct/union" warning
#endif
namespace WebCore {
class RenderBlockFlow;
namespace SimpleLineLayout {
bool canUseFor(const RenderBlockFlow&);
struct Run {
#if COMPILER(MSVC)
Run() { }
#endif
Run(unsigned start, unsigned end, float logicalLeft, float logicalRight, bool isEndOfLine)
: start(start)
, end(end)
, isEndOfLine(isEndOfLine)
, logicalLeft(logicalLeft)
, logicalRight(logicalRight)
{ }
unsigned start;
unsigned end : 31;
unsigned isEndOfLine : 1;
float logicalLeft;
float logicalRight;
float expansion { 0 };
ExpansionBehavior expansionBehavior { ForbidLeadingExpansion | ForbidTrailingExpansion };
};
class Layout {
WTF_MAKE_FAST_ALLOCATED;
public:
typedef Vector<Run, 10> RunVector;
static std::unique_ptr<Layout> create(const RunVector&, unsigned lineCount);
unsigned lineCount() const { return m_lineCount; }
unsigned runCount() const { return m_runCount; }
const Run& runAt(unsigned i) const { return m_runs[i]; }
private:
Layout(const RunVector&, unsigned lineCount);
unsigned m_lineCount;
unsigned m_runCount;
Run m_runs[0];
};
std::unique_ptr<Layout> create(RenderBlockFlow&);
}
}
#if COMPILER(MSVC)
#pragma warning(pop)
#endif
#endif