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.
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.
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.
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.
28 #include "AdjustViewSizeOrNot.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>
44 class FrameActionScheduler;
49 class RenderEmbeddedObject;
52 class RenderScrollbarPart;
54 Pagination::Mode paginationModeForRenderStyle(RenderStyle*);
56 typedef unsigned long long DOMTimeStamp;
58 class FrameView : public ScrollView {
60 friend class RenderView;
61 friend class Internals;
63 static PassRefPtr<FrameView> create(Frame*);
64 static PassRefPtr<FrameView> create(Frame*, const IntSize& initialSize);
68 virtual HostWindow* hostWindow() const;
70 virtual void invalidateRect(const IntRect&);
71 virtual void setFrameRect(const IntRect&);
73 #if ENABLE(REQUEST_ANIMATION_FRAME)
74 virtual bool scheduleAnimation();
77 Frame* frame() const { return m_frame.get(); }
80 RenderView* renderView() const { return m_frame ? m_frame->contentRenderer() : 0; }
82 int mapFromLayoutToCSSUnits(LayoutUnit);
83 LayoutUnit mapFromCSSToLayoutUnits(int);
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);
90 virtual void setCanHaveScrollbars(bool);
91 void updateCanHaveScrollbars();
93 virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation);
95 virtual bool avoidScrollbarCreation() const;
97 virtual void setContentsSize(const IntSize&);
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; }
108 RenderObject* layoutRoot(bool onlyDuringLayout = false) const;
109 void clearLayoutRoot() { m_layoutRoot = 0; }
110 int layoutCount() const { return m_layoutCount; }
112 bool needsLayout() const;
113 void setNeedsLayout();
114 void setViewportConstrainedObjectsNeedLayout();
116 bool needsFullRepaint() const { return m_doFullRepaint; }
118 #if ENABLE(REQUEST_ANIMATION_FRAME)
119 void serviceScriptedAnimations(double monotonicAnimationStartTime);
122 #if USE(ACCELERATED_COMPOSITING)
123 void updateCompositingLayersAfterStyleChange();
124 void updateCompositingLayersAfterLayout();
125 bool flushCompositingStateForThisFrame(Frame* rootFrameForFlush);
127 void clearBackingStores();
128 void restoreBackingStores();
130 // Called when changes to the GraphicsLayer hierarchy have to be synchronized with
131 // content rendered via the normal painting path.
132 void setNeedsOneShotDrawingSynchronization();
134 virtual TiledBacking* tiledBacking() OVERRIDE;
136 // In the future when any ScrollableArea can have a node in th ScrollingTree, this should
137 // become a virtual function on ScrollableArea.
138 uint64_t scrollLayerID() const;
141 bool hasCompositedContent() const;
142 bool hasCompositedContentIncludingDescendants() const;
143 bool hasCompositingAncestor() const;
144 void enterCompositingMode();
145 bool isEnclosedInCompositingLayer() const;
147 // Only used with accelerated compositing, but outside the #ifdef to make linkage easier.
148 // Returns true if the flush was completed.
149 bool flushCompositingStateIncludingSubframes();
151 // Returns true when a paint with the PaintBehaviorFlattenCompositingLayers flag set gives
152 // a faithful representation of the content.
153 bool isSoftwareRenderable() const;
155 void didMoveOnscreen();
156 void willMoveOffscreen();
157 void setIsInWindow(bool);
159 void resetScrollbars();
160 void resetScrollbarsAndClearContentsSize();
161 void prepareForDetach();
162 void detachCustomScrollbars();
163 virtual void recalculateScrollbarOverlayStyle();
167 bool isTransparent() const;
168 void setTransparent(bool isTransparent);
170 // True if the FrameView is not transparent, and the base background color is opaque.
171 bool hasOpaqueBackground() const;
173 Color baseBackgroundColor() const;
174 void setBaseBackgroundColor(const Color&);
175 void updateBackgroundRecursively(const Color&, bool);
177 bool shouldUpdateWhileOffscreen() const;
178 void setShouldUpdateWhileOffscreen(bool);
179 bool shouldUpdate(bool = false) const;
181 void adjustViewSize();
183 virtual IntRect windowClipRect(bool clipToContents = true) const;
184 IntRect windowClipRectForFrameOwner(const HTMLFrameOwnerElement*, bool clipToLayerContents) const;
186 virtual IntRect windowResizerRect() const;
188 virtual float visibleContentScaleFactor() const OVERRIDE;
190 virtual void setFixedVisibleContentRect(const IntRect&) OVERRIDE;
191 virtual void setScrollPosition(const IntPoint&) OVERRIDE;
192 void scrollPositionChangedViaPlatformWidget();
193 virtual void repaintFixedElementsAfterScrolling();
194 virtual void updateFixedElementsAfterScrolling();
195 virtual bool shouldRubberBandInDirection(ScrollDirection) const;
196 virtual bool requestScrollPositionUpdate(const IntPoint&) OVERRIDE;
197 virtual bool isRubberBandInProgress() const OVERRIDE;
199 // This is different than visibleContentRect() in that it ignores negative (or overly positive)
200 // offsets from rubber-banding, and it takes zooming into account.
201 LayoutRect viewportConstrainedVisibleContentRect() const;
203 String mediaType() const;
204 void setMediaType(const String&);
205 void adjustMediaTypeForPrinting(bool printing);
207 void setCannotBlitToWindow();
208 void setIsOverlapped(bool);
209 bool isOverlapped() const { return m_isOverlapped; }
210 bool isOverlappedIncludingAncestors() const;
211 void setContentIsOpaque(bool);
213 void addSlowRepaintObject();
214 void removeSlowRepaintObject();
215 bool hasSlowRepaintObjects() const { return m_slowRepaintObjectCount; }
217 // Includes fixed- and sticky-position objects.
218 typedef HashSet<RenderObject*> ViewportConstrainedObjectSet;
219 void addViewportConstrainedObject(RenderObject*);
220 void removeViewportConstrainedObject(RenderObject*);
221 const ViewportConstrainedObjectSet* viewportConstrainedObjects() const { return m_viewportConstrainedObjects.get(); }
222 bool hasViewportConstrainedObjects() const { return m_viewportConstrainedObjects && m_viewportConstrainedObjects->size() > 0; }
224 // Functions for querying the current scrolled position, negating the effects of overhang
225 // and adjusting for page scale.
226 IntSize scrollOffsetForFixedPosition() const;
227 // Static function can be called from another thread.
228 static IntSize scrollOffsetForFixedPosition(const IntRect& visibleContentRect, const IntSize& totalContentsSize, const IntPoint& scrollPosition, const IntPoint& scrollOrigin, float frameScaleFactor, bool fixedElementsLayoutRelativeToFrame, int headerHeight, int footerHeight);
230 bool fixedElementsLayoutRelativeToFrame() const;
232 void beginDeferredRepaints();
233 void endDeferredRepaints();
234 void handleLoadCompleted();
235 void flushDeferredRepaints();
236 void startDeferredRepaintTimer(double delay);
237 void resetDeferredRepaintDelay();
239 void beginDisableRepaints();
240 void endDisableRepaints();
241 bool repaintsDisabled() { return m_disableRepaints > 0; }
243 #if ENABLE(DASHBOARD_SUPPORT) || ENABLE(DRAGGABLE_REGION)
244 void updateAnnotatedRegions();
246 void updateControlTints();
248 void restoreScrollbar();
250 void scheduleEvent(PassRefPtr<Event>, PassRefPtr<Node>);
251 void pauseScheduledEvents();
252 void resumeScheduledEvents();
253 void postLayoutTimerFired(Timer<FrameView>*);
255 bool wasScrolledByUser() const;
256 void setWasScrolledByUser(bool);
258 bool safeToPropagateScrollToParent() const { return m_safeToPropagateScrollToParent; }
259 void setSafeToPropagateScrollToParent(bool isSafe) { m_safeToPropagateScrollToParent = isSafe; }
261 void addWidgetToUpdate(RenderObject*);
262 void removeWidgetToUpdate(RenderObject*);
264 virtual void paintContents(GraphicsContext*, const IntRect& damageRect);
265 void setPaintBehavior(PaintBehavior);
266 PaintBehavior paintBehavior() const;
267 bool isPainting() const;
268 bool hasEverPainted() const { return m_lastPaintTime; }
269 void setLastPaintTime(double lastPaintTime) { m_lastPaintTime = lastPaintTime; }
270 void setNodeToDraw(Node*);
272 enum SelectionInSnaphot { IncludeSelection, ExcludeSelection };
273 enum CoordinateSpaceForSnapshot { DocumentCoordinates, ViewCoordinates };
274 void paintContentsForSnapshot(GraphicsContext*, const IntRect& imageRect, SelectionInSnaphot shouldPaintSelection, CoordinateSpaceForSnapshot);
276 virtual void paintOverhangAreas(GraphicsContext*, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect);
277 virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect);
278 virtual void paintScrollbar(GraphicsContext*, Scrollbar*, const IntRect&) OVERRIDE;
280 Color documentBackgroundColor() const;
282 bool isInChildFrameWithFrameFlattening() const;
284 static double currentPaintTimeStamp() { return sCurrentPaintTimeStamp; } // returns 0 if not painting
286 void updateLayoutAndStyleIfNeededRecursive();
288 void incrementVisuallyNonEmptyCharacterCount(unsigned);
289 void incrementVisuallyNonEmptyPixelCount(const IntSize&);
290 void setIsVisuallyNonEmpty() { m_isVisuallyNonEmpty = true; }
291 bool isVisuallyNonEmpty() const { return m_isVisuallyNonEmpty; }
292 void enableAutoSizeMode(bool enable, const IntSize& minSize, const IntSize& maxSize);
294 void forceLayout(bool allowSubtree = false);
295 void forceLayoutForPagination(const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkFactor, AdjustViewSizeOrNot);
297 // FIXME: This method is retained because of embedded WebViews in AppKit. When a WebView is embedded inside
298 // some enclosing view with auto-pagination, no call happens to resize the view. The new pagination model
299 // needs the view to resize as a result of the breaks, but that means that the enclosing view has to potentially
300 // resize around that view. Auto-pagination uses the bounds of the actual view that's being printed to determine
301 // the edges of the print operation, so the resize is necessary if the enclosing view's bounds depend on the
302 // web document's bounds.
304 // This is already a problem if the view needs to be a different size because of printer fonts or because of print stylesheets.
305 // Mail/Dictionary work around this problem by using the _layoutForPrinting SPI
306 // to at least get print stylesheets and printer fonts into play, but since WebKit doesn't know about the page offset or
307 // page size, it can't actually paginate correctly during _layoutForPrinting.
309 // We can eventually move Mail to a newer SPI that would let them opt in to the layout-time pagination model,
310 // but that doesn't solve the general problem of how other AppKit views could opt in to the better model.
312 // NO OTHER PLATFORM BESIDES MAC SHOULD USE THIS METHOD.
313 void adjustPageHeightDeprecated(float* newBottom, float oldTop, float oldBottom, float bottomLimit);
315 bool scrollToFragment(const KURL&);
316 bool scrollToAnchor(const String&);
317 void maintainScrollPositionAtAnchor(Node*);
318 void scrollElementToRect(Element*, const IntRect&);
320 // Methods to convert points and rects between the coordinate space of the renderer, and this view.
321 virtual IntRect convertFromRenderer(const RenderObject*, const IntRect&) const;
322 virtual IntRect convertToRenderer(const RenderObject*, const IntRect&) const;
323 virtual IntPoint convertFromRenderer(const RenderObject*, const IntPoint&) const;
324 virtual IntPoint convertToRenderer(const RenderObject*, const IntPoint&) const;
326 bool isFrameViewScrollCorner(RenderScrollbarPart* scrollCorner) const { return m_scrollCorner == scrollCorner; }
330 enum ScrollbarModesCalculationStrategy { RulesFromWebContentOnly, AnyRule };
331 void calculateScrollbarModesForLayout(ScrollbarMode& hMode, ScrollbarMode& vMode, ScrollbarModesCalculationStrategy = AnyRule);
334 static void setRepaintThrottlingDeferredRepaintDelay(double p);
335 // Negative value would mean that first few repaints happen without a delay
336 static void setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading(double p);
337 // The delay grows on each repaint to this maximum value
338 static void setRepaintThrottlingMaxDeferredRepaintDelayDuringLoading(double p);
339 // On each repaint the delay increses by this amount
340 static void setRepaintThrottlingDeferredRepaintDelayIncrementDuringLoading(double p);
342 virtual IntPoint lastKnownMousePosition() const;
343 bool shouldSetCursor() const;
345 virtual bool scrollbarsCanBeActive() const OVERRIDE;
347 // FIXME: Remove this method once plugin loading is decoupled from layout.
348 void flushAnyPendingPostLayoutTasks();
350 virtual bool shouldSuspendScrollAnimations() const;
351 virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate);
353 void setAnimatorsAreActive();
355 RenderBox* embeddedContentBox() const;
357 void setTracksRepaints(bool);
358 bool isTrackingRepaints() const { return m_isTrackingRepaints; }
359 void resetTrackedRepaints();
360 const Vector<IntRect>& trackedRepaintRects() const { return m_trackedRepaintRects; }
361 String trackedRepaintRectsAsText() const;
363 typedef HashSet<ScrollableArea*> ScrollableAreaSet;
364 // Returns whether the scrollable area has just been newly added.
365 bool addScrollableArea(ScrollableArea*);
366 // Returns whether the scrollable area has just been removed.
367 bool removeScrollableArea(ScrollableArea*);
368 bool containsScrollableArea(ScrollableArea*) const;
369 const ScrollableAreaSet* scrollableAreas() const { return m_scrollableAreas.get(); }
371 virtual void removeChild(Widget*) OVERRIDE;
373 // This function exists for ports that need to handle wheel events manually.
374 // On Mac WebKit1 the underlying NSScrollView just does the scrolling, but on most other platforms
375 // we need this function in order to do the scroll ourselves.
376 bool wheelEvent(const PlatformWheelEvent&);
378 void setScrollingPerformanceLoggingEnabled(bool);
380 // Page and FrameView both store a Pagination value. Page::pagination() is set only by API,
381 // and FrameView::pagination() is set only by CSS. Page::pagination() will affect all
382 // FrameViews in the page cache, but FrameView::pagination() only affects the current
383 // FrameView. FrameView::pagination() will return m_pagination if it has been set. Otherwise,
384 // it will return Page::pagination() since currently there are no callers that need to
385 // distinguish between the two.
386 const Pagination& pagination() const;
387 void setPagination(const Pagination&);
389 bool inProgrammaticScroll() const { return m_inProgrammaticScroll; }
390 void setInProgrammaticScroll(bool programmaticScroll) { m_inProgrammaticScroll = programmaticScroll; }
392 #if ENABLE(CSS_FILTERS)
393 void setHasSoftwareFilters(bool hasSoftwareFilters) { m_hasSoftwareFilters = hasSoftwareFilters; }
394 bool hasSoftwareFilters() const { return m_hasSoftwareFilters; }
396 #if ENABLE(CSS_DEVICE_ADAPTATION)
397 IntSize initialViewportSize() const { return m_initialViewportSize; }
398 void setInitialViewportSize(const IntSize& size) { m_initialViewportSize = size; }
401 virtual bool isActive() const OVERRIDE;
403 #if ENABLE(RUBBER_BANDING)
404 GraphicsLayer* setWantsLayerForTopOverHangArea(bool) const;
405 GraphicsLayer* setWantsLayerForBottomOverHangArea(bool) const;
406 GraphicsLayer* setWantsLayerForHeader(bool) const;
407 GraphicsLayer* setWantsLayerForFooter(bool) const;
410 virtual int headerHeight() const OVERRIDE { return m_headerHeight; }
411 void setHeaderHeight(int);
412 virtual int footerHeight() const OVERRIDE { return m_footerHeight; }
413 void setFooterHeight(int);
416 virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
417 virtual void scrollContentsSlowPath(const IntRect& updateRect);
419 virtual bool isVerticalDocument() const;
420 virtual bool isFlippedDocument() const;
423 explicit FrameView(Frame*);
428 virtual bool isFrameView() const OVERRIDE { return true; }
430 friend class RenderWidget;
431 bool useSlowRepaints(bool considerOverlap = true) const;
432 bool useSlowRepaintsIfNotOverlapped() const;
433 void updateCanBlitOnScrollRecursively();
434 bool contentsInCompositedLayer() const;
436 bool shouldUpdateFixedElementsAfterScrolling();
438 void applyOverflowToViewport(RenderObject*, ScrollbarMode& hMode, ScrollbarMode& vMode);
439 void applyPaginationToViewport();
441 void updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow);
443 void paintControlTints();
445 void forceLayoutParentViewIfNeeded();
446 void performPostLayoutTasks();
447 void autoSizeIfEnabled();
449 virtual void repaintContentRectangle(const IntRect&, bool immediate);
450 virtual void contentsResized() OVERRIDE;
451 virtual void visibleContentsResized();
453 virtual void delegatesScrollingDidChange();
455 // Override ScrollView methods to do point conversion via renderers, in order to
456 // take transforms into account.
457 virtual IntRect convertToContainingView(const IntRect&) const OVERRIDE;
458 virtual IntRect convertFromContainingView(const IntRect&) const OVERRIDE;
459 virtual IntPoint convertToContainingView(const IntPoint&) const OVERRIDE;
460 virtual IntPoint convertFromContainingView(const IntPoint&) const OVERRIDE;
462 // ScrollableArea interface
463 virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) OVERRIDE;
464 virtual void getTickmarks(Vector<IntRect>&) const OVERRIDE;
465 virtual void scrollTo(const IntSize&) OVERRIDE;
466 virtual void setVisibleScrollerThumbRect(const IntRect&) OVERRIDE;
467 virtual ScrollableArea* enclosingScrollableArea() const OVERRIDE;
468 virtual IntRect scrollableAreaBoundingBox() const OVERRIDE;
469 virtual bool scrollAnimatorEnabled() const OVERRIDE;
470 #if USE(ACCELERATED_COMPOSITING)
471 virtual bool usesCompositedScrolling() const OVERRIDE;
472 virtual GraphicsLayer* layerForScrolling() const OVERRIDE;
473 virtual GraphicsLayer* layerForHorizontalScrollbar() const OVERRIDE;
474 virtual GraphicsLayer* layerForVerticalScrollbar() const OVERRIDE;
475 virtual GraphicsLayer* layerForScrollCorner() const OVERRIDE;
476 #if ENABLE(RUBBER_BANDING)
477 virtual GraphicsLayer* layerForOverhangAreas() const OVERRIDE;
481 void updateScrollableAreaSet();
483 virtual void notifyPageThatContentAreaWillPaint() const;
485 bool shouldUseLoadTimeDeferredRepaintDelay() const;
486 void deferredRepaintTimerFired(Timer<FrameView>*);
487 void doDeferredRepaints();
488 void updateDeferredRepaintDelayAfterRepaint();
489 double adjustedDeferredRepaintDelay() const;
491 bool updateWidgets();
492 void updateWidget(RenderObject*);
493 void scrollToAnchor();
494 void scrollPositionChanged();
496 bool hasCustomScrollbars() const;
498 virtual void updateScrollCorner();
500 FrameView* parentFrameView() const;
502 bool doLayoutWithFrameFlattening(bool allowSubtree);
504 virtual AXObjectCache* axObjectCache() const;
505 void notifyWidgetsInAllFrames(WidgetNotification);
506 void removeFromAXObjectCache();
508 static double sCurrentPaintTimeStamp; // used for detecting decoded resource thrash in the cache
511 LayoutSize m_margins;
513 typedef HashSet<RenderObject*> RenderObjectSet;
514 OwnPtr<RenderObjectSet> m_widgetUpdateSet;
515 RefPtr<Frame> m_frame;
517 bool m_doFullRepaint;
519 bool m_canHaveScrollbars;
520 bool m_cannotBlitToWindow;
522 bool m_contentIsOpaque;
523 unsigned m_slowRepaintObjectCount;
527 Timer<FrameView> m_layoutTimer;
528 bool m_delayedLayout;
529 RenderObject* m_layoutRoot;
531 bool m_layoutSchedulingEnabled;
533 bool m_doingPreLayoutStyleUpdate;
534 bool m_inSynchronousPostLayout;
536 unsigned m_nestedLayoutCount;
537 Timer<FrameView> m_postLayoutTasksTimer;
538 bool m_firstLayoutCallbackPending;
541 bool m_isTransparent;
542 Color m_baseBackgroundColor;
543 IntSize m_lastViewportSize;
544 float m_lastZoomFactor;
547 String m_mediaTypeWhenNotPrinting;
549 OwnPtr<FrameActionScheduler> m_actionScheduler;
551 bool m_overflowStatusDirty;
552 bool m_horizontalOverflow;
553 bool m_verticalOverflow;
554 RenderObject* m_viewportRenderer;
556 Pagination m_pagination;
558 bool m_wasScrolledByUser;
559 bool m_inProgrammaticScroll;
560 bool m_safeToPropagateScrollToParent;
562 unsigned m_deferringRepaints;
563 unsigned m_repaintCount;
564 Vector<LayoutRect> m_repaintRects;
565 Timer<FrameView> m_deferredRepaintTimer;
566 double m_deferredRepaintDelay;
567 double m_lastPaintTime;
569 unsigned m_disableRepaints;
571 bool m_isTrackingRepaints; // Used for testing.
572 Vector<IntRect> m_trackedRepaintRects;
574 bool m_shouldUpdateWhileOffscreen;
576 unsigned m_deferSetNeedsLayouts;
577 bool m_setNeedsLayoutWasDeferred;
579 RefPtr<Node> m_nodeToDraw;
580 PaintBehavior m_paintBehavior;
583 unsigned m_visuallyNonEmptyCharacterCount;
584 unsigned m_visuallyNonEmptyPixelCount;
585 bool m_isVisuallyNonEmpty;
586 bool m_firstVisuallyNonEmptyLayoutCallbackPending;
588 RefPtr<Node> m_maintainScrollPositionAnchor;
590 // Renderer to hold our custom scroll corner.
591 RenderScrollbarPart* m_scrollCorner;
593 // If true, automatically resize the frame view around its content.
594 bool m_shouldAutoSize;
596 // True if autosize has been run since m_shouldAutoSize was set.
597 bool m_didRunAutosize;
598 // The lower bound on the size when autosizing.
599 IntSize m_minAutoSize;
600 // The upper bound on the size when autosizing.
601 IntSize m_maxAutoSize;
603 OwnPtr<ScrollableAreaSet> m_scrollableAreas;
604 OwnPtr<ViewportConstrainedObjectSet> m_viewportConstrainedObjects;
609 static double s_normalDeferredRepaintDelay;
610 static double s_initialDeferredRepaintDelayDuringLoading;
611 static double s_maxDeferredRepaintDelayDuringLoading;
612 static double s_deferredRepaintDelayIncrementDuringLoading;
614 #if ENABLE(CSS_FILTERS)
615 bool m_hasSoftwareFilters;
617 #if ENABLE(CSS_DEVICE_ADAPTATION)
618 // Size of viewport before any UA or author styles have overridden
619 // the viewport given by the window or viewing area of the UA.
620 IntSize m_initialViewportSize;
624 inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count)
626 if (m_isVisuallyNonEmpty)
628 m_visuallyNonEmptyCharacterCount += count;
629 // Use a threshold value to prevent very small amounts of visible content from triggering didFirstVisuallyNonEmptyLayout.
630 // The first few hundred characters rarely contain the interesting content of the page.
631 static const unsigned visualCharacterThreshold = 200;
632 if (m_visuallyNonEmptyCharacterCount > visualCharacterThreshold)
633 setIsVisuallyNonEmpty();
636 inline void FrameView::incrementVisuallyNonEmptyPixelCount(const IntSize& size)
638 if (m_isVisuallyNonEmpty)
640 m_visuallyNonEmptyPixelCount += size.width() * size.height();
641 // Use a threshold value to prevent very small amounts of visible content from triggering didFirstVisuallyNonEmptyLayout
642 static const unsigned visualPixelThreshold = 32 * 32;
643 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold)
644 setIsVisuallyNonEmpty();
647 inline int FrameView::mapFromLayoutToCSSUnits(LayoutUnit value)
649 return value / (m_frame->pageZoomFactor() * m_frame->frameScaleFactor());
652 inline LayoutUnit FrameView::mapFromCSSToLayoutUnits(int value)
654 return value * m_frame->pageZoomFactor() * m_frame->frameScaleFactor();
657 inline FrameView* toFrameView(Widget* widget)
659 ASSERT(!widget || widget->isFrameView());
660 return static_cast<FrameView*>(widget);
663 inline const FrameView* toFrameView(const Widget* widget)
665 ASSERT(!widget || widget->isFrameView());
666 return static_cast<const FrameView*>(widget);
669 // This will catch anyone doing an unnecessary cast.
670 void toFrameView(const FrameView*);
672 } // namespace WebCore
674 #endif // FrameView_h