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"
37 #include <wtf/Forward.h>
38 #include <wtf/ListHashSet.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();
133 bool useCustomFixedPositionLayoutRect() const { return false; }
136 #if ENABLE(REQUEST_ANIMATION_FRAME)
137 void serviceScriptedAnimations(double monotonicAnimationStartTime);
140 void updateCompositingLayersAfterStyleChange();
141 void updateCompositingLayersAfterLayout();
142 bool flushCompositingStateForThisFrame(Frame* rootFrameForFlush);
144 void clearBackingStores();
145 void restoreBackingStores();
147 // Called when changes to the GraphicsLayer hierarchy have to be synchronized with
148 // content rendered via the normal painting path.
149 void setNeedsOneShotDrawingSynchronization();
151 GraphicsLayer* graphicsLayerForPlatformWidget(PlatformWidget);
152 void scheduleLayerFlushAllowingThrottling();
154 virtual TiledBacking* tiledBacking() const override;
156 // In the future when any ScrollableArea can have a node in th ScrollingTree, this should
157 // become a virtual function on ScrollableArea.
158 uint64_t scrollLayerID() const;
159 ScrollableArea* scrollableAreaForScrollLayerID(uint64_t) const;
161 bool hasCompositedContent() const;
162 bool hasCompositedContentIncludingDescendants() const;
163 bool hasCompositingAncestor() const;
164 void enterCompositingMode();
165 bool isEnclosedInCompositingLayer() const;
167 // Only used with accelerated compositing, but outside the #ifdef to make linkage easier.
168 // Returns true if the flush was completed.
169 bool flushCompositingStateIncludingSubframes();
171 // Returns true when a paint with the PaintBehaviorFlattenCompositingLayers flag set gives
172 // a faithful representation of the content.
173 bool isSoftwareRenderable() const;
175 void didMoveOnscreen();
176 void willMoveOffscreen();
177 void setIsInWindow(bool);
179 void resetScrollbars();
180 void resetScrollbarsAndClearContentsSize();
181 void prepareForDetach();
182 void detachCustomScrollbars();
183 void recalculateScrollbarOverlayStyle();
187 bool isTransparent() const;
188 void setTransparent(bool isTransparent);
190 // True if the FrameView is not transparent, and the base background color is opaque.
191 bool hasOpaqueBackground() const;
193 Color baseBackgroundColor() const;
194 void setBaseBackgroundColor(const Color&);
195 void updateBackgroundRecursively(const Color&, bool);
197 // setBackgroundExtendsBeyondPage() is controlled by Settings::setBackgroundShouldExtendBeyondPage(). Some
198 // extended backgrounds require an extended background rect for painting, (at this time, that corresponds
199 // to documents with background images) and needsExtendedBackgroundRectForPainting() determines if this
200 // FrameView is one of those special FrameViews that does require an extended rect for painting. Since
201 // needing an extended background rect for painting is something that can change in the course of a FrameView's
202 // life, the extended rect is set and unset using setHasExtendedBackgroundRectForPainting(). The
203 // extendedBackgroundRectForPainting() is in the viewport's coordinate space.
204 void setBackgroundExtendsBeyondPage(bool);
205 bool needsExtendedBackgroundRectForPainting() const;
206 void setHasExtendedBackgroundRectForPainting(bool shouldHaveExtendedBackgroundRect);
207 bool hasExtendedBackgroundRectForPainting() const;
208 IntRect extendedBackgroundRectForPainting() const;
210 bool shouldUpdateWhileOffscreen() const;
211 void setShouldUpdateWhileOffscreen(bool);
212 bool shouldUpdate() const;
214 void adjustViewSize();
216 void setViewportSize(IntSize);
217 IntSize viewportSize() const;
219 virtual IntRect windowClipRect(bool clipToContents = true) const override;
220 IntRect windowClipRectForFrameOwner(const HTMLFrameOwnerElement*, bool clipToLayerContents) const;
222 virtual IntRect windowResizerRect() const override;
224 virtual float visibleContentScaleFactor() const override;
226 #if USE(TILED_BACKING_STORE)
227 virtual void setFixedVisibleContentRect(const IntRect&) override;
229 virtual void setScrollPosition(const IntPoint&) override;
230 void scrollPositionChangedViaPlatformWidget(const IntPoint& oldPosition, const IntPoint& newPosition);
231 virtual void updateLayerPositionsAfterScrolling() override;
232 virtual void updateCompositingLayersAfterScrolling() override;
233 virtual bool requestScrollPositionUpdate(const IntPoint&) override;
234 virtual bool isRubberBandInProgress() const override;
235 virtual IntPoint minimumScrollPosition() const override;
236 virtual IntPoint maximumScrollPosition() const override;
238 // This is different than visibleContentRect() in that it ignores negative (or overly positive)
239 // offsets from rubber-banding, and it takes zooming into account.
240 LayoutRect viewportConstrainedVisibleContentRect() const;
242 // A rectangle in content coordinates that is used to clip layers for fixed-position objects.
243 LayoutRect viewportConstrainedExtentRect() const;
245 String mediaType() const;
246 void setMediaType(const String&);
247 void adjustMediaTypeForPrinting(bool printing);
249 void setCannotBlitToWindow();
250 void setIsOverlapped(bool);
251 bool isOverlapped() const { return m_isOverlapped; }
252 bool isOverlappedIncludingAncestors() const;
253 void setContentIsOpaque(bool);
255 void addSlowRepaintObject(RenderElement*);
256 void removeSlowRepaintObject(RenderElement*);
257 bool hasSlowRepaintObject(RenderElement* o) const { return m_slowRepaintObjects && m_slowRepaintObjects->contains(o); }
258 bool hasSlowRepaintObjects() const { return m_slowRepaintObjects && m_slowRepaintObjects->size(); }
260 // Includes fixed- and sticky-position objects.
261 typedef HashSet<RenderElement*> ViewportConstrainedObjectSet;
262 void addViewportConstrainedObject(RenderElement*);
263 void removeViewportConstrainedObject(RenderElement*);
264 const ViewportConstrainedObjectSet* viewportConstrainedObjects() const { return m_viewportConstrainedObjects.get(); }
265 bool hasViewportConstrainedObjects() const { return m_viewportConstrainedObjects && m_viewportConstrainedObjects->size() > 0; }
267 // Functions for querying the current scrolled position, negating the effects of overhang
268 // and adjusting for page scale.
269 LayoutSize scrollOffsetForFixedPosition() const;
270 // Static function can be called from another thread.
271 static LayoutSize scrollOffsetForFixedPosition(const LayoutRect& visibleContentRect, const LayoutSize& totalContentsSize, const LayoutPoint& scrollPosition, const LayoutPoint& scrollOrigin, float frameScaleFactor, bool fixedElementsLayoutRelativeToFrame, ScrollBehaviorForFixedElements, int headerHeight, int footerHeight);
274 LayoutRect viewportConstrainedObjectsRect() const;
275 // Static function can be called from another thread.
276 static LayoutRect rectForViewportConstrainedObjects(const LayoutRect& visibleContentRect, const LayoutSize& totalContentsSize, float frameScaleFactor, bool fixedElementsLayoutRelativeToFrame, ScrollBehaviorForFixedElements);
279 bool fixedElementsLayoutRelativeToFrame() const;
281 void disableLayerFlushThrottlingTemporarilyForInteraction();
282 void updateLayerFlushThrottlingInAllFrames();
283 void adjustTiledBackingCoverage();
284 bool speculativeTilingEnabled() const { return m_speculativeTilingEnabled; }
286 #if ENABLE(DASHBOARD_SUPPORT)
287 void updateAnnotatedRegions();
289 void updateControlTints();
291 void restoreScrollbar();
293 void postLayoutTimerFired(Timer<FrameView>&);
295 bool wasScrolledByUser() const;
296 void setWasScrolledByUser(bool);
298 bool safeToPropagateScrollToParent() const { return m_safeToPropagateScrollToParent; }
299 void setSafeToPropagateScrollToParent(bool isSafe) { m_safeToPropagateScrollToParent = isSafe; }
301 void addEmbeddedObjectToUpdate(RenderEmbeddedObject&);
302 void removeEmbeddedObjectToUpdate(RenderEmbeddedObject&);
304 virtual void paintContents(GraphicsContext*, const IntRect& dirtyRect) override;
306 struct PaintingState {
307 PaintBehavior paintBehavior;
308 bool isTopLevelPainter;
309 bool isFlatteningPaintOfRootFrame;
312 , isTopLevelPainter(false)
313 , isFlatteningPaintOfRootFrame(false)
318 void willPaintContents(GraphicsContext*, const IntRect& dirtyRect, PaintingState&);
319 void didPaintContents(GraphicsContext*, const IntRect& dirtyRect, PaintingState&);
321 void setPaintBehavior(PaintBehavior);
322 PaintBehavior paintBehavior() const;
323 bool isPainting() const;
324 bool hasEverPainted() const { return m_lastPaintTime; }
325 void setLastPaintTime(double lastPaintTime) { m_lastPaintTime = lastPaintTime; }
326 void setNodeToDraw(Node*);
328 enum SelectionInSnapshot { IncludeSelection, ExcludeSelection };
329 enum CoordinateSpaceForSnapshot { DocumentCoordinates, ViewCoordinates };
330 void paintContentsForSnapshot(GraphicsContext*, const IntRect& imageRect, SelectionInSnapshot shouldPaintSelection, CoordinateSpaceForSnapshot);
332 virtual void paintOverhangAreas(GraphicsContext*, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect) override;
333 virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect) override;
334 virtual void paintScrollbar(GraphicsContext*, Scrollbar*, const IntRect&) override;
336 Color documentBackgroundColor() const;
338 bool isInChildFrameWithFrameFlattening() const;
340 static double currentPaintTimeStamp() { return sCurrentPaintTimeStamp; } // returns 0 if not painting
342 void updateLayoutAndStyleIfNeededRecursive();
344 void incrementVisuallyNonEmptyCharacterCount(unsigned);
345 void incrementVisuallyNonEmptyPixelCount(const IntSize&);
346 void updateIsVisuallyNonEmpty();
347 bool isVisuallyNonEmpty() const { return m_isVisuallyNonEmpty; }
348 void enableAutoSizeMode(bool enable, const IntSize& minSize, const IntSize& maxSize);
349 void setAutoSizeFixedMinimumHeight(int fixedMinimumHeight);
350 IntSize autoSizingIntrinsicContentSize() const { return m_autoSizeContentSize; }
352 void forceLayout(bool allowSubtree = false);
353 void forceLayoutForPagination(const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkFactor, AdjustViewSizeOrNot);
355 // FIXME: This method is retained because of embedded WebViews in AppKit. When a WebView is embedded inside
356 // some enclosing view with auto-pagination, no call happens to resize the view. The new pagination model
357 // needs the view to resize as a result of the breaks, but that means that the enclosing view has to potentially
358 // resize around that view. Auto-pagination uses the bounds of the actual view that's being printed to determine
359 // the edges of the print operation, so the resize is necessary if the enclosing view's bounds depend on the
360 // web document's bounds.
362 // This is already a problem if the view needs to be a different size because of printer fonts or because of print stylesheets.
363 // Mail/Dictionary work around this problem by using the _layoutForPrinting SPI
364 // to at least get print stylesheets and printer fonts into play, but since WebKit doesn't know about the page offset or
365 // page size, it can't actually paginate correctly during _layoutForPrinting.
367 // We can eventually move Mail to a newer SPI that would let them opt in to the layout-time pagination model,
368 // but that doesn't solve the general problem of how other AppKit views could opt in to the better model.
370 // NO OTHER PLATFORM BESIDES MAC SHOULD USE THIS METHOD.
371 void adjustPageHeightDeprecated(float* newBottom, float oldTop, float oldBottom, float bottomLimit);
373 bool scrollToFragment(const URL&);
374 bool scrollToAnchor(const String&);
375 void maintainScrollPositionAtAnchor(Node*);
376 void scrollElementToRect(Element*, const IntRect&);
378 // Methods to convert points and rects between the coordinate space of the renderer, and this view.
379 IntRect convertFromRenderer(const RenderElement*, const IntRect&) const;
380 IntRect convertToRenderer(const RenderElement*, const IntRect&) const;
381 IntPoint convertFromRenderer(const RenderElement*, const IntPoint&) const;
382 IntPoint convertToRenderer(const RenderElement*, const IntPoint&) const;
384 bool isFrameViewScrollCorner(RenderScrollbarPart* scrollCorner) const { return m_scrollCorner == scrollCorner; }
388 enum ScrollbarModesCalculationStrategy { RulesFromWebContentOnly, AnyRule };
389 void calculateScrollbarModesForLayout(ScrollbarMode& hMode, ScrollbarMode& vMode, ScrollbarModesCalculationStrategy = AnyRule);
391 virtual IntPoint lastKnownMousePosition() const override;
392 virtual bool isHandlingWheelEvent() const override;
393 bool shouldSetCursor() const;
395 // FIXME: Remove this method once plugin loading is decoupled from layout.
396 void flushAnyPendingPostLayoutTasks();
398 virtual bool shouldSuspendScrollAnimations() const override;
399 virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate) override;
401 RenderBox* embeddedContentBox() const;
403 void setTracksRepaints(bool);
404 bool isTrackingRepaints() const { return m_isTrackingRepaints; }
405 void resetTrackedRepaints();
406 const Vector<FloatRect>& trackedRepaintRects() const { return m_trackedRepaintRects; }
407 String trackedRepaintRectsAsText() const;
409 typedef HashSet<ScrollableArea*> ScrollableAreaSet;
410 // Returns whether the scrollable area has just been newly added.
411 bool addScrollableArea(ScrollableArea*);
412 // Returns whether the scrollable area has just been removed.
413 bool removeScrollableArea(ScrollableArea*);
414 bool containsScrollableArea(ScrollableArea*) const;
415 const ScrollableAreaSet* scrollableAreas() const { return m_scrollableAreas.get(); }
417 virtual void removeChild(Widget*) override;
419 // This function exists for ports that need to handle wheel events manually.
420 // On Mac WebKit1 the underlying NSScrollView just does the scrolling, but on most other platforms
421 // we need this function in order to do the scroll ourselves.
422 bool wheelEvent(const PlatformWheelEvent&);
424 void setScrollingPerformanceLoggingEnabled(bool);
426 // Page and FrameView both store a Pagination value. Page::pagination() is set only by API,
427 // and FrameView::pagination() is set only by CSS. Page::pagination() will affect all
428 // FrameViews in the page cache, but FrameView::pagination() only affects the current
429 // FrameView. FrameView::pagination() will return m_pagination if it has been set. Otherwise,
430 // it will return Page::pagination() since currently there are no callers that need to
431 // distinguish between the two.
432 const Pagination& pagination() const;
433 void setPagination(const Pagination&);
435 bool inProgrammaticScroll() const { return m_inProgrammaticScroll; }
436 void setInProgrammaticScroll(bool programmaticScroll) { m_inProgrammaticScroll = programmaticScroll; }
438 #if ENABLE(CSS_DEVICE_ADAPTATION)
439 IntSize initialViewportSize() const { return m_initialViewportSize; }
440 void setInitialViewportSize(const IntSize& size) { m_initialViewportSize = size; }
443 virtual bool isActive() const override;
444 virtual bool updatesScrollLayerPositionOnMainThread() const override;
446 #if ENABLE(RUBBER_BANDING)
447 GraphicsLayer* setWantsLayerForTopOverHangArea(bool) const;
448 GraphicsLayer* setWantsLayerForBottomOverHangArea(bool) const;
451 virtual int headerHeight() const override { return m_headerHeight; }
452 void setHeaderHeight(int);
453 virtual int footerHeight() const override { return m_footerHeight; }
454 void setFooterHeight(int);
456 virtual float topContentInset() const override;
457 void topContentInsetDidChange();
459 virtual void willStartLiveResize() override;
460 virtual void willEndLiveResize() override;
462 void addPaintPendingMilestones(LayoutMilestones);
463 void firePaintRelatedMilestonesIfNeeded();
464 void fireLayoutRelatedMilestonesIfNeeded();
465 LayoutMilestones milestonesPendingPaint() const { return m_milestonesPendingPaint; }
467 bool visualUpdatesAllowedByClient() const { return m_visualUpdatesAllowedByClient; }
468 void setVisualUpdatesAllowedByClient(bool);
470 void setScrollPinningBehavior(ScrollPinningBehavior);
472 ScrollBehaviorForFixedElements scrollBehaviorForFixedElements() const;
474 void updateWidgetPositions();
475 void didAddWidgetToRenderTree(Widget&);
476 void willRemoveWidgetFromRenderTree(Widget&);
478 void addTrackedRepaintRect(const FloatRect&);
480 // exposedRect represents WebKit's understanding of what part
481 // of the view is actually exposed on screen (taking into account
482 // clipping by other UI elements), whereas visibleContentRect is
483 // internal to WebCore and doesn't respect those things.
484 void setExposedRect(FloatRect);
485 FloatRect exposedRect() const { return m_exposedRect; }
488 virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) override;
489 virtual void scrollContentsSlowPath(const IntRect& updateRect) override;
491 void repaintSlowRepaintObjects();
493 virtual bool isVerticalDocument() const override;
494 virtual bool isFlippedDocument() const override;
497 explicit FrameView(Frame&);
505 InPreLayoutStyleUpdate,
510 LayoutPhase layoutPhase() const { return m_layoutPhase; }
512 bool inPreLayoutStyleUpdate() const { return m_layoutPhase == InPreLayoutStyleUpdate; }
514 virtual bool isFrameView() const override { return true; }
516 friend class RenderWidget;
517 bool useSlowRepaints(bool considerOverlap = true) const;
518 bool useSlowRepaintsIfNotOverlapped() const;
519 void updateCanBlitOnScrollRecursively();
520 bool contentsInCompositedLayer() const;
521 bool shouldLayoutAfterContentsResized() const;
523 bool shouldUpdateCompositingLayersAfterScrolling() const;
525 void applyOverflowToViewport(RenderElement*, ScrollbarMode& hMode, ScrollbarMode& vMode);
526 void applyPaginationToViewport();
528 void updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow);
530 void paintControlTints();
532 void forceLayoutParentViewIfNeeded();
533 void performPostLayoutTasks();
534 void autoSizeIfEnabled();
536 virtual void repaintContentRectangle(const IntRect&) override;
537 virtual void contentsResized() override;
538 virtual void visibleContentsResized() override;
539 virtual void addedOrRemovedScrollbar() override;
540 virtual void fixedLayoutSizeChanged() override;
542 virtual void delegatesScrollingDidChange() override;
544 // Override ScrollView methods to do point conversion via renderers, in order to
545 // take transforms into account.
546 virtual IntRect convertToContainingView(const IntRect&) const override;
547 virtual IntRect convertFromContainingView(const IntRect&) const override;
548 virtual IntPoint convertToContainingView(const IntPoint&) const override;
549 virtual IntPoint convertFromContainingView(const IntPoint&) const override;
551 // ScrollableArea interface
552 virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) override;
553 virtual void scrollTo(const IntSize&) override;
554 virtual void setVisibleScrollerThumbRect(const IntRect&) override;
555 virtual ScrollableArea* enclosingScrollableArea() const override;
556 virtual IntRect scrollableAreaBoundingBox() const override;
557 virtual bool scrollAnimatorEnabled() const override;
558 virtual bool usesCompositedScrolling() const override;
559 virtual GraphicsLayer* layerForScrolling() const override;
560 virtual GraphicsLayer* layerForHorizontalScrollbar() const override;
561 virtual GraphicsLayer* layerForVerticalScrollbar() const override;
562 virtual GraphicsLayer* layerForScrollCorner() const override;
563 #if ENABLE(RUBBER_BANDING)
564 virtual GraphicsLayer* layerForOverhangAreas() const override;
567 // Override scrollbar notifications to update the AXObject cache.
568 virtual void didAddScrollbar(Scrollbar*, ScrollbarOrientation) override;
569 virtual void willRemoveScrollbar(Scrollbar*, ScrollbarOrientation) override;
571 void sendResizeEventIfNeeded();
573 void updateScrollableAreaSet();
575 virtual void notifyPageThatContentAreaWillPaint() const override;
577 void enableSpeculativeTilingIfNeeded();
578 void speculativeTilingEnableTimerFired(Timer<FrameView>&);
580 bool updateEmbeddedObjects();
581 void updateEmbeddedObject(RenderEmbeddedObject&);
582 void scrollToAnchor();
583 void scrollPositionChanged(const IntPoint& oldPosition, const IntPoint& newPosition);
585 bool hasCustomScrollbars() const;
587 virtual void updateScrollCorner() override;
589 FrameView* parentFrameView() const;
591 void startLayoutAtMainFrameViewIfNeeded(bool allowSubtree);
592 bool frameFlatteningEnabled() const;
593 bool isFrameFlatteningValidForThisFrame() const;
595 bool qualifiesAsVisuallyNonEmpty() const;
597 AXObjectCache* axObjectCache() const;
598 void notifyWidgetsInAllFrames(WidgetNotification);
599 void removeFromAXObjectCache();
600 void notifyWidgets(WidgetNotification);
602 HashSet<Widget*> m_widgetsInRenderTree;
604 static double sCurrentPaintTimeStamp; // used for detecting decoded resource thrash in the cache
607 LayoutSize m_margins;
609 std::unique_ptr<ListHashSet<RenderEmbeddedObject*>> m_embeddedObjectsToUpdate;
610 const RefPtr<Frame> m_frame;
612 std::unique_ptr<HashSet<RenderElement*>> m_slowRepaintObjects;
614 bool m_needsFullRepaint;
616 bool m_canHaveScrollbars;
617 bool m_cannotBlitToWindow;
619 bool m_contentIsOpaque;
624 Timer<FrameView> m_layoutTimer;
625 bool m_delayedLayout;
626 RenderElement* m_layoutRoot;
628 LayoutPhase m_layoutPhase;
629 bool m_layoutSchedulingEnabled;
630 bool m_inSynchronousPostLayout;
632 unsigned m_nestedLayoutCount;
633 Timer<FrameView> m_postLayoutTasksTimer;
634 bool m_firstLayoutCallbackPending;
637 bool m_isTransparent;
638 Color m_baseBackgroundColor;
639 IntSize m_lastViewportSize;
640 float m_lastZoomFactor;
643 String m_mediaTypeWhenNotPrinting;
645 bool m_overflowStatusDirty;
646 bool m_horizontalOverflow;
647 bool m_verticalOverflow;
648 RenderElement* m_viewportRenderer;
650 Pagination m_pagination;
652 bool m_wasScrolledByUser;
653 bool m_inProgrammaticScroll;
654 bool m_safeToPropagateScrollToParent;
656 double m_lastPaintTime;
658 bool m_isTrackingRepaints; // Used for testing.
659 Vector<FloatRect> m_trackedRepaintRects;
661 bool m_shouldUpdateWhileOffscreen;
663 FloatRect m_exposedRect;
665 unsigned m_deferSetNeedsLayouts;
666 bool m_setNeedsLayoutWasDeferred;
668 RefPtr<Node> m_nodeToDraw;
669 PaintBehavior m_paintBehavior;
672 unsigned m_visuallyNonEmptyCharacterCount;
673 unsigned m_visuallyNonEmptyPixelCount;
674 bool m_isVisuallyNonEmpty;
675 bool m_firstVisuallyNonEmptyLayoutCallbackPending;
677 RefPtr<Node> m_maintainScrollPositionAnchor;
679 // Renderer to hold our custom scroll corner.
680 RenderPtr<RenderScrollbarPart> m_scrollCorner;
682 bool m_speculativeTilingEnabled;
683 Timer<FrameView> m_speculativeTilingEnableTimer;
686 bool m_useCustomFixedPositionLayoutRect;
687 IntRect m_customFixedPositionLayoutRect;
690 IntSize m_overrideViewportSize;
691 bool m_hasOverrideViewportSize;
693 // If true, automatically resize the frame view around its content.
694 bool m_shouldAutoSize;
696 // True if autosize has been run since m_shouldAutoSize was set.
697 bool m_didRunAutosize;
698 // The lower bound on the size when autosizing.
699 IntSize m_minAutoSize;
700 // The upper bound on the size when autosizing.
701 IntSize m_maxAutoSize;
702 // The fixed height to resize the view to after autosizing is complete.
703 int m_autoSizeFixedMinimumHeight;
704 // The intrinsic content size decided by autosizing.
705 IntSize m_autoSizeContentSize;
707 std::unique_ptr<ScrollableAreaSet> m_scrollableAreas;
708 std::unique_ptr<ViewportConstrainedObjectSet> m_viewportConstrainedObjects;
713 LayoutMilestones m_milestonesPendingPaint;
715 static const unsigned visualCharacterThreshold = 200;
716 static const unsigned visualPixelThreshold = 32 * 32;
718 #if ENABLE(CSS_DEVICE_ADAPTATION)
719 // Size of viewport before any UA or author styles have overridden
720 // the viewport given by the window or viewing area of the UA.
721 IntSize m_initialViewportSize;
724 bool m_visualUpdatesAllowedByClient;
726 ScrollPinningBehavior m_scrollPinningBehavior;
729 inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count)
731 if (m_isVisuallyNonEmpty)
733 m_visuallyNonEmptyCharacterCount += count;
734 if (m_visuallyNonEmptyCharacterCount <= visualCharacterThreshold)
736 updateIsVisuallyNonEmpty();
739 inline void FrameView::incrementVisuallyNonEmptyPixelCount(const IntSize& size)
741 if (m_isVisuallyNonEmpty)
743 m_visuallyNonEmptyPixelCount += size.width() * size.height();
744 if (m_visuallyNonEmptyPixelCount <= visualPixelThreshold)
746 updateIsVisuallyNonEmpty();
749 WIDGET_TYPE_CASTS(FrameView, isFrameView());
751 } // namespace WebCore
753 #endif // FrameView_h