~ubuntu-branches/ubuntu/raring/qtwebkit-source/raring-proposed

« back to all changes in this revision

Viewing changes to Source/WebCore/page/FrameView.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-02-18 14:24:18 UTC
  • Revision ID: package-import@ubuntu.com-20130218142418-eon0jmjg3nj438uy
Tags: upstream-2.3
ImportĀ upstreamĀ versionĀ 2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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, 2008, 2009 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 "AdjustViewSizeOrNot.h"
 
29
#include "Color.h"
 
30
#include "Frame.h"
 
31
#include "LayoutRect.h"
 
32
#include "Pagination.h"
 
33
#include "PaintPhase.h"
 
34
#include "ScrollView.h"
 
35
#include <wtf/Forward.h>
 
36
#include <wtf/OwnPtr.h>
 
37
#include <wtf/text/WTFString.h>
 
38
 
 
39
namespace WebCore {
 
40
 
 
41
class Color;
 
42
class Element;
 
43
class Event;
 
44
class FloatSize;
 
45
class Frame;
 
46
class FrameActionScheduler;
 
47
class KURL;
 
48
class Node;
 
49
class Page;
 
50
class RenderBox;
 
51
class RenderEmbeddedObject;
 
52
class RenderLayer;
 
53
class RenderObject;
 
54
class RenderScrollbarPart;
 
55
 
 
56
Pagination::Mode paginationModeForRenderStyle(RenderStyle*);
 
57
 
 
58
typedef unsigned long long DOMTimeStamp;
 
59
 
 
60
class FrameView : public ScrollView {
 
61
public:
 
62
    friend class RenderView;
 
63
    friend class Internals;
 
64
 
 
65
    static PassRefPtr<FrameView> create(Frame*);
 
66
    static PassRefPtr<FrameView> create(Frame*, const IntSize& initialSize);
 
67
 
 
68
    virtual ~FrameView();
 
69
 
 
70
    virtual HostWindow* hostWindow() const;
 
71
    
 
72
    virtual void invalidateRect(const IntRect&);
 
73
    virtual void setFrameRect(const IntRect&);
 
74
 
 
75
#if ENABLE(REQUEST_ANIMATION_FRAME)
 
76
    virtual bool scheduleAnimation();
 
77
#endif
 
78
 
 
79
    Frame* frame() const { return m_frame.get(); }
 
80
    void clearFrame();
 
81
 
 
82
    int mapFromLayoutToCSSUnits(LayoutUnit);
 
83
    LayoutUnit mapFromCSSToLayoutUnits(int);
 
84
 
 
85
    LayoutUnit marginWidth() const { return m_margins.width(); } // -1 means default
 
86
    LayoutUnit marginHeight() const { return m_margins.height(); } // -1 means default
 
87
    void setMarginWidth(LayoutUnit);
 
88
    void setMarginHeight(LayoutUnit);
 
89
 
 
90
    virtual void setCanHaveScrollbars(bool);
 
91
    void updateCanHaveScrollbars();
 
92
 
 
93
    virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation);
 
94
 
 
95
    virtual bool avoidScrollbarCreation() const;
 
96
 
 
97
    virtual void setContentsSize(const IntSize&);
 
98
 
 
99
    void layout(bool allowSubtree = true);
 
100
    bool didFirstLayout() const;
 
101
    void layoutTimerFired(Timer<FrameView>*);
 
102
    void scheduleRelayout();
 
103
    void scheduleRelayoutOfSubtree(RenderObject*);
 
104
    void unscheduleRelayout();
 
105
    bool layoutPending() const;
 
106
    bool isInLayout() const { return m_inLayout; }
 
107
 
 
108
    RenderObject* layoutRoot(bool onlyDuringLayout = false) const;
 
109
    void clearLayoutRoot() { m_layoutRoot = 0; }
 
110
    int layoutCount() const { return m_layoutCount; }
 
111
 
 
112
    bool needsLayout() const;
 
113
    void setNeedsLayout();
 
114
 
 
115
    bool needsFullRepaint() const { return m_doFullRepaint; }
 
116
 
 
117
#if ENABLE(REQUEST_ANIMATION_FRAME)
 
118
    void serviceScriptedAnimations(double monotonicAnimationStartTime);
 
119
#endif
 
120
 
 
121
#if USE(ACCELERATED_COMPOSITING)
 
122
    void updateCompositingLayersAfterStyleChange();
 
123
    void updateCompositingLayersAfterLayout();
 
124
    bool flushCompositingStateForThisFrame(Frame* rootFrameForFlush);
 
125
 
 
126
    void clearBackingStores();
 
127
    void restoreBackingStores();
 
128
 
 
129
    // Called when changes to the GraphicsLayer hierarchy have to be synchronized with
 
130
    // content rendered via the normal painting path.
 
131
    void setNeedsOneShotDrawingSynchronization();
 
132
 
 
133
    virtual TiledBacking* tiledBacking() OVERRIDE;
 
134
 
 
135
    // In the future when any ScrollableArea can have a node in th ScrollingTree, this should
 
136
    // become a virtual function on ScrollableArea.
 
137
    uint64_t scrollLayerID() const;
 
138
#endif
 
139
 
 
140
    bool hasCompositedContent() const;
 
141
    bool hasCompositedContentIncludingDescendants() const;
 
142
    bool hasCompositingAncestor() const;
 
143
    void enterCompositingMode();
 
144
    bool isEnclosedInCompositingLayer() const;
 
145
 
 
146
    // Only used with accelerated compositing, but outside the #ifdef to make linkage easier.
 
147
    // Returns true if the flush was completed.
 
148
    bool flushCompositingStateIncludingSubframes();
 
149
 
 
150
    // Returns true when a paint with the PaintBehaviorFlattenCompositingLayers flag set gives
 
151
    // a faithful representation of the content.
 
152
    bool isSoftwareRenderable() const;
 
153
 
 
154
    void didMoveOnscreen();
 
155
    void willMoveOffscreen();
 
156
 
 
157
    void resetScrollbars();
 
158
    void resetScrollbarsAndClearContentsSize();
 
159
    void detachCustomScrollbars();
 
160
    virtual void recalculateScrollbarOverlayStyle();
 
161
 
 
162
    void clear();
 
163
 
 
164
    bool isTransparent() const;
 
165
    void setTransparent(bool isTransparent);
 
166
 
 
167
    Color baseBackgroundColor() const;
 
168
    void setBaseBackgroundColor(const Color&);
 
169
    void updateBackgroundRecursively(const Color&, bool);
 
170
 
 
171
    bool shouldUpdateWhileOffscreen() const;
 
172
    void setShouldUpdateWhileOffscreen(bool);
 
173
    bool shouldUpdate(bool = false) const;
 
174
 
 
175
    void adjustViewSize();
 
176
    
 
177
    virtual IntRect windowClipRect(bool clipToContents = true) const;
 
178
    IntRect windowClipRectForFrameOwner(const HTMLFrameOwnerElement*, bool clipToLayerContents) const;
 
179
 
 
180
    virtual IntRect windowResizerRect() const;
 
181
 
 
182
    virtual void setFixedVisibleContentRect(const IntRect&) OVERRIDE;
 
183
    virtual void setScrollPosition(const IntPoint&) OVERRIDE;
 
184
    void scrollPositionChangedViaPlatformWidget();
 
185
    virtual void repaintFixedElementsAfterScrolling();
 
186
    virtual void updateFixedElementsAfterScrolling();
 
187
    virtual bool shouldRubberBandInDirection(ScrollDirection) const;
 
188
    virtual bool requestScrollPositionUpdate(const IntPoint&) OVERRIDE;
 
189
 
 
190
    String mediaType() const;
 
191
    void setMediaType(const String&);
 
192
    void adjustMediaTypeForPrinting(bool printing);
 
193
 
 
194
    void setCannotBlitToWindow();
 
195
    void setIsOverlapped(bool);
 
196
    bool isOverlapped() const { return m_isOverlapped; }
 
197
    bool isOverlappedIncludingAncestors() const;
 
198
    void setContentIsOpaque(bool);
 
199
 
 
200
    void addSlowRepaintObject();
 
201
    void removeSlowRepaintObject();
 
202
    bool hasSlowRepaintObjects() const { return m_slowRepaintObjectCount; }
 
203
 
 
204
    // Includes fixed- and sticky-position objects.
 
205
    typedef HashSet<RenderObject*> ViewportConstrainedObjectSet;
 
206
    void addViewportConstrainedObject(RenderObject*);
 
207
    void removeViewportConstrainedObject(RenderObject*);
 
208
    const ViewportConstrainedObjectSet* viewportConstrainedObjects() const { return m_viewportConstrainedObjects.get(); }
 
209
    bool hasViewportConstrainedObjects() const { return m_viewportConstrainedObjects && m_viewportConstrainedObjects->size() > 0; }
 
210
 
 
211
    // Functions for querying the current scrolled position, negating the effects of overhang
 
212
    // and adjusting for page scale.
 
213
    IntSize scrollOffsetForFixedPosition() const;
 
214
 
 
215
    bool fixedElementsLayoutRelativeToFrame() const;
 
216
 
 
217
    void beginDeferredRepaints();
 
218
    void endDeferredRepaints();
 
219
    void handleLoadCompleted();
 
220
    void flushDeferredRepaints();
 
221
    void startDeferredRepaintTimer(double delay);
 
222
    void resetDeferredRepaintDelay();
 
223
 
 
224
    void beginDisableRepaints();
 
225
    void endDisableRepaints();
 
226
    bool repaintsDisabled() { return m_disableRepaints > 0; }
 
227
 
 
228
#if ENABLE(DASHBOARD_SUPPORT) || ENABLE(DRAGGABLE_REGION)
 
229
    void updateAnnotatedRegions();
 
230
#endif
 
231
    void updateControlTints();
 
232
 
 
233
    void restoreScrollbar();
 
234
 
 
235
    void scheduleEvent(PassRefPtr<Event>, PassRefPtr<Node>);
 
236
    void pauseScheduledEvents();
 
237
    void resumeScheduledEvents();
 
238
    void postLayoutTimerFired(Timer<FrameView>*);
 
239
 
 
240
    bool wasScrolledByUser() const;
 
241
    void setWasScrolledByUser(bool);
 
242
 
 
243
    bool safeToPropagateScrollToParent() const { return m_safeToPropagateScrollToParent; }
 
244
    void setSafeToPropagateScrollToParent(bool isSafe) { m_safeToPropagateScrollToParent = isSafe; }
 
245
 
 
246
    void addWidgetToUpdate(RenderEmbeddedObject*);
 
247
    void removeWidgetToUpdate(RenderEmbeddedObject*);
 
248
 
 
249
    virtual void paintContents(GraphicsContext*, const IntRect& damageRect);
 
250
    void setPaintBehavior(PaintBehavior);
 
251
    PaintBehavior paintBehavior() const;
 
252
    bool isPainting() const;
 
253
    bool hasEverPainted() const { return m_lastPaintTime; }
 
254
    void setLastPaintTime(double lastPaintTime) { m_lastPaintTime = lastPaintTime; }
 
255
    void setNodeToDraw(Node*);
 
256
 
 
257
    enum SelectionInSnaphot { IncludeSelection, ExcludeSelection };
 
258
    enum CoordinateSpaceForSnapshot { DocumentCoordinates, ViewCoordinates };
 
259
    void paintContentsForSnapshot(GraphicsContext*, const IntRect& imageRect, SelectionInSnaphot shouldPaintSelection, CoordinateSpaceForSnapshot);
 
260
 
 
261
    virtual void paintOverhangAreas(GraphicsContext*, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect);
 
262
    virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect);
 
263
    virtual void paintScrollbar(GraphicsContext*, Scrollbar*, const IntRect&) OVERRIDE;
 
264
 
 
265
    Color documentBackgroundColor() const;
 
266
 
 
267
    bool isInChildFrameWithFrameFlattening() const;
 
268
 
 
269
    static double currentPaintTimeStamp() { return sCurrentPaintTimeStamp; } // returns 0 if not painting
 
270
    
 
271
    void updateLayoutAndStyleIfNeededRecursive();
 
272
 
 
273
    void incrementVisuallyNonEmptyCharacterCount(unsigned);
 
274
    void incrementVisuallyNonEmptyPixelCount(const IntSize&);
 
275
    void setIsVisuallyNonEmpty() { m_isVisuallyNonEmpty = true; }
 
276
    bool isVisuallyNonEmpty() const { return m_isVisuallyNonEmpty; }
 
277
    void enableAutoSizeMode(bool enable, const IntSize& minSize, const IntSize& maxSize);
 
278
 
 
279
    void forceLayout(bool allowSubtree = false);
 
280
    void forceLayoutForPagination(const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkFactor, AdjustViewSizeOrNot);
 
281
 
 
282
    // FIXME: This method is retained because of embedded WebViews in AppKit.  When a WebView is embedded inside
 
283
    // some enclosing view with auto-pagination, no call happens to resize the view.  The new pagination model
 
284
    // needs the view to resize as a result of the breaks, but that means that the enclosing view has to potentially
 
285
    // resize around that view.  Auto-pagination uses the bounds of the actual view that's being printed to determine
 
286
    // the edges of the print operation, so the resize is necessary if the enclosing view's bounds depend on the
 
287
    // web document's bounds.
 
288
    // 
 
289
    // This is already a problem if the view needs to be a different size because of printer fonts or because of print stylesheets.
 
290
    // Mail/Dictionary work around this problem by using the _layoutForPrinting SPI
 
291
    // to at least get print stylesheets and printer fonts into play, but since WebKit doesn't know about the page offset or
 
292
    // page size, it can't actually paginate correctly during _layoutForPrinting.
 
293
    //
 
294
    // We can eventually move Mail to a newer SPI that would let them opt in to the layout-time pagination model,
 
295
    // but that doesn't solve the general problem of how other AppKit views could opt in to the better model.
 
296
    //
 
297
    // NO OTHER PLATFORM BESIDES MAC SHOULD USE THIS METHOD.
 
298
    void adjustPageHeightDeprecated(float* newBottom, float oldTop, float oldBottom, float bottomLimit);
 
299
 
 
300
    bool scrollToFragment(const KURL&);
 
301
    bool scrollToAnchor(const String&);
 
302
    void maintainScrollPositionAtAnchor(Node*);
 
303
    void scrollElementToRect(Element*, const IntRect&);
 
304
 
 
305
    // Methods to convert points and rects between the coordinate space of the renderer, and this view.
 
306
    virtual IntRect convertFromRenderer(const RenderObject*, const IntRect&) const;
 
307
    virtual IntRect convertToRenderer(const RenderObject*, const IntRect&) const;
 
308
    virtual IntPoint convertFromRenderer(const RenderObject*, const IntPoint&) const;
 
309
    virtual IntPoint convertToRenderer(const RenderObject*, const IntPoint&) const;
 
310
 
 
311
    bool isFrameViewScrollCorner(RenderScrollbarPart* scrollCorner) const { return m_scrollCorner == scrollCorner; }
 
312
 
 
313
    enum ScrollbarModesCalculationStrategy { RulesFromWebContentOnly, AnyRule };
 
314
    void calculateScrollbarModesForLayout(ScrollbarMode& hMode, ScrollbarMode& vMode, ScrollbarModesCalculationStrategy = AnyRule);
 
315
 
 
316
    // Normal delay
 
317
    static void setRepaintThrottlingDeferredRepaintDelay(double p);
 
318
    // Negative value would mean that first few repaints happen without a delay
 
319
    static void setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading(double p);
 
320
    // The delay grows on each repaint to this maximum value
 
321
    static void setRepaintThrottlingMaxDeferredRepaintDelayDuringLoading(double p);
 
322
    // On each repaint the delay increses by this amount
 
323
    static void setRepaintThrottlingDeferredRepaintDelayIncrementDuringLoading(double p);
 
324
 
 
325
    virtual IntPoint currentMousePosition() const;
 
326
 
 
327
    virtual bool scrollbarsCanBeActive() const OVERRIDE;
 
328
 
 
329
    // FIXME: Remove this method once plugin loading is decoupled from layout.
 
330
    void flushAnyPendingPostLayoutTasks();
 
331
 
 
332
    virtual bool shouldSuspendScrollAnimations() const;
 
333
    virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate);
 
334
 
 
335
    void setAnimatorsAreActive();
 
336
 
 
337
    RenderBox* embeddedContentBox() const;
 
338
    
 
339
    void setTracksRepaints(bool);
 
340
    bool isTrackingRepaints() const { return m_isTrackingRepaints; }
 
341
    void resetTrackedRepaints();
 
342
    const Vector<IntRect>& trackedRepaintRects() const { return m_trackedRepaintRects; }
 
343
    String trackedRepaintRectsAsText() const;
 
344
 
 
345
    typedef HashSet<ScrollableArea*> ScrollableAreaSet;
 
346
    void addScrollableArea(ScrollableArea*);
 
347
    void removeScrollableArea(ScrollableArea*);
 
348
    bool containsScrollableArea(ScrollableArea*) const;
 
349
    const ScrollableAreaSet* scrollableAreas() const { return m_scrollableAreas.get(); }
 
350
 
 
351
    virtual void removeChild(Widget*) OVERRIDE;
 
352
 
 
353
    // This function exists for ports that need to handle wheel events manually.
 
354
    // On Mac WebKit1 the underlying NSScrollView just does the scrolling, but on most other platforms
 
355
    // we need this function in order to do the scroll ourselves.
 
356
    bool wheelEvent(const PlatformWheelEvent&);
 
357
 
 
358
    void setScrollingPerformanceLoggingEnabled(bool);
 
359
 
 
360
    // Page and FrameView both store a Pagination value. Page::pagination() is set only by API,
 
361
    // and FrameView::pagination() is set only by CSS. Page::pagination() will affect all
 
362
    // FrameViews in the page cache, but FrameView::pagination() only affects the current
 
363
    // FrameView. FrameView::pagination() will return m_pagination if it has been set. Otherwise,
 
364
    // it will return Page::pagination() since currently there are no callers that need to
 
365
    // distinguish between the two.
 
366
    const Pagination& pagination() const;
 
367
    void setPagination(const Pagination&);
 
368
    
 
369
    bool inProgrammaticScroll() const { return m_inProgrammaticScroll; }
 
370
    void setInProgrammaticScroll(bool programmaticScroll) { m_inProgrammaticScroll = programmaticScroll; }
 
371
 
 
372
#if ENABLE(CSS_FILTERS)
 
373
    void setHasSoftwareFilters(bool hasSoftwareFilters) { m_hasSoftwareFilters = hasSoftwareFilters; }
 
374
    bool hasSoftwareFilters() const { return m_hasSoftwareFilters; }
 
375
#endif
 
376
 
 
377
protected:
 
378
    virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
 
379
    virtual void scrollContentsSlowPath(const IntRect& updateRect);
 
380
 
 
381
    virtual bool isVerticalDocument() const;
 
382
    virtual bool isFlippedDocument() const;
 
383
 
 
384
private:
 
385
    explicit FrameView(Frame*);
 
386
 
 
387
    void reset();
 
388
    void init();
 
389
 
 
390
    virtual bool isFrameView() const;
 
391
 
 
392
    friend class RenderWidget;
 
393
    bool useSlowRepaints(bool considerOverlap = true) const;
 
394
    bool useSlowRepaintsIfNotOverlapped() const;
 
395
    void updateCanBlitOnScrollRecursively();
 
396
    bool contentsInCompositedLayer() const;
 
397
 
 
398
    bool shouldUpdateFixedElementsAfterScrolling();
 
399
 
 
400
    void applyOverflowToViewport(RenderObject*, ScrollbarMode& hMode, ScrollbarMode& vMode);
 
401
    void applyPaginationToViewport();
 
402
 
 
403
    void updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow);
 
404
 
 
405
    void paintControlTints();
 
406
 
 
407
    void forceLayoutParentViewIfNeeded();
 
408
    void performPostLayoutTasks();
 
409
    void autoSizeIfEnabled();
 
410
 
 
411
    virtual void repaintContentRectangle(const IntRect&, bool immediate);
 
412
    virtual void contentsResized() OVERRIDE;
 
413
    virtual void visibleContentsResized();
 
414
 
 
415
    virtual void delegatesScrollingDidChange();
 
416
 
 
417
    // Override ScrollView methods to do point conversion via renderers, in order to
 
418
    // take transforms into account.
 
419
    virtual IntRect convertToContainingView(const IntRect&) const OVERRIDE;
 
420
    virtual IntRect convertFromContainingView(const IntRect&) const OVERRIDE;
 
421
    virtual IntPoint convertToContainingView(const IntPoint&) const OVERRIDE;
 
422
    virtual IntPoint convertFromContainingView(const IntPoint&) const OVERRIDE;
 
423
 
 
424
    // ScrollableArea interface
 
425
    virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) OVERRIDE;
 
426
    virtual bool isActive() const OVERRIDE;
 
427
    virtual void getTickmarks(Vector<IntRect>&) const OVERRIDE;
 
428
    virtual void scrollTo(const IntSize&) OVERRIDE;
 
429
    virtual void setVisibleScrollerThumbRect(const IntRect&) OVERRIDE;
 
430
    virtual ScrollableArea* enclosingScrollableArea() const OVERRIDE;
 
431
    virtual IntRect scrollableAreaBoundingBox() const OVERRIDE;
 
432
    virtual bool scrollAnimatorEnabled() const OVERRIDE;
 
433
#if USE(ACCELERATED_COMPOSITING)
 
434
    virtual GraphicsLayer* layerForHorizontalScrollbar() const OVERRIDE;
 
435
    virtual GraphicsLayer* layerForVerticalScrollbar() const OVERRIDE;
 
436
    virtual GraphicsLayer* layerForScrollCorner() const OVERRIDE;
 
437
#if ENABLE(RUBBER_BANDING)
 
438
    virtual GraphicsLayer* layerForOverhangAreas() const OVERRIDE;
 
439
#endif
 
440
#endif
 
441
 
 
442
    void updateScrollableAreaSet();
 
443
 
 
444
    virtual void notifyPageThatContentAreaWillPaint() const;
 
445
 
 
446
    bool shouldUseLoadTimeDeferredRepaintDelay() const;
 
447
    void deferredRepaintTimerFired(Timer<FrameView>*);
 
448
    void doDeferredRepaints();
 
449
    void updateDeferredRepaintDelayAfterRepaint();
 
450
    double adjustedDeferredRepaintDelay() const;
 
451
 
 
452
    bool updateWidgets();
 
453
    void updateWidget(RenderEmbeddedObject*);
 
454
    void scrollToAnchor();
 
455
    void scrollPositionChanged();
 
456
 
 
457
    bool hasCustomScrollbars() const;
 
458
 
 
459
    virtual void updateScrollCorner();
 
460
 
 
461
    FrameView* parentFrameView() const;
 
462
 
 
463
    bool doLayoutWithFrameFlattening(bool allowSubtree);
 
464
 
 
465
    void setViewportConstrainedObjectsNeedLayout();
 
466
 
 
467
    virtual AXObjectCache* axObjectCache() const;
 
468
    void notifyWidgetsInAllFrames(WidgetNotification);
 
469
    
 
470
    static double sCurrentPaintTimeStamp; // used for detecting decoded resource thrash in the cache
 
471
 
 
472
    LayoutSize m_size;
 
473
    LayoutSize m_margins;
 
474
    
 
475
    typedef HashSet<RenderEmbeddedObject*> RenderEmbeddedObjectSet;
 
476
    OwnPtr<RenderEmbeddedObjectSet> m_widgetUpdateSet;
 
477
    RefPtr<Frame> m_frame;
 
478
 
 
479
    bool m_doFullRepaint;
 
480
    
 
481
    bool m_canHaveScrollbars;
 
482
    bool m_cannotBlitToWindow;
 
483
    bool m_isOverlapped;
 
484
    bool m_contentIsOpaque;
 
485
    unsigned m_slowRepaintObjectCount;
 
486
    int m_borderX;
 
487
    int m_borderY;
 
488
 
 
489
    Timer<FrameView> m_layoutTimer;
 
490
    bool m_delayedLayout;
 
491
    RenderObject* m_layoutRoot;
 
492
    
 
493
    bool m_layoutSchedulingEnabled;
 
494
    bool m_inLayout;
 
495
    bool m_doingPreLayoutStyleUpdate;
 
496
    bool m_inSynchronousPostLayout;
 
497
    int m_layoutCount;
 
498
    unsigned m_nestedLayoutCount;
 
499
    Timer<FrameView> m_postLayoutTasksTimer;
 
500
    bool m_firstLayoutCallbackPending;
 
501
 
 
502
    bool m_firstLayout;
 
503
    bool m_isTransparent;
 
504
    Color m_baseBackgroundColor;
 
505
    IntSize m_lastViewportSize;
 
506
    float m_lastZoomFactor;
 
507
 
 
508
    String m_mediaType;
 
509
    String m_mediaTypeWhenNotPrinting;
 
510
 
 
511
    OwnPtr<FrameActionScheduler> m_actionScheduler;
 
512
 
 
513
    bool m_overflowStatusDirty;
 
514
    bool m_horizontalOverflow;
 
515
    bool m_verticalOverflow;    
 
516
    RenderObject* m_viewportRenderer;
 
517
 
 
518
    Pagination m_pagination;
 
519
 
 
520
    bool m_wasScrolledByUser;
 
521
    bool m_inProgrammaticScroll;
 
522
    bool m_safeToPropagateScrollToParent;
 
523
 
 
524
    unsigned m_deferringRepaints;
 
525
    unsigned m_repaintCount;
 
526
    Vector<LayoutRect> m_repaintRects;
 
527
    Timer<FrameView> m_deferredRepaintTimer;
 
528
    double m_deferredRepaintDelay;
 
529
    double m_lastPaintTime;
 
530
 
 
531
    unsigned m_disableRepaints;
 
532
 
 
533
    bool m_isTrackingRepaints; // Used for testing.
 
534
    Vector<IntRect> m_trackedRepaintRects;
 
535
 
 
536
    bool m_shouldUpdateWhileOffscreen;
 
537
 
 
538
    unsigned m_deferSetNeedsLayouts;
 
539
    bool m_setNeedsLayoutWasDeferred;
 
540
 
 
541
    RefPtr<Node> m_nodeToDraw;
 
542
    PaintBehavior m_paintBehavior;
 
543
    bool m_isPainting;
 
544
 
 
545
    unsigned m_visuallyNonEmptyCharacterCount;
 
546
    unsigned m_visuallyNonEmptyPixelCount;
 
547
    bool m_isVisuallyNonEmpty;
 
548
    bool m_firstVisuallyNonEmptyLayoutCallbackPending;
 
549
 
 
550
    RefPtr<Node> m_maintainScrollPositionAnchor;
 
551
 
 
552
    // Renderer to hold our custom scroll corner.
 
553
    RenderScrollbarPart* m_scrollCorner;
 
554
 
 
555
    // If true, automatically resize the frame view around its content.
 
556
    bool m_shouldAutoSize;
 
557
    bool m_inAutoSize;
 
558
    // True if autosize has been run since m_shouldAutoSize was set.
 
559
    bool m_didRunAutosize;
 
560
    // The lower bound on the size when autosizing.
 
561
    IntSize m_minAutoSize;
 
562
    // The upper bound on the size when autosizing.
 
563
    IntSize m_maxAutoSize;
 
564
 
 
565
    OwnPtr<ScrollableAreaSet> m_scrollableAreas;
 
566
    OwnPtr<ViewportConstrainedObjectSet> m_viewportConstrainedObjects;
 
567
 
 
568
    static double s_normalDeferredRepaintDelay;
 
569
    static double s_initialDeferredRepaintDelayDuringLoading;
 
570
    static double s_maxDeferredRepaintDelayDuringLoading;
 
571
    static double s_deferredRepaintDelayIncrementDuringLoading;
 
572
 
 
573
#if ENABLE(CSS_FILTERS)
 
574
    bool m_hasSoftwareFilters;
 
575
#endif
 
576
};
 
577
 
 
578
inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count)
 
579
{
 
580
    if (m_isVisuallyNonEmpty)
 
581
        return;
 
582
    m_visuallyNonEmptyCharacterCount += count;
 
583
    // Use a threshold value to prevent very small amounts of visible content from triggering didFirstVisuallyNonEmptyLayout.
 
584
    // The first few hundred characters rarely contain the interesting content of the page.
 
585
    static const unsigned visualCharacterThreshold = 200;
 
586
    if (m_visuallyNonEmptyCharacterCount > visualCharacterThreshold)
 
587
        setIsVisuallyNonEmpty();
 
588
}
 
589
 
 
590
inline void FrameView::incrementVisuallyNonEmptyPixelCount(const IntSize& size)
 
591
{
 
592
    if (m_isVisuallyNonEmpty)
 
593
        return;
 
594
    m_visuallyNonEmptyPixelCount += size.width() * size.height();
 
595
    // Use a threshold value to prevent very small amounts of visible content from triggering didFirstVisuallyNonEmptyLayout
 
596
    static const unsigned visualPixelThreshold = 32 * 32;
 
597
    if (m_visuallyNonEmptyPixelCount > visualPixelThreshold)
 
598
        setIsVisuallyNonEmpty();
 
599
}
 
600
 
 
601
inline int FrameView::mapFromLayoutToCSSUnits(LayoutUnit value)
 
602
{
 
603
    return value / (m_frame->pageZoomFactor() * m_frame->frameScaleFactor());
 
604
}
 
605
 
 
606
inline LayoutUnit FrameView::mapFromCSSToLayoutUnits(int value)
 
607
{
 
608
    return value * m_frame->pageZoomFactor() * m_frame->frameScaleFactor();
 
609
}
 
610
 
 
611
} // namespace WebCore
 
612
 
 
613
#endif // FrameView_h