#ifndef LayoutState_h
#define LayoutState_h
#include "core/rendering/ColumnInfo.h"
#include "platform/geometry/LayoutRect.h"
#include "wtf/HashMap.h"
#include "wtf/Noncopyable.h"
namespace WebCore {
class RenderBlockFlow;
class RenderBox;
class RenderObject;
class RenderFlowThread;
class LayoutState {
WTF_MAKE_NONCOPYABLE(LayoutState);
public:
LayoutState(LayoutUnit pageLogicalHeight, bool pageLogicalHeightChanged)
: m_clipped(false)
, m_isPaginated(pageLogicalHeight)
, m_pageLogicalHeightChanged(pageLogicalHeightChanged)
#if !ASSERT_DISABLED
, m_layoutDeltaXSaturated(false)
, m_layoutDeltaYSaturated(false)
#endif
, m_columnInfo(0)
, m_next(0)
, m_pageLogicalHeight(pageLogicalHeight)
#ifndef NDEBUG
, m_renderer(0)
#endif
{
}
LayoutState(LayoutState*, RenderBox&, const LayoutSize& offset, LayoutUnit pageLogicalHeight, bool pageHeightLogicalChanged, ColumnInfo*);
explicit LayoutState(RenderObject&);
void* operator new(size_t);
void operator delete(void*);
void clearPaginationInformation();
bool isPaginatingColumns() const { return m_columnInfo; }
bool isPaginated() const { return m_isPaginated; }
bool isClipped() const { return m_clipped; }
LayoutUnit pageLogicalOffset(const RenderBox&, const LayoutUnit& childLogicalOffset) const;
void addForcedColumnBreak(const RenderBox&, const LayoutUnit& childLogicalOffset);
void addLayoutDelta(const LayoutSize& delta)
{
m_layoutDelta += delta;
#if !ASSERT_DISABLED
m_layoutDeltaXSaturated |= m_layoutDelta.width() == LayoutUnit::max() || m_layoutDelta.width() == LayoutUnit::min();
m_layoutDeltaYSaturated |= m_layoutDelta.height() == LayoutUnit::max() || m_layoutDelta.height() == LayoutUnit::min();
#endif
}
void setColumnInfo(ColumnInfo* columnInfo) { m_columnInfo = columnInfo; }
const LayoutSize& layoutOffset() const { return m_layoutOffset; }
const LayoutSize& layoutDelta() const { return m_layoutDelta; }
const LayoutSize& pageOffset() const { return m_pageOffset; }
LayoutUnit pageLogicalHeight() const { return m_pageLogicalHeight; }
bool pageLogicalHeightChanged() const { return m_pageLogicalHeightChanged; }
LayoutState* next() const { return m_next; }
bool needsBlockDirectionLocationSetBeforeLayout() const { return m_isPaginated && m_pageLogicalHeight; }
ColumnInfo* columnInfo() const { return m_columnInfo; }
const LayoutRect& clipRect() const { return m_clipRect; }
const LayoutSize& paintOffset() const { return m_paintOffset; }
#ifndef NDEBUG
RenderObject* renderer() const { return m_renderer; }
#endif
#if !ASSERT_DISABLED
bool layoutDeltaXSaturated() const { return m_layoutDeltaXSaturated; }
bool layoutDeltaYSaturated() const { return m_layoutDeltaYSaturated; }
#endif
private:
bool m_clipped:1;
bool m_isPaginated:1;
bool m_pageLogicalHeightChanged:1;
#if !ASSERT_DISABLED
bool m_layoutDeltaXSaturated:1;
bool m_layoutDeltaYSaturated:1;
#endif
ColumnInfo* m_columnInfo;
LayoutState* m_next;
LayoutRect m_clipRect;
LayoutSize m_paintOffset;
LayoutSize m_layoutOffset;
LayoutSize m_layoutDelta;
LayoutUnit m_pageLogicalHeight;
LayoutSize m_pageOffset;
#ifndef NDEBUG
RenderObject* m_renderer;
#endif
};
}
#endif