#ifndef RenderView_h
#define RenderView_h
#include "FrameView.h"
#include "LayoutState.h"
#include "RenderBlock.h"
namespace WebCore {
class RenderView : public RenderBlock {
public:
RenderView(Node*, FrameView*);
virtual ~RenderView();
virtual const char* renderName() const { return "RenderView"; }
virtual bool isRenderView() const { return true; }
virtual void layout();
virtual void calcWidth();
virtual void calcHeight();
virtual void calcPrefWidths();
virtual bool absolutePosition(int& xPos, int& yPos, bool fixed = false) const;
int docHeight() const;
int docWidth() const;
FrameView* frameView() const { return m_frameView; }
virtual bool hasOverhangingFloats() { return false; }
virtual void computeAbsoluteRepaintRect(IntRect&, bool fixed = false);
virtual void repaintViewRectangle(const IntRect&, bool immediate = false);
virtual void paint(PaintInfo&, int tx, int ty);
virtual void paintBoxDecorations(PaintInfo&, int tx, int ty);
void setSelection(RenderObject* start, int startPos, RenderObject* end, int endPos);
void clearSelection();
virtual RenderObject* selectionStart() const { return m_selectionStart; }
virtual RenderObject* selectionEnd() const { return m_selectionEnd; }
bool printing() const;
void setPrintImages(bool enable) { m_printImages = enable; }
bool printImages() const { return m_printImages; }
void setTruncatedAt(int y) { m_truncatedAt = y; m_bestTruncatedAt = m_truncatorWidth = 0; m_forcedPageBreak = false; }
void setBestTruncatedAt(int y, RenderObject *forRenderer, bool forcedBreak = false);
int bestTruncatedAt() const { return m_bestTruncatedAt; }
int truncatedAt() const { return m_truncatedAt; }
virtual void absoluteRects(Vector<IntRect>&, int tx, int ty, bool topLevel = true);
IntRect selectionRect(bool clipToVisibleContent = true) const;
void setMaximalOutlineSize(int o) { m_maximalOutlineSize = o; }
int maximalOutlineSize() const { return m_maximalOutlineSize; }
virtual IntRect viewRect() const;
virtual void selectionStartEnd(int& startPos, int& endPos) const;
IntRect printRect() const { return m_printRect; }
void setPrintRect(const IntRect& r) { m_printRect = r; }
void updateWidgetPositions();
void addWidget(RenderObject*);
void removeWidget(RenderObject*);
const IntSize& layoutDelta() const { return m_layoutDelta; }
void addLayoutDelta(const IntSize& delta) { m_layoutDelta += delta; }
void pushLayoutState(RenderBox* renderer, const IntSize& offset)
{
if (m_layoutStateDisableCount || m_frameView->needsFullRepaint())
return;
m_layoutState = new (renderArena()) LayoutState(m_layoutState, renderer, offset);
}
void pushLayoutState(RenderObject*);
void popLayoutState()
{
if (m_layoutStateDisableCount || m_frameView->needsFullRepaint())
return;
LayoutState* state = m_layoutState;
m_layoutState = state->m_next;
state->destroy(renderArena());
}
LayoutState* layoutState() const { return m_layoutStateDisableCount ? 0 : m_layoutState; }
void disableLayoutState() { m_layoutStateDisableCount++; }
void enableLayoutState() { ASSERT(m_layoutStateDisableCount > 0); m_layoutStateDisableCount--; }
protected:
FrameView* m_frameView;
RenderObject* m_selectionStart;
RenderObject* m_selectionEnd;
int m_selectionStartPos;
int m_selectionEndPos;
bool m_printImages;
int m_truncatedAt;
int m_maximalOutlineSize; IntRect m_printRect;
typedef HashSet<RenderObject*> RenderObjectSet;
RenderObjectSet m_widgets;
private:
int m_bestTruncatedAt;
int m_truncatorWidth;
bool m_forcedPageBreak;
IntSize m_layoutDelta;
LayoutState* m_layoutState;
unsigned m_layoutStateDisableCount;
};
}
#endif // RenderView_h