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 "RenderPtr.h"
35 #include "ScrollView.h"
36 #include <wtf/Forward.h>
37 #include <wtf/ListHashSet.h>
38 #include <wtf/OwnPtr.h>
39 #include <wtf/text/WTFString.h>
47 class HTMLFrameOwnerElement;
53 class RenderEmbeddedObject;
56 class RenderScrollbarPart;
61 Pagination::Mode paginationModeForRenderStyle(const RenderStyle&);
63 typedef unsigned long long DOMTimeStamp;
65 class FrameView final : public ScrollView {
67 friend class RenderView;
68 friend class Internals;
70 static PassRefPtr<FrameView> create(Frame&);
71 static PassRefPtr<FrameView> create(Frame&, const IntSize& initialSize);
75 virtual HostWindow* hostWindow() const override;
77 virtual void invalidateRect(const IntRect&) override;
78 virtual void setFrameRect(const IntRect&) override;
80 #if ENABLE(REQUEST_ANIMATION_FRAME)
81 virtual bool scheduleAnimation() override;
84 Frame& frame() const { return *m_frame; }
86 RenderView* renderView() const;
88 int mapFromLayoutToCSSUnits(LayoutUnit) const;
89 LayoutUnit mapFromCSSToLayoutUnits(int) const;
91 LayoutUnit marginWidth() const { return m_margins.width(); } // -1 means default
92 LayoutUnit marginHeight() const { return m_margins.height(); } // -1 means default
93 void setMarginWidth(LayoutUnit);
94 void setMarginHeight(LayoutUnit);
96 virtual void setCanHaveScrollbars(bool) override;
97 void updateCanHaveScrollbars();
99 virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation) override;
101 virtual bool avoidScrollbarCreation() const override;
103 virtual void setContentsSize(const IntSize&) override;
105 void layout(bool allowSubtree = true);
106 bool didFirstLayout() const;
107 void layoutTimerFired(Timer<FrameView>&);
108 void scheduleRelayout();
109 void scheduleRelayoutOfSubtree(RenderElement&);
110 void unscheduleRelayout();
111 bool layoutPending() const;
112 bool isInLayout() const { return m_layoutPhase == InLayout; }
114 RenderObject* layoutRoot(bool onlyDuringLayout = false) const;
115 void clearLayoutRoot() { m_layoutRoot = nullptr; }
116 int layoutCount() const { return m_layoutCount; }
118 bool needsLayout() const;
119 void setNeedsLayout();
120 void setViewportConstrainedObjectsNeedLayout();
122 bool needsFullRepaint() const { return m_needsFullRepaint; }
124 bool renderedCharactersExceed(unsigned threshold);
127 bool useCustomFixedPositionLayoutRect() const { return m_useCustomFixedPositionLayoutRect; }
128 void setUseCustomFixedPositionLayoutRect(bool);
129 IntRect customFixedPositionLayoutRect() const { return m_customFixedPositionLayoutRect; }
130 void setCustomFixedPositionLayoutRect(const IntRect&);
131 bool updateFixedPositionLayoutRect();
134 #if ENABLE(REQUEST_ANIMATION_FRAME)
135 void serviceScriptedAnimations(double monotonicAnimationStartTime);
138 #if USE(ACCELERATED_COMPOSITING)
139 void updateCompositingLayersAfterStyleChange();
140 void updateCompositingLayersAfterLayout();
141 bool flushCompositingStateForThisFrame(Frame* rootFrameForFlush);
143 void clearBackingStores();
144 void restoreBackingStores();
146 // Called when changes to the GraphicsLayer hierarchy have to be synchronized with
147 // content rendered via the normal painting path.
148 void setNeedsOneShotDrawingSynchronization();
150 GraphicsLayer* graphicsLayerForPlatformWidget(PlatformWidget);
151 void scheduleLayerFlushAllowingThrottling();
153 virtual TiledBacking* tiledBacking() const override;
155 // In the future when any ScrollableArea can have a node in th ScrollingTree, this should
156 // become a virtual function on ScrollableArea.
157 uint64_t scrollLayerID() const;
160 bool hasCompositedContent() const;
161 bool hasCompositedContentIncludingDescendants() const;
162 bool hasCompositingAncestor() const;
163 void enterCompositingMode();
164 bool isEnclosedInCompositingLayer() const;
166 // Only used with accelerated compositing, but outside the #ifdef to make linkage easier.
167 // Returns true if the flush was completed.
168 bool flushCompositingStateIncludingSubframes();
170 // Returns true when a paint with the PaintBehaviorFlattenCompositingLayers flag set gives
171 // a faithful representation of the content.
172 bool isSoftwareRenderable() const;
174 void didMoveOnscreen();
175 void willMoveOffscreen();
176 void setIsInWindow(bool);
178 void resetScrollbars();
179 void resetScrollbarsAndClearContentsSize();
180 void prepareForDetach();
181 void detachCustomScrollbars();
182 void recalculateScrollbarOverlayStyle();
186 bool isTransparent() const;
187 void setTransparent(bool isTransparent);
189 // True if the FrameView is not transparent, and the base background color is opaque.
190 bool hasOpaqueBackground() const;
192 Color baseBackgroundColor() const;
193 void setBaseBackgroundColor(const Color&);
194 void updateBackgroundRecursively(const Color&, bool);
196 // extendedBackgroundRect() is in the viewport's coordinate space.
197 bool hasExtendedBackground() const;
198 IntRect extendedBackgroundRect() const;
200 bool shouldUpdateWhileOffscreen() const;
201 void setShouldUpdateWhileOffscreen(bool);
202 bool shouldUpdate(bool = false) const;
204 void adjustViewSize();
206 virtual IntRect windowClipRect(bool clipToContents = true) const override;
207 IntRect windowClipRectForFrameOwner(const HTMLFrameOwnerElement*, bool clipToLayerContents) const;
209 virtual IntRect windowResizerRect() const override;
211 virtual float visibleContentScaleFactor() const override;
214 virtual void setFixedVisibleContentRect(const IntRect&) override;
216 virtual void setScrollPosition(const IntPoint&) override;
217 void scrollPositionChangedViaPlatformWidget();
218 virtual void updateLayerPositionsAfterScrolling() override;
219 virtual void updateCompositingLayersAfterScrolling() override;
220 virtual bool requestScrollPositionUpdate(const IntPoint&) override;
221 virtual bool isRubberBandInProgress() const override;
222 virtual IntPoint minimumScrollPosition() const override;
223 virtual IntPoint maximumScrollPosition() const override;
225 // This is different than visibleContentRect() in that it ignores negative (or overly positive)
226 // offsets from rubber-banding, and it takes zooming into account.
227 LayoutRect viewportConstrainedVisibleContentRect() const;
229 String mediaType() const;
230 void setMediaType(const String&);
231 void adjustMediaTypeForPrinting(bool printing);
233 void setCannotBlitToWindow();
234 void setIsOverlapped(bool);
235 bool isOverlapped() const { return m_isOverlapped; }
236 bool isOverlappedIncludingAncestors() const;
237 void setContentIsOpaque(bool);
239 void addSlowRepaintObject(RenderElement*);
240 void removeSlowRepaintObject(RenderElement*);
241 bool hasSlowRepaintObject(RenderElement* o) const { return m_slowRepaintObjects && m_slowRepaintObjects->contains(o); }
242 bool hasSlowRepaintObjects() const { return m_slowRepaintObjects && m_slowRepaintObjects->size(); }
244 // Includes fixed- and sticky-position objects.
245 typedef HashSet<RenderElement*> ViewportConstrainedObjectSet;
246 void addViewportConstrainedObject(RenderElement*);
247 void removeViewportConstrainedObject(RenderElement*);
248 const ViewportConstrainedObjectSet* viewportConstrainedObjects() const { return m_viewportConstrainedObjects.get(); }
249 bool hasViewportConstrainedObjects() const { return m_viewportConstrainedObjects && m_viewportConstrainedObjects->size() > 0; }
251 // Functions for querying the current scrolled position, negating the effects of overhang
252 // and adjusting for page scale.
253 IntSize scrollOffsetForFixedPosition() const;
254 // Static function can be called from another thread.
255 static IntSize scrollOffsetForFixedPosition(const IntRect& visibleContentRect, const IntSize& totalContentsSize, const IntPoint& scrollPosition, const IntPoint& scrollOrigin, float frameScaleFactor, bool fixedElementsLayoutRelativeToFrame, ScrollBehaviorForFixedElements, int headerHeight, int footerHeight);
257 bool fixedElementsLayoutRelativeToFrame() const;
259 void beginDeferredRepaints();
260 void endDeferredRepaints();
261 void handleLoadCompleted();
262 void flushDeferredRepaints();
263 void startDeferredRepaintTimer(double delay);
264 void resetDeferredRepaintDelay();
266 void updateLayerFlushThrottlingInAllFrames();
267 void adjustTiledBackingCoverage();
269 #if ENABLE(DASHBOARD_SUPPORT) || ENABLE(DRAGGABLE_REGION)
270 void updateAnnotatedRegions();
272 void updateControlTints();
274 void restoreScrollbar();
276 void postLayoutTimerFired(Timer<FrameView>&);
278 bool wasScrolledByUser() const;
279 void setWasScrolledByUser(bool);
281 bool safeToPropagateScrollToParent() const { return m_safeToPropagateScrollToParent; }
282 void setSafeToPropagateScrollToParent(bool isSafe) { m_safeToPropagateScrollToParent = isSafe; }
284 void addEmbeddedObjectToUpdate(RenderEmbeddedObject&);
285 void removeEmbeddedObjectToUpdate(RenderEmbeddedObject&);
287 virtual void paintContents(GraphicsContext*, const IntRect& damageRect) override;
288 void setPaintBehavior(PaintBehavior);
289 PaintBehavior paintBehavior() const;
290 bool isPainting() const;
291 bool hasEverPainted() const { return m_lastPaintTime; }
292 void setLastPaintTime(double lastPaintTime) { m_lastPaintTime = lastPaintTime; }
293 void setNodeToDraw(Node*);
295 enum SelectionInSnapshot { IncludeSelection, ExcludeSelection };
296 enum CoordinateSpaceForSnapshot { DocumentCoordinates, ViewCoordinates };
297 void paintContentsForSnapshot(GraphicsContext*, const IntRect& imageRect, SelectionInSnapshot shouldPaintSelection, CoordinateSpaceForSnapshot);
299 virtual void paintOverhangAreas(GraphicsContext*, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect) override;
300 virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect) override;
301 virtual void paintScrollbar(GraphicsContext*, Scrollbar*, const IntRect&) override;
303 Color documentBackgroundColor() const;
305 bool isInChildFrameWithFrameFlattening() const;
307 static double currentPaintTimeStamp() { return sCurrentPaintTimeStamp; } // returns 0 if not painting
309 void updateLayoutAndStyleIfNeededRecursive();
311 void incrementVisuallyNonEmptyCharacterCount(unsigned);
312 void incrementVisuallyNonEmptyPixelCount(const IntSize&);
313 void updateIsVisuallyNonEmpty();
314 bool isVisuallyNonEmpty() const { return m_isVisuallyNonEmpty; }
315 void enableAutoSizeMode(bool enable, const IntSize& minSize, const IntSize& maxSize);
316 void setAutoSizeFixedMinimumHeight(int fixedMinimumHeight);
317 IntSize autoSizingIntrinsicContentSize() const { return m_autoSizeContentSize; }
319 void forceLayout(bool allowSubtree = false);
320 void forceLayoutForPagination(const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkFactor, AdjustViewSizeOrNot);
322 // FIXME: This method is retained because of embedded WebViews in AppKit. When a WebView is embedded inside
323 // some enclosing view with auto-pagination, no call happens to resize the view. The new pagination model
324 // needs the view to resize as a result of the breaks, but that means that the enclosing view has to potentially
325 // resize around that view. Auto-pagination uses the bounds of the actual view that's being printed to determine
326 // the edges of the print operation, so the resize is necessary if the enclosing view's bounds depend on the
327 // web document's bounds.
329 // This is already a problem if the view needs to be a different size because of printer fonts or because of print stylesheets.
330 // Mail/Dictionary work around this problem by using the _layoutForPrinting SPI
331 // to at least get print stylesheets and printer fonts into play, but since WebKit doesn't know about the page offset or
332 // page size, it can't actually paginate correctly during _layoutForPrinting.
334 // We can eventually move Mail to a newer SPI that would let them opt in to the layout-time pagination model,
335 // but that doesn't solve the general problem of how other AppKit views could opt in to the better model.
337 // NO OTHER PLATFORM BESIDES MAC SHOULD USE THIS METHOD.
338 void adjustPageHeightDeprecated(float* newBottom, float oldTop, float oldBottom, float bottomLimit);
340 bool scrollToFragment(const URL&);
341 bool scrollToAnchor(const String&);
342 void maintainScrollPositionAtAnchor(Node*);
343 void scrollElementToRect(Element*, const IntRect&);
345 // Methods to convert points and rects between the coordinate space of the renderer, and this view.
346 IntRect convertFromRenderer(const RenderElement*, const IntRect&) const;
347 IntRect convertToRenderer(const RenderElement*, const IntRect&) const;
348 IntPoint convertFromRenderer(const RenderElement*, const IntPoint&) const;
349 IntPoint convertToRenderer(const RenderElement*, const IntPoint&) const;
351 bool isFrameViewScrollCorner(RenderScrollbarPart* scrollCorner) const { return m_scrollCorner == scrollCorner; }
355 enum ScrollbarModesCalculationStrategy { RulesFromWebContentOnly, AnyRule };
356 void calculateScrollbarModesForLayout(ScrollbarMode& hMode, ScrollbarMode& vMode, ScrollbarModesCalculationStrategy = AnyRule);
359 static void setRepaintThrottlingDeferredRepaintDelay(double p);
360 // Negative value would mean that first few repaints happen without a delay
361 static void setRepaintThrottlingnInitialDeferredRepaintDelayDuringLoading(double p);
362 // The delay grows on each repaint to this maximum value
363 static void setRepaintThrottlingMaxDeferredRepaintDelayDuringLoading(double p);
364 // On each repaint the delay increses by this amount
365 static void setRepaintThrottlingDeferredRepaintDelayIncrementDuringLoading(double p);
367 virtual IntPoint lastKnownMousePosition() const override;
368 virtual bool isHandlingWheelEvent() const override;
369 bool shouldSetCursor() const;
371 // FIXME: Remove this method once plugin loading is decoupled from layout.
372 void flushAnyPendingPostLayoutTasks();
374 virtual bool shouldSuspendScrollAnimations() const override;
375 virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate) override;
377 RenderBox* embeddedContentBox() const;
379 void setTracksRepaints(bool);
380 bool isTrackingRepaints() const { return m_isTrackingRepaints; }
381 void resetTrackedRepaints();
382 const Vector<IntRect>& trackedRepaintRects() const { return m_trackedRepaintRects; }
383 String trackedRepaintRectsAsText() const;
385 typedef HashSet<ScrollableArea*> ScrollableAreaSet;
386 // Returns whether the scrollable area has just been newly added.
387 bool addScrollableArea(ScrollableArea*);
388 // Returns whether the scrollable area has just been removed.
389 bool removeScrollableArea(ScrollableArea*);
390 bool containsScrollableArea(ScrollableArea*) const;
391 const ScrollableAreaSet* scrollableAreas() const { return m_scrollableAreas.get(); }
393 virtual void removeChild(Widget*) override;
395 // This function exists for ports that need to handle wheel events manually.
396 // On Mac WebKit1 the underlying NSScrollView just does the scrolling, but on most other platforms
397 // we need this function in order to do the scroll ourselves.
398 bool wheelEvent(const PlatformWheelEvent&);
400 void setScrollingPerformanceLoggingEnabled(bool);
402 // Page and FrameView both store a Pagination value. Page::pagination() is set only by API,
403 // and FrameView::pagination() is set only by CSS. Page::pagination() will affect all
404 // FrameViews in the page cache, but FrameView::pagination() only affects the current
405 // FrameView. FrameView::pagination() will return m_pagination if it has been set. Otherwise,
406 // it will return Page::pagination() since currently there are no callers that need to
407 // distinguish between the two.
408 const Pagination& pagination() const;
409 void setPagination(const Pagination&);
411 bool inProgrammaticScroll() const { return m_inProgrammaticScroll; }
412 void setInProgrammaticScroll(bool programmaticScroll) { m_inProgrammaticScroll = programmaticScroll; }
414 #if ENABLE(CSS_DEVICE_ADAPTATION)
415 IntSize initialViewportSize() const { return m_initialViewportSize; }
416 void setInitialViewportSize(const IntSize& size) { m_initialViewportSize = size; }
419 virtual bool isActive() const override;
420 virtual bool updatesScrollLayerPositionOnMainThread() const override;
422 #if ENABLE(RUBBER_BANDING)
423 GraphicsLayer* setWantsLayerForTopOverHangArea(bool) const;
424 GraphicsLayer* setWantsLayerForBottomOverHangArea(bool) const;
427 virtual int headerHeight() const override { return m_headerHeight; }
428 void setHeaderHeight(int);
429 virtual int footerHeight() const override { return m_footerHeight; }
430 void setFooterHeight(int);
432 virtual void willStartLiveResize() override;
433 virtual void willEndLiveResize() override;
435 void addPaintPendingMilestones(LayoutMilestones);
436 void firePaintRelatedMilestones();
437 LayoutMilestones milestonesPendingPaint() const { return m_milestonesPendingPaint; }
439 bool visualUpdatesAllowedByClient() const { return m_visualUpdatesAllowedByClient; }
440 void setVisualUpdatesAllowedByClient(bool);
442 void setScrollPinningBehavior(ScrollPinningBehavior);
444 ScrollBehaviorForFixedElements scrollBehaviorForFixedElements() const;
446 void updateWidgetPositions();
447 void didAddWidgetToRenderTree(Widget&);
448 void willRemoveWidgetFromRenderTree(Widget&);
450 void addTrackedRepaintRect(const IntRect&);
452 // exposedRect represents WebKit's understanding of what part
453 // of the view is actually exposed on screen (taking into account
454 // clipping by other UI elements), whereas visibleContentRect is
455 // internal to WebCore and doesn't respect those things.
456 void setExposedRect(FloatRect);
457 FloatRect exposedRect() const { return m_exposedRect; }
460 virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) override;
461 virtual void scrollContentsSlowPath(const IntRect& updateRect) override;
463 void repaintSlowRepaintObjects();
465 virtual bool isVerticalDocument() const override;
466 virtual bool isFlippedDocument() const override;
469 explicit FrameView(Frame&);
477 InPreLayoutStyleUpdate,
482 LayoutPhase layoutPhase() const { return m_layoutPhase; }
484 bool inPreLayoutStyleUpdate() const { return m_layoutPhase == InPreLayoutStyleUpdate; }
486 virtual bool isFrameView() const override { return true; }
488 friend class RenderWidget;
489 bool useSlowRepaints(bool considerOverlap = true) const;
490 bool useSlowRepaintsIfNotOverlapped() const;
491 void updateCanBlitOnScrollRecursively();
492 bool contentsInCompositedLayer() const;
494 bool shouldUpdateCompositingLayersAfterScrolling() const;
496 void applyOverflowToViewport(RenderElement*, ScrollbarMode& hMode, ScrollbarMode& vMode);
497 void applyPaginationToViewport();
499 void updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow);
501 void paintControlTints();
503 void forceLayoutParentViewIfNeeded();
504 void performPostLayoutTasks();
505 void autoSizeIfEnabled();
507 virtual void repaintContentRectangle(const IntRect&, bool immediate) override;
508 virtual void contentsResized() override;
509 virtual void visibleContentsResized() override;
510 virtual void addedOrRemovedScrollbar() override;
511 virtual void fixedLayoutSizeChanged() override;
513 virtual void delegatesScrollingDidChange() override;
515 // Override ScrollView methods to do point conversion via renderers, in order to
516 // take transforms into account.
517 virtual IntRect convertToContainingView(const IntRect&) const override;
518 virtual IntRect convertFromContainingView(const IntRect&) const override;
519 virtual IntPoint convertToContainingView(const IntPoint&) const override;
520 virtual IntPoint convertFromContainingView(const IntPoint&) const override;
522 // ScrollableArea interface
523 virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) override;
524 virtual void scrollTo(const IntSize&) override;
525 virtual void setVisibleScrollerThumbRect(const IntRect&) override;
526 virtual ScrollableArea* enclosingScrollableArea() const override;
527 virtual IntRect scrollableAreaBoundingBox() const override;
528 virtual bool scrollAnimatorEnabled() const override;
529 #if USE(ACCELERATED_COMPOSITING)
530 virtual bool usesCompositedScrolling() const override;
531 virtual GraphicsLayer* layerForScrolling() const override;
532 virtual GraphicsLayer* layerForHorizontalScrollbar() const override;
533 virtual GraphicsLayer* layerForVerticalScrollbar() const override;
534 virtual GraphicsLayer* layerForScrollCorner() const override;
535 #if ENABLE(RUBBER_BANDING)
536 virtual GraphicsLayer* layerForOverhangAreas() const override;
540 // Override scrollbar notifications to update the AXObject cache.
541 virtual void didAddScrollbar(Scrollbar*, ScrollbarOrientation) override;
542 virtual void willRemoveScrollbar(Scrollbar*, ScrollbarOrientation) override;
544 void sendResizeEventIfNeeded();
546 void updateScrollableAreaSet();
548 virtual void notifyPageThatContentAreaWillPaint() const override;
550 bool shouldUseLoadTimeDeferredRepaintDelay() const;
551 void deferredRepaintTimerFired(Timer<FrameView>&);
552 void doDeferredRepaints();
553 void updateDeferredRepaintDelayAfterRepaint();
554 double adjustedDeferredRepaintDelay() const;
556 bool updateEmbeddedObjects();
557 void updateEmbeddedObject(RenderEmbeddedObject&);
558 void scrollToAnchor();
559 void scrollPositionChanged();
561 bool hasCustomScrollbars() const;
563 virtual void updateScrollCorner() override;
565 FrameView* parentFrameView() const;
567 void startLayoutAtMainFrameViewIfNeeded(bool allowSubtree);
568 bool frameFlatteningEnabled() const;
569 bool isFrameFlatteningValidForThisFrame() const;
571 bool qualifiesAsVisuallyNonEmpty() const;
573 AXObjectCache* axObjectCache() const;
574 void notifyWidgetsInAllFrames(WidgetNotification);
575 void removeFromAXObjectCache();
576 void notifyWidgets(WidgetNotification);
578 HashSet<Widget*> m_widgetsInRenderTree;
580 static double sCurrentPaintTimeStamp; // used for detecting decoded resource thrash in the cache
583 LayoutSize m_margins;
585 OwnPtr<ListHashSet<RenderEmbeddedObject*>> m_embeddedObjectsToUpdate;
586 const RefPtr<Frame> m_frame;
588 OwnPtr<HashSet<RenderElement*>> m_slowRepaintObjects;
590 bool m_needsFullRepaint;
592 bool m_canHaveScrollbars;
593 bool m_cannotBlitToWindow;
595 bool m_contentIsOpaque;
600 Timer<FrameView> m_layoutTimer;
601 bool m_delayedLayout;
602 RenderElement* m_layoutRoot;
604 LayoutPhase m_layoutPhase;
605 bool m_layoutSchedulingEnabled;
606 bool m_inSynchronousPostLayout;
608 unsigned m_nestedLayoutCount;
609 Timer<FrameView> m_postLayoutTasksTimer;
610 bool m_firstLayoutCallbackPending;
613 bool m_isTransparent;
614 Color m_baseBackgroundColor;
615 IntSize m_lastViewportSize;
616 float m_lastZoomFactor;
619 String m_mediaTypeWhenNotPrinting;
621 bool m_overflowStatusDirty;
622 bool m_horizontalOverflow;
623 bool m_verticalOverflow;
624 RenderElement* m_viewportRenderer;
626 Pagination m_pagination;
628 bool m_wasScrolledByUser;
629 bool m_inProgrammaticScroll;
630 bool m_safeToPropagateScrollToParent;
632 unsigned m_deferringRepaints;
633 unsigned m_repaintCount;
634 Vector<LayoutRect> m_repaintRects;
635 Timer<FrameView> m_deferredRepaintTimer;
636 double m_deferredRepaintDelay;
637 double m_lastPaintTime;
639 bool m_isTrackingRepaints; // Used for testing.
640 Vector<IntRect> m_trackedRepaintRects;
642 bool m_shouldUpdateWhileOffscreen;
644 FloatRect m_exposedRect;
646 unsigned m_deferSetNeedsLayouts;
647 bool m_setNeedsLayoutWasDeferred;
649 RefPtr<Node> m_nodeToDraw;
650 PaintBehavior m_paintBehavior;
653 unsigned m_visuallyNonEmptyCharacterCount;
654 unsigned m_visuallyNonEmptyPixelCount;
655 bool m_isVisuallyNonEmpty;
656 bool m_firstVisuallyNonEmptyLayoutCallbackPending;
658 RefPtr<Node> m_maintainScrollPositionAnchor;
660 // Renderer to hold our custom scroll corner.
661 RenderPtr<RenderScrollbarPart> m_scrollCorner;
664 bool m_useCustomFixedPositionLayoutRect;
665 IntRect m_customFixedPositionLayoutRect;
668 // If true, automatically resize the frame view around its content.
669 bool m_shouldAutoSize;
671 // True if autosize has been run since m_shouldAutoSize was set.
672 bool m_didRunAutosize;
673 // The lower bound on the size when autosizing.
674 IntSize m_minAutoSize;
675 // The upper bound on the size when autosizing.
676 IntSize m_maxAutoSize;
677 // The fixed height to resize the view to after autosizing is complete.
678 int m_autoSizeFixedMinimumHeight;
679 // The intrinsic content size decided by autosizing.
680 IntSize m_autoSizeContentSize;
682 OwnPtr<ScrollableAreaSet> m_scrollableAreas;
683 OwnPtr<ViewportConstrainedObjectSet> m_viewportConstrainedObjects;
688 LayoutMilestones m_milestonesPendingPaint;
690 static double s_normalDeferredRepaintDelay;
691 static double s_initialDeferredRepaintDelayDuringLoading;
692 static double s_maxDeferredRepaintDelayDuringLoading;
693 static double s_deferredRepaintDelayIncrementDuringLoading;
695 static const unsigned visualCharacterThreshold = 200;
696 static const unsigned visualPixelThreshold = 32 * 32;
698 #if ENABLE(CSS_DEVICE_ADAPTATION)
699 // Size of viewport before any UA or author styles have overridden
700 // the viewport given by the window or viewing area of the UA.
701 IntSize m_initialViewportSize;
704 bool m_visualUpdatesAllowedByClient;
706 ScrollPinningBehavior m_scrollPinningBehavior;
709 inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count)
711 if (m_isVisuallyNonEmpty)
713 m_visuallyNonEmptyCharacterCount += count;
714 if (m_visuallyNonEmptyCharacterCount <= visualCharacterThreshold)
716 updateIsVisuallyNonEmpty();
719 inline void FrameView::incrementVisuallyNonEmptyPixelCount(const IntSize& size)
721 if (m_isVisuallyNonEmpty)
723 m_visuallyNonEmptyPixelCount += size.width() * size.height();
724 if (m_visuallyNonEmptyPixelCount <= visualPixelThreshold)
726 updateIsVisuallyNonEmpty();
729 WIDGET_TYPE_CASTS(FrameView, isFrameView());
731 } // namespace WebCore
733 #endif // FrameView_h