2 * Copyright (C) 2004, 2006, 2007, 2008, 2013, 2014 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Holger Hans Peter Freyther
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #include "FloatRect.h"
32 #include "Scrollbar.h"
33 #include "ScrollableArea.h"
34 #include "ScrollTypes.h"
37 #include <wtf/HashSet.h>
40 OBJC_CLASS WAKScrollView;
44 #define NSScrollView WAKScrollView
48 #define NSView WAKView
50 #endif // PLATFORM(IOS)
52 #if PLATFORM(COCOA) && defined __OBJC__
54 @protocol WebCoreFrameScrollView;
60 class LegacyTileCache;
63 class ScrollView : public Widget, public ScrollableArea {
65 virtual ~ScrollView();
67 // ScrollableArea functions.
68 int scrollSize(ScrollbarOrientation) const override;
69 int scrollOffset(ScrollbarOrientation) const override;
70 WEBCORE_EXPORT void setScrollOffset(const ScrollOffset&) override;
71 bool isScrollCornerVisible() const override;
72 void scrollbarStyleChanged(ScrollbarStyle, bool forceUpdate) override;
74 virtual void notifyPageThatContentAreaWillPaint() const;
76 // NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea.
77 virtual void scrollTo(const ScrollPosition&);
79 // The window thats hosts the ScrollView. The ScrollView will communicate scrolls and repaints to the
80 // host window in the window's coordinate space.
81 virtual HostWindow* hostWindow() const = 0;
83 // Returns a clip rect in host window coordinates. Used to clip the blit on a scroll.
84 virtual IntRect windowClipRect() const = 0;
86 // Functions for child manipulation and inspection.
87 const HashSet<RefPtr<Widget>>& children() const { return m_children; }
88 WEBCORE_EXPORT virtual void addChild(PassRefPtr<Widget>);
89 virtual void removeChild(Widget&);
91 // If the scroll view does not use a native widget, then it will have cross-platform Scrollbars. These functions
92 // can be used to obtain those scrollbars.
93 Scrollbar* horizontalScrollbar() const override { return m_horizontalScrollbar.get(); }
94 Scrollbar* verticalScrollbar() const override { return m_verticalScrollbar.get(); }
95 bool isScrollViewScrollbar(const Widget* child) const { return horizontalScrollbar() == child || verticalScrollbar() == child; }
97 void positionScrollbarLayers();
99 // Functions for setting and retrieving the scrolling mode in each axis (horizontal/vertical). The mode has values of
100 // AlwaysOff, AlwaysOn, and Auto. AlwaysOff means never show a scrollbar, AlwaysOn means always show a scrollbar.
101 // Auto means show a scrollbar only when one is needed.
102 // Note that for platforms with native widgets, these modes are considered advisory. In other words the underlying native
103 // widget may choose not to honor the requested modes.
104 void setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode verticalMode, bool horizontalLock = false, bool verticalLock = false);
105 void setHorizontalScrollbarMode(ScrollbarMode mode, bool lock = false) { setScrollbarModes(mode, verticalScrollbarMode(), lock, verticalScrollbarLock()); }
106 void setVerticalScrollbarMode(ScrollbarMode mode, bool lock = false) { setScrollbarModes(horizontalScrollbarMode(), mode, horizontalScrollbarLock(), lock); };
107 WEBCORE_EXPORT void scrollbarModes(ScrollbarMode& horizontalMode, ScrollbarMode& verticalMode) const;
108 ScrollbarMode horizontalScrollbarMode() const { ScrollbarMode horizontal, vertical; scrollbarModes(horizontal, vertical); return horizontal; }
109 ScrollbarMode verticalScrollbarMode() const { ScrollbarMode horizontal, vertical; scrollbarModes(horizontal, vertical); return vertical; }
111 void setHorizontalScrollbarLock(bool lock = true) { m_horizontalScrollbarLock = lock; }
112 bool horizontalScrollbarLock() const { return m_horizontalScrollbarLock; }
113 void setVerticalScrollbarLock(bool lock = true) { m_verticalScrollbarLock = lock; }
114 bool verticalScrollbarLock() const { return m_verticalScrollbarLock; }
116 void setScrollingModesLock(bool lock = true) { m_horizontalScrollbarLock = m_verticalScrollbarLock = lock; }
118 WEBCORE_EXPORT virtual void setCanHaveScrollbars(bool);
119 bool canHaveScrollbars() const { return horizontalScrollbarMode() != ScrollbarAlwaysOff || verticalScrollbarMode() != ScrollbarAlwaysOff; }
121 virtual bool avoidScrollbarCreation() const { return false; }
123 void setScrollbarOverlayStyle(ScrollbarOverlayStyle) override;
125 // By default you only receive paint events for the area that is visible. In the case of using a
126 // tiled backing store, this function can be set, so that the view paints the entire contents.
127 bool paintsEntireContents() const { return m_paintsEntireContents; }
128 WEBCORE_EXPORT void setPaintsEntireContents(bool);
130 // By default, paint events are clipped to the visible area. If set to
131 // false, paint events are no longer clipped. paintsEntireContents() implies !clipsRepaints().
132 bool clipsRepaints() const { return m_clipsRepaints; }
133 void setClipsRepaints(bool);
135 // By default programmatic scrolling is handled by WebCore and not by the UI application.
136 // In the case of using a tiled backing store, this mode can be set, so that the scroll requests
137 // are delegated to the UI application.
138 bool delegatesScrolling() const { return m_delegatesScrolling; }
139 WEBCORE_EXPORT void setDelegatesScrolling(bool);
141 // Overridden by FrameView to create custom CSS scrollbars if applicable.
142 virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation);
144 void styleDidChange();
146 // If the prohibits scrolling flag is set, then all scrolling in the view (even programmatic scrolling) is turned off.
147 void setProhibitsScrolling(bool b) { m_prohibitsScrolling = b; }
148 bool prohibitsScrolling() const { return m_prohibitsScrolling; }
150 // Whether or not a scroll view will blit visible contents when it is scrolled. Blitting is disabled in situations
151 // where it would cause rendering glitches (such as with fixed backgrounds or when the view is partially transparent).
152 void setCanBlitOnScroll(bool);
153 bool canBlitOnScroll() const;
155 // There are at least three types of contentInset. Usually we just care about WebCoreContentInset, which is the inset
156 // that is set on a Page that requires WebCore to move its layers to accomodate the inset. However, there are platform
157 // concepts that are similar on both iOS and Mac when there is a platformWidget(). Sometimes we need the Mac platform value
158 // for topContentInset, so when the TopContentInsetType is WebCoreOrPlatformContentInset, platformTopContentInset()
159 // will be returned instead of the value set on Page.
160 enum class TopContentInsetType { WebCoreContentInset, WebCoreOrPlatformContentInset };
161 virtual float topContentInset(TopContentInsetType = TopContentInsetType::WebCoreContentInset) const { return 0; }
163 // The visible content rect has a location that is the scrolled offset of the document. The width and height are the unobscured viewport
164 // width and height. By default the scrollbars themselves are excluded from this rectangle, but an optional boolean argument allows them
166 // In the situation the client is responsible for the scrolling (ie. with a tiled backing store) it is possible to use
167 // the setFixedVisibleContentRect instead for the mainframe, though this must be updated manually, e.g just before resuming the page
168 // which usually will happen when panning, pinching and rotation ends, or when scale or position are changed manually.
169 IntSize visibleSize() const override { return visibleContentRect(LegacyIOSDocumentVisibleRect).size(); }
171 #if USE(COORDINATED_GRAPHICS)
172 virtual void setFixedVisibleContentRect(const IntRect& visibleContentRect) { m_fixedVisibleContentRect = visibleContentRect; }
173 IntRect fixedVisibleContentRect() const { return m_fixedVisibleContentRect; }
176 // Parts of the document can be visible through transparent or blured UI widgets of the chrome. Those parts
177 // contribute to painting but not to the scrollable area.
178 // The unobscuredContentRect is the area that is not covered by UI elements.
179 WEBCORE_EXPORT IntRect unobscuredContentRect(VisibleContentRectIncludesScrollbars = ExcludeScrollbars) const;
181 IntRect unobscuredContentRectIncludingScrollbars() const { return unobscuredContentRect(IncludeScrollbars); }
183 IntRect unobscuredContentRectIncludingScrollbars() const { return visibleContentRectIncludingScrollbars(); }
187 // This is the area that is partially or fully exposed, and may extend under overlapping UI elements.
188 WEBCORE_EXPORT FloatRect exposedContentRect() const;
190 // The given rects are only used if there is no platform widget.
191 WEBCORE_EXPORT void setExposedContentRect(const FloatRect&);
192 const FloatSize& unobscuredContentSize() const { return m_unobscuredContentSize; }
193 WEBCORE_EXPORT void setUnobscuredContentSize(const FloatSize&);
195 void setActualScrollPosition(const IntPoint&);
196 LegacyTileCache* legacyTileCache();
199 virtual bool inProgrammaticScroll() const { return false; }
201 // visibleContentRect().size() is computed from unscaledUnobscuredVisibleContentSize() divided by the value of visibleContentScaleFactor.
202 // visibleContentScaleFactor is usually 1, except when the setting delegatesPageScaling is true and the
203 // ScrollView is the main frame; in that case, visibleContentScaleFactor is equal to the page's pageScaleFactor.
204 // Ports that don't use pageScaleFactor can treat unscaledUnobscuredVisibleContentSize and visibleContentRect().size() as equivalent.
205 // unscaledVisibleContentSizeIncludingObscuredArea() includes areas in the content that might be obscured by UI elements.
206 IntSize unscaledUnobscuredVisibleContentSize(VisibleContentRectIncludesScrollbars = ExcludeScrollbars) const;
207 IntSize unscaledVisibleContentSizeIncludingObscuredArea(VisibleContentRectIncludesScrollbars = ExcludeScrollbars) const;
208 virtual float visibleContentScaleFactor() const { return 1; }
210 // Functions for getting/setting the size webkit should use to layout the contents. By default this is the same as the visible
211 // content size. Explicitly setting a layout size value will cause webkit to layout the contents using this size instead.
212 IntSize layoutSize() const;
213 int layoutWidth() const { return layoutSize().width(); }
214 int layoutHeight() const { return layoutSize().height(); }
215 WEBCORE_EXPORT IntSize fixedLayoutSize() const;
216 WEBCORE_EXPORT void setFixedLayoutSize(const IntSize&);
217 WEBCORE_EXPORT bool useFixedLayout() const;
218 WEBCORE_EXPORT void setUseFixedLayout(bool enable);
220 // Functions for getting/setting the size of the document contained inside the ScrollView (as an IntSize or as individual width and height
222 WEBCORE_EXPORT IntSize contentsSize() const override; // Always at least as big as the visibleWidth()/visibleHeight().
223 int contentsWidth() const { return contentsSize().width(); }
224 int contentsHeight() const { return contentsSize().height(); }
225 virtual void setContentsSize(const IntSize&);
227 // Functions for querying the current scrolled position (both as a point, a size, or as individual X and Y values).
228 ScrollPosition scrollPosition() const override { return visibleContentRect(LegacyIOSDocumentVisibleRect).location(); }
230 ScrollPosition maximumScrollPosition() const override; // The maximum position we can be scrolled to.
232 // Adjust the passed in scroll position to keep it between the minimum and maximum positions.
233 ScrollPosition adjustScrollPositionWithinRange(const ScrollPosition&) const;
234 int scrollX() const { return scrollPosition().x(); }
235 int scrollY() const { return scrollPosition().y(); }
237 // Scroll position used by web-exposed features (has legacy iOS behavior).
238 IntPoint contentsScrollPosition() const;
239 void setContentsScrollPosition(const IntPoint&);
242 int actualScrollX() const { return unobscuredContentRect().x(); }
243 int actualScrollY() const { return unobscuredContentRect().y(); }
244 // FIXME: maybe fix scrollPosition() on iOS to return the actual scroll position.
245 IntPoint actualScrollPosition() const { return unobscuredContentRect().location(); }
248 // scrollOffset() anchors its (0,0) point at the ScrollableArea's origin. When the Page has a
249 // header, the header is positioned at (0,0), ABOVE the start of the Document. So when a page with
250 // a header is pinned to the top, the scrollOffset() is (0,0), but the Document is actually at
251 // (0, -headerHeight()). documentScrollPositionRelativeToScrollableAreaOrigin() will return this
252 // version of the offset, which tracks the top of Document relative to where scrolling was achored.
253 ScrollPosition documentScrollPositionRelativeToScrollableAreaOrigin() const;
255 // scrollPostion() anchors its (0,0) point at the ScrollableArea's origin. The top of the scrolling
256 // layer does not represent the top of the view when there is a topContentInset. Additionally, as
257 // detailed above, the origin of the scrolling layer also does not necessarily correspond with the
258 // top of the document anyway, since there could also be header. documentScrollPositionRelativeToViewOrigin()
259 // will return a version of the current scroll offset which tracks the top of the Document
260 // relative to the very top of the view.
261 WEBCORE_EXPORT ScrollPosition documentScrollPositionRelativeToViewOrigin() const;
263 IntSize overhangAmount() const override;
265 void cacheCurrentScrollPosition() { m_cachedScrollPosition = scrollPosition(); }
266 ScrollPosition cachedScrollPosition() const { return m_cachedScrollPosition; }
268 // Functions for scrolling the view.
269 virtual void setScrollPosition(const ScrollPosition&);
270 void scrollBy(const IntSize& s) { return setScrollPosition(scrollPosition() + s); }
272 // This function scrolls by lines, pages or pixels.
273 bool scroll(ScrollDirection, ScrollGranularity);
275 // A logical scroll that just ends up calling the corresponding physical scroll() based off the document's writing mode.
276 bool logicalScroll(ScrollLogicalDirection, ScrollGranularity);
278 // Scroll the actual contents of the view (either blitting or invalidating as needed).
279 void scrollContents(const IntSize& scrollDelta);
281 // This gives us a means of blocking painting on our scrollbars until the first layout has occurred.
282 WEBCORE_EXPORT void setScrollbarsSuppressed(bool suppressed, bool repaintOnUnsuppress = false);
283 bool scrollbarsSuppressed() const { return m_scrollbarsSuppressed; }
285 WEBCORE_EXPORT IntPoint rootViewToContents(const IntPoint&) const;
286 WEBCORE_EXPORT IntPoint contentsToRootView(const IntPoint&) const;
287 IntRect rootViewToContents(const IntRect&) const;
288 WEBCORE_EXPORT IntRect contentsToRootView(const IntRect&) const;
290 IntPoint viewToContents(const IntPoint&) const;
291 IntPoint contentsToView(const IntPoint&) const;
293 IntRect viewToContents(IntRect) const;
294 IntRect contentsToView(IntRect) const;
296 IntPoint contentsToContainingViewContents(const IntPoint&) const;
297 IntRect contentsToContainingViewContents(IntRect) const;
299 WEBCORE_EXPORT IntPoint rootViewToTotalContents(const IntPoint&) const;
301 // Event coordinates are assumed to be in the coordinate space of a window that contains
302 // the entire widget hierarchy. It is up to the platform to decide what the precise definition
303 // of containing window is. (For example on Mac it is the containing NSWindow.)
304 WEBCORE_EXPORT IntPoint windowToContents(const IntPoint&) const;
305 WEBCORE_EXPORT IntPoint contentsToWindow(const IntPoint&) const;
306 WEBCORE_EXPORT IntRect windowToContents(const IntRect&) const;
307 WEBCORE_EXPORT IntRect contentsToWindow(const IntRect&) const;
309 // Functions for converting to and from screen coordinates.
310 WEBCORE_EXPORT IntRect contentsToScreen(const IntRect&) const;
311 IntPoint screenToContents(const IntPoint&) const;
313 // The purpose of this function is to answer whether or not the scroll view is currently visible. Animations and painting updates can be suspended if
314 // we know that we are either not in a window right now or if that window is not visible.
315 bool isOffscreen() const;
317 // Called when our frame rect changes (or the rect/scroll position of an ancestor changes).
318 void frameRectsChanged() override;
320 // Widget override to update our scrollbars and notify our contents of the resize.
321 void setFrameRect(const IntRect&) override;
323 // Widget override to notify our contents of a cliprect change.
324 void clipRectChanged() override;
326 // For platforms that need to hit test scrollbars from within the engine's event handlers (like Win32).
327 Scrollbar* scrollbarAtPoint(const IntPoint& windowPoint);
329 IntPoint convertChildToSelf(const Widget* child, const IntPoint& point) const
331 IntPoint newPoint = point;
332 if (!isScrollViewScrollbar(child))
333 newPoint = point - toIntSize(scrollPosition());
334 newPoint.moveBy(child->location());
338 IntPoint convertSelfToChild(const Widget* child, const IntPoint& point) const
340 IntPoint newPoint = point;
341 if (!isScrollViewScrollbar(child))
342 newPoint = point + toIntSize(scrollPosition());
343 newPoint.moveBy(-child->location());
347 // Widget override. Handles painting of the contents of the view as well as the scrollbars.
348 WEBCORE_EXPORT void paint(GraphicsContext&, const IntRect&) override;
349 void paintScrollbars(GraphicsContext&, const IntRect&);
351 // Widget overrides to ensure that our children's visibility status is kept up to date when we get shown and hidden.
352 WEBCORE_EXPORT void show() override;
353 WEBCORE_EXPORT void hide() override;
354 WEBCORE_EXPORT void setParentVisible(bool) override;
357 static const int noPanScrollRadius = 15;
358 void addPanScrollIcon(const IntPoint&);
359 void removePanScrollIcon();
360 void paintPanScrollIcon(GraphicsContext&);
362 virtual bool isPointInScrollbarCorner(const IntPoint&);
363 virtual bool scrollbarCornerPresent() const;
364 IntRect scrollCornerRect() const override;
365 virtual void paintScrollCorner(GraphicsContext&, const IntRect& cornerRect);
366 virtual void paintScrollbar(GraphicsContext&, Scrollbar&, const IntRect&);
368 IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const override;
369 IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const override;
370 IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoint&) const override;
371 IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoint&) const override;
373 void calculateAndPaintOverhangAreas(GraphicsContext&, const IntRect& dirtyRect);
375 bool isScrollView() const override { return true; }
377 WEBCORE_EXPORT void scrollOffsetChangedViaPlatformWidget(const ScrollOffset& oldOffset, const ScrollOffset& newOffset);
382 virtual void repaintContentRectangle(const IntRect&);
383 virtual void paintContents(GraphicsContext&, const IntRect& damageRect) = 0;
385 virtual void paintOverhangAreas(GraphicsContext&, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect);
387 void availableContentSizeChanged(AvailableSizeChangeReason) override;
388 virtual void addedOrRemovedScrollbar() = 0;
389 virtual void delegatesScrollingDidChange() { }
391 // These functions are used to create/destroy scrollbars.
392 // They return true if the scrollbar was added or removed.
393 bool setHasHorizontalScrollbar(bool, bool* contentSizeAffected = 0);
394 bool setHasVerticalScrollbar(bool, bool* contentSizeAffected = 0);
396 virtual void updateScrollCorner();
397 void invalidateScrollCornerRect(const IntRect&) override;
399 // Scroll the content by blitting the pixels.
400 virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
401 // Scroll the content by invalidating everything.
402 virtual void scrollContentsSlowPath(const IntRect& updateRect);
404 void setScrollOrigin(const IntPoint&, bool updatePositionAtAll, bool updatePositionSynchronously);
406 // Subclassed by FrameView to check the writing-mode of the document.
407 virtual bool isVerticalDocument() const { return true; }
408 virtual bool isFlippedDocument() const { return false; }
410 // Called to update the scrollbars to accurately reflect the state of the view.
411 void updateScrollbars(const ScrollPosition& desiredPosition);
413 float platformTopContentInset() const;
414 void platformSetTopContentInset(float);
416 virtual void handleDeferredScrollUpdateAfterContentSizeChange();
418 virtual bool shouldDeferScrollUpdateAfterContentSizeChange() { return false; }
420 virtual void scrollOffsetChangedViaPlatformWidgetImpl(const ScrollOffset&, const ScrollOffset&) { }
423 virtual void unobscuredContentSizeChanged() { }
427 IntRect visibleContentRectInternal(VisibleContentRectIncludesScrollbars, VisibleContentRectBehavior) const override;
428 WEBCORE_EXPORT IntRect unobscuredContentRectInternal(VisibleContentRectIncludesScrollbars = ExcludeScrollbars) const;
430 void completeUpdatesAfterScrollTo(const IntSize& scrollDelta);
432 RefPtr<Scrollbar> m_horizontalScrollbar;
433 RefPtr<Scrollbar> m_verticalScrollbar;
434 ScrollbarMode m_horizontalScrollbarMode;
435 ScrollbarMode m_verticalScrollbarMode;
437 bool m_horizontalScrollbarLock;
438 bool m_verticalScrollbarLock;
440 bool m_prohibitsScrolling;
442 HashSet<RefPtr<Widget>> m_children;
444 // This bool is unused on Mac OS because we directly ask the platform widget
445 // whether it is safe to blit on scroll.
446 bool m_canBlitOnScroll;
448 // FIXME: exposedContentRect is a very similar concept to fixedVisibleContentRect except it does not differentiate
449 // between exposed and unobscured areas. The two attributes should eventually be merged.
451 FloatRect m_exposedContentRect;
452 FloatSize m_unobscuredContentSize;
454 IntRect m_fixedVisibleContentRect;
456 ScrollPosition m_scrollPosition;
457 IntPoint m_cachedScrollPosition;
458 IntSize m_fixedLayoutSize;
459 IntSize m_contentsSize;
461 std::unique_ptr<IntSize> m_deferredScrollDelta; // Needed for WebKit scrolling
462 std::unique_ptr<std::pair<ScrollOffset, ScrollOffset>> m_deferredScrollOffsets; // Needed for platform widget scrolling
464 bool m_scrollbarsSuppressed;
466 bool m_inUpdateScrollbars;
467 unsigned m_updateScrollbarsPass;
469 IntPoint m_panScrollIconPoint;
470 bool m_drawPanScrollIcon;
471 bool m_useFixedLayout;
473 bool m_paintsEntireContents;
474 bool m_clipsRepaints;
475 bool m_delegatesScrolling;
480 IntRect rectToCopyOnScroll() const;
482 // Called when the scroll position within this view changes. FrameView overrides this to generate repaint invalidations.
483 virtual void updateLayerPositionsAfterScrolling() { }
484 virtual void updateCompositingLayersAfterScrolling() { }
486 void platformAddChild(Widget*);
487 void platformRemoveChild(Widget*);
488 void platformSetScrollbarModes();
489 void platformScrollbarModes(ScrollbarMode& horizontal, ScrollbarMode& vertical) const;
490 void platformSetCanBlitOnScroll(bool);
491 bool platformCanBlitOnScroll() const;
492 IntRect platformVisibleContentRect(bool includeScrollbars) const;
493 IntSize platformVisibleContentSize(bool includeScrollbars) const;
494 IntRect platformVisibleContentRectIncludingObscuredArea(bool includeScrollbars) const;
495 IntSize platformVisibleContentSizeIncludingObscuredArea(bool includeScrollbars) const;
496 void platformSetContentsSize();
497 IntRect platformContentsToScreen(const IntRect&) const;
498 IntPoint platformScreenToContents(const IntPoint&) const;
499 void platformSetScrollPosition(const IntPoint&);
500 bool platformScroll(ScrollDirection, ScrollGranularity);
501 void platformSetScrollbarsSuppressed(bool repaintOnUnsuppress);
502 void platformRepaintContentRectangle(const IntRect&);
503 bool platformIsOffscreen() const;
504 void platformSetScrollbarOverlayStyle(ScrollbarOverlayStyle);
506 void platformSetScrollOrigin(const IntPoint&, bool updatePositionAtAll, bool updatePositionSynchronously);
508 void calculateOverhangAreasForPainting(IntRect& horizontalOverhangRect, IntRect& verticalOverhangRect);
509 void updateOverhangAreas();
511 #if PLATFORM(COCOA) && defined __OBJC__
513 WEBCORE_EXPORT NSView* documentView() const;
516 NSScrollView<WebCoreFrameScrollView>* scrollView() const;
518 }; // class ScrollView
520 } // namespace WebCore
522 SPECIALIZE_TYPE_TRAITS_WIDGET(ScrollView, isScrollView())
524 #endif // ScrollView_h