Changeset 127689 in webkit


Ignore:
Timestamp:
Sep 5, 2012 9:46:39 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Source/WebKit/chromium: Use new type-specific WebGestureEvent fields
https://bugs.webkit.org/show_bug.cgi?id=95573

Patch by Rick Byers <rbyers@chromium.org> on 2012-09-05
Reviewed by James Robinson.

Chromium has been updated to store gesture-type specific details in the
new WebGestureEvent fields (crrev.com/152508, crrev.com/154815 and
crrev.com/154959), so we can now rely on them.

  • src/WebCompositorInputHandlerImpl.cpp:

Update the compositor scroll, pinch and fling handling to use these new fields.
(WebKit::WebCompositorInputHandlerImpl::handleInputEventInternal):
(WebKit::WebCompositorInputHandlerImpl::handleGestureFling):

  • src/WebInputEventConversion.cpp:

Update PlatformGestureEvent/WebGestureEvent conversion to use the new
fields, storing into the existing overloaded PlatformGestureEvent
fields (which will be cleaned up in my next CL).
(WebKit::PlatformGestureEventBuilder::PlatformGestureEventBuilder):
(WebKit::WebGestureEventBuilder::WebGestureEventBuilder):

  • src/WebViewImpl.cpp:

(WebKit::WebViewImpl::handleGestureEvent):
Update fling scrolling implementation for correct location of velocity.

  • tests/WebCompositorInputHandlerImplTest.cpp:

(WebKit::TEST_F):
Update tests to use the new fields.

Tools: Update chromium DumpRenderTree for new WebGestureEvent fields
https://bugs.webkit.org/show_bug.cgi?id=95573

Patch by Rick Byers <rbyers@chromium.org> on 2012-09-05
Reviewed by James Robinson.

Update EventSender to write gesture details into the appropriate
type-specific WebGestureEvent fields.

  • DumpRenderTree/chromium/TestRunner/EventSender.cpp:

(EventSender::gestureEvent):
(EventSender::gestureFlingStart):

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/chromium/ChangeLog

    r127678 r127689  
     12012-09-05  Rick Byers  <rbyers@chromium.org>
     2
     3        Use new type-specific WebGestureEvent fields
     4        https://bugs.webkit.org/show_bug.cgi?id=95573
     5
     6        Reviewed by James Robinson.
     7
     8        Chromium has been updated to store gesture-type specific details in the
     9        new WebGestureEvent fields (crrev.com/152508, crrev.com/154815 and
     10        crrev.com/154959), so we can now rely on them.
     11
     12        * src/WebCompositorInputHandlerImpl.cpp:
     13        Update the compositor scroll, pinch and fling handling to use these new fields.
     14        (WebKit::WebCompositorInputHandlerImpl::handleInputEventInternal):
     15        (WebKit::WebCompositorInputHandlerImpl::handleGestureFling):
     16        * src/WebInputEventConversion.cpp:
     17        Update PlatformGestureEvent/WebGestureEvent conversion to use the new
     18        fields, storing into the existing overloaded PlatformGestureEvent
     19        fields (which will be cleaned up in my next CL).
     20        (WebKit::PlatformGestureEventBuilder::PlatformGestureEventBuilder):
     21        (WebKit::WebGestureEventBuilder::WebGestureEventBuilder):
     22        * src/WebViewImpl.cpp:
     23        (WebKit::WebViewImpl::handleGestureEvent):
     24        Update fling scrolling implementation for correct location of velocity.
     25        * tests/WebCompositorInputHandlerImplTest.cpp:
     26        (WebKit::TEST_F):
     27        Update tests to use the new fields.
     28
     29
    1302012-09-05  James Robinson  <jamesr@chromium.org>
    231
  • trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp

    r126018 r127689  
    217217
    218218        const WebGestureEvent& gestureEvent = *static_cast<const WebGestureEvent*>(&event);
    219         m_inputHandlerClient->scrollBy(IntPoint(gestureEvent.x, gestureEvent.y), IntSize(-gestureEvent.deltaX, -gestureEvent.deltaY));
     219        m_inputHandlerClient->scrollBy(IntPoint(gestureEvent.x, gestureEvent.y),
     220            IntSize(-gestureEvent.data.scrollUpdate.deltaX, -gestureEvent.data.scrollUpdate.deltaY));
    220221        return DidHandle;
    221222    } else if (event.type == WebInputEvent::GestureScrollEnd) {
     
    247248        ASSERT(m_expectPinchUpdateEnd);
    248249        const WebGestureEvent& gestureEvent = *static_cast<const WebGestureEvent*>(&event);
    249         m_inputHandlerClient->pinchGestureUpdate(gestureEvent.deltaX, IntPoint(gestureEvent.x, gestureEvent.y));
     250        m_inputHandlerClient->pinchGestureUpdate(gestureEvent.data.pinchUpdate.scale, IntPoint(gestureEvent.x, gestureEvent.y));
    250251        return DidHandle;
    251252    } else if (event.type == WebInputEvent::GestureFlingStart) {
     
    268269    case CCInputHandlerClient::ScrollStarted: {
    269270        TRACE_EVENT_INSTANT0("cc", "WebCompositorInputHandlerImpl::handleGestureFling::started");
    270         OwnPtr<PlatformGestureCurve> flingCurve = TouchpadFlingPlatformGestureCurve::create(FloatPoint(gestureEvent.deltaX, gestureEvent.deltaY));
     271        OwnPtr<PlatformGestureCurve> flingCurve = TouchpadFlingPlatformGestureCurve::create(FloatPoint(gestureEvent.data.flingStart.velocityX, gestureEvent.data.flingStart.velocityY));
    271272        m_wheelFlingAnimation = CCActiveGestureAnimation::create(PlatformGestureToCCGestureAdapter::create(flingCurve.release()), this);
    272         m_wheelFlingParameters.delta = WebFloatPoint(gestureEvent.deltaX, gestureEvent.deltaY);
     273        m_wheelFlingParameters.delta = WebFloatPoint(gestureEvent.data.flingStart.velocityX, gestureEvent.data.flingStart.velocityY);
    273274        m_wheelFlingParameters.point = WebPoint(gestureEvent.x, gestureEvent.y);
    274275        m_wheelFlingParameters.globalPoint = WebPoint(gestureEvent.globalX, gestureEvent.globalY);
  • trunk/Source/WebKit/chromium/src/WebInputEventConversion.cpp

    r124954 r127689  
    150150    case WebInputEvent::GestureScrollUpdate:
    151151        m_type = PlatformEvent::GestureScrollUpdate;
     152        m_deltaX = e.data.scrollUpdate.deltaX;
     153        m_deltaY = e.data.scrollUpdate.deltaY;
    152154        break;
    153155    case WebInputEvent::GestureTap:
    154156        m_type = PlatformEvent::GestureTap;
    155         m_area = IntSize(e.boundingBox.width, e.boundingBox.height);
     157        m_area = IntSize(e.data.tap.width, e.data.tap.height);
     158        // FIXME: PlatformGestureEvent deltaX is overloaded - wkb.ug/93123
     159        m_deltaX = static_cast<int>(e.data.tap.tapCount);
    156160        break;
    157161    case WebInputEvent::GestureTapDown:
     
    166170    case WebInputEvent::GestureLongPress:
    167171        m_type = PlatformEvent::GestureLongPress;
    168         m_area = IntSize(e.boundingBox.width, e.boundingBox.height);
     172        m_area = IntSize(e.data.longPress.width, e.data.longPress.height);
    169173        break;
    170174    case WebInputEvent::GesturePinchBegin:
     
    176180    case WebInputEvent::GesturePinchUpdate:
    177181        m_type = PlatformEvent::GesturePinchUpdate;
     182        // FIXME: PlatformGestureEvent deltaX is overloaded - wkb.ug/93123
     183        m_deltaX = e.data.pinchUpdate.scale;
    178184        break;
    179185    default:
     
    182188    m_position = widget->convertFromContainingWindow(IntPoint(e.x, e.y));
    183189    m_globalPosition = IntPoint(e.globalX, e.globalY);
    184     m_deltaX = e.deltaX;
    185     m_deltaY = e.deltaY;
    186190    m_timestamp = e.timeStampSeconds;
    187191
     
    527531    else if (event.type() == eventNames().gesturescrollendEvent)
    528532        type = GestureScrollEnd;
    529     else if (event.type() == eventNames().gesturescrollupdateEvent)
     533    else if (event.type() == eventNames().gesturescrollupdateEvent) {
    530534        type = GestureScrollUpdate;
     535        data.scrollUpdate.deltaX = event.deltaX();
     536        data.scrollUpdate.deltaY = event.deltaY();
     537    }
    531538
    532539    timeStampSeconds = event.timeStamp() / millisPerSecond;
     
    537544    x = event.absoluteLocation().x() - widget->location().x();
    538545    y = event.absoluteLocation().y() - widget->location().y();
    539 
    540     deltaX = event.deltaX();
    541     deltaY = event.deltaY();
    542546}
    543547#endif // ENABLE(GESTURE_EVENTS)
  • trunk/Source/WebKit/chromium/src/WebViewImpl.cpp

    r127672 r127689  
    694694        m_flingModifier = event.modifiers;
    695695        // FIXME: Make the curve parametrizable from the browser.
    696         m_gestureAnimation = ActivePlatformGestureAnimation::create(TouchpadFlingPlatformGestureCurve::create(FloatPoint(event.deltaX, event.deltaY)), this);
     696        m_gestureAnimation = ActivePlatformGestureAnimation::create(TouchpadFlingPlatformGestureCurve::create(FloatPoint(event.data.flingStart.velocityX, event.data.flingStart.velocityY)), this);
    697697        scheduleAnimation();
    698698        return true;
  • trunk/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp

    r126018 r127689  
    201201
    202202    gesture.type = WebInputEvent::GestureScrollUpdate;
    203     gesture.deltaY = -40; // -Y means scroll down - i.e. in the +Y direction.
     203    gesture.data.scrollUpdate.deltaY = -40; // -Y means scroll down - i.e. in the +Y direction.
    204204    EXPECT_CALL(m_mockCCInputHandlerClient, scrollBy(testing::_, testing::Property(&WebCore::IntSize::height, testing::Gt(0))));
    205205    m_inputHandler->handleInputEvent(gesture);
     
    208208
    209209    gesture.type = WebInputEvent::GestureScrollEnd;
    210     gesture.deltaY = 0;
     210    gesture.data.scrollUpdate.deltaY = 0;
    211211    EXPECT_CALL(m_mockCCInputHandlerClient, scrollEnd());
    212212    m_inputHandler->handleInputEvent(gesture);
     
    228228
    229229    gesture.type = WebInputEvent::GestureScrollUpdate;
    230     gesture.deltaY = 40;
     230    gesture.data.scrollUpdate.deltaY = 40;
    231231    m_inputHandler->handleInputEvent(gesture);
    232232
     
    234234
    235235    gesture.type = WebInputEvent::GestureScrollEnd;
    236     gesture.deltaY = 0;
     236    gesture.data.scrollUpdate.deltaY = 0;
    237237    m_inputHandler->handleInputEvent(gesture);
    238238}
     
    267267
    268268    gesture.type = WebInputEvent::GesturePinchUpdate;
    269     gesture.deltaX = 1.5;
     269    gesture.data.pinchUpdate.scale = 1.5;
    270270    gesture.x = 7;
    271271    gesture.y = 13;
     
    276276
    277277    gesture.type = WebInputEvent::GesturePinchUpdate;
    278     gesture.deltaX = 0.5;
     278    gesture.data.pinchUpdate.scale = 0.5;
    279279    gesture.x = 9;
    280280    gesture.y = 6;
     
    299299
    300300    gesture.type = WebInputEvent::GestureFlingStart;
    301     gesture.deltaX = 10;
     301    gesture.data.flingStart.velocityX = 10;
    302302    EXPECT_CALL(m_mockCCInputHandlerClient, scheduleAnimation());
    303303    m_inputHandler->handleInputEvent(gesture);
     
    360360    WebPoint flingGlobalPoint = WebPoint(17, 23);
    361361    int modifiers = 7;
    362     gesture.deltaX = flingDelta.x;
    363     gesture.deltaY = flingDelta.y;
     362    gesture.data.flingStart.velocityX = flingDelta.x;
     363    gesture.data.flingStart.velocityY = flingDelta.y;
    364364    gesture.x = flingPoint.x;
    365365    gesture.y = flingPoint.y;
     
    444444    WebPoint flingGlobalPoint = WebPoint(17, 23);
    445445    int modifiers = 1;
    446     gesture.deltaX = flingDelta.x;
    447     gesture.deltaY = flingDelta.y;
     446    gesture.data.flingStart.velocityX = flingDelta.x;
     447    gesture.data.flingStart.velocityY = flingDelta.y;
    448448    gesture.x = flingPoint.x;
    449449    gesture.y = flingPoint.y;
     
    523523    flingGlobalPoint = WebPoint(32, 71);
    524524    modifiers = 2;
    525     gesture.deltaX = flingDelta.x;
    526     gesture.deltaY = flingDelta.y;
     525    gesture.data.flingStart.velocityX = flingDelta.x;
     526    gesture.data.flingStart.velocityY = flingDelta.y;
    527527    gesture.x = flingPoint.x;
    528528    gesture.y = flingPoint.y;
  • trunk/Tools/ChangeLog

    r127688 r127689  
     12012-09-05  Rick Byers  <rbyers@chromium.org>
     2
     3        Update chromium DumpRenderTree for new WebGestureEvent fields
     4        https://bugs.webkit.org/show_bug.cgi?id=95573
     5
     6        Reviewed by James Robinson.
     7
     8        Update EventSender to write gesture details into the appropriate
     9        type-specific WebGestureEvent fields.
     10        * DumpRenderTree/chromium/TestRunner/EventSender.cpp:
     11        (EventSender::gestureEvent):
     12        (EventSender::gestureFlingStart):
     13
    1142012-09-05  Dirk Pranke  <dpranke@chromium.org>
    215
  • trunk/Tools/DumpRenderTree/chromium/TestRunner/EventSender.cpp

    r124906 r127689  
    11541154    switch (type) {
    11551155    case WebInputEvent::GestureScrollUpdate:
    1156         event.deltaX = static_cast<float>(arguments[0].toDouble());
    1157         event.deltaY = static_cast<float>(arguments[1].toDouble());
     1156        event.data.scrollUpdate.deltaX = static_cast<float>(arguments[0].toDouble());
     1157        event.data.scrollUpdate.deltaY = static_cast<float>(arguments[1].toDouble());
    11581158        event.x = m_currentGestureLocation.x;
    11591159        event.y = m_currentGestureLocation.y;
    1160         m_currentGestureLocation.x = m_currentGestureLocation.x + event.deltaX;
    1161         m_currentGestureLocation.y = m_currentGestureLocation.y + event.deltaY;
     1160        m_currentGestureLocation.x = m_currentGestureLocation.x + event.data.scrollUpdate.deltaX;
     1161        m_currentGestureLocation.y = m_currentGestureLocation.y + event.data.scrollUpdate.deltaY;
    11621162        break;
    11631163
     
    11681168        break;
    11691169    case WebInputEvent::GestureScrollEnd:
    1170         event.deltaX = static_cast<float>(arguments[0].toDouble());
    1171         event.deltaY = static_cast<float>(arguments[1].toDouble());
    11721170        event.x = m_currentGestureLocation.x;
    11731171        event.y = m_currentGestureLocation.y;
    11741172        break;
    11751173    case WebInputEvent::GestureTap:
    1176         if (arguments.size() >= 3) {
    1177             // Tap count.
    1178             event.deltaX = static_cast<float>(arguments[2].toDouble());
    1179         }
     1174        if (arguments.size() >= 3)
     1175            event.data.tap.tapCount = static_cast<float>(arguments[2].toDouble());
     1176        else
     1177          event.data.tap.tapCount = 1;
    11801178        event.x = point.x;
    11811179        event.y = point.y;
     
    12331231    event.globalY = event.y;
    12341232
    1235     event.deltaX = static_cast<float>(arguments[2].toDouble());
    1236     event.deltaY = static_cast<float>(arguments[3].toDouble());
     1233    event.data.flingStart.velocityX = static_cast<float>(arguments[2].toDouble());
     1234    event.data.flingStart.velocityY = static_cast<float>(arguments[3].toDouble());
    12371235    event.timeStampSeconds = getCurrentEventTimeSec();
    12381236    webview()->handleInputEvent(event);
Note: See TracChangeset for help on using the changeset viewer.