|
1 /* |
|
2 Copyright (C) 1997 Martin Jones (mjones@kde.org) |
|
3 (C) 1998 Waldo Bastian (bastian@kde.org) |
|
4 (C) 1998, 1999 Torben Weis (weis@kde.org) |
|
5 (C) 1999 Lars Knoll (knoll@kde.org) |
|
6 (C) 1999 Antti Koivisto (koivisto@kde.org) |
|
7 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
|
8 |
|
9 This library is free software; you can redistribute it and/or |
|
10 modify it under the terms of the GNU Library General Public |
|
11 License as published by the Free Software Foundation; either |
|
12 version 2 of the License, or (at your option) any later version. |
|
13 |
|
14 This library is distributed in the hope that it will be useful, |
|
15 but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
17 Library General Public License for more details. |
|
18 |
|
19 You should have received a copy of the GNU Library General Public License |
|
20 along with this library; see the file COPYING.LIB. If not, write to |
|
21 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
22 Boston, MA 02110-1301, USA. |
|
23 */ |
|
24 |
|
25 #ifndef FrameView_h |
|
26 #define FrameView_h |
|
27 |
|
28 #include "ScrollView.h" |
|
29 #include "IntSize.h" |
|
30 #include <wtf/Forward.h> |
|
31 #include <wtf/OwnPtr.h> |
|
32 |
|
33 namespace WebCore { |
|
34 |
|
35 class Color; |
|
36 class Event; |
|
37 class EventTargetNode; |
|
38 class Frame; |
|
39 class FrameViewPrivate; |
|
40 class IntRect; |
|
41 class PlatformMouseEvent; |
|
42 class Node; |
|
43 class RenderLayer; |
|
44 class RenderObject; |
|
45 class RenderPartObject; |
|
46 class String; |
|
47 |
|
48 template <typename T> class Timer; |
|
49 |
|
50 class FrameView : public ScrollView { |
|
51 public: |
|
52 FrameView(Frame*); |
|
53 virtual ~FrameView(); |
|
54 |
|
55 Frame* frame() const { return m_frame.get(); } |
|
56 void clearFrame(); |
|
57 |
|
58 void ref() { ++m_refCount; } |
|
59 void deref() { if (!--m_refCount) delete this; } |
|
60 bool hasOneRef() { return m_refCount == 1; } |
|
61 |
|
62 int marginWidth() const { return m_margins.width(); } // -1 means default |
|
63 int marginHeight() const { return m_margins.height(); } // -1 means default |
|
64 void setMarginWidth(int); |
|
65 void setMarginHeight(int); |
|
66 |
|
67 virtual void setVScrollbarMode(ScrollbarMode); |
|
68 virtual void setHScrollbarMode(ScrollbarMode); |
|
69 virtual void setScrollbarsMode(ScrollbarMode); |
|
70 |
|
71 void layout(bool allowSubtree = true); |
|
72 bool didFirstLayout() const; |
|
73 void layoutTimerFired(Timer<FrameView>*); |
|
74 void scheduleRelayout(); |
|
75 void scheduleRelayoutOfSubtree(Node*); |
|
76 void unscheduleRelayout(); |
|
77 bool layoutPending() const; |
|
78 |
|
79 Node* layoutRoot() const; |
|
80 int layoutCount() const; |
|
81 |
|
82 // These two helper functions just pass through to the RenderView. |
|
83 bool needsLayout() const; |
|
84 void setNeedsLayout(); |
|
85 |
|
86 bool needsFullRepaint() const; |
|
87 void repaintRectangle(const IntRect&, bool immediate); |
|
88 void addRepaintInfo(RenderObject*, const IntRect&); |
|
89 |
|
90 void resetScrollbars(); |
|
91 |
|
92 void clear(); |
|
93 |
|
94 bool isTransparent() const; |
|
95 void setTransparent(bool isTransparent); |
|
96 |
|
97 Color baseBackgroundColor() const; |
|
98 void setBaseBackgroundColor(Color); |
|
99 |
|
100 void adjustViewSize(); |
|
101 void initScrollbars(); |
|
102 |
|
103 virtual IntRect windowClipRect() const; |
|
104 IntRect windowClipRect(bool clipToContents) const; |
|
105 IntRect windowClipRectForLayer(const RenderLayer*, bool clipToLayerContents) const; |
|
106 |
|
107 virtual void scrollRectIntoViewRecursively(const IntRect&); |
|
108 virtual void setContentsPos(int x, int y); |
|
109 |
|
110 String mediaType() const; |
|
111 void setMediaType(const String&); |
|
112 |
|
113 void setUseSlowRepaints(); |
|
114 |
|
115 void addSlowRepaintObject(); |
|
116 void removeSlowRepaintObject(); |
|
117 |
|
118 void updateDashboardRegions(); |
|
119 void updateControlTints(); |
|
120 |
|
121 void restoreScrollbar(); |
|
122 |
|
123 void scheduleEvent(PassRefPtr<Event>, PassRefPtr<EventTargetNode>, bool tempEvent); |
|
124 void pauseScheduledEvents(); |
|
125 void resumeScheduledEvents(); |
|
126 |
|
127 bool wasScrolledByUser() const; |
|
128 void setWasScrolledByUser(bool); |
|
129 |
|
130 void addWidgetToUpdate(RenderPartObject*); |
|
131 void removeWidgetToUpdate(RenderPartObject*); |
|
132 |
|
133 // FIXME: This method should be used by all platforms, but currently depends on ScrollView::children, |
|
134 // which not all methods have. Once FrameView and ScrollView are merged, this #if should be removed. |
|
135 #if PLATFORM(WIN) || PLATFORM(GTK) |
|
136 void layoutIfNeededRecursive(); |
|
137 #endif |
|
138 |
|
139 private: |
|
140 void init(); |
|
141 |
|
142 virtual bool isFrameView() const; |
|
143 |
|
144 bool scrollTo(const IntRect&); |
|
145 |
|
146 bool useSlowRepaints() const; |
|
147 |
|
148 void applyOverflowToViewport(RenderObject*, ScrollbarMode& hMode, ScrollbarMode& vMode); |
|
149 |
|
150 void updateBorder(); |
|
151 |
|
152 void updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow); |
|
153 |
|
154 void dispatchScheduledEvents(); |
|
155 |
|
156 unsigned m_refCount; |
|
157 IntSize m_size; |
|
158 IntSize m_margins; |
|
159 OwnPtr<HashSet<RenderPartObject*> > m_widgetUpdateSet; |
|
160 RefPtr<Frame> m_frame; |
|
161 FrameViewPrivate* d; |
|
162 }; |
|
163 |
|
164 } |
|
165 |
|
166 #endif |