OLD | NEW |
1 /* | 1 /* |
2 Copyright (C) 1997 Martin Jones (mjones@kde.org) | 2 Copyright (C) 1997 Martin Jones (mjones@kde.org) |
3 (C) 1998 Waldo Bastian (bastian@kde.org) | 3 (C) 1998 Waldo Bastian (bastian@kde.org) |
4 (C) 1998, 1999 Torben Weis (weis@kde.org) | 4 (C) 1998, 1999 Torben Weis (weis@kde.org) |
5 (C) 1999 Lars Knoll (knoll@kde.org) | 5 (C) 1999 Lars Knoll (knoll@kde.org) |
6 (C) 1999 Antti Koivisto (koivisto@kde.org) | 6 (C) 1999 Antti Koivisto (koivisto@kde.org) |
7 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 7 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
8 | 8 |
9 This library is free software; you can redistribute it and/or | 9 This library is free software; you can redistribute it and/or |
10 modify it under the terms of the GNU Library General Public | 10 modify it under the terms of the GNU Library General Public |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 bool canInvalidatePaintDuringPerformLayout() const { return m_canInvalidateP
aintDuringPerformLayout; } | 88 bool canInvalidatePaintDuringPerformLayout() const { return m_canInvalidateP
aintDuringPerformLayout; } |
89 | 89 |
90 RenderObject* layoutRoot(bool onlyDuringLayout = false) const; | 90 RenderObject* layoutRoot(bool onlyDuringLayout = false) const; |
91 void clearLayoutSubtreeRoot() { m_layoutSubtreeRoot = 0; } | 91 void clearLayoutSubtreeRoot() { m_layoutSubtreeRoot = 0; } |
92 int layoutCount() const { return m_layoutCount; } | 92 int layoutCount() const { return m_layoutCount; } |
93 | 93 |
94 bool needsLayout() const; | 94 bool needsLayout() const; |
95 void setNeedsLayout(); | 95 void setNeedsLayout(); |
96 | 96 |
97 // Methods for getting/setting the size Blink should use to layout the conte
nts. | 97 // Methods for getting/setting the size Blink should use to layout the conte
nts. |
| 98 // FIXME(sky): Remove the scrollbars argument now that FrameView doesn't scr
oll. |
98 IntSize layoutSize(IncludeScrollbarsInRect = ExcludeScrollbars) const; | 99 IntSize layoutSize(IncludeScrollbarsInRect = ExcludeScrollbars) const; |
99 void setLayoutSize(const IntSize&); | 100 void setLayoutSize(const IntSize&); |
100 | 101 |
101 // If this is set to false, the layout size will need to be explicitly set b
y the owner. | 102 // If this is set to false, the layout size will need to be explicitly set b
y the owner. |
102 // E.g. WebViewImpl sets its mainFrame's layout size manually | 103 // E.g. WebViewImpl sets its mainFrame's layout size manually |
103 void setLayoutSizeFixedToFrameSize(bool isFixed) { m_layoutSizeFixedToFrameS
ize = isFixed; } | 104 void setLayoutSizeFixedToFrameSize(bool isFixed) { m_layoutSizeFixedToFrameS
ize = isFixed; } |
104 bool layoutSizeFixedToFrameSize() { return m_layoutSizeFixedToFrameSize; } | 105 bool layoutSizeFixedToFrameSize() { return m_layoutSizeFixedToFrameSize; } |
105 | 106 |
106 bool needsFullPaintInvalidation() const { return m_doFullPaintInvalidation;
} | 107 bool needsFullPaintInvalidation() const { return m_doFullPaintInvalidation;
} |
107 | 108 |
108 void updateAcceleratedCompositingSettings(); | 109 void updateAcceleratedCompositingSettings(); |
109 | 110 |
110 void recalcOverflowAfterStyleChange(); | 111 void recalcOverflowAfterStyleChange(); |
111 | 112 |
112 bool isEnclosedInCompositingLayer() const; | 113 bool isEnclosedInCompositingLayer() const; |
113 | 114 |
114 void prepareForDetach(); | 115 void prepareForDetach(); |
115 virtual void recalculateScrollbarOverlayStyle(); | |
116 | 116 |
117 void clear(); | 117 void clear(); |
118 | 118 |
119 bool isTransparent() const; | 119 bool isTransparent() const; |
120 void setTransparent(bool isTransparent); | 120 void setTransparent(bool isTransparent); |
121 | 121 |
122 // True if the FrameView is not transparent, and the base background color i
s opaque. | 122 // True if the FrameView is not transparent, and the base background color i
s opaque. |
123 bool hasOpaqueBackground() const; | 123 bool hasOpaqueBackground() const; |
124 | 124 |
125 Color baseBackgroundColor() const; | 125 Color baseBackgroundColor() const; |
126 void setBaseBackgroundColor(const Color&); | 126 void setBaseBackgroundColor(const Color&); |
127 void updateBackgroundRecursively(const Color&, bool); | 127 void updateBackgroundRecursively(const Color&, bool); |
128 | 128 |
129 IntRect windowClipRect(IncludeScrollbarsInRect = ExcludeScrollbars) const; | 129 IntRect windowClipRect(IncludeScrollbarsInRect = ExcludeScrollbars) const; |
130 | 130 |
131 float visibleContentScaleFactor() const { return m_visibleContentScaleFactor
; } | 131 float visibleContentScaleFactor() const { return m_visibleContentScaleFactor
; } |
132 void setVisibleContentScaleFactor(float); | 132 void setVisibleContentScaleFactor(float); |
133 | 133 |
134 float inputEventsScaleFactor() const; | 134 float inputEventsScaleFactor() const; |
135 IntSize inputEventsOffsetForEmulation() const; | 135 IntSize inputEventsOffsetForEmulation() const; |
136 void setInputEventsTransformForEmulation(const IntSize&, float); | 136 void setInputEventsTransformForEmulation(const IntSize&, float); |
137 | 137 |
138 AtomicString mediaType() const; | 138 AtomicString mediaType() const; |
139 void setMediaType(const AtomicString&); | 139 void setMediaType(const AtomicString&); |
140 | 140 |
141 void restoreScrollbar(); | |
142 | |
143 void postLayoutTimerFired(Timer<FrameView>*); | 141 void postLayoutTimerFired(Timer<FrameView>*); |
144 | 142 |
145 bool wasScrolledByUser() const; | 143 bool wasScrolledByUser() const; |
146 void setWasScrolledByUser(bool); | 144 void setWasScrolledByUser(bool); |
147 | 145 |
148 void paintContents(GraphicsContext*, const IntRect& damageRect); | 146 void paintContents(GraphicsContext*, const IntRect& damageRect); |
149 void setPaintBehavior(PaintBehavior); | 147 void setPaintBehavior(PaintBehavior); |
150 PaintBehavior paintBehavior() const; | 148 PaintBehavior paintBehavior() const; |
151 bool isPainting() const; | 149 bool isPainting() const; |
152 bool hasEverPainted() const { return m_lastPaintTime; } | 150 bool hasEverPainted() const { return m_lastPaintTime; } |
153 void setNodeToDraw(Node*); | 151 void setNodeToDraw(Node*); |
154 | 152 |
155 Color documentBackgroundColor() const; | 153 Color documentBackgroundColor() const; |
156 | 154 |
157 static double currentFrameTimeStamp() { return s_currentFrameTimeStamp; } | 155 static double currentFrameTimeStamp() { return s_currentFrameTimeStamp; } |
158 | 156 |
159 void updateLayoutAndStyleForPainting(); | 157 void updateLayoutAndStyleForPainting(); |
160 void updateLayoutAndStyleIfNeededRecursive(); | 158 void updateLayoutAndStyleIfNeededRecursive(); |
161 | 159 |
162 void invalidateTreeIfNeededRecursive(); | 160 void invalidateTreeIfNeededRecursive(); |
163 | 161 |
164 void forceLayout(bool allowSubtree = false); | 162 void forceLayout(bool allowSubtree = false); |
165 | 163 |
166 void scrollContentsIfNeededRecursive(); | |
167 | |
168 // Methods to convert points and rects between the coordinate space of the r
enderer, and this view. | 164 // Methods to convert points and rects between the coordinate space of the r
enderer, and this view. |
169 IntRect convertFromRenderer(const RenderObject&, const IntRect&) const; | 165 IntRect convertFromRenderer(const RenderObject&, const IntRect&) const; |
170 IntRect convertToRenderer(const RenderObject&, const IntRect&) const; | 166 IntRect convertToRenderer(const RenderObject&, const IntRect&) const; |
171 IntPoint convertFromRenderer(const RenderObject&, const IntPoint&) const; | 167 IntPoint convertFromRenderer(const RenderObject&, const IntPoint&) const; |
172 IntPoint convertToRenderer(const RenderObject&, const IntPoint&) const; | 168 IntPoint convertToRenderer(const RenderObject&, const IntPoint&) const; |
173 | 169 |
174 bool isScrollable(); | |
175 | |
176 enum ScrollbarModesCalculationStrategy { RulesFromWebContentOnly, AnyRule }; | |
177 void calculateScrollbarModesForLayoutAndSetViewportRenderer(ScrollbarMode& h
Mode, ScrollbarMode& vMode, ScrollbarModesCalculationStrategy = AnyRule); | |
178 | |
179 // FIXME(sky): Maybe remove now that we're not a ScrollView? | |
180 IntPoint lastKnownMousePosition() const; | |
181 bool shouldSetCursor() const; | 170 bool shouldSetCursor() const; |
182 | 171 |
183 void setCursor(const Cursor&); | 172 void setCursor(const Cursor&); |
184 | 173 |
185 // FIXME: Remove this method once plugin loading is decoupled from layout. | 174 // FIXME: Remove this method once plugin loading is decoupled from layout. |
186 void flushAnyPendingPostLayoutTasks(); | 175 void flushAnyPendingPostLayoutTasks(); |
187 | 176 |
188 void setTracksPaintInvalidations(bool); | 177 void setTracksPaintInvalidations(bool); |
189 bool isTrackingPaintInvalidations() const { return m_isTrackingPaintInvalida
tions; } | 178 bool isTrackingPaintInvalidations() const { return m_isTrackingPaintInvalida
tions; } |
190 void resetTrackedPaintInvalidations(); | 179 void resetTrackedPaintInvalidations(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 // false. | 214 // false. |
226 bool isSubtreeLayout() const { return !!m_layoutSubtreeRoot; } | 215 bool isSubtreeLayout() const { return !!m_layoutSubtreeRoot; } |
227 | 216 |
228 // Sets the tickmarks for the FrameView, overriding the default behavior | 217 // Sets the tickmarks for the FrameView, overriding the default behavior |
229 // which is to display the tickmarks corresponding to find results. | 218 // which is to display the tickmarks corresponding to find results. |
230 // If |m_tickmarks| is empty, the default behavior is restored. | 219 // If |m_tickmarks| is empty, the default behavior is restored. |
231 void setTickmarks(const Vector<IntRect>& tickmarks) { m_tickmarks = tickmark
s; } | 220 void setTickmarks(const Vector<IntRect>& tickmarks) { m_tickmarks = tickmark
s; } |
232 | 221 |
233 // ScrollableArea interface | 222 // ScrollableArea interface |
234 // FIXME(sky): Remove | 223 // FIXME(sky): Remove |
235 void invalidateScrollbarRect(Scrollbar*, const IntRect&); | |
236 void getTickmarks(Vector<IntRect>&) const; | 224 void getTickmarks(Vector<IntRect>&) const; |
237 IntRect scrollableAreaBoundingBox() const; | 225 IntRect scrollableAreaBoundingBox() const; |
238 bool scrollAnimatorEnabled() const; | 226 bool scrollAnimatorEnabled() const; |
239 bool usesCompositedScrolling() const; | 227 bool usesCompositedScrolling() const; |
240 GraphicsLayer* layerForScrolling() const; | 228 GraphicsLayer* layerForScrolling() const; |
241 GraphicsLayer* layerForHorizontalScrollbar() const; | 229 GraphicsLayer* layerForHorizontalScrollbar() const; |
242 GraphicsLayer* layerForVerticalScrollbar() const; | 230 GraphicsLayer* layerForVerticalScrollbar() const; |
243 GraphicsLayer* layerForScrollCorner() const; | 231 GraphicsLayer* layerForScrollCorner() const; |
244 | 232 |
245 // FIXME(sky): remove | 233 // FIXME(sky): remove |
(...skipping 12 matching lines...) Expand all Loading... |
258 IntPoint scrollPosition() const { return IntPoint(); } | 246 IntPoint scrollPosition() const { return IntPoint(); } |
259 bool scheduleAnimation(); | 247 bool scheduleAnimation(); |
260 IntRect visibleContentRect(IncludeScrollbarsInRect = ExcludeScrollbars) cons
t { return IntRect(IntPoint(), expandedIntSize(frameRect().size())); } | 248 IntRect visibleContentRect(IncludeScrollbarsInRect = ExcludeScrollbars) cons
t { return IntRect(IntPoint(), expandedIntSize(frameRect().size())); } |
261 IntSize unscaledVisibleContentSize(IncludeScrollbarsInRect = ExcludeScrollba
rs) const { return frameRect().size(); } | 249 IntSize unscaledVisibleContentSize(IncludeScrollbarsInRect = ExcludeScrollba
rs) const { return frameRect().size(); } |
262 // FIXME(sky): Not clear what values these should return. This is just what
they happen to be | 250 // FIXME(sky): Not clear what values these should return. This is just what
they happen to be |
263 // returning today. | 251 // returning today. |
264 bool paintsEntireContents() const { return false; } | 252 bool paintsEntireContents() const { return false; } |
265 bool clipsPaintInvalidations() const { return true; } | 253 bool clipsPaintInvalidations() const { return true; } |
266 | 254 |
267 protected: | 255 protected: |
268 virtual void scrollContentsIfNeeded(); | |
269 bool scrollContentsFastPath(const IntSize& scrollDelta); | |
270 void scrollContentsSlowPath(const IntRect& updateRect); | |
271 | |
272 bool isVerticalDocument() const; | 256 bool isVerticalDocument() const; |
273 bool isFlippedDocument() const; | 257 bool isFlippedDocument() const; |
274 | 258 |
275 private: | 259 private: |
276 explicit FrameView(LocalFrame*); | 260 explicit FrameView(LocalFrame*); |
277 | 261 |
278 void reset(); | 262 void reset(); |
279 void init(); | 263 void init(); |
280 | 264 |
281 virtual void frameRectsChanged() override; | 265 virtual void frameRectsChanged() override; |
282 virtual bool isFrameView() const override { return true; } | 266 virtual bool isFrameView() const override { return true; } |
283 | 267 |
284 bool contentsInCompositedLayer() const; | 268 bool contentsInCompositedLayer() const; |
285 | 269 |
286 void applyOverflowToViewportAndSetRenderer(RenderObject*, ScrollbarMode& hMo
de, ScrollbarMode& vMode); | |
287 void updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow); | |
288 | |
289 void forceLayoutParentViewIfNeeded(); | 270 void forceLayoutParentViewIfNeeded(); |
290 void performPreLayoutTasks(); | 271 void performPreLayoutTasks(); |
291 void performLayout(RenderObject* rootForThisLayout, bool inSubtreeLayout); | 272 void performLayout(RenderObject* rootForThisLayout, bool inSubtreeLayout); |
292 void scheduleOrPerformPostLayoutTasks(); | 273 void scheduleOrPerformPostLayoutTasks(); |
293 void performPostLayoutTasks(); | 274 void performPostLayoutTasks(); |
294 | 275 |
295 void invalidateTreeIfNeeded(); | 276 void invalidateTreeIfNeeded(); |
296 | 277 |
297 void gatherDebugLayoutRects(RenderObject* layoutRoot); | 278 void gatherDebugLayoutRects(RenderObject* layoutRoot); |
298 | 279 |
299 DocumentLifecycle& lifecycle() const; | 280 DocumentLifecycle& lifecycle() const; |
300 | 281 |
301 // FIXME(sky): Remove now that we're not a ScrollView? | 282 // FIXME(sky): Remove now that we're not a ScrollView? |
302 void contentRectangleForPaintInvalidation(const IntRect&); | 283 void contentRectangleForPaintInvalidation(const IntRect&); |
303 void contentsResized(); | 284 void contentsResized(); |
304 void scrollbarExistenceDidChange(); | |
305 | 285 |
306 // Override ScrollView methods to do point conversion via renderers, in orde
r to | 286 // Override ScrollView methods to do point conversion via renderers, in orde
r to |
307 // take transforms into account. | 287 // take transforms into account. |
308 virtual IntRect convertToContainingView(const IntRect&) const override; | 288 virtual IntRect convertToContainingView(const IntRect&) const override; |
309 virtual IntRect convertFromContainingView(const IntRect&) const override; | 289 virtual IntRect convertFromContainingView(const IntRect&) const override; |
310 virtual IntPoint convertToContainingView(const IntPoint&) const override; | 290 virtual IntPoint convertToContainingView(const IntPoint&) const override; |
311 virtual IntPoint convertFromContainingView(const IntPoint&) const override; | 291 virtual IntPoint convertFromContainingView(const IntPoint&) const override; |
312 | 292 |
313 bool wasViewportResized(); | 293 bool wasViewportResized(); |
314 void sendResizeEventIfNeeded(); | 294 void sendResizeEventIfNeeded(); |
(...skipping 13 matching lines...) Expand all Loading... |
328 static double s_currentFrameTimeStamp; // used for detecting decoded resourc
e thrash in the cache | 308 static double s_currentFrameTimeStamp; // used for detecting decoded resourc
e thrash in the cache |
329 static bool s_inPaintContents; | 309 static bool s_inPaintContents; |
330 | 310 |
331 LayoutSize m_size; | 311 LayoutSize m_size; |
332 | 312 |
333 RefPtr<LocalFrame> m_frame; | 313 RefPtr<LocalFrame> m_frame; |
334 HashSet<RefPtr<Widget> > m_children; | 314 HashSet<RefPtr<Widget> > m_children; |
335 | 315 |
336 bool m_doFullPaintInvalidation; | 316 bool m_doFullPaintInvalidation; |
337 | 317 |
338 // FIXME(sky): Remove | |
339 bool m_canHaveScrollbars; | |
340 | |
341 bool m_hasPendingLayout; | 318 bool m_hasPendingLayout; |
342 RenderObject* m_layoutSubtreeRoot; | 319 RenderObject* m_layoutSubtreeRoot; |
343 | 320 |
344 bool m_layoutSchedulingEnabled; | 321 bool m_layoutSchedulingEnabled; |
345 bool m_inPerformLayout; | 322 bool m_inPerformLayout; |
346 bool m_canInvalidatePaintDuringPerformLayout; | 323 bool m_canInvalidatePaintDuringPerformLayout; |
347 bool m_inSynchronousPostLayout; | 324 bool m_inSynchronousPostLayout; |
348 int m_layoutCount; | 325 int m_layoutCount; |
349 unsigned m_nestedLayoutCount; | 326 unsigned m_nestedLayoutCount; |
350 Timer<FrameView> m_postLayoutTasksTimer; | 327 Timer<FrameView> m_postLayoutTasksTimer; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 m_view->setCanInvalidatePaintDuringPerformLayout(m_originalValue); | 391 m_view->setCanInvalidatePaintDuringPerformLayout(m_originalValue); |
415 } | 392 } |
416 private: | 393 private: |
417 FrameView* m_view; | 394 FrameView* m_view; |
418 bool m_originalValue; | 395 bool m_originalValue; |
419 }; | 396 }; |
420 | 397 |
421 } // namespace blink | 398 } // namespace blink |
422 | 399 |
423 #endif // FrameView_h | 400 #endif // FrameView_h |
OLD | NEW |