#ifndef LayoutState_h
#define LayoutState_h
#include "LayoutRect.h"
#include <wtf/HashMap.h>
#include <wtf/Noncopyable.h>
namespace WebCore {
class RenderBlock;
class RenderBlockFlow;
class RenderBox;
class RenderElement;
class RenderFlowThread;
class RenderObject;
class ShapeInsideInfo;
class LayoutState {
WTF_MAKE_NONCOPYABLE(LayoutState); WTF_MAKE_FAST_ALLOCATED;
public:
LayoutState()
: m_clipped(false)
, m_isPaginated(false)
, m_pageLogicalHeightChanged(false)
#if !ASSERT_DISABLED
, m_layoutDeltaXSaturated(false)
, m_layoutDeltaYSaturated(false)
#endif
{
}
LayoutState(std::unique_ptr<LayoutState>, RenderBox*, const LayoutSize& offset, LayoutUnit pageHeight, bool pageHeightChanged);
explicit LayoutState(RenderObject&);
void clearPaginationInformation();
bool isPaginated() const { return m_isPaginated; }
LayoutUnit pageLogicalOffset(RenderBox*, LayoutUnit childLogicalOffset) const;
LayoutUnit pageLogicalHeight() const { return m_pageLogicalHeight; }
bool pageLogicalHeightChanged() const { return m_pageLogicalHeightChanged; }
RenderBlockFlow* lineGrid() const { return m_lineGrid; }
LayoutSize lineGridOffset() const { return m_lineGridOffset; }
LayoutSize lineGridPaginationOrigin() const { return m_lineGridPaginationOrigin; }
LayoutSize layoutOffset() const { return m_layoutOffset; }
LayoutSize pageOffset() const { return m_pageOffset; }
void setLineGridPaginationOrigin(const LayoutSize& origin) { m_lineGridPaginationOrigin = origin; }
bool needsBlockDirectionLocationSetBeforeLayout() const { return m_lineGrid || (m_isPaginated && m_pageLogicalHeight); }
RenderFlowThread* currentRenderFlowThread() const { return m_currentRenderFlowThread; }
void setCurrentRenderFlowThread(RenderFlowThread* flowThread) { m_currentRenderFlowThread = flowThread; }
private:
void propagateLineGridInfo(RenderBox*);
void establishLineGrid(RenderBlockFlow*);
public:
bool m_clipped : 1;
bool m_isPaginated : 1;
bool m_pageLogicalHeightChanged : 1;
#if !ASSERT_DISABLED
bool m_layoutDeltaXSaturated : 1;
bool m_layoutDeltaYSaturated : 1;
#endif
RenderBlockFlow* m_lineGrid { nullptr };
std::unique_ptr<LayoutState> m_next;
LayoutRect m_clipRect;
LayoutSize m_paintOffset;
LayoutSize m_layoutOffset;
LayoutSize m_layoutDelta;
LayoutUnit m_pageLogicalHeight;
LayoutSize m_pageOffset;
LayoutSize m_lineGridOffset;
LayoutSize m_lineGridPaginationOrigin;
RenderFlowThread* m_currentRenderFlowThread { nullptr };
#ifndef NDEBUG
RenderObject* m_renderer { nullptr };
#endif
};
}
#endif // LayoutState_h