Title: [119684] trunk/Source
Revision
119684
Author
[email protected]
Date
2012-06-06 22:56:12 -0700 (Wed, 06 Jun 2012)

Log Message

Source/WebCore: [Chromium] Re-enable handling of smooth scrolling on Chromium Linux/Windows
https://bugs.webkit.org/show_bug.cgi?id=87535 by adding support for
m_hasPreciseScrollingDelta on all Chromium platforms and adjusting ScrollAnimator
and ScrollAnimatorNone accordingly to let m_hasPreciseScrollingDelta == true
force exact (non-animated) scrolling.

Reviewed by James Robinson.

Updated WebKit unit tests to validate change.

* platform/PlatformWheelEvent.h:
(WebCore::PlatformWheelEvent::PlatformWheelEvent): Adjusted #ifdefs to
make m_hasPreciseScrollingDelta available on all Chromium platforms.
(PlatformWheelEvent):
* platform/ScrollAnimator.cpp:
(WebCore::ScrollAnimator::handleWheelEvent): Default scroll type is set based on
m_hasPreciseScrollingDelta value.
* platform/ScrollAnimatorNone.cpp:
(WebCore::ScrollAnimatorNone::scroll): Scroll precisely when necessary.
* platform/ScrollTypes.h: Added additional pixel scrolling subtype.
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::scroll): Updated for additional pixel scroll subtype.

Source/WebKit/chromium: [Chromium] Re-enable handling of smooth scrolling on Chromium Linux/Windows
https://bugs.webkit.org/show_bug.cgi?id=87535 by adding support for precise
scrolling deltas on all Chromium platforms.

Reviewed by James Robinson.

* src/WebInputEventConversion.cpp:
(WebKit::PlatformWheelEventBuilder::PlatformWheelEventBuilder): Create PlatformWheelEvents
with m_hasPreciseScrollingDelta flag as required.
* tests/ScrollAnimatorNoneTest.cpp: Added new unit test condiiton for precise scrolling.
(TEST):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (119683 => 119684)


--- trunk/Source/WebCore/ChangeLog	2012-06-07 05:00:00 UTC (rev 119683)
+++ trunk/Source/WebCore/ChangeLog	2012-06-07 05:56:12 UTC (rev 119684)
@@ -1,3 +1,28 @@
+2012-06-06  Robert Kroeger  <[email protected]>
+
+        [Chromium] Re-enable handling of smooth scrolling on Chromium Linux/Windows
+        https://bugs.webkit.org/show_bug.cgi?id=87535 by adding support for
+        m_hasPreciseScrollingDelta on all Chromium platforms and adjusting ScrollAnimator
+        and ScrollAnimatorNone accordingly to let m_hasPreciseScrollingDelta == true
+        force exact (non-animated) scrolling.
+
+        Reviewed by James Robinson.
+
+        Updated WebKit unit tests to validate change.
+
+        * platform/PlatformWheelEvent.h:
+        (WebCore::PlatformWheelEvent::PlatformWheelEvent): Adjusted #ifdefs to
+        make m_hasPreciseScrollingDelta available on all Chromium platforms.
+        (PlatformWheelEvent):
+        * platform/ScrollAnimator.cpp:
+        (WebCore::ScrollAnimator::handleWheelEvent): Default scroll type is set based on 
+        m_hasPreciseScrollingDelta value.
+        * platform/ScrollAnimatorNone.cpp:
+        (WebCore::ScrollAnimatorNone::scroll): Scroll precisely when necessary.
+        * platform/ScrollTypes.h: Added additional pixel scrolling subtype.
+        * platform/ScrollableArea.cpp:
+        (WebCore::ScrollableArea::scroll): Updated for additional pixel scroll subtype.
+
 2012-06-06  Michal Mocny  <[email protected]>
 
         [chromium] Stop dropping texture limits when the layer tree host becomes invisible, and initialize with 0 allocation.

Modified: trunk/Source/WebCore/platform/PlatformWheelEvent.h (119683 => 119684)


--- trunk/Source/WebCore/platform/PlatformWheelEvent.h	2012-06-07 05:00:00 UTC (rev 119683)
+++ trunk/Source/WebCore/platform/PlatformWheelEvent.h	2012-06-07 05:56:12 UTC (rev 119684)
@@ -90,8 +90,10 @@
             , m_wheelTicksY(0)
             , m_granularity(ScrollByPixelWheelEvent)
             , m_directionInvertedFromDevice(false)
+#if PLATFORM(MAC) || PLATFORM(CHROMIUM)
+            , m_hasPreciseScrollingDeltas(false)
+#endif
 #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN))
-            , m_hasPreciseScrollingDeltas(false)
             , m_phase(PlatformWheelEventPhaseNone)
             , m_momentumPhase(PlatformWheelEventPhaseNone)
             , m_scrollCount(0)
@@ -111,9 +113,11 @@
             , m_wheelTicksY(wheelTicksY)
             , m_granularity(granularity)
             , m_directionInvertedFromDevice(false)
+#if PLATFORM(MAC) || PLATFORM(CHROMIUM)
+            , m_hasPreciseScrollingDeltas(false)
+#endif
 #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN))
-            , m_hasPreciseScrollingDeltas(false)
-            , m_phase(PlatformWheelEventPhaseNone)
+           , m_phase(PlatformWheelEventPhaseNone)
             , m_momentumPhase(PlatformWheelEventPhaseNone)
             , m_scrollCount(0)
             , m_unacceleratedScrollingDeltaX(0)
@@ -155,11 +159,12 @@
         PlatformWheelEvent(const Evas_Event_Mouse_Wheel*);
 #endif
 
+#if PLATFORM(MAC) || PLATFORM(CHROMIUM)
+       bool hasPreciseScrollingDeltas() const { return m_hasPreciseScrollingDeltas; }
+#endif
 #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN))
         PlatformWheelEventPhase phase() const { return m_phase; }
         PlatformWheelEventPhase momentumPhase() const { return m_momentumPhase; }
-        bool hasPreciseScrollingDeltas() const { return m_hasPreciseScrollingDeltas; }
-
         unsigned scrollCount() const { return m_scrollCount; }
         float unacceleratedScrollingDeltaX() const { return m_unacceleratedScrollingDeltaX; }
         float unacceleratedScrollingDeltaY() const { return m_unacceleratedScrollingDeltaY; }
@@ -187,9 +192,11 @@
         float m_wheelTicksY;
         PlatformWheelEventGranularity m_granularity;
         bool m_directionInvertedFromDevice;
+#if PLATFORM(MAC) || PLATFORM(CHROMIUM)
+        bool m_hasPreciseScrollingDeltas;
+#endif
 #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN))
-        bool m_hasPreciseScrollingDeltas;
-        PlatformWheelEventPhase m_phase;
+         PlatformWheelEventPhase m_phase;
         PlatformWheelEventPhase m_momentumPhase;
         unsigned m_scrollCount;
         float m_unacceleratedScrollingDeltaX;

Modified: trunk/Source/WebCore/platform/ScrollAnimator.cpp (119683 => 119684)


--- trunk/Source/WebCore/platform/ScrollAnimator.cpp	2012-06-07 05:00:00 UTC (rev 119683)
+++ trunk/Source/WebCore/platform/ScrollAnimator.cpp	2012-06-07 05:56:12 UTC (rev 119684)
@@ -91,6 +91,12 @@
 
     bool handled = false;
 
+#if PLATFORM(CHROMIUM)
+    ScrollGranularity granularity = e.hasPreciseScrollingDeltas() ? ScrollByPrecisePixel : ScrollByPixel;
+#else
+    ScrollGranularity granularity = ScrollByPixel;
+#endif
+
     IntSize maxForwardScrollDelta = m_scrollableArea->maximumScrollPosition() - m_scrollableArea->scrollPosition();
     IntSize maxBackwardScrollDelta = m_scrollableArea->scrollPosition() - m_scrollableArea->minimumScrollPosition();
     if ((deltaX < 0 && maxForwardScrollDelta.width() > 0)
@@ -111,7 +117,7 @@
                 if (negative)
                     deltaY = -deltaY;
             }
-            scroll(VerticalScrollbar, ScrollByPixel, verticalScrollbar->pixelStep(), -deltaY);
+            scroll(VerticalScrollbar, granularity, verticalScrollbar->pixelStep(), -deltaY);
         }
 
         if (deltaX) {
@@ -121,7 +127,7 @@
                 if (negative)
                     deltaX = -deltaX;
             }
-            scroll(HorizontalScrollbar, ScrollByPixel, horizontalScrollbar->pixelStep(), -deltaX);
+            scroll(HorizontalScrollbar, granularity, horizontalScrollbar->pixelStep(), -deltaX);
         }
     }
     return handled;

Modified: trunk/Source/WebCore/platform/ScrollAnimatorNone.cpp (119683 => 119684)


--- trunk/Source/WebCore/platform/ScrollAnimatorNone.cpp	2012-06-07 05:00:00 UTC (rev 119683)
+++ trunk/Source/WebCore/platform/ScrollAnimatorNone.cpp	2012-06-07 05:56:12 UTC (rev 119684)
@@ -434,13 +434,10 @@
         parameters = Parameters(true, 15 * kTickTime, 10 * kTickTime, Cubic, 5 * kTickTime, Cubic, 5 * kTickTime, Linear, 1);
         break;
     case ScrollByPixel:
-#if PLATFORM(CHROMIUM)
-        // FIXME: plumb a flag specifying precise deltas.
-        return ScrollAnimator::scroll(orientation, granularity, step, multiplier);
-#else
         parameters = Parameters(true, 11 * kTickTime, 2 * kTickTime, Cubic, 3 * kTickTime, Cubic, 3 * kTickTime, Quadratic, 1.25);
         break;
-#endif
+    case ScrollByPrecisePixel:
+        return ScrollAnimator::scroll(orientation, granularity, step, multiplier);
     case ScrollByPixelVelocity:
         // FIXME: Generalize the scroll interface to support a richer set of parameters.
         if (m_firstVelocitySet) {

Modified: trunk/Source/WebCore/platform/ScrollTypes.h (119683 => 119684)


--- trunk/Source/WebCore/platform/ScrollTypes.h	2012-06-07 05:00:00 UTC (rev 119683)
+++ trunk/Source/WebCore/platform/ScrollTypes.h	2012-06-07 05:56:12 UTC (rev 119684)
@@ -106,7 +106,8 @@
         ScrollByPage,
         ScrollByDocument,
         ScrollByPixel,
-        ScrollByPixelVelocity
+        ScrollByPixelVelocity,
+        ScrollByPrecisePixel
     };
 
     enum ScrollElasticity {

Modified: trunk/Source/WebCore/platform/ScrollableArea.cpp (119683 => 119684)


--- trunk/Source/WebCore/platform/ScrollableArea.cpp	2012-06-07 05:00:00 UTC (rev 119683)
+++ trunk/Source/WebCore/platform/ScrollableArea.cpp	2012-06-07 05:56:12 UTC (rev 119684)
@@ -108,6 +108,7 @@
         step = scrollbar->totalSize();
         break;
     case ScrollByPixel:
+    case ScrollByPrecisePixel:
         step = scrollbar->pixelStep();
         break;
     case ScrollByPixelVelocity:

Modified: trunk/Source/WebKit/chromium/ChangeLog (119683 => 119684)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-06-07 05:00:00 UTC (rev 119683)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-06-07 05:56:12 UTC (rev 119684)
@@ -1,3 +1,17 @@
+2012-06-06  Robert Kroeger  <[email protected]>
+
+        [Chromium] Re-enable handling of smooth scrolling on Chromium Linux/Windows
+        https://bugs.webkit.org/show_bug.cgi?id=87535 by adding support for precise
+        scrolling deltas on all Chromium platforms.
+
+        Reviewed by James Robinson.
+
+        * src/WebInputEventConversion.cpp:
+        (WebKit::PlatformWheelEventBuilder::PlatformWheelEventBuilder): Create PlatformWheelEvents
+        with m_hasPreciseScrollingDelta flag as required.
+        * tests/ScrollAnimatorNoneTest.cpp: Added new unit test condiiton for precise scrolling.
+        (TEST):
+
 2012-06-06  Michal Mocny  <[email protected]>
 
         [chromium] Stop dropping texture limits when the layer tree host becomes invisible, and initialize with 0 allocation.

Modified: trunk/Source/WebKit/chromium/src/WebInputEventConversion.cpp (119683 => 119684)


--- trunk/Source/WebKit/chromium/src/WebInputEventConversion.cpp	2012-06-07 05:00:00 UTC (rev 119683)
+++ trunk/Source/WebKit/chromium/src/WebInputEventConversion.cpp	2012-06-07 05:56:12 UTC (rev 119684)
@@ -123,8 +123,8 @@
     if (e.modifiers & WebInputEvent::MetaKey)
         m_modifiers |= PlatformEvent::MetaKey;
 
+    m_hasPreciseScrollingDeltas = e.hasPreciseScrollingDeltas;
 #if OS(DARWIN)
-    m_hasPreciseScrollingDeltas = e.hasPreciseScrollingDeltas;
     m_phase = static_cast<WebCore::PlatformWheelEventPhase>(e.phase);
     m_momentumPhase = static_cast<WebCore::PlatformWheelEventPhase>(e.momentumPhase);
     m_timestamp = e.timeStampSeconds;

Modified: trunk/Source/WebKit/chromium/tests/ScrollAnimatorNoneTest.cpp (119683 => 119684)


--- trunk/Source/WebKit/chromium/tests/ScrollAnimatorNoneTest.cpp	2012-06-07 05:00:00 UTC (rev 119683)
+++ trunk/Source/WebKit/chromium/tests/ScrollAnimatorNoneTest.cpp	2012-06-07 05:56:12 UTC (rev 119684)
@@ -110,7 +110,7 @@
     MockScrollAnimatorNone scrollAnimatorNone(&scrollableArea);
 
     EXPECT_CALL(scrollableArea, scrollSize(_)).Times(AtLeast(1)).WillRepeatedly(Return(1000));
-    EXPECT_CALL(scrollableArea, setScrollOffset(_)).Times(3);
+    EXPECT_CALL(scrollableArea, setScrollOffset(_)).Times(4);
 
     scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByLine, 100, 1);
     EXPECT_NE(100, scrollAnimatorNone.currentX());
@@ -125,6 +125,12 @@
     scrollAnimatorNone.reset();
 
     scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByPixel, 4, 25);
+    EXPECT_NE(100, scrollAnimatorNone.currentX());
+    EXPECT_NE(0, scrollAnimatorNone.currentX());
+    EXPECT_EQ(0, scrollAnimatorNone.currentY());
+    scrollAnimatorNone.reset();
+
+    scrollAnimatorNone.scroll(HorizontalScrollbar, ScrollByPrecisePixel, 4, 25);
     EXPECT_EQ(100, scrollAnimatorNone.currentX());
     EXPECT_NE(0, scrollAnimatorNone.currentX());
     EXPECT_EQ(0, scrollAnimatorNone.currentY());
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to