[FreeType] Incorrect application of glyph positioning in the Y direction
[WebKit-https.git] / Source / WebCore / platform / mac / ScrollAnimatorMac.h
index 44a3d32..ff733c1 100644 (file)
@@ -1,5 +1,6 @@
+
 /*
- * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011, 2014-2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef ScrollAnimatorMac_h
-#define ScrollAnimatorMac_h
+#pragma once
 
 #if ENABLE(SMOOTH_SCROLLING)
 
+#include "IntRect.h"
 #include "FloatPoint.h"
 #include "FloatSize.h"
-#include "HeaderDetection.h"
 #include "ScrollAnimator.h"
 #include "Timer.h"
-#include "WebCoreSystemInterface.h"
 #include <wtf/RetainPtr.h>
 
-#ifdef __OBJC__
-@class ScrollAnimationHelperDelegate;
-@class ScrollbarPainterDelegate;
-@class ScrollbarPainterControllerDelegate;
-@class ScrollbarPainterDelegate;
-#else
-class ScrollAnimationHelperDelegate;
-class ScrollbarPainterDelegate;
-class ScrollbarPainterControllerDelegate;
-class ScrollbarPainterDelegate;
-#endif
+OBJC_CLASS WebScrollAnimationHelperDelegate;
+OBJC_CLASS WebScrollerImpPairDelegate;
+OBJC_CLASS WebScrollerImpDelegate;
+
+typedef id ScrollerImpPair;
 
 namespace WebCore {
 
 class Scrollbar;
 
 class ScrollAnimatorMac : public ScrollAnimator {
+
 public:
-    ScrollAnimatorMac(ScrollableArea*);
+    ScrollAnimatorMac(ScrollableArea&);
     virtual ~ScrollAnimatorMac();
 
-    virtual bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier);
-    virtual void scrollToOffsetWithoutAnimation(const FloatPoint&);
-
-#if ENABLE(RUBBER_BANDING)
-    virtual void handleWheelEvent(PlatformWheelEvent&);
-#if ENABLE(GESTURE_EVENTS)
-    virtual void handleGestureEvent(const PlatformGestureEvent&);
-#endif
-#endif
-
-    virtual void cancelAnimations();
-
-    void immediateScrollToPoint(const FloatPoint& newPosition);
-    void immediateScrollByDeltaX(float deltaX);
-    void immediateScrollByDeltaY(float deltaY);
-
-    void setIsDrawingIntoLayer(bool b) { m_drawingIntoLayer = b; }
-    bool isDrawingIntoLayer() const { return m_drawingIntoLayer; }
-
+    void immediateScrollToPositionForScrollAnimation(const FloatPoint& newPosition);
     bool haveScrolledSincePageLoad() const { return m_haveScrolledSincePageLoad; }
 
-#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
+    void updateScrollerStyle();
+
     bool scrollbarPaintTimerIsActive() const;
     void startScrollbarPaintTimer();
     void stopScrollbarPaintTimer();
-#endif
+
+    void setVisibleScrollerThumbRect(const IntRect&);
+
+    bool scrollbarsCanBeActive() const final;
 
 private:
     RetainPtr<id> m_scrollAnimationHelper;
-    RetainPtr<ScrollAnimationHelperDelegate> m_scrollAnimationHelperDelegate;
+    RetainPtr<WebScrollAnimationHelperDelegate> m_scrollAnimationHelperDelegate;
+
+    RetainPtr<ScrollerImpPair> m_scrollerImpPair;
+    RetainPtr<WebScrollerImpPairDelegate> m_scrollerImpPairDelegate;
+    RetainPtr<WebScrollerImpDelegate> m_horizontalScrollerImpDelegate;
+    RetainPtr<WebScrollerImpDelegate> m_verticalScrollerImpDelegate;
+
+    void initialScrollbarPaintTimerFired();
+    Timer m_initialScrollbarPaintTimer;
 
-#if defined(USE_WK_SCROLLBAR_PAINTER_AND_CONTROLLER)
-    RetainPtr<WKScrollbarPainterControllerRef> m_scrollbarPainterController;
-    RetainPtr<ScrollbarPainterControllerDelegate> m_scrollbarPainterControllerDelegate;
-    RetainPtr<id> m_scrollbarPainterDelegate;
+    void sendContentAreaScrolledTimerFired();
+    Timer m_sendContentAreaScrolledTimer;
+    FloatSize m_contentAreaScrolledTimerScrollDelta;
 
-    void initialScrollbarPaintTimerFired(Timer<ScrollAnimatorMac>*);
-    Timer<ScrollAnimatorMac> m_initialScrollbarPaintTimer;
+    bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier) override;
+    void scrollToOffsetWithoutAnimation(const FloatPoint&, ScrollClamping) override;
+
+#if ENABLE(RUBBER_BANDING)
+    bool shouldForwardWheelEventsToParent(const PlatformWheelEvent&);
+    bool handleWheelEvent(const PlatformWheelEvent&) override;
 #endif
+
+    void handleWheelEventPhase(PlatformWheelEventPhase) override;
+
+    void cancelAnimations() override;
     
-    virtual void notityPositionChanged();
-    virtual void contentAreaWillPaint() const;
-    virtual void mouseEnteredContentArea() const;
-    virtual void mouseExitedContentArea() const;
-    virtual void mouseMovedInContentArea() const;
-    virtual void willStartLiveResize();
-    virtual void contentsResized() const;
-    virtual void willEndLiveResize();
-    virtual void contentAreaDidShow() const;
-    virtual void contentAreaDidHide() const;
-
-    virtual void didAddVerticalScrollbar(Scrollbar*);
-    virtual void willRemoveVerticalScrollbar(Scrollbar*);
-    virtual void didAddHorizontalScrollbar(Scrollbar*);
-    virtual void willRemoveHorizontalScrollbar(Scrollbar*);
-
-    float adjustScrollXPositionIfNecessary(float) const;
-    float adjustScrollYPositionIfNecessary(float) const;
+    void notifyPositionChanged(const FloatSize& delta) override;
+    void contentAreaWillPaint() const override;
+    void mouseEnteredContentArea() override;
+    void mouseExitedContentArea() override;
+    void mouseMovedInContentArea() override;
+    void mouseEnteredScrollbar(Scrollbar*) const override;
+    void mouseExitedScrollbar(Scrollbar*) const override;
+    void mouseIsDownInScrollbar(Scrollbar*, bool) const override;
+    void willStartLiveResize() override;
+    void contentsResized() const override;
+    void willEndLiveResize() override;
+    void contentAreaDidShow() override;
+    void contentAreaDidHide() override;
+    void didBeginScrollGesture() const;
+    void didEndScrollGesture() const;
+    void mayBeginScrollGesture() const;
+
+    void lockOverlayScrollbarStateToHidden(bool shouldLockState) final;
+
+    void didAddVerticalScrollbar(Scrollbar*) override;
+    void willRemoveVerticalScrollbar(Scrollbar*) override;
+    void didAddHorizontalScrollbar(Scrollbar*) override;
+    void willRemoveHorizontalScrollbar(Scrollbar*) override;
+
+    void invalidateScrollbarPartLayers(Scrollbar*) override;
+
+    void verticalScrollbarLayerDidChange() override;
+    void horizontalScrollbarLayerDidChange() override;
+
+    bool shouldScrollbarParticipateInHitTesting(Scrollbar*) override;
+
+    void notifyContentAreaScrolled(const FloatSize& delta) override;
+
+    // sendContentAreaScrolledSoon() will do the same work that sendContentAreaScrolled() does except
+    // it does it after a zero-delay timer fires. This will prevent us from updating overlay scrollbar 
+    // information during layout.
+    void sendContentAreaScrolled(const FloatSize& scrollDelta);
+    void sendContentAreaScrolledSoon(const FloatSize& scrollDelta);
+
     FloatPoint adjustScrollPositionIfNecessary(const FloatPoint&) const;
 
+    void immediateScrollToPosition(const FloatPoint&, ScrollClamping = ScrollClamping::Clamped);
+
+    bool isRubberBandInProgress() const override;
+    bool isScrollSnapInProgress() const override;
+
 #if ENABLE(RUBBER_BANDING)
-    bool allowsVerticalStretching() const;
-    bool allowsHorizontalStretching() const;
-    bool pinnedInDirection(float deltaX, float deltaY);
-    void snapRubberBand();
-    void snapRubberBandTimerFired(Timer<ScrollAnimatorMac>*);
-    void smoothScrollWithEvent(PlatformWheelEvent&);
-    void beginScrollGesture();
-    void endScrollGesture();
-
-    bool m_inScrollGesture;
-    bool m_momentumScrollInProgress;
-    bool m_ignoreMomentumScrolls;
-    
-    CFTimeInterval m_lastMomemtumScrollTimestamp;
-    FloatSize m_overflowScrollDelta;
-    FloatSize m_stretchScrollForce;
-    FloatSize m_momentumVelocity;
-
-    // Rubber band state.
-    CFTimeInterval m_startTime;
-    FloatSize m_startStretch;
-    FloatPoint m_origOrigin;
-    FloatSize m_origVelocity;
-    Timer<ScrollAnimatorMac> m_snapRubberBandTimer;
+    /// ScrollControllerClient member functions.
+    IntSize stretchAmount() override;
+    bool allowsHorizontalStretching(const PlatformWheelEvent&) override;
+    bool allowsVerticalStretching(const PlatformWheelEvent&) override;
+    bool pinnedInDirection(const FloatSize&) override;
+    bool canScrollHorizontally() override;
+    bool canScrollVertically() override;
+    bool shouldRubberBandInDirection(ScrollDirection) override;
+    void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&) override;
+    void immediateScrollBy(const FloatSize&) override;
+    void adjustScrollPositionToBoundsIfNecessary() override;
+
+    bool isAlreadyPinnedInDirectionOfGesture(const PlatformWheelEvent&, ScrollEventAxis);
 #endif
-    bool m_drawingIntoLayer;
+
     bool m_haveScrolledSincePageLoad;
+    bool m_needsScrollerStyleUpdate;
+    IntRect m_visibleScrollerThumbRect;
 };
 
 } // namespace WebCore
 
 #endif // ENABLE(SMOOTH_SCROLLING)
 
-#endif // ScrollAnimatorMac_h