| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
#ifndef RenderView_h |
|---|
| 25 |
#define RenderView_h |
|---|
| 26 |
|
|---|
| 27 |
#include "FrameView.h" |
|---|
| 28 |
#include "Frame.h" |
|---|
| 29 |
#include "LayoutState.h" |
|---|
| 30 |
#include "RenderBlock.h" |
|---|
| 31 |
|
|---|
| 32 |
namespace WebCore { |
|---|
| 33 |
|
|---|
| 34 |
class RenderView : public RenderBlock { |
|---|
| 35 |
public: |
|---|
| 36 |
RenderView(Node*, FrameView*); |
|---|
| 37 |
virtual ~RenderView(); |
|---|
| 38 |
|
|---|
| 39 |
virtual const char* renderName() const { return "RenderView"; } |
|---|
| 40 |
|
|---|
| 41 |
virtual bool isRenderView() const { return true; } |
|---|
| 42 |
|
|---|
| 43 |
virtual void layout(); |
|---|
| 44 |
virtual void calcWidth(); |
|---|
| 45 |
virtual void calcHeight(); |
|---|
| 46 |
virtual void calcPrefWidths(); |
|---|
| 47 |
virtual bool absolutePosition(int& xPos, int& yPos, bool fixed = false) const; |
|---|
| 48 |
|
|---|
| 49 |
int docHeight() const; |
|---|
| 50 |
int docWidth() const; |
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
int viewHeight() const; |
|---|
| 54 |
int viewWidth() const; |
|---|
| 55 |
|
|---|
| 56 |
float zoomFactor() const { return m_frameView->frame() && m_frameView->frame()->shouldApplyPageZoom() ? m_frameView->frame()->zoomFactor() : 1.0f; } |
|---|
| 57 |
|
|---|
| 58 |
FrameView* frameView() const { return m_frameView; } |
|---|
| 59 |
|
|---|
| 60 |
virtual bool hasOverhangingFloats() { return false; } |
|---|
| 61 |
|
|---|
| 62 |
virtual void computeAbsoluteRepaintRect(IntRect&, bool fixed = false); |
|---|
| 63 |
virtual void repaintViewRectangle(const IntRect&, bool immediate = false); |
|---|
| 64 |
|
|---|
| 65 |
virtual void paint(PaintInfo&, int tx, int ty); |
|---|
| 66 |
virtual void paintBoxDecorations(PaintInfo&, int tx, int ty); |
|---|
| 67 |
|
|---|
| 68 |
void setSelection(RenderObject* start, int startPos, RenderObject* end, int endPos); |
|---|
| 69 |
void clearSelection(); |
|---|
| 70 |
virtual RenderObject* selectionStart() const { return m_selectionStart; } |
|---|
| 71 |
virtual RenderObject* selectionEnd() const { return m_selectionEnd; } |
|---|
| 72 |
|
|---|
| 73 |
bool printing() const; |
|---|
| 74 |
void setPrintImages(bool enable) { m_printImages = enable; } |
|---|
| 75 |
bool printImages() const { return m_printImages; } |
|---|
| 76 |
void setTruncatedAt(int y) { m_truncatedAt = y; m_bestTruncatedAt = m_truncatorWidth = 0; m_forcedPageBreak = false; } |
|---|
| 77 |
void setBestTruncatedAt(int y, RenderObject *forRenderer, bool forcedBreak = false); |
|---|
| 78 |
int bestTruncatedAt() const { return m_bestTruncatedAt; } |
|---|
| 79 |
|
|---|
| 80 |
int truncatedAt() const { return m_truncatedAt; } |
|---|
| 81 |
|
|---|
| 82 |
virtual void absoluteRects(Vector<IntRect>&, int tx, int ty, bool topLevel = true); |
|---|
| 83 |
|
|---|
| 84 |
IntRect selectionRect(bool clipToVisibleContent = true) const; |
|---|
| 85 |
|
|---|
| 86 |
void setMaximalOutlineSize(int o) { m_maximalOutlineSize = o; } |
|---|
| 87 |
int maximalOutlineSize() const { return m_maximalOutlineSize; } |
|---|
| 88 |
|
|---|
| 89 |
virtual IntRect viewRect() const; |
|---|
| 90 |
|
|---|
| 91 |
virtual void selectionStartEnd(int& startPos, int& endPos) const; |
|---|
| 92 |
|
|---|
| 93 |
IntRect printRect() const { return m_printRect; } |
|---|
| 94 |
void setPrintRect(const IntRect& r) { m_printRect = r; } |
|---|
| 95 |
|
|---|
| 96 |
void updateWidgetPositions(); |
|---|
| 97 |
void addWidget(RenderObject*); |
|---|
| 98 |
void removeWidget(RenderObject*); |
|---|
| 99 |
|
|---|
| 100 |
const IntSize& layoutDelta() const { return m_layoutDelta; } |
|---|
| 101 |
void addLayoutDelta(const IntSize& delta) { m_layoutDelta += delta; } |
|---|
| 102 |
|
|---|
| 103 |
void pushLayoutState(RenderBox* renderer, const IntSize& offset) |
|---|
| 104 |
{ |
|---|
| 105 |
if (m_layoutStateDisableCount || m_frameView->needsFullRepaint()) |
|---|
| 106 |
return; |
|---|
| 107 |
m_layoutState = new (renderArena()) LayoutState(m_layoutState, renderer, offset); |
|---|
| 108 |
} |
|---|
| 109 |
|
|---|
| 110 |
void pushLayoutState(RenderObject*); |
|---|
| 111 |
|
|---|
| 112 |
void popLayoutState() |
|---|
| 113 |
{ |
|---|
| 114 |
if (m_layoutStateDisableCount || m_frameView->needsFullRepaint()) |
|---|
| 115 |
return; |
|---|
| 116 |
LayoutState* state = m_layoutState; |
|---|
| 117 |
m_layoutState = state->m_next; |
|---|
| 118 |
state->destroy(renderArena()); |
|---|
| 119 |
} |
|---|
| 120 |
|
|---|
| 121 |
LayoutState* layoutState() const { return m_layoutStateDisableCount ? 0 : m_layoutState; } |
|---|
| 122 |
|
|---|
| 123 |
|
|---|
| 124 |
|
|---|
| 125 |
|
|---|
| 126 |
void disableLayoutState() { m_layoutStateDisableCount++; } |
|---|
| 127 |
void enableLayoutState() { ASSERT(m_layoutStateDisableCount > 0); m_layoutStateDisableCount--; } |
|---|
| 128 |
|
|---|
| 129 |
protected: |
|---|
| 130 |
FrameView* m_frameView; |
|---|
| 131 |
|
|---|
| 132 |
RenderObject* m_selectionStart; |
|---|
| 133 |
RenderObject* m_selectionEnd; |
|---|
| 134 |
int m_selectionStartPos; |
|---|
| 135 |
int m_selectionEndPos; |
|---|
| 136 |
|
|---|
| 137 |
|
|---|
| 138 |
bool m_printImages; |
|---|
| 139 |
int m_truncatedAt; |
|---|
| 140 |
|
|---|
| 141 |
int m_maximalOutlineSize; |
|---|
| 142 |
IntRect m_printRect; |
|---|
| 143 |
|
|---|
| 144 |
typedef HashSet<RenderObject*> RenderObjectSet; |
|---|
| 145 |
|
|---|
| 146 |
RenderObjectSet m_widgets; |
|---|
| 147 |
|
|---|
| 148 |
private: |
|---|
| 149 |
int m_bestTruncatedAt; |
|---|
| 150 |
int m_truncatorWidth; |
|---|
| 151 |
bool m_forcedPageBreak; |
|---|
| 152 |
IntSize m_layoutDelta; |
|---|
| 153 |
LayoutState* m_layoutState; |
|---|
| 154 |
unsigned m_layoutStateDisableCount; |
|---|
| 155 |
}; |
|---|
| 156 |
|
|---|
| 157 |
} |
|---|
| 158 |
|
|---|
| 159 |
#endif |
|---|
| 160 |
|
|---|