• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "core/frame/AdjustViewSizeOrNot.h"
29 #include "core/rendering/Pagination.h"
30 #include "core/rendering/PaintPhase.h"
31 #include "core/rendering/PartialLayoutState.h"
32 #include "platform/geometry/LayoutRect.h"
33 #include "platform/graphics/Color.h"
34 #include "platform/scroll/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 AXObjectCache;
42 class Element;
43 class FloatSize;
44 class Frame;
45 class KURL;
46 class Node;
47 class Page;
48 class RenderBox;
49 class RenderEmbeddedObject;
50 class RenderObject;
51 class RenderScrollbarPart;
52 class RenderStyle;
53 
54 Pagination::Mode paginationModeForRenderStyle(RenderStyle*);
55 
56 typedef unsigned long long DOMTimeStamp;
57 
58 class FrameView : public ScrollView {
59 public:
60     friend class RenderView;
61     friend class Internals;
62 
63     static PassRefPtr<FrameView> create(Frame*);
64     static PassRefPtr<FrameView> create(Frame*, const IntSize& initialSize);
65 
66     virtual ~FrameView();
67 
68     virtual HostWindow* hostWindow() const;
69 
70     virtual void invalidateRect(const IntRect&);
71     virtual void setFrameRect(const IntRect&);
72 
73     virtual bool scheduleAnimation();
74 
frame()75     Frame& frame() const { return *m_frame; }
76 
77     RenderView* renderView() const;
78 
marginWidth()79     LayoutUnit marginWidth() const { return m_margins.width(); } // -1 means default
marginHeight()80     LayoutUnit marginHeight() const { return m_margins.height(); } // -1 means default
81     void setMarginWidth(LayoutUnit);
82     void setMarginHeight(LayoutUnit);
83 
84     virtual void setCanHaveScrollbars(bool);
85     void updateCanHaveScrollbars();
86 
87     virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation);
88 
89     virtual void setContentsSize(const IntSize&);
90 
91     void layout(bool allowSubtree = true);
92     bool didFirstLayout() const;
93     void layoutTimerFired(Timer<FrameView>*);
94     void scheduleRelayout();
95     void scheduleRelayoutOfSubtree(RenderObject*);
96     void unscheduleRelayout();
97     bool layoutPending() const;
isInLayout()98     bool isInLayout() const { return m_inLayout; }
99 
100     RenderObject* layoutRoot(bool onlyDuringLayout = false) const;
clearLayoutRoot()101     void clearLayoutRoot() { m_layoutRoot = 0; }
layoutCount()102     int layoutCount() const { return m_layoutCount; }
103 
104     bool needsLayout() const;
105     void setNeedsLayout();
106     void setViewportConstrainedObjectsNeedLayout();
107 
108     // Methods for getting/setting the size Blink should use to layout the contents.
109     IntSize layoutSize(IncludeScrollbarsInRect = ExcludeScrollbars) const;
110     void setLayoutSize(const IntSize&);
111 
112     // If this is set to false, the layout size will need to be explicitly set by the owner.
113     // E.g. WebViewImpl sets its mainFrame's layout size manually
setLayoutSizeFixedToFrameSize(bool isFixed)114     void setLayoutSizeFixedToFrameSize(bool isFixed) { m_layoutSizeFixedToFrameSize = isFixed; }
layoutSizeFixedToFrameSize()115     bool layoutSizeFixedToFrameSize() { return m_layoutSizeFixedToFrameSize; }
116 
needsFullRepaint()117     bool needsFullRepaint() const { return m_doFullRepaint; }
118 
119     void serviceScriptedAnimations(double monotonicAnimationStartTime);
120 
121     void updateCompositingLayersAfterStyleChange();
122     void updateCompositingLayersAfterLayout();
123 
124     bool hasCompositedContent() const;
125     bool isEnclosedInCompositingLayer() const;
126 
127     // Returns true when a paint with the PaintBehaviorFlattenCompositingLayers flag set gives
128     // a faithful representation of the content.
129     bool isSoftwareRenderable() const;
130 
131     void resetScrollbars();
132     void prepareForDetach();
133     void detachCustomScrollbars();
134     virtual void recalculateScrollbarOverlayStyle();
135 
136     void clear();
137 
138     bool isTransparent() const;
139     void setTransparent(bool isTransparent);
140 
141     // True if the FrameView is not transparent, and the base background color is opaque.
142     bool hasOpaqueBackground() const;
143 
144     Color baseBackgroundColor() const;
145     void setBaseBackgroundColor(const Color&);
146     void updateBackgroundRecursively(const Color&, bool);
147 
148     bool shouldUpdateWhileOffscreen() const;
149     void setShouldUpdateWhileOffscreen(bool);
150     bool shouldUpdate() const;
151 
152     void adjustViewSize();
153 
154     virtual IntRect windowClipRect(bool clipToContents = true) const;
155     IntRect windowClipRectForFrameOwner(const HTMLFrameOwnerElement*, bool clipToLayerContents) const;
156 
157     virtual IntRect windowResizerRect() const;
158 
visibleContentScaleFactor()159     virtual float visibleContentScaleFactor() const OVERRIDE { return m_visibleContentScaleFactor; }
160     void setVisibleContentScaleFactor(float);
161 
162     virtual float inputEventsScaleFactor() const OVERRIDE;
163     virtual IntSize inputEventsOffsetForEmulation() const OVERRIDE;
164     void setInputEventsTransformForEmulation(const IntSize&, float);
165 
166     virtual void setScrollPosition(const IntPoint&) OVERRIDE;
167     virtual void repaintFixedElementsAfterScrolling();
168     virtual void updateFixedElementsAfterScrolling();
169     virtual bool shouldRubberBandInDirection(ScrollDirection) const;
170     virtual bool isRubberBandInProgress() const OVERRIDE;
171     void setScrollPositionNonProgrammatically(const IntPoint&);
172 
173     // This is different than visibleContentRect() in that it ignores negative (or overly positive)
174     // offsets from rubber-banding, and it takes zooming into account.
175     LayoutRect viewportConstrainedVisibleContentRect() const;
176 
177     AtomicString mediaType() const;
178     void setMediaType(const AtomicString&);
179     void adjustMediaTypeForPrinting(bool printing);
180 
181     void setCannotBlitToWindow();
182     void setIsOverlapped(bool);
isOverlapped()183     bool isOverlapped() const { return m_isOverlapped; }
184     bool isOverlappedIncludingAncestors() const;
185     void setContentIsOpaque(bool);
186 
187     void addSlowRepaintObject();
188     void removeSlowRepaintObject();
hasSlowRepaintObjects()189     bool hasSlowRepaintObjects() const { return m_slowRepaintObjectCount; }
190 
191     // Includes fixed- and sticky-position objects.
192     typedef HashSet<RenderObject*> ViewportConstrainedObjectSet;
193     void addViewportConstrainedObject(RenderObject*);
194     void removeViewportConstrainedObject(RenderObject*);
viewportConstrainedObjects()195     const ViewportConstrainedObjectSet* viewportConstrainedObjects() const { return m_viewportConstrainedObjects.get(); }
hasViewportConstrainedObjects()196     bool hasViewportConstrainedObjects() const { return m_viewportConstrainedObjects && m_viewportConstrainedObjects->size() > 0; }
197 
198     void handleLoadCompleted();
199     void resetDeferredRepaintDelay();
200 
201     void updateAnnotatedRegions();
202     void updateControlTints();
203 
204     void restoreScrollbar();
205 
206     void postLayoutTimerFired(Timer<FrameView>*);
207 
208     bool wasScrolledByUser() const;
209     void setWasScrolledByUser(bool);
210 
safeToPropagateScrollToParent()211     bool safeToPropagateScrollToParent() const { return m_safeToPropagateScrollToParent; }
setSafeToPropagateScrollToParent(bool isSafe)212     void setSafeToPropagateScrollToParent(bool isSafe) { m_safeToPropagateScrollToParent = isSafe; }
213 
214     void addWidgetToUpdate(RenderEmbeddedObject&);
215 
216     virtual void paintContents(GraphicsContext*, const IntRect& damageRect);
217     void setPaintBehavior(PaintBehavior);
218     PaintBehavior paintBehavior() const;
219     bool isPainting() const;
hasEverPainted()220     bool hasEverPainted() const { return m_lastPaintTime; }
setLastPaintTime(double lastPaintTime)221     void setLastPaintTime(double lastPaintTime) { m_lastPaintTime = lastPaintTime; }
222     void setNodeToDraw(Node*);
223 
224     virtual void paintOverhangAreas(GraphicsContext*, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect);
225     virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect);
226     virtual void paintScrollbar(GraphicsContext*, Scrollbar*, const IntRect&) OVERRIDE;
227 
228     Color documentBackgroundColor() const;
229 
currentFrameTimeStamp()230     static double currentFrameTimeStamp() { return s_currentFrameTimeStamp; }
231 
232     void updateLayoutAndStyleIfNeededRecursive();
233 
234     void incrementVisuallyNonEmptyCharacterCount(unsigned);
235     void incrementVisuallyNonEmptyPixelCount(const IntSize&);
setIsVisuallyNonEmpty()236     void setIsVisuallyNonEmpty() { m_isVisuallyNonEmpty = true; }
isVisuallyNonEmpty()237     bool isVisuallyNonEmpty() const { return m_isVisuallyNonEmpty; }
238     void enableAutoSizeMode(bool enable, const IntSize& minSize, const IntSize& maxSize);
239 
240     void forceLayout(bool allowSubtree = false);
241     void forceLayoutForPagination(const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkFactor, AdjustViewSizeOrNot);
242 
243     bool scrollToFragment(const KURL&);
244     bool scrollToAnchor(const String&);
245     void maintainScrollPositionAtAnchor(Node*);
246     void scrollElementToRect(Element*, const IntRect&);
247 
248     // Methods to convert points and rects between the coordinate space of the renderer, and this view.
249     virtual IntRect convertFromRenderer(const RenderObject*, const IntRect&) const;
250     virtual IntRect convertToRenderer(const RenderObject*, const IntRect&) const;
251     virtual IntPoint convertFromRenderer(const RenderObject*, const IntPoint&) const;
252     virtual IntPoint convertToRenderer(const RenderObject*, const IntPoint&) const;
253 
isFrameViewScrollCorner(RenderScrollbarPart * scrollCorner)254     bool isFrameViewScrollCorner(RenderScrollbarPart* scrollCorner) const { return m_scrollCorner == scrollCorner; }
255 
256     bool isScrollable();
257 
258     enum ScrollbarModesCalculationStrategy { RulesFromWebContentOnly, AnyRule };
259     void calculateScrollbarModesForLayout(ScrollbarMode& hMode, ScrollbarMode& vMode, ScrollbarModesCalculationStrategy = AnyRule);
260 
261     // Normal delay
262     static void setRepaintThrottlingDeferredRepaintDelay(double);
263     // Negative value would mean that first few repaints happen without a delay
264     static void setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading(double);
265     // The delay grows on each repaint to this maximum value
266     static void setRepaintThrottlingMaxDeferredRepaintDelayDuringLoading(double);
267     // On each repaint the delay increses by this amount
268     static void setRepaintThrottlingDeferredRepaintDelayIncrementDuringLoading(double);
269 
270     virtual IntPoint lastKnownMousePosition() const;
271     bool shouldSetCursor() const;
272 
273     void setCursor(const Cursor&);
274 
275     virtual bool scrollbarsCanBeActive() const OVERRIDE;
276 
277     // FIXME: Remove this method once plugin loading is decoupled from layout.
278     void flushAnyPendingPostLayoutTasks();
279 
280     virtual bool shouldSuspendScrollAnimations() const;
281     virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate);
282 
283     void setAnimatorsAreActive();
284 
285     RenderBox* embeddedContentBox() const;
286 
287     void setTracksRepaints(bool);
isTrackingRepaints()288     bool isTrackingRepaints() const { return m_isTrackingRepaints; }
289     void resetTrackedRepaints();
trackedRepaintRects()290     const Vector<IntRect>& trackedRepaintRects() const { return m_trackedRepaintRects; }
291     String trackedRepaintRectsAsText() const;
292 
293     typedef HashSet<ScrollableArea*> ScrollableAreaSet;
294     // Returns whether the scrollable area has just been newly added.
295     bool addScrollableArea(ScrollableArea*);
296     // Returns whether the scrollable area has just been removed.
297     bool removeScrollableArea(ScrollableArea*);
298     bool containsScrollableArea(const ScrollableArea*) const;
scrollableAreas()299     const ScrollableAreaSet* scrollableAreas() const { return m_scrollableAreas.get(); }
300 
301     // With CSS style "resize:" enabled, a little resizer handle will appear at the bottom
302     // right of the object. We keep track of these resizer areas for checking if touches
303     // (implemented using Scroll gesture) are targeting the resizer.
304     typedef HashSet<RenderBox*> ResizerAreaSet;
305     void addResizerArea(RenderBox*);
306     void removeResizerArea(RenderBox*);
resizerAreas()307     const ResizerAreaSet* resizerAreas() const { return m_resizerAreas.get(); }
308 
309     virtual void removeChild(Widget*) OVERRIDE;
310 
311     // This function exists for ports that need to handle wheel events manually.
312     // On Mac WebKit1 the underlying NSScrollView just does the scrolling, but on most other platforms
313     // we need this function in order to do the scroll ourselves.
314     bool wheelEvent(const PlatformWheelEvent&);
315 
316     // Page and FrameView both store a Pagination value. Page::pagination() is set only by API,
317     // and FrameView::pagination() is set only by CSS. Page::pagination() will affect all
318     // FrameViews in the page cache, but FrameView::pagination() only affects the current
319     // FrameView. FrameView::pagination() will return m_pagination if it has been set. Otherwise,
320     // it will return Page::pagination() since currently there are no callers that need to
321     // distinguish between the two.
322     const Pagination& pagination() const;
323     void setPagination(const Pagination&);
324 
inProgrammaticScroll()325     bool inProgrammaticScroll() const { return m_inProgrammaticScroll; }
setInProgrammaticScroll(bool programmaticScroll)326     void setInProgrammaticScroll(bool programmaticScroll) { m_inProgrammaticScroll = programmaticScroll; }
327 
setHasSoftwareFilters(bool hasSoftwareFilters)328     void setHasSoftwareFilters(bool hasSoftwareFilters) { m_hasSoftwareFilters = hasSoftwareFilters; }
hasSoftwareFilters()329     bool hasSoftwareFilters() const { return m_hasSoftwareFilters; }
330 
331     virtual bool isActive() const OVERRIDE;
332 
333     // DEPRECATED: Use viewportConstrainedVisibleContentRect() instead.
334     IntSize scrollOffsetForFixedPosition() const;
335 
partialLayout()336     PartialLayoutState& partialLayout() { return m_partialLayout; }
337 
338     // Override scrollbar notifications to update the AXObject cache.
339     virtual void didAddScrollbar(Scrollbar*, ScrollbarOrientation) OVERRIDE;
340     virtual void willRemoveScrollbar(Scrollbar*, ScrollbarOrientation) OVERRIDE;
341 
342     class DeferredRepaintScope {
343     public:
344         DeferredRepaintScope(FrameView&);
345         ~DeferredRepaintScope();
346     private:
347         RefPtr<FrameView> m_view;
348     };
349 
350 protected:
351     virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
352     virtual void scrollContentsSlowPath(const IntRect& updateRect);
353 
354     virtual bool isVerticalDocument() const;
355     virtual bool isFlippedDocument() const;
356 
357 private:
358     explicit FrameView(Frame*);
359 
360     void beginDeferredRepaints();
361     void endDeferredRepaints();
362     void flushDeferredRepaints();
363     void startDeferredRepaintTimer(double delay);
364 
365     void reset();
366     void init();
367 
368     virtual void frameRectsChanged();
isFrameView()369     virtual bool isFrameView() const OVERRIDE { return true; }
370 
371     friend class RenderWidget;
372     bool useSlowRepaints(bool considerOverlap = true) const;
373     bool useSlowRepaintsIfNotOverlapped() const;
374     void updateCanBlitOnScrollRecursively();
375     bool contentsInCompositedLayer() const;
376 
377     void applyOverflowToViewport(RenderObject*, ScrollbarMode& hMode, ScrollbarMode& vMode);
378     void applyPaginationToViewport();
379 
380     void updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow);
381 
382     void paintControlTints();
383 
384     void updateCounters();
385     void autoSizeIfEnabled();
386     void forceLayoutParentViewIfNeeded();
387     void performPreLayoutTasks();
388     void performLayout(RenderObject* rootForThisLayout, bool inSubtreeLayout);
389     void scheduleOrPerformPostLayoutTasks();
390     void performPostLayoutTasks();
391 
392     void repaintTree(RenderObject* root);
393 
394     virtual void gatherDebugLayoutRects(RenderObject* layoutRoot);
395 
396     virtual void repaintContentRectangle(const IntRect&);
397     virtual void contentsResized() OVERRIDE;
398     virtual void scrollbarExistenceDidChange();
399 
400     // Override ScrollView methods to do point conversion via renderers, in order to
401     // take transforms into account.
402     virtual IntRect convertToContainingView(const IntRect&) const OVERRIDE;
403     virtual IntRect convertFromContainingView(const IntRect&) const OVERRIDE;
404     virtual IntPoint convertToContainingView(const IntPoint&) const OVERRIDE;
405     virtual IntPoint convertFromContainingView(const IntPoint&) const OVERRIDE;
406 
407     // ScrollableArea interface
408     virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) OVERRIDE;
409     virtual void getTickmarks(Vector<IntRect>&) const OVERRIDE;
410     virtual void scrollTo(const IntSize&) OVERRIDE;
411     virtual ScrollableArea* enclosingScrollableArea() const OVERRIDE;
412     virtual IntRect scrollableAreaBoundingBox() const OVERRIDE;
413     virtual bool scrollAnimatorEnabled() const OVERRIDE;
414     virtual bool usesCompositedScrolling() const OVERRIDE;
415     virtual GraphicsLayer* layerForScrolling() const OVERRIDE;
416     virtual GraphicsLayer* layerForHorizontalScrollbar() const OVERRIDE;
417     virtual GraphicsLayer* layerForVerticalScrollbar() const OVERRIDE;
418     virtual GraphicsLayer* layerForScrollCorner() const OVERRIDE;
419 
420     void sendResizeEventIfNeeded();
421 
422     void updateScrollableAreaSet();
423 
424     virtual void notifyPageThatContentAreaWillPaint() const;
425 
426     bool shouldUseLoadTimeDeferredRepaintDelay() const;
427     void deferredRepaintTimerFired(Timer<FrameView>*);
428     void doDeferredRepaints();
429     void updateDeferredRepaintDelayAfterRepaint();
430     double adjustedDeferredRepaintDelay() const;
431 
432     void updateWidgetsTimerFired(Timer<FrameView>*);
433     bool updateWidgets();
434 
435     void scrollToAnchor();
436     void scrollPositionChanged();
437 
438     bool hasCustomScrollbars() const;
439     bool shouldUseCustomScrollbars(Element*& customScrollbarElement, Frame*& customScrollbarFrame);
440 
441     virtual void updateScrollCorner();
442 
443     FrameView* parentFrameView() const;
444 
445     virtual AXObjectCache* axObjectCache() const;
446     void removeFromAXObjectCache();
447 
448     bool isMainFrame() const;
449 
450     void setLayoutSizeInternal(const IntSize&);
451 
452     static double s_currentFrameTimeStamp; // used for detecting decoded resource thrash in the cache
453     static bool s_inPaintContents;
454 
455     LayoutSize m_size;
456     LayoutSize m_margins;
457 
458     typedef HashSet<RefPtr<RenderEmbeddedObject> > EmbeddedObjectSet;
459     EmbeddedObjectSet m_widgetUpdateSet;
460 
461     RefPtr<Frame> m_frame;
462 
463     bool m_doFullRepaint;
464 
465     bool m_canHaveScrollbars;
466     bool m_cannotBlitToWindow;
467     bool m_isOverlapped;
468     bool m_contentIsOpaque;
469     unsigned m_slowRepaintObjectCount;
470     int m_borderX;
471     int m_borderY;
472 
473     Timer<FrameView> m_layoutTimer;
474     bool m_delayedLayout;
475     RenderObject* m_layoutRoot;
476 
477     bool m_layoutSchedulingEnabled;
478     bool m_inLayout;
479     bool m_doingPreLayoutStyleUpdate;
480     bool m_inSynchronousPostLayout;
481     int m_layoutCount;
482     unsigned m_nestedLayoutCount;
483     Timer<FrameView> m_postLayoutTasksTimer;
484     Timer<FrameView> m_updateWidgetsTimer;
485     bool m_firstLayoutCallbackPending;
486 
487     bool m_firstLayout;
488     bool m_isTransparent;
489     Color m_baseBackgroundColor;
490     IntSize m_lastViewportSize;
491     float m_lastZoomFactor;
492 
493     AtomicString m_mediaType;
494     AtomicString m_mediaTypeWhenNotPrinting;
495 
496     bool m_overflowStatusDirty;
497     bool m_horizontalOverflow;
498     bool m_verticalOverflow;
499     RenderObject* m_viewportRenderer;
500 
501     Pagination m_pagination;
502 
503     bool m_wasScrolledByUser;
504     bool m_inProgrammaticScroll;
505     bool m_safeToPropagateScrollToParent;
506 
507     unsigned m_deferringRepaints;
508     unsigned m_repaintCount;
509     Vector<LayoutRect> m_repaintRects;
510     Timer<FrameView> m_deferredRepaintTimer;
511     double m_deferredRepaintDelay;
512     double m_lastPaintTime;
513 
514     bool m_isTrackingRepaints; // Used for testing.
515     Vector<IntRect> m_trackedRepaintRects;
516 
517     bool m_shouldUpdateWhileOffscreen;
518 
519     RefPtr<Node> m_nodeToDraw;
520     PaintBehavior m_paintBehavior;
521     bool m_isPainting;
522 
523     unsigned m_visuallyNonEmptyCharacterCount;
524     unsigned m_visuallyNonEmptyPixelCount;
525     bool m_isVisuallyNonEmpty;
526     bool m_firstVisuallyNonEmptyLayoutCallbackPending;
527 
528     RefPtr<Node> m_maintainScrollPositionAnchor;
529 
530     // Renderer to hold our custom scroll corner.
531     RenderScrollbarPart* m_scrollCorner;
532 
533     // If true, automatically resize the frame view around its content.
534     bool m_shouldAutoSize;
535     bool m_inAutoSize;
536     // True if autosize has been run since m_shouldAutoSize was set.
537     bool m_didRunAutosize;
538     // The lower bound on the size when autosizing.
539     IntSize m_minAutoSize;
540     // The upper bound on the size when autosizing.
541     IntSize m_maxAutoSize;
542 
543     OwnPtr<ScrollableAreaSet> m_scrollableAreas;
544     OwnPtr<ResizerAreaSet> m_resizerAreas;
545     OwnPtr<ViewportConstrainedObjectSet> m_viewportConstrainedObjects;
546 
547     static double s_normalDeferredRepaintDelay;
548     static double s_initialDeferredRepaintDelayDuringLoading;
549     static double s_maxDeferredRepaintDelayDuringLoading;
550     static double s_deferredRepaintDelayIncrementDuringLoading;
551 
552     bool m_hasSoftwareFilters;
553 
554     float m_visibleContentScaleFactor;
555     IntSize m_inputEventsOffsetForEmulation;
556     float m_inputEventsScaleFactorForEmulation;
557 
558     PartialLayoutState m_partialLayout;
559     IntSize m_layoutSize;
560     bool m_layoutSizeFixedToFrameSize;
561 };
562 
incrementVisuallyNonEmptyCharacterCount(unsigned count)563 inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count)
564 {
565     if (m_isVisuallyNonEmpty)
566         return;
567     m_visuallyNonEmptyCharacterCount += count;
568     // Use a threshold value to prevent very small amounts of visible content from triggering didFirstVisuallyNonEmptyLayout.
569     // The first few hundred characters rarely contain the interesting content of the page.
570     static const unsigned visualCharacterThreshold = 200;
571     if (m_visuallyNonEmptyCharacterCount > visualCharacterThreshold)
572         setIsVisuallyNonEmpty();
573 }
574 
incrementVisuallyNonEmptyPixelCount(const IntSize & size)575 inline void FrameView::incrementVisuallyNonEmptyPixelCount(const IntSize& size)
576 {
577     if (m_isVisuallyNonEmpty)
578         return;
579     m_visuallyNonEmptyPixelCount += size.width() * size.height();
580     // Use a threshold value to prevent very small amounts of visible content from triggering didFirstVisuallyNonEmptyLayout
581     static const unsigned visualPixelThreshold = 32 * 32;
582     if (m_visuallyNonEmptyPixelCount > visualPixelThreshold)
583         setIsVisuallyNonEmpty();
584 }
585 
586 DEFINE_TYPE_CASTS(FrameView, Widget, widget, widget->isFrameView(), widget.isFrameView());
587 
588 } // namespace WebCore
589 
590 #endif // FrameView_h
591