#ifndef RENDER_FLOW_H
#define RENDER_FLOW_H
#include "render_container.h"
#include "bidi.h"
#include "render_line.h"
namespace khtml {
class RenderFlow : public RenderContainer
{
public:
RenderFlow(DOM::NodeImpl* node)
: RenderContainer(node), m_lineHeight(-1)
{ m_continuation = 0; m_firstLineBox = 0; m_lastLineBox = 0;}
virtual RenderFlow* continuation() const { return m_continuation; }
void setContinuation(RenderFlow* c) { m_continuation = c; }
RenderFlow* continuationBefore(RenderObject* beforeChild);
void addChildWithContinuation(RenderObject* newChild, RenderObject* beforeChild);
virtual void addChildToFlow(RenderObject* newChild, RenderObject* beforeChild) = 0;
virtual void addChild(RenderObject *newChild, RenderObject *beforeChild = 0);
static RenderFlow* createAnonymousFlow(DOM::DocumentImpl* doc, RenderStyle* style);
void extractLineBox(InlineFlowBox* lineBox);
void attachLineBox(InlineFlowBox* lineBox);
void removeLineBox(InlineFlowBox* lineBox);
void deleteLineBoxes();
virtual void detach();
virtual void dirtyLinesFromChangedChild(RenderObject* child, bool adding = true);
virtual short lineHeight(bool firstLine, bool isRootLineBox=false) const;
InlineFlowBox* firstLineBox() const { return m_firstLineBox; }
InlineFlowBox* lastLineBox() const { return m_lastLineBox; }
virtual InlineBox* createInlineBox(bool makePlaceHolderBox, bool isRootLineBox, bool isOnlyRun=false);
virtual void dirtyLineBoxes(bool fullLayout, bool isRootLineBox = false);
void paintLines(PaintInfo& i, int _tx, int _ty);
bool hitTestLines(NodeInfo& i, int x, int y, int tx, int ty, HitTestAction hitTestAction);
virtual QRect getAbsoluteRepaintRect();
virtual int lowestPosition(bool includeOverflowInterior=true, bool includeSelf=true) const;
virtual int rightmostPosition(bool includeOverflowInterior=true, bool includeSelf=true) const;
virtual int leftmostPosition(bool includeOverflowInterior=true, bool includeSelf=true) const;
virtual QRect caretRect(int offset, EAffinity affinity = UPSTREAM, int *extraWidthToEndOfLine = 0);
#ifdef APPLE_CHANGES
virtual void addFocusRingRects(QPainter *painter, int _tx, int _ty);
void paintFocusRing(QPainter *p, int tx, int ty);
#endif
void paintOutlineForLine(QPainter *p, int tx, int ty, const QRect &prevLine, const QRect &thisLine, const QRect &nextLine);
void paintOutlines(QPainter *p, int tx, int ty);
protected:
RenderFlow* m_continuation;
InlineFlowBox* m_firstLineBox;
InlineFlowBox* m_lastLineBox;
mutable short m_lineHeight;
};
};
#endif