From ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Mon, 16 May 2011 16:25:10 +0100 Subject: Merge WebKit at r76408: Initial merge by git. Change-Id: I5b91decbd693ccbf5c1b8354b37cd68cc9a1ea53 --- Source/WebCore/platform/Scrollbar.h | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) (limited to 'Source/WebCore/platform/Scrollbar.h') diff --git a/Source/WebCore/platform/Scrollbar.h b/Source/WebCore/platform/Scrollbar.h index 69e94a1..5db191a 100644 --- a/Source/WebCore/platform/Scrollbar.h +++ b/Source/WebCore/platform/Scrollbar.h @@ -36,32 +36,30 @@ namespace WebCore { class GraphicsContext; class IntRect; -class ScrollbarClient; -class ScrollbarTheme; class PlatformMouseEvent; +class ScrollableArea; +class ScrollbarTheme; class Scrollbar : public Widget { public: - enum ScrollSource { - FromScrollAnimator, - NotFromScrollAnimator, - }; + // Must be implemented by platforms that can't simply use the Scrollbar base class. Right now the only platform that is not using the base class is GTK. + static PassRefPtr createNativeScrollbar(ScrollableArea*, ScrollbarOrientation orientation, ScrollbarControlSize size); virtual ~Scrollbar(); - // Must be implemented by platforms that can't simply use the Scrollbar base class. Right now the only platform that is not using the base class is GTK. - static PassRefPtr createNativeScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize size); + // Called by the ScrollableArea when the scroll offset changes. + void offsetDidChange(); static int pixelsPerLineStep() { return 40; } static float minFractionToStepWhenPaging() { return 0.875f; } static int maxOverlapBetweenPages(); - void setClient(ScrollbarClient* client) { m_client = client; } - ScrollbarClient* client() const { return m_client; } + void disconnectFromScrollableArea() { m_scrollableArea = 0; } + ScrollableArea* scrollableArea() const { return m_scrollableArea; } virtual bool isCustomScrollbar() const { return false; } ScrollbarOrientation orientation() const { return m_orientation; } - + int value() const { return lroundf(m_currentPos); } float currentPos() const { return m_currentPos; } int pressedPos() const { return m_pressedPos; } @@ -73,18 +71,15 @@ public: int lineStep() const { return m_lineStep; } int pageStep() const { return m_pageStep; } float pixelStep() const { return m_pixelStep; } - + ScrollbarPart pressedPart() const { return m_pressedPart; } ScrollbarPart hoveredPart() const { return m_hoveredPart; } virtual void setHoveredPart(ScrollbarPart); virtual void setPressedPart(ScrollbarPart); void setSteps(int lineStep, int pageStep, int pixelsPerStep = 1); - bool setValue(int, ScrollSource source); void setProportion(int visibleSize, int totalSize); void setPressedPos(int p) { m_pressedPos = p; } - - bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1); virtual void paint(GraphicsContext*, const IntRect& damageRect); @@ -130,7 +125,7 @@ public: virtual IntPoint convertFromContainingView(const IntPoint&) const; protected: - Scrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize, ScrollbarTheme* = 0); + Scrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize, ScrollbarTheme* = 0); void updateThumb(); virtual void updateThumbPosition(); @@ -145,7 +140,7 @@ protected: void moveThumb(int pos); - ScrollbarClient* m_client; + ScrollableArea* m_scrollableArea; ScrollbarOrientation m_orientation; ScrollbarControlSize m_controlSize; ScrollbarTheme* m_theme; @@ -172,10 +167,8 @@ protected: private: virtual bool isScrollbar() const { return true; } virtual AXObjectCache* axObjectCache() const; - - bool setCurrentPos(float pos, ScrollSource source); }; -} +} // namespace WebCore -#endif +#endif // Scrollbar_h -- cgit v1.1