18e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/*
28e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved.
35f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian * Copyright (C) 2009 Holger Hans Peter Freyther
48e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *
58e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Redistribution and use in source and binary forms, with or without
68e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * modification, are permitted provided that the following conditions
78e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * are met:
88e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 1. Redistributions of source code must retain the above copyright
98e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *    notice, this list of conditions and the following disclaimer.
108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 2. Redistributions in binary form must reproduce the above copyright
118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *    notice, this list of conditions and the following disclaimer in the
128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *    documentation and/or other materials provided with the distribution.
138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *
148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */
268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#ifndef ScrollView_h
288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define ScrollView_h
298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "IntRect.h"
318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "Scrollbar.h"
32ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddbBen Murdoch#include "ScrollableArea.h"
338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "ScrollTypes.h"
348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "Widget.h"
358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include <wtf/HashSet.h>
378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#if PLATFORM(MAC) && defined __OBJC__
398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project@protocol WebCoreFrameScrollView;
408e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#endif
418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#if PLATFORM(GTK)
435abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick#include "GRefPtrGtk.h"
448e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projecttypedef struct _GtkAdjustment GtkAdjustment;
458e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#endif
468e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#if PLATFORM(WX)
488e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectclass wxScrollWinEvent;
498e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#endif
508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
518e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectnamespace WebCore {
528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
538e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectclass HostWindow;
548e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectclass Scrollbar;
558e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
56a3d6f6aedc8ed044682d65258bb964c64fc7511bNicolas Roard#if PLATFORM(ANDROID)
57a3d6f6aedc8ed044682d65258bb964c64fc7511bNicolas Roardclass FrameView;
58a3d6f6aedc8ed044682d65258bb964c64fc7511bNicolas Roard#endif
59a3d6f6aedc8ed044682d65258bb964c64fc7511bNicolas Roard
60ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddbBen Murdochclass ScrollView : public Widget, public ScrollableArea {
618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectpublic:
628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    ~ScrollView();
638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
64ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddbBen Murdoch    // ScrollableArea functions.  FrameView overrides the others.
655abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick    virtual int scrollSize(ScrollbarOrientation orientation) const;
66ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddbBen Murdoch    virtual int scrollPosition(Scrollbar*) const;
67ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddbBen Murdoch    virtual void setScrollOffset(const IntPoint&);
682fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    virtual void didCompleteRubberBand(const IntSize&) const;
692bde8e466a4451c7319e3a072d118917957d6554Steve Block    virtual void notifyPageThatContentAreaWillPaint() const;
702daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    virtual bool isScrollCornerVisible() const;
712fc2651226baac27029e38c9d6ef883fa32084dbSteve Block
72ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddbBen Murdoch    // NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea.
73ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddbBen Murdoch    virtual void scrollTo(const IntSize& newOffset);
74ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddbBen Murdoch
7521939df44de1705786c545cd1bf519d47250322dBen Murdoch    // The window thats hosts the ScrollView. The ScrollView will communicate scrolls and repaints to the
768e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // host window in the window's coordinate space.
778e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    virtual HostWindow* hostWindow() const = 0;
788e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
7921939df44de1705786c545cd1bf519d47250322dBen Murdoch    // Returns a clip rect in host window coordinates. Used to clip the blit on a scroll.
808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    virtual IntRect windowClipRect(bool clipToContents = true) const = 0;
818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
8221939df44de1705786c545cd1bf519d47250322dBen Murdoch    // Functions for child manipulation and inspection.
830bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    const HashSet<RefPtr<Widget> >* children() const { return &m_children; }
840bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    void addChild(PassRefPtr<Widget>);
858e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void removeChild(Widget*);
868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
8721939df44de1705786c545cd1bf519d47250322dBen Murdoch    // If the scroll view does not use a native widget, then it will have cross-platform Scrollbars. These functions
888e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // can be used to obtain those scrollbars.
89ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddbBen Murdoch    virtual Scrollbar* horizontalScrollbar() const { return m_horizontalScrollbar.get(); }
90ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddbBen Murdoch    virtual Scrollbar* verticalScrollbar() const { return m_verticalScrollbar.get(); }
918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    bool isScrollViewScrollbar(const Widget* child) const { return horizontalScrollbar() == child || verticalScrollbar() == child; }
928e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
932daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    void positionScrollbarLayers();
942daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch
9521939df44de1705786c545cd1bf519d47250322dBen Murdoch    // Functions for setting and retrieving the scrolling mode in each axis (horizontal/vertical). The mode has values of
9621939df44de1705786c545cd1bf519d47250322dBen Murdoch    // AlwaysOff, AlwaysOn, and Auto. AlwaysOff means never show a scrollbar, AlwaysOn means always show a scrollbar.
978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // Auto means show a scrollbar only when one is needed.
9821939df44de1705786c545cd1bf519d47250322dBen Murdoch    // Note that for platforms with native widgets, these modes are considered advisory. In other words the underlying native
998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // widget may choose not to honor the requested modes.
100dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode verticalMode, bool horizontalLock = false, bool verticalLock = false);
101dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setHorizontalScrollbarMode(ScrollbarMode mode, bool lock = false) { setScrollbarModes(mode, verticalScrollbarMode(), lock, verticalScrollbarLock()); }
102dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setVerticalScrollbarMode(ScrollbarMode mode, bool lock = false) { setScrollbarModes(horizontalScrollbarMode(), mode, horizontalScrollbarLock(), lock); };
1038e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void scrollbarModes(ScrollbarMode& horizontalMode, ScrollbarMode& verticalMode) const;
1048e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    ScrollbarMode horizontalScrollbarMode() const { ScrollbarMode horizontal, vertical; scrollbarModes(horizontal, vertical); return horizontal; }
1058e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    ScrollbarMode verticalScrollbarMode() const { ScrollbarMode horizontal, vertical; scrollbarModes(horizontal, vertical); return vertical; }
106dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
107dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setHorizontalScrollbarLock(bool lock = true) { m_horizontalScrollbarLock = lock; }
108dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool horizontalScrollbarLock() const { return m_horizontalScrollbarLock; }
109dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setVerticalScrollbarLock(bool lock = true) { m_verticalScrollbarLock = lock; }
110dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool verticalScrollbarLock() const { return m_verticalScrollbarLock; }
111dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
112dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    void setScrollingModesLock(bool lock = true) { m_horizontalScrollbarLock = m_verticalScrollbarLock = lock; }
113dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
114643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    virtual void setCanHaveScrollbars(bool);
1158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    bool canHaveScrollbars() const { return horizontalScrollbarMode() != ScrollbarAlwaysOff || verticalScrollbarMode() != ScrollbarAlwaysOff; }
1168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
1174576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wang    virtual bool avoidScrollbarCreation() const { return false; }
118dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
119643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    // By default you only receive paint events for the area that is visible. In the case of using a
12021939df44de1705786c545cd1bf519d47250322dBen Murdoch    // tiled backing store, this function can be set, so that the view paints the entire contents.
121643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    bool paintsEntireContents() const { return m_paintsEntireContents; }
122643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    void setPaintsEntireContents(bool);
123643ca7872b450ea4efacab6188849e5aac2ba161Steve Block
124cad810f21b803229eb11403f9209855525a25d57Steve Block    // By default, paint events are clipped to the visible area.  If set to
125cad810f21b803229eb11403f9209855525a25d57Steve Block    // false, paint events are no longer clipped.  paintsEntireContents() implies !clipsRepaints().
126cad810f21b803229eb11403f9209855525a25d57Steve Block    bool clipsRepaints() const { return m_clipsRepaints; }
127cad810f21b803229eb11403f9209855525a25d57Steve Block    void setClipsRepaints(bool);
128cad810f21b803229eb11403f9209855525a25d57Steve Block
1294576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wang    // By default programmatic scrolling is handled by WebCore and not by the UI application.
1304576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wang    // In the case of using a tiled backing store, this mode can be set, so that the scroll requests
1314576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wang    // are delegated to the UI application.
1324576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wang    bool delegatesScrolling() const { return m_delegatesScrolling; }
1334576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wang    void setDelegatesScrolling(bool);
1344576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wang
135635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project    // Overridden by FrameView to create custom CSS scrollbars if applicable.
136635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project    virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation);
137635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project
1388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // If the prohibits scrolling flag is set, then all scrolling in the view (even programmatic scrolling) is turned off.
1398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void setProhibitsScrolling(bool b) { m_prohibitsScrolling = b; }
1408e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    bool prohibitsScrolling() const { return m_prohibitsScrolling; }
1418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
14221939df44de1705786c545cd1bf519d47250322dBen Murdoch    // Whether or not a scroll view will blit visible contents when it is scrolled. Blitting is disabled in situations
1438e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // where it would cause rendering glitches (such as with fixed backgrounds or when the view is partially transparent).
1448e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void setCanBlitOnScroll(bool);
145635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project    bool canBlitOnScroll() const;
1468e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
1478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // The visible content rect has a location that is the scrolled offset of the document. The width and height are the viewport width
14821939df44de1705786c545cd1bf519d47250322dBen Murdoch    // and height. By default the scrollbars themselves are excluded from this rectangle, but an optional boolean argument allows them to be
1498e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // included.
1506b70adc33054f8aee8c54d0f460458a9df11b8a5Russell Brenner    // In the situation the client is responsible for the scrolling (ie. with a tiled backing store) it is possible to use
1516b70adc33054f8aee8c54d0f460458a9df11b8a5Russell Brenner    // the actualVisibleContentRect instead, though this must be updated manually, e.g after panning ends.
1528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    IntRect visibleContentRect(bool includeScrollbars = false) const;
1536b70adc33054f8aee8c54d0f460458a9df11b8a5Russell Brenner    IntRect actualVisibleContentRect() const { return m_actualVisibleContentRect.isEmpty() ? visibleContentRect() : m_actualVisibleContentRect; }
1546b70adc33054f8aee8c54d0f460458a9df11b8a5Russell Brenner    void setActualVisibleContentRect(const IntRect& actualVisibleContentRect) { m_actualVisibleContentRect = actualVisibleContentRect; }
1558e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    int visibleWidth() const { return visibleContentRect().width(); }
1568e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    int visibleHeight() const { return visibleContentRect().height(); }
157635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project
15821939df44de1705786c545cd1bf519d47250322dBen Murdoch    // Functions for getting/setting the size webkit should use to layout the contents. By default this is the same as the visible
15921939df44de1705786c545cd1bf519d47250322dBen Murdoch    // content size. Explicitly setting a layout size value will cause webkit to layout the contents using this size instead.
160635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project    int layoutWidth() const;
161635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project    int layoutHeight() const;
162635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project    IntSize fixedLayoutSize() const;
163635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project    void setFixedLayoutSize(const IntSize&);
164635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project    bool useFixedLayout() const;
165635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project    void setUseFixedLayout(bool enable);
1668e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
16721939df44de1705786c545cd1bf519d47250322dBen Murdoch    // Functions for getting/setting the size of the document contained inside the ScrollView (as an IntSize or as individual width and height
1688e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // values).
1695f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian    IntSize contentsSize() const; // Always at least as big as the visibleWidth()/visibleHeight().
1708e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    int contentsWidth() const { return contentsSize().width(); }
1718e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    int contentsHeight() const { return contentsSize().height(); }
172635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project    virtual void setContentsSize(const IntSize&);
17309b60ab8488b362c96df8f268613aafaeebfcfa1Steve Block
174a551d0e188b3b4a05e05cc70ff0838c3165c10f6Grace Kloba#if PLATFORM(ANDROID)
175541af8dff4d592277d0f835deafaf728dad8bc57Mangesh Ghiware    int actualWidth() const;
176541af8dff4d592277d0f835deafaf728dad8bc57Mangesh Ghiware    int actualHeight() const;
177541af8dff4d592277d0f835deafaf728dad8bc57Mangesh Ghiware    int actualScrollX() const;
178541af8dff4d592277d0f835deafaf728dad8bc57Mangesh Ghiware    int actualScrollY() const;
179a3d6f6aedc8ed044682d65258bb964c64fc7511bNicolas Roard    FrameView* frameView();
180a551d0e188b3b4a05e05cc70ff0838c3165c10f6Grace Kloba#endif
181a551d0e188b3b4a05e05cc70ff0838c3165c10f6Grace Kloba
18221939df44de1705786c545cd1bf519d47250322dBen Murdoch    // Functions for querying the current scrolled position (both as a point, a size, or as individual X and Y values).
1838e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    IntPoint scrollPosition() const { return visibleContentRect().location(); }
1848e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    IntSize scrollOffset() const { return visibleContentRect().location() - IntPoint(); } // Gets the scrolled position as an IntSize. Convenient for adding to other sizes.
1858e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    IntPoint maximumScrollPosition() const; // The maximum position we can be scrolled to.
1864a156157940f51b91eadd76f6c86f862ec0a1da0Ben Murdoch    IntPoint minimumScrollPosition() const; // The minimum position we can be scrolled to.
187f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    // Adjust the passed in scroll position to keep it between the minimum and maximum positions.
1884a156157940f51b91eadd76f6c86f862ec0a1da0Ben Murdoch    IntPoint adjustScrollPositionWithinRange(const IntPoint&) const;
1898e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    int scrollX() const { return scrollPosition().x(); }
1908e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    int scrollY() const { return scrollPosition().y(); }
1912fc2651226baac27029e38c9d6ef883fa32084dbSteve Block
1922fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    IntSize overhangAmount() const;
1932fc2651226baac27029e38c9d6ef883fa32084dbSteve Block
1942daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    void cacheCurrentScrollPosition() { m_cachedScrollPosition = scrollPosition(); }
1952daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    IntPoint cachedScrollPosition() const { return m_cachedScrollPosition; }
1962daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch
19721939df44de1705786c545cd1bf519d47250322dBen Murdoch    // Functions for scrolling the view.
1988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void setScrollPosition(const IntPoint&);
1998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void scrollBy(const IntSize& s) { return setScrollPosition(scrollPosition() + s); }
20021939df44de1705786c545cd1bf519d47250322dBen Murdoch
20121939df44de1705786c545cd1bf519d47250322dBen Murdoch    // This function scrolls by lines, pages or pixels.
2028e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    bool scroll(ScrollDirection, ScrollGranularity);
203f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch
204f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    // A logical scroll that just ends up calling the corresponding physical scroll() based off the document's writing mode.
205f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    bool logicalScroll(ScrollLogicalDirection, ScrollGranularity);
206f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch
2078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // Scroll the actual contents of the view (either blitting or invalidating as needed).
2088e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void scrollContents(const IntSize& scrollDelta);
2098e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // This gives us a means of blocking painting on our scrollbars until the first layout has occurred.
2118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void setScrollbarsSuppressed(bool suppressed, bool repaintOnUnsuppress = false);
2128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    bool scrollbarsSuppressed() const { return m_scrollbarsSuppressed; }
2138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // Event coordinates are assumed to be in the coordinate space of a window that contains
2158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // the entire widget hierarchy. It is up to the platform to decide what the precise definition
2168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // of containing window is. (For example on Mac it is the containing NSWindow.)
2178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    IntPoint windowToContents(const IntPoint&) const;
2188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    IntPoint contentsToWindow(const IntPoint&) const;
2198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    IntRect windowToContents(const IntRect&) const;
2208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    IntRect contentsToWindow(const IntRect&) const;
2218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
22221939df44de1705786c545cd1bf519d47250322dBen Murdoch    // Functions for converting to and from screen coordinates.
2238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    IntRect contentsToScreen(const IntRect&) const;
2248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    IntPoint screenToContents(const IntPoint&) const;
2258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
22621939df44de1705786c545cd1bf519d47250322dBen Murdoch    // 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
2278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // we know that we are either not in a window right now or if that window is not visible.
2288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    bool isOffscreen() const;
2298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
23021939df44de1705786c545cd1bf519d47250322dBen Murdoch    // These functions are used to enable scrollbars to avoid window resizer controls that overlap the scroll view. This happens on Mac
2318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // for example.
2328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    virtual IntRect windowResizerRect() const { return IntRect(); }
2338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    bool containsScrollbarsAvoidingResizer() const;
2348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void adjustScrollbarsAvoidingResizerCount(int overlapDelta);
235bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen    void windowResizerRectChanged();
236bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen
2378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    virtual void setParent(ScrollView*); // Overridden to update the overlapping scrollbar count.
2388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // Called when our frame rect changes (or the rect/scroll position of an ancestor changes).
240635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project    virtual void frameRectsChanged();
2418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // Widget override to update our scrollbars and notify our contents of the resize.
2438e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    virtual void setFrameRect(const IntRect&);
24481bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch    virtual void setBoundsSize(const IntSize&);
2458e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2468e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // For platforms that need to hit test scrollbars from within the engine's event handlers (like Win32).
2470bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    Scrollbar* scrollbarAtPoint(const IntPoint& windowPoint);
2488e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
24921939df44de1705786c545cd1bf519d47250322dBen Murdoch    // This function exists for scrollviews that need to handle wheel events manually.
2508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // On Mac the underlying NSScrollView just does the scrolling, but on other platforms
25121939df44de1705786c545cd1bf519d47250322dBen Murdoch    // (like Windows), we need this function in order to do the scroll ourselves.
2528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void wheelEvent(PlatformWheelEvent&);
2532fc2651226baac27029e38c9d6ef883fa32084dbSteve Block#if ENABLE(GESTURE_EVENTS)
2542fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    void gestureEvent(const PlatformGestureEvent&);
2552fc2651226baac27029e38c9d6ef883fa32084dbSteve Block#endif
2568e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2578e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    IntPoint convertChildToSelf(const Widget* child, const IntPoint& point) const
2588e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    {
2598e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        IntPoint newPoint = point;
2608e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        if (!isScrollViewScrollbar(child))
2618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project            newPoint = point - scrollOffset();
2628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        newPoint.move(child->x(), child->y());
2638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        return newPoint;
2648e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    }
2658e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2668e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    IntPoint convertSelfToChild(const Widget* child, const IntPoint& point) const
2678e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    {
2688e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        IntPoint newPoint = point;
2698e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        if (!isScrollViewScrollbar(child))
2708e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project            newPoint = point + scrollOffset();
2718e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        newPoint.move(-child->x(), -child->y());
2728e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project        return newPoint;
2738e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    }
2748e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
27521939df44de1705786c545cd1bf519d47250322dBen Murdoch    // Widget override. Handles painting of the contents of the view as well as the scrollbars.
2768e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    virtual void paint(GraphicsContext*, const IntRect&);
277cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block    void paintScrollbars(GraphicsContext*, const IntRect&);
2788e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2798e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // Widget overrides to ensure that our children's visibility status is kept up to date when we get shown and hidden.
2808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    virtual void show();
2818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    virtual void hide();
2828e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    virtual void setParentVisible(bool);
2838e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2840bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    // Pan scrolling.
2850bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    static const int noPanScrollRadius = 15;
2868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void addPanScrollIcon(const IntPoint&);
2878e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void removePanScrollIcon();
288cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block    void paintPanScrollIcon(GraphicsContext*);
2898e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2900bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    virtual bool isPointInScrollbarCorner(const IntPoint&);
2918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    virtual bool scrollbarCornerPresent() const;
2922daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    virtual IntRect scrollCornerRect() const;
2932daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect);
2948e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
2950bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const;
2960bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const;
2970bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoint&) const;
2980bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoint&) const;
2990bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch
3002daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    bool containsScrollableAreaWithOverlayScrollbars() const { return m_containsScrollableAreaWithOverlayScrollbars; }
3012daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    void setContainsScrollableAreaWithOverlayScrollbars(bool contains) { m_containsScrollableAreaWithOverlayScrollbars = contains; }
3022daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch
3038e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectprotected:
3040bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    ScrollView();
3050bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch
3068e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    virtual void repaintContentRectangle(const IntRect&, bool now = false);
3078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    virtual void paintContents(GraphicsContext*, const IntRect& damageRect) = 0;
3082fc2651226baac27029e38c9d6ef883fa32084dbSteve Block
3092fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    void calculateOverhangAreasForPainting(IntRect& horizontalOverhangRect, IntRect& verticalOverhangRect);
3102fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    virtual void paintOverhangAreas(GraphicsContext*, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect);
3112fc2651226baac27029e38c9d6ef883fa32084dbSteve Block
3128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    virtual void contentsResized() = 0;
3138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    virtual void visibleContentsResized() = 0;
314cac0f67c402d107cdb10971b95719e2ff9c7c76bSteve Block
31581bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch    IntSize boundsSize() const { return m_boundsSize; }
31681bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch    void setInitialBoundsSize(const IntSize&);
31781bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch
31821939df44de1705786c545cd1bf519d47250322dBen Murdoch    // These functions are used to create/destroy scrollbars.
3198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void setHasHorizontalScrollbar(bool);
3208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void setHasVerticalScrollbar(bool);
3218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
322231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    virtual void updateScrollCorner();
3232daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    virtual void invalidateScrollCornerRect(const IntRect&);
324dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
325e14391e94c850b8bd03680c23b38978db68687a8John Reck    // Scroll the content by blitting the pixels.
32606ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen    virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
327e14391e94c850b8bd03680c23b38978db68687a8John Reck    // Scroll the content by invalidating everything.
328e14391e94c850b8bd03680c23b38978db68687a8John Reck    virtual void scrollContentsSlowPath(const IntRect& updateRect);
32906ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen
3302fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    void setScrollOrigin(const IntPoint&, bool updatePositionAtAll, bool updatePositionSynchronously);
331f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    IntPoint scrollOrigin() { return m_scrollOrigin; }
332f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch
333f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    // Subclassed by FrameView to check the writing-mode of the document.
334f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    virtual bool isVerticalDocument() const { return true; }
335f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    virtual bool isFlippedDocument() const { return false; }
3364a156157940f51b91eadd76f6c86f862ec0a1da0Ben Murdoch
3378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectprivate:
3388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    RefPtr<Scrollbar> m_horizontalScrollbar;
3398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    RefPtr<Scrollbar> m_verticalScrollbar;
3408e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    ScrollbarMode m_horizontalScrollbarMode;
3418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    ScrollbarMode m_verticalScrollbarMode;
342dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
343dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool m_horizontalScrollbarLock;
344dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block    bool m_verticalScrollbarLock;
345dcc8cf2e65d1aa555cce12431a16547e66b469eeSteve Block
3468e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    bool m_prohibitsScrolling;
3478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
3480bf48ef3be53ddaa52bbead65dfd75bf90e7a2b5Ben Murdoch    HashSet<RefPtr<Widget> > m_children;
349635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project
350635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project    // This bool is unused on Mac OS because we directly ask the platform widget
351635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project    // whether it is safe to blit on scroll.
3528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    bool m_canBlitOnScroll;
353635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project
3546b70adc33054f8aee8c54d0f460458a9df11b8a5Russell Brenner    IntRect m_actualVisibleContentRect;
3558e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    IntSize m_scrollOffset; // FIXME: Would rather store this as a position, but we will wait to make this change until more code is shared.
3562daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    IntPoint m_cachedScrollPosition;
357635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project    IntSize m_fixedLayoutSize;
3588e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    IntSize m_contentsSize;
3598e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
3608e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    int m_scrollbarsAvoidingResizer;
3618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    bool m_scrollbarsSuppressed;
3628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
3638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    bool m_inUpdateScrollbars;
3645f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian    unsigned m_updateScrollbarsPass;
3658e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
3668e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    IntPoint m_panScrollIconPoint;
3678e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    bool m_drawPanScrollIcon;
368635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project    bool m_useFixedLayout;
3698e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
370643ca7872b450ea4efacab6188849e5aac2ba161Steve Block    bool m_paintsEntireContents;
371cad810f21b803229eb11403f9209855525a25d57Steve Block    bool m_clipsRepaints;
3724576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wang    bool m_delegatesScrolling;
3734576aa36e9a9671459299c7963ac95aa94beaea9Shimeng (Simon) Wang
3742daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    bool m_containsScrollableAreaWithOverlayScrollbars;
3752daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch
37681bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch    IntSize m_boundsSize;
37781bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch
3788e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void init();
3798e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void destroy();
3808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
3818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    // Called to update the scrollbars to accurately reflect the state of the view.
3828e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void updateScrollbars(const IntSize& desiredOffset);
3838e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
38421939df44de1705786c545cd1bf519d47250322dBen Murdoch    // Called when the scroll position within this view changes.  FrameView overrides this to generate repaint invalidations.
385545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch    virtual void repaintFixedElementsAfterScrolling() {}
38621939df44de1705786c545cd1bf519d47250322dBen Murdoch
3878e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void platformInit();
3888e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void platformDestroy();
3898e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void platformAddChild(Widget*);
3908e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void platformRemoveChild(Widget*);
3918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void platformSetScrollbarModes();
3928e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void platformScrollbarModes(ScrollbarMode& horizontal, ScrollbarMode& vertical) const;
393635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project    void platformSetCanBlitOnScroll(bool);
394635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project    bool platformCanBlitOnScroll() const;
3958e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    IntRect platformVisibleContentRect(bool includeScrollbars) const;
3968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    IntSize platformContentsSize() const;
3978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void platformSetContentsSize();
3988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    IntRect platformContentsToScreen(const IntRect&) const;
3998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    IntPoint platformScreenToContents(const IntPoint&) const;
4008e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void platformSetScrollPosition(const IntPoint&);
4018e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    bool platformScroll(ScrollDirection, ScrollGranularity);
4028e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void platformSetScrollbarsSuppressed(bool repaintOnUnsuppress);
4038e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void platformRepaintContentRectangle(const IntRect&, bool now);
4048e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    bool platformIsOffscreen() const;
4054a156157940f51b91eadd76f6c86f862ec0a1da0Ben Murdoch
4062fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    void platformSetScrollOrigin(const IntPoint&, bool updatePositionAtAll, bool updatePositionSynchronously);
4078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
408541af8dff4d592277d0f835deafaf728dad8bc57Mangesh Ghiware#if PLATFORM(ANDROID)
409541af8dff4d592277d0f835deafaf728dad8bc57Mangesh Ghiware    int platformActualWidth() const;
410541af8dff4d592277d0f835deafaf728dad8bc57Mangesh Ghiware    int platformActualHeight() const;
411541af8dff4d592277d0f835deafaf728dad8bc57Mangesh Ghiware    int platformActualScrollX() const;
412541af8dff4d592277d0f835deafaf728dad8bc57Mangesh Ghiware    int platformActualScrollY() const;
413541af8dff4d592277d0f835deafaf728dad8bc57Mangesh Ghiware#endif
414541af8dff4d592277d0f835deafaf728dad8bc57Mangesh Ghiware
4158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#if PLATFORM(MAC) && defined __OBJC__
4168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectpublic:
4178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NSView* documentView() const;
4188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
4198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectprivate:
4208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    NSScrollView<WebCoreFrameScrollView>* scrollView() const;
4218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#endif
4228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
4238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#if PLATFORM(GTK)
4248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectpublic:
4258a0914b749bbe7da7768e07a7db5c6d4bb09472bSteve Block    void setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj, bool resetValues = true);
426e14391e94c850b8bd03680c23b38978db68687a8John Reck    void setHorizontalAdjustment(GtkAdjustment* hadj, bool resetValues = true);
427e14391e94c850b8bd03680c23b38978db68687a8John Reck    void setVerticalAdjustment(GtkAdjustment* vadj, bool resetValues = true);
4288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void setScrollOffset(const IntSize& offset) { m_scrollOffset = offset; }
4295abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick
4305abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrickprivate:
431cad810f21b803229eb11403f9209855525a25d57Steve Block    GRefPtr<GtkAdjustment> m_horizontalAdjustment;
432cad810f21b803229eb11403f9209855525a25d57Steve Block    GRefPtr<GtkAdjustment> m_verticalAdjustment;
4338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#endif
4348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
4358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#if PLATFORM(WX)
4368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectpublic:
4378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    virtual void setPlatformWidget(wxWindow*);
4388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    void adjustScrollbars(int x = -1, int y = -1, bool refresh = true);
4398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectprivate:
4408e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    class ScrollViewPrivate;
4418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project    ScrollViewPrivate* m_data;
4428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#endif
4438e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
4448e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#ifdef ANDROID_CAPTURE_OFFSCREEN_PAINTS
44557a47dd4f75b9c15804c3c61479540cfdc11bd6eBen Murdochpublic:
446025ac4e283bb4b48f580d48541224e3996dc6f84Cary Clark    // capture parts of rect not contained by vis
447025ac4e283bb4b48f580d48541224e3996dc6f84Cary Clark    void platformOffscreenContentRectangle(const IntRect& vis,
448025ac4e283bb4b48f580d48541224e3996dc6f84Cary Clark        const IntRect& rect);
4498e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#endif
4508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}; // class ScrollView
4518e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
4528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} // namespace WebCore
4538e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
4548e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#endif // ScrollView_h
455