Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / platform / scroll / ScrollableArea.h
index bb9c728..225c398 100644 (file)
@@ -27,6 +27,7 @@
 #define ScrollableArea_h
 
 #include "platform/PlatformExport.h"
+#include "platform/geometry/DoublePoint.h"
 #include "platform/scroll/ScrollAnimator.h"
 #include "platform/scroll/Scrollbar.h"
 #include "wtf/Noncopyable.h"
@@ -59,7 +60,7 @@ public:
     static float minFractionToStepWhenPaging();
     static int maxOverlapBetweenPages();
 
-    // The window that hosts the ScrollView. The ScrollView will communicate scrolls and repaints to the
+    // The window that hosts the ScrollableArea. The ScrollableArea will communicate scrolls and repaints to the
     // host window in the window's coordinate space.
     virtual HostWindow* hostWindow() const { return 0; };
 
@@ -159,8 +160,12 @@ public:
     virtual Scrollbar* verticalScrollbar() const { return 0; }
 
     // scrollPosition is relative to the scrollOrigin. i.e. If the page is RTL
-    // then scrollPosition will be negative.
+    // then scrollPosition will be negative. By default, scrollPositionDouble()
+    // just call into scrollPosition(). Subclass can override scrollPositionDouble()
+    // to return floating point precision scrolloffset.
+    // FIXME: Remove scrollPosition(). crbug.com/414283.
     virtual IntPoint scrollPosition() const = 0;
+    virtual DoublePoint scrollPositionDouble() const { return DoublePoint(scrollPosition()); }
     virtual IntPoint minimumScrollPosition() const = 0;
     virtual IntPoint maximumScrollPosition() const = 0;
 
@@ -248,15 +253,24 @@ protected:
     virtual void invalidateScrollCornerRect(const IntRect&) = 0;
 
 private:
-    void scrollPositionChanged(const IntPoint&);
+    void scrollPositionChanged(const DoublePoint&);
 
     // NOTE: Only called from the ScrollAnimator.
     friend class ScrollAnimator;
-    void setScrollOffsetFromAnimation(const IntPoint&);
+    void setScrollOffsetFromAnimation(const DoublePoint&);
 
     // This function should be overriden by subclasses to perform the actual
-    // scroll of the content.
+    // scroll of the content. By default the DoublePoint version will just
+    // call into the IntPoint version. If fractional scroll is needed, one
+    // can override the DoublePoint version to take advantage of the double
+    // precision scroll offset.
+    // FIXME: Remove the IntPoint version. And change the function to
+    // take DoubleSize. crbug.com/414283.
     virtual void setScrollOffset(const IntPoint&) = 0;
+    virtual void setScrollOffset(const DoublePoint& offset)
+    {
+        setScrollOffset(flooredIntPoint(offset));
+    }
 
     virtual int lineStep(ScrollbarOrientation) const;
     virtual int pageStep(ScrollbarOrientation) const;
@@ -268,7 +282,7 @@ private:
     IntRect m_verticalBarDamage;
 
     struct ScrollableAreaAnimators {
-        OwnPtr<ScrollAnimator> scrollAnimator;
+        RefPtr<ScrollAnimator> scrollAnimator;
         OwnPtr<ProgrammaticScrollAnimator> programmaticScrollAnimator;
     };