#ifndef RenderRegion_h
#define RenderRegion_h
#include "core/rendering/RenderBlockFlow.h"
#include "core/rendering/style/StyleInheritedData.h"
namespace WebCore {
struct LayerFragment;
typedef Vector<LayerFragment, 1> LayerFragments;
class RenderBox;
class RenderFlowThread;
class RenderRegion : public RenderBlockFlow {
public:
explicit RenderRegion(Element*, RenderFlowThread*);
virtual bool isRenderRegion() const OVERRIDE FINAL { return true; }
void setFlowThreadPortionRect(const LayoutRect& rect) { m_flowThreadPortionRect = rect; }
LayoutRect flowThreadPortionRect() const { return m_flowThreadPortionRect; }
LayoutRect flowThreadPortionOverflowRect() const;
void attachRegion();
void detachRegion();
RenderFlowThread* flowThread() const { return m_flowThread; }
bool isValid() const { return m_isValid; }
void setIsValid(bool valid) { m_isValid = valid; }
bool isFirstRegion() const;
bool isLastRegion() const;
virtual LayoutUnit pageLogicalWidth() const;
virtual LayoutUnit pageLogicalHeight() const;
LayoutUnit logicalTopOfFlowThreadContentRect(const LayoutRect&) const;
LayoutUnit logicalBottomOfFlowThreadContentRect(const LayoutRect&) const;
LayoutUnit logicalTopForFlowThreadContent() const { return logicalTopOfFlowThreadContentRect(flowThreadPortionRect()); };
LayoutUnit logicalBottomForFlowThreadContent() const { return logicalBottomOfFlowThreadContentRect(flowThreadPortionRect()); };
virtual LayoutUnit logicalHeightOfAllFlowThreadContent() const;
virtual LayoutUnit pageLogicalTopForOffset(LayoutUnit offset) const;
virtual void expandToEncompassFlowThreadContentsIfNeeded() { };
virtual void repaintFlowThreadContent(const LayoutRect& repaintRect) const;
virtual void collectLayerFragments(LayerFragments&, const LayoutRect&, const LayoutRect&) { }
virtual bool canHaveChildren() const OVERRIDE FINAL { return false; }
virtual bool canHaveGeneratedChildren() const OVERRIDE FINAL { return true; }
virtual const char* renderName() const OVERRIDE { return "RenderRegion"; }
protected:
virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const OVERRIDE FINAL;
LayoutRect overflowRectForFlowThreadPortion(const LayoutRect& flowThreadPortionRect, bool isFirstPortion, bool isLastPortion) const;
void repaintFlowThreadContentRectangle(const LayoutRect& repaintRect, const LayoutRect& flowThreadPortionRect,
const LayoutRect& flowThreadPortionOverflowRect, const LayoutPoint& regionLocation) const;
private:
virtual void insertedIntoTree() OVERRIDE FINAL;
virtual void willBeRemovedFromTree() OVERRIDE FINAL;
virtual void layoutBlock(bool relayoutChildren) OVERRIDE FINAL;
protected:
RenderFlowThread* m_flowThread;
private:
LayoutRect m_flowThreadPortionRect;
bool m_isValid : 1;
};
DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderRegion, isRenderRegion());
}
#endif