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"
30 #include "LayoutMilestones.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/ListHashSet.h>
37 #include <wtf/OwnPtr.h>
38 #include <wtf/text/WTFString.h>
46 class HTMLFrameOwnerElement;
52 class RenderEmbeddedObject;
55 class RenderScrollbarPart;
60 Pagination::Mode paginationModeForRenderStyle(const RenderStyle&);
62 typedef unsigned long long DOMTimeStamp;
64 class FrameView FINAL : public ScrollView {
66 friend class RenderView;
67 friend class Internals;
69 static PassRefPtr<FrameView> create(Frame&);
70 static PassRefPtr<FrameView> create(Frame&, const IntSize& initialSize);
74 virtual HostWindow* hostWindow() const OVERRIDE;
76 virtual void invalidateRect(const IntRect&) OVERRIDE;
77 virtual void setFrameRect(const IntRect&) OVERRIDE;
79 #if ENABLE(REQUEST_ANIMATION_FRAME)
80 virtual bool scheduleAnimation() OVERRIDE;
83 Frame& frame() const { return *m_frame; }
85 RenderView* renderView() const;
87 int mapFromLayoutToCSSUnits(LayoutUnit) const;
88 LayoutUnit mapFromCSSToLayoutUnits(int) const;
90 LayoutUnit marginWidth() const { return m_margins.width(); } // -1 means default
91 LayoutUnit marginHeight() const { return m_margins.height(); } // -1 means default
92 void setMarginWidth(LayoutUnit);
93 void setMarginHeight(LayoutUnit);
95 virtual void setCanHaveScrollbars(bool) OVERRIDE;
96 void updateCanHaveScrollbars();
98 virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation) OVERRIDE;
100 virtual bool avoidScrollbarCreation() const OVERRIDE;
102 virtual void setContentsSize(const IntSize&) OVERRIDE;
104 void layout(bool allowSubtree = true);
105 bool didFirstLayout() const;
106 void layoutTimerFired(Timer<FrameView>*);
107 void scheduleRelayout();
108 void scheduleRelayoutOfSubtree(RenderElement&);
109 void unscheduleRelayout();
110 bool layoutPending() const;
111 bool isInLayout() const { return m_layoutPhase == InLayout; }
113 RenderObject* layoutRoot(bool onlyDuringLayout = false) const;
114 void clearLayoutRoot() { m_layoutRoot = nullptr; }
115 int layoutCount() const { return m_layoutCount; }
117 bool needsLayout() const;
118 void setNeedsLayout();
119 void setViewportConstrainedObjectsNeedLayout();
121 bool needsFullRepaint() const { return m_needsFullRepaint; }
123 #if ENABLE(REQUEST_ANIMATION_FRAME)
124 void serviceScriptedAnimations(double monotonicAnimationStartTime);
127 #if USE(ACCELERATED_COMPOSITING)
128 void updateCompositingLayersAfterStyleChange();
129 void updateCompositingLayersAfterLayout();
130 bool flushCompositingStateForThisFrame(Frame* rootFrameForFlush);
132 void clearBackingStores();
133 void restoreBackingStores();
135 // Called when changes to the GraphicsLayer hierarchy have to be synchronized with
136 // content rendered via the normal painting path.
137 void setNeedsOneShotDrawingSynchronization();
139 virtual TiledBacking* tiledBacking() OVERRIDE;
141 // In the future when any ScrollableArea can have a node in th ScrollingTree, this should
142 // become a virtual function on ScrollableArea.
143 uint64_t scrollLayerID() const;
146 bool hasCompositedContent() const;
147 bool hasCompositedContentIncludingDescendants() const;
148 bool hasCompositingAncestor() const;
149 void enterCompositingMode();
150 bool isEnclosedInCompositingLayer() const;
152 // Only used with accelerated compositing, but outside the #ifdef to make linkage easier.
153 // Returns true if the flush was completed.
154 bool flushCompositingStateIncludingSubframes();
156 // Returns true when a paint with the PaintBehaviorFlattenCompositingLayers flag set gives
157 // a faithful representation of the content.
158 bool isSoftwareRenderable() const;
160 void didMoveOnscreen();
161 void willMoveOffscreen();
162 void setIsInWindow(bool);
164 void resetScrollbars();
165 void resetScrollbarsAndClearContentsSize();
166 void prepareForDetach();
167 void detachCustomScrollbars();
168 void recalculateScrollbarOverlayStyle();
172 bool isTransparent() const;
173 void setTransparent(bool isTransparent);
175 // True if the FrameView is not transparent, and the base background color is opaque.
176 bool hasOpaqueBackground() const;
178 Color baseBackgroundColor() const;
179 void setBaseBackgroundColor(const Color&);
180 void updateBackgroundRecursively(const Color&, bool);
182 bool shouldUpdateWhileOffscreen() const;
183 void setShouldUpdateWhileOffscreen(bool);
184 bool shouldUpdate(bool = false) const;
186 void adjustViewSize();
188 virtual IntRect windowClipRect(bool clipToContents = true) const OVERRIDE;
189 IntRect windowClipRectForFrameOwner(const HTMLFrameOwnerElement*, bool clipToLayerContents) const;
191 virtual IntRect windowResizerRect() const OVERRIDE;
193 virtual float visibleContentScaleFactor() const OVERRIDE;
195 virtual void setFixedVisibleContentRect(const IntRect&) OVERRIDE;
196 virtual void setScrollPosition(const IntPoint&) OVERRIDE;
197 void scrollPositionChangedViaPlatformWidget();
198 virtual void updateLayerPositionsAfterScrolling() OVERRIDE;
199 virtual void updateCompositingLayersAfterScrolling() OVERRIDE;
200 virtual bool requestScrollPositionUpdate(const IntPoint&) OVERRIDE;
201 virtual bool isRubberBandInProgress() const OVERRIDE;
202 virtual IntPoint minimumScrollPosition() const OVERRIDE;
203 virtual IntPoint maximumScrollPosition() const OVERRIDE;
205 // This is different than visibleContentRect() in that it ignores negative (or overly positive)
206 // offsets from rubber-banding, and it takes zooming into account.
207 LayoutRect viewportConstrainedVisibleContentRect() const;
209 String mediaType() const;
210 void setMediaType(const String&);
211 void adjustMediaTypeForPrinting(bool printing);
213 void setCannotBlitToWindow();
214 void setIsOverlapped(bool);
215 bool isOverlapped() const { return m_isOverlapped; }
216 bool isOverlappedIncludingAncestors() const;
217 void setContentIsOpaque(bool);
219 void addSlowRepaintObject(RenderElement*);
220 void removeSlowRepaintObject(RenderElement*);
221 bool hasSlowRepaintObject(RenderElement* o) const { return m_slowRepaintObjects && m_slowRepaintObjects->contains(o); }
222 bool hasSlowRepaintObjects() const { return m_slowRepaintObjects && m_slowRepaintObjects->size(); }
224 // Includes fixed- and sticky-position objects.
225 typedef HashSet<RenderElement*> ViewportConstrainedObjectSet;
226 void addViewportConstrainedObject(RenderElement*);
227 void removeViewportConstrainedObject(RenderElement*);
228 const ViewportConstrainedObjectSet* viewportConstrainedObjects() const { return m_viewportConstrainedObjects.get(); }
229 bool hasViewportConstrainedObjects() const { return m_viewportConstrainedObjects && m_viewportConstrainedObjects->size() > 0; }
231 // Functions for querying the current scrolled position, negating the effects of overhang
232 // and adjusting for page scale.
233 IntSize scrollOffsetForFixedPosition() const;
234 // Static function can be called from another thread.
235 static IntSize scrollOffsetForFixedPosition(const IntRect& visibleContentRect, const IntSize& totalContentsSize, const IntPoint& scrollPosition, const IntPoint& scrollOrigin, float frameScaleFactor, bool fixedElementsLayoutRelativeToFrame, ScrollBehaviorForFixedElements, int headerHeight, int footerHeight);
237 bool fixedElementsLayoutRelativeToFrame() const;
239 void beginDeferredRepaints();
240 void endDeferredRepaints();
241 void handleLoadCompleted();
242 void flushDeferredRepaints();
243 void startDeferredRepaintTimer(double delay);
244 void resetDeferredRepaintDelay();
246 void updateLayerFlushThrottlingInAllFrames();
247 void adjustTiledBackingCoverage();
249 #if ENABLE(DASHBOARD_SUPPORT) || ENABLE(DRAGGABLE_REGION)
250 void updateAnnotatedRegions();
252 void updateControlTints();
254 void restoreScrollbar();
256 void postLayoutTimerFired(Timer<FrameView>*);
258 bool wasScrolledByUser() const;
259 void setWasScrolledByUser(bool);
261 bool safeToPropagateScrollToParent() const { return m_safeToPropagateScrollToParent; }
262 void setSafeToPropagateScrollToParent(bool isSafe) { m_safeToPropagateScrollToParent = isSafe; }
264 void addEmbeddedObjectToUpdate(RenderEmbeddedObject&);
265 void removeEmbeddedObjectToUpdate(RenderEmbeddedObject&);
267 virtual void paintContents(GraphicsContext*, const IntRect& damageRect) OVERRIDE;
268 void setPaintBehavior(PaintBehavior);
269 PaintBehavior paintBehavior() const;
270 bool isPainting() const;
271 bool hasEverPainted() const { return m_lastPaintTime; }
272 void setLastPaintTime(double lastPaintTime) { m_lastPaintTime = lastPaintTime; }
273 void setNodeToDraw(Node*);
275 enum SelectionInSnapshot { IncludeSelection, ExcludeSelection };
276 enum CoordinateSpaceForSnapshot { DocumentCoordinates, ViewCoordinates };
277 void paintContentsForSnapshot(GraphicsContext*, const IntRect& imageRect, SelectionInSnapshot shouldPaintSelection, CoordinateSpaceForSnapshot);
279 virtual void paintOverhangAreas(GraphicsContext*, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect) OVERRIDE;
280 virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect) OVERRIDE;
281 virtual void paintScrollbar(GraphicsContext*, Scrollbar*, const IntRect&) OVERRIDE;
283 Color documentBackgroundColor() const;
285 bool isInChildFrameWithFrameFlattening() const;
287 static double currentPaintTimeStamp() { return sCurrentPaintTimeStamp; } // returns 0 if not painting
289 void updateLayoutAndStyleIfNeededRecursive();
291 void incrementVisuallyNonEmptyCharacterCount(unsigned);
292 void incrementVisuallyNonEmptyPixelCount(const IntSize&);
293 void updateIsVisuallyNonEmpty();
294 bool isVisuallyNonEmpty() const { return m_isVisuallyNonEmpty; }
295 void enableAutoSizeMode(bool enable, const IntSize& minSize, const IntSize& maxSize);
296 void setAutoSizeFixedMinimumHeight(int fixedMinimumHeight);
297 IntSize autoSizingIntrinsicContentSize() const { return m_autoSizeContentSize; }
299 void forceLayout(bool allowSubtree = false);
300 void forceLayoutForPagination(const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkFactor, AdjustViewSizeOrNot);
302 // FIXME: This method is retained because of embedded WebViews in AppKit. When a WebView is embedded inside
303 // some enclosing view with auto-pagination, no call happens to resize the view. The new pagination model
304 // needs the view to resize as a result of the breaks, but that means that the enclosing view has to potentially
305 // resize around that view. Auto-pagination uses the bounds of the actual view that's being printed to determine
306 // the edges of the print operation, so the resize is necessary if the enclosing view's bounds depend on the
307 // web document's bounds.
309 // This is already a problem if the view needs to be a different size because of printer fonts or because of print stylesheets.
310 // Mail/Dictionary work around this problem by using the _layoutForPrinting SPI
311 // to at least get print stylesheets and printer fonts into play, but since WebKit doesn't know about the page offset or
312 // page size, it can't actually paginate correctly during _layoutForPrinting.
314 // We can eventually move Mail to a newer SPI that would let them opt in to the layout-time pagination model,
315 // but that doesn't solve the general problem of how other AppKit views could opt in to the better model.
317 // NO OTHER PLATFORM BESIDES MAC SHOULD USE THIS METHOD.
318 void adjustPageHeightDeprecated(float* newBottom, float oldTop, float oldBottom, float bottomLimit);
320 bool scrollToFragment(const URL&);
321 bool scrollToAnchor(const String&);
322 void maintainScrollPositionAtAnchor(Node*);
323 void scrollElementToRect(Element*, const IntRect&);
325 // Methods to convert points and rects between the coordinate space of the renderer, and this view.
326 IntRect convertFromRenderer(const RenderElement*, const IntRect&) const;
327 IntRect convertToRenderer(const RenderElement*, const IntRect&) const;
328 IntPoint convertFromRenderer(const RenderElement*, const IntPoint&) const;
329 IntPoint convertToRenderer(const RenderElement*, const IntPoint&) const;
331 bool isFrameViewScrollCorner(RenderScrollbarPart* scrollCorner) const { return m_scrollCorner == scrollCorner; }
335 enum ScrollbarModesCalculationStrategy { RulesFromWebContentOnly, AnyRule };
336 void calculateScrollbarModesForLayout(ScrollbarMode& hMode, ScrollbarMode& vMode, ScrollbarModesCalculationStrategy = AnyRule);
339 static void setRepaintThrottlingDeferredRepaintDelay(double p);
340 // Negative value would mean that first few repaints happen without a delay
341 static void setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading(double p);
342 // The delay grows on each repaint to this maximum value
343 static void setRepaintThrottlingMaxDeferredRepaintDelayDuringLoading(double p);
344 // On each repaint the delay increses by this amount
345 static void setRepaintThrottlingDeferredRepaintDelayIncrementDuringLoading(double p);
347 virtual IntPoint lastKnownMousePosition() const OVERRIDE;
348 virtual bool isHandlingWheelEvent() const OVERRIDE;
349 bool shouldSetCursor() const;
351 // FIXME: Remove this method once plugin loading is decoupled from layout.
352 void flushAnyPendingPostLayoutTasks();
354 virtual bool shouldSuspendScrollAnimations() const OVERRIDE;
355 virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate) OVERRIDE;
357 RenderBox* embeddedContentBox() const;
359 void setTracksRepaints(bool);
360 bool isTrackingRepaints() const { return m_isTrackingRepaints; }
361 void resetTrackedRepaints();
362 const Vector<IntRect>& trackedRepaintRects() const { return m_trackedRepaintRects; }
363 String trackedRepaintRectsAsText() const;
365 typedef HashSet<ScrollableArea*> ScrollableAreaSet;
366 // Returns whether the scrollable area has just been newly added.
367 bool addScrollableArea(ScrollableArea*);
368 // Returns whether the scrollable area has just been removed.
369 bool removeScrollableArea(ScrollableArea*);
370 bool containsScrollableArea(ScrollableArea*) const;
371 const ScrollableAreaSet* scrollableAreas() const { return m_scrollableAreas.get(); }
373 virtual void removeChild(Widget*) OVERRIDE;
375 // This function exists for ports that need to handle wheel events manually.
376 // On Mac WebKit1 the underlying NSScrollView just does the scrolling, but on most other platforms
377 // we need this function in order to do the scroll ourselves.
378 bool wheelEvent(const PlatformWheelEvent&);
380 void setScrollingPerformanceLoggingEnabled(bool);
382 // Page and FrameView both store a Pagination value. Page::pagination() is set only by API,
383 // and FrameView::pagination() is set only by CSS. Page::pagination() will affect all
384 // FrameViews in the page cache, but FrameView::pagination() only affects the current
385 // FrameView. FrameView::pagination() will return m_pagination if it has been set. Otherwise,
386 // it will return Page::pagination() since currently there are no callers that need to
387 // distinguish between the two.
388 const Pagination& pagination() const;
389 void setPagination(const Pagination&);
391 bool inProgrammaticScroll() const { return m_inProgrammaticScroll; }
392 void setInProgrammaticScroll(bool programmaticScroll) { m_inProgrammaticScroll = programmaticScroll; }
394 #if ENABLE(CSS_DEVICE_ADAPTATION)
395 IntSize initialViewportSize() const { return m_initialViewportSize; }
396 void setInitialViewportSize(const IntSize& size) { m_initialViewportSize = size; }
399 virtual bool isActive() const OVERRIDE;
400 virtual bool updatesScrollLayerPositionOnMainThread() const OVERRIDE;
402 #if ENABLE(RUBBER_BANDING)
403 GraphicsLayer* setWantsLayerForTopOverHangArea(bool) const;
404 GraphicsLayer* setWantsLayerForBottomOverHangArea(bool) const;
407 virtual int headerHeight() const OVERRIDE { return m_headerHeight; }
408 void setHeaderHeight(int);
409 virtual int footerHeight() const OVERRIDE { return m_footerHeight; }
410 void setFooterHeight(int);
412 virtual void willStartLiveResize() OVERRIDE;
413 virtual void willEndLiveResize() OVERRIDE;
415 void addPaintPendingMilestones(LayoutMilestones);
416 void firePaintRelatedMilestones();
417 LayoutMilestones milestonesPendingPaint() const { return m_milestonesPendingPaint; }
419 bool visualUpdatesAllowedByClient() const { return m_visualUpdatesAllowedByClient; }
420 void setVisualUpdatesAllowedByClient(bool);
422 void setScrollPinningBehavior(ScrollPinningBehavior);
424 ScrollBehaviorForFixedElements scrollBehaviorForFixedElements() const;
426 void updateWidgetPositions();
427 void didAddWidgetToRenderTree(Widget&);
428 void willRemoveWidgetFromRenderTree(Widget&);
430 void addTrackedRepaintRect(const IntRect&);
433 virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) OVERRIDE;
434 virtual void scrollContentsSlowPath(const IntRect& updateRect) OVERRIDE;
436 void repaintSlowRepaintObjects();
438 virtual bool isVerticalDocument() const OVERRIDE;
439 virtual bool isFlippedDocument() const OVERRIDE;
442 explicit FrameView(Frame&);
450 InPreLayoutStyleUpdate,
455 LayoutPhase layoutPhase() const { return m_layoutPhase; }
457 bool inPreLayoutStyleUpdate() const { return m_layoutPhase == InPreLayoutStyleUpdate; }
459 virtual bool isFrameView() const OVERRIDE { return true; }
461 friend class RenderWidget;
462 bool useSlowRepaints(bool considerOverlap = true) const;
463 bool useSlowRepaintsIfNotOverlapped() const;
464 void updateCanBlitOnScrollRecursively();
465 bool contentsInCompositedLayer() const;
467 bool shouldUpdateCompositingLayersAfterScrolling() const;
469 void applyOverflowToViewport(RenderElement*, ScrollbarMode& hMode, ScrollbarMode& vMode);
470 void applyPaginationToViewport();
472 void updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow);
474 void paintControlTints();
476 void forceLayoutParentViewIfNeeded();
477 void performPostLayoutTasks();
478 void autoSizeIfEnabled();
480 virtual void repaintContentRectangle(const IntRect&, bool immediate) OVERRIDE;
481 virtual void contentsResized() OVERRIDE;
482 virtual void visibleContentsResized() OVERRIDE;
483 virtual void addedOrRemovedScrollbar() OVERRIDE;
484 virtual void fixedLayoutSizeChanged() OVERRIDE;
486 virtual void delegatesScrollingDidChange() OVERRIDE;
488 // Override ScrollView methods to do point conversion via renderers, in order to
489 // take transforms into account.
490 virtual IntRect convertToContainingView(const IntRect&) const OVERRIDE;
491 virtual IntRect convertFromContainingView(const IntRect&) const OVERRIDE;
492 virtual IntPoint convertToContainingView(const IntPoint&) const OVERRIDE;
493 virtual IntPoint convertFromContainingView(const IntPoint&) const OVERRIDE;
495 // ScrollableArea interface
496 virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) OVERRIDE;
497 virtual void scrollTo(const IntSize&) OVERRIDE;
498 virtual void setVisibleScrollerThumbRect(const IntRect&) OVERRIDE;
499 virtual ScrollableArea* enclosingScrollableArea() const OVERRIDE;
500 virtual IntRect scrollableAreaBoundingBox() const OVERRIDE;
501 virtual bool scrollAnimatorEnabled() const OVERRIDE;
502 #if USE(ACCELERATED_COMPOSITING)
503 virtual bool usesCompositedScrolling() const OVERRIDE;
504 virtual GraphicsLayer* layerForScrolling() const OVERRIDE;
505 virtual GraphicsLayer* layerForHorizontalScrollbar() const OVERRIDE;
506 virtual GraphicsLayer* layerForVerticalScrollbar() const OVERRIDE;
507 virtual GraphicsLayer* layerForScrollCorner() const OVERRIDE;
508 #if ENABLE(RUBBER_BANDING)
509 virtual GraphicsLayer* layerForOverhangAreas() const OVERRIDE;
513 // Override scrollbar notifications to update the AXObject cache.
514 virtual void didAddScrollbar(Scrollbar*, ScrollbarOrientation) OVERRIDE;
515 virtual void willRemoveScrollbar(Scrollbar*, ScrollbarOrientation) OVERRIDE;
517 void sendResizeEventIfNeeded();
519 void updateScrollableAreaSet();
521 virtual void notifyPageThatContentAreaWillPaint() const OVERRIDE;
523 bool shouldUseLoadTimeDeferredRepaintDelay() const;
524 void deferredRepaintTimerFired(Timer<FrameView>*);
525 void doDeferredRepaints();
526 void updateDeferredRepaintDelayAfterRepaint();
527 double adjustedDeferredRepaintDelay() const;
529 bool updateEmbeddedObjects();
530 void updateEmbeddedObject(RenderEmbeddedObject&);
531 void scrollToAnchor();
532 void scrollPositionChanged();
534 bool hasCustomScrollbars() const;
536 virtual void updateScrollCorner() OVERRIDE;
538 FrameView* parentFrameView() const;
540 void startLayoutAtMainFrameViewIfNeeded(bool allowSubtree);
541 bool frameFlatteningEnabled() const;
542 bool isFrameFlatteningValidForThisFrame() const;
544 bool qualifiesAsVisuallyNonEmpty() const;
546 AXObjectCache* axObjectCache() const;
547 void notifyWidgetsInAllFrames(WidgetNotification);
548 void removeFromAXObjectCache();
549 void notifyWidgets(WidgetNotification);
551 HashSet<Widget*> m_widgetsInRenderTree;
553 static double sCurrentPaintTimeStamp; // used for detecting decoded resource thrash in the cache
556 LayoutSize m_margins;
558 OwnPtr<ListHashSet<RenderEmbeddedObject*>> m_embeddedObjectsToUpdate;
559 const RefPtr<Frame> m_frame;
561 OwnPtr<HashSet<RenderElement*>> m_slowRepaintObjects;
563 bool m_needsFullRepaint;
565 bool m_canHaveScrollbars;
566 bool m_cannotBlitToWindow;
568 bool m_contentIsOpaque;
573 Timer<FrameView> m_layoutTimer;
574 bool m_delayedLayout;
575 RenderElement* m_layoutRoot;
577 LayoutPhase m_layoutPhase;
578 bool m_layoutSchedulingEnabled;
579 bool m_inSynchronousPostLayout;
581 unsigned m_nestedLayoutCount;
582 Timer<FrameView> m_postLayoutTasksTimer;
583 bool m_firstLayoutCallbackPending;
586 bool m_isTransparent;
587 Color m_baseBackgroundColor;
588 IntSize m_lastViewportSize;
589 float m_lastZoomFactor;
592 String m_mediaTypeWhenNotPrinting;
594 bool m_overflowStatusDirty;
595 bool m_horizontalOverflow;
596 bool m_verticalOverflow;
597 RenderElement* m_viewportRenderer;
599 Pagination m_pagination;
601 bool m_wasScrolledByUser;
602 bool m_inProgrammaticScroll;
603 bool m_safeToPropagateScrollToParent;
605 unsigned m_deferringRepaints;
606 unsigned m_repaintCount;
607 Vector<LayoutRect> m_repaintRects;
608 Timer<FrameView> m_deferredRepaintTimer;
609 double m_deferredRepaintDelay;
610 double m_lastPaintTime;
612 bool m_isTrackingRepaints; // Used for testing.
613 Vector<IntRect> m_trackedRepaintRects;
615 bool m_shouldUpdateWhileOffscreen;
617 unsigned m_deferSetNeedsLayouts;
618 bool m_setNeedsLayoutWasDeferred;
620 RefPtr<Node> m_nodeToDraw;
621 PaintBehavior m_paintBehavior;
624 unsigned m_visuallyNonEmptyCharacterCount;
625 unsigned m_visuallyNonEmptyPixelCount;
626 bool m_isVisuallyNonEmpty;
627 bool m_firstVisuallyNonEmptyLayoutCallbackPending;
629 RefPtr<Node> m_maintainScrollPositionAnchor;
631 // Renderer to hold our custom scroll corner.
632 RenderScrollbarPart* m_scrollCorner;
634 // If true, automatically resize the frame view around its content.
635 bool m_shouldAutoSize;
637 // True if autosize has been run since m_shouldAutoSize was set.
638 bool m_didRunAutosize;
639 // The lower bound on the size when autosizing.
640 IntSize m_minAutoSize;
641 // The upper bound on the size when autosizing.
642 IntSize m_maxAutoSize;
643 // The fixed height to resize the view to after autosizing is complete.
644 int m_autoSizeFixedMinimumHeight;
645 // The intrinsic content size decided by autosizing.
646 IntSize m_autoSizeContentSize;
648 OwnPtr<ScrollableAreaSet> m_scrollableAreas;
649 OwnPtr<ViewportConstrainedObjectSet> m_viewportConstrainedObjects;
654 LayoutMilestones m_milestonesPendingPaint;
656 static double s_normalDeferredRepaintDelay;
657 static double s_initialDeferredRepaintDelayDuringLoading;
658 static double s_maxDeferredRepaintDelayDuringLoading;
659 static double s_deferredRepaintDelayIncrementDuringLoading;
661 static const unsigned visualCharacterThreshold = 200;
662 static const unsigned visualPixelThreshold = 32 * 32;
664 #if ENABLE(CSS_DEVICE_ADAPTATION)
665 // Size of viewport before any UA or author styles have overridden
666 // the viewport given by the window or viewing area of the UA.
667 IntSize m_initialViewportSize;
670 bool m_visualUpdatesAllowedByClient;
672 ScrollPinningBehavior m_scrollPinningBehavior;
675 inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count)
677 if (m_isVisuallyNonEmpty)
679 m_visuallyNonEmptyCharacterCount += count;
680 if (m_visuallyNonEmptyCharacterCount <= visualCharacterThreshold)
682 updateIsVisuallyNonEmpty();
685 inline void FrameView::incrementVisuallyNonEmptyPixelCount(const IntSize& size)
687 if (m_isVisuallyNonEmpty)
689 m_visuallyNonEmptyPixelCount += size.width() * size.height();
690 if (m_visuallyNonEmptyPixelCount <= visualPixelThreshold)
692 updateIsVisuallyNonEmpty();
695 WIDGET_TYPE_CASTS(FrameView, isFrameView());
697 } // namespace WebCore
699 #endif // FrameView_h