| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 // TODO(mustaq): Add tests for this. | 170 // TODO(mustaq): Add tests for this. |
| 171 PlatformMouseEventBuilder::PlatformMouseEventBuilder(Widget* widget, | 171 PlatformMouseEventBuilder::PlatformMouseEventBuilder(Widget* widget, |
| 172 const WebMouseEvent& e) { | 172 const WebMouseEvent& e) { |
| 173 // FIXME: Widget is always toplevel, unless it's a popup. We may be able | 173 // FIXME: Widget is always toplevel, unless it's a popup. We may be able |
| 174 // to get rid of this once we abstract popups into a WebKit API. | 174 // to get rid of this once we abstract popups into a WebKit API. |
| 175 m_position = widget->convertFromRootFrame( | 175 m_position = widget->convertFromRootFrame( |
| 176 flooredIntPoint(convertHitPointToRootFrame(widget, IntPoint(e.x, e.y)))); | 176 flooredIntPoint(convertHitPointToRootFrame(widget, IntPoint(e.x, e.y)))); |
| 177 m_globalPosition = IntPoint(e.globalX, e.globalY); | 177 m_globalPosition = IntPoint(e.globalX, e.globalY); |
| 178 m_movementDelta = IntPoint(scaleDeltaToWindow(widget, e.movementX), | 178 m_movementDelta = IntPoint(scaleDeltaToWindow(widget, e.movementX), |
| 179 scaleDeltaToWindow(widget, e.movementY)); | 179 scaleDeltaToWindow(widget, e.movementY)); |
| 180 m_modifiers = e.modifiers; | 180 m_modifiers = e.modifiers(); |
| 181 | 181 |
| 182 m_timestamp = TimeTicks::FromSeconds(e.timeStampSeconds); | 182 m_timestamp = TimeTicks::FromSeconds(e.timeStampSeconds()); |
| 183 m_clickCount = e.clickCount; | 183 m_clickCount = e.clickCount; |
| 184 | 184 |
| 185 m_pointerProperties = static_cast<WebPointerProperties>(e); | 185 m_pointerProperties = static_cast<WebPointerProperties>(e); |
| 186 | 186 |
| 187 switch (e.type) { | 187 switch (e.type()) { |
| 188 case WebInputEvent::MouseMove: | 188 case WebInputEvent::MouseMove: |
| 189 case WebInputEvent::MouseEnter: // synthesize a move event | 189 case WebInputEvent::MouseEnter: // synthesize a move event |
| 190 case WebInputEvent::MouseLeave: // synthesize a move event | 190 case WebInputEvent::MouseLeave: // synthesize a move event |
| 191 m_type = PlatformEvent::MouseMoved; | 191 m_type = PlatformEvent::MouseMoved; |
| 192 break; | 192 break; |
| 193 | 193 |
| 194 case WebInputEvent::MouseDown: | 194 case WebInputEvent::MouseDown: |
| 195 m_type = PlatformEvent::MousePressed; | 195 m_type = PlatformEvent::MousePressed; |
| 196 break; | 196 break; |
| 197 | 197 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 widget->convertFromRootFrame(flooredPoint) + (floatPos - flooredPoint); | 290 widget->convertFromRootFrame(flooredPoint) + (floatPos - flooredPoint); |
| 291 | 291 |
| 292 m_screenPos = FloatPoint(point.screenPosition.x, point.screenPosition.y); | 292 m_screenPos = FloatPoint(point.screenPosition.x, point.screenPosition.y); |
| 293 m_radius = scaleSizeToWindow(widget, FloatSize(point.radiusX, point.radiusY)); | 293 m_radius = scaleSizeToWindow(widget, FloatSize(point.radiusX, point.radiusY)); |
| 294 m_rotationAngle = point.rotationAngle; | 294 m_rotationAngle = point.rotationAngle; |
| 295 } | 295 } |
| 296 | 296 |
| 297 PlatformTouchEventBuilder::PlatformTouchEventBuilder( | 297 PlatformTouchEventBuilder::PlatformTouchEventBuilder( |
| 298 Widget* widget, | 298 Widget* widget, |
| 299 const WebTouchEvent& event) { | 299 const WebTouchEvent& event) { |
| 300 m_type = toPlatformTouchEventType(event.type); | 300 m_type = toPlatformTouchEventType(event.type()); |
| 301 m_modifiers = event.modifiers; | 301 m_modifiers = event.modifiers(); |
| 302 m_timestamp = TimeTicks::FromSeconds(event.timeStampSeconds); | 302 m_timestamp = TimeTicks::FromSeconds(event.timeStampSeconds()); |
| 303 m_causesScrollingIfUncanceled = event.movedBeyondSlopRegion; | 303 m_causesScrollingIfUncanceled = event.movedBeyondSlopRegion; |
| 304 m_touchStartOrFirstTouchMove = event.touchStartOrFirstTouchMove; | 304 m_touchStartOrFirstTouchMove = event.touchStartOrFirstTouchMove; |
| 305 | 305 |
| 306 for (unsigned i = 0; i < event.touchesLength; ++i) | 306 for (unsigned i = 0; i < event.touchesLength; ++i) |
| 307 m_touchPoints.append(PlatformTouchPointBuilder(widget, event.touches[i])); | 307 m_touchPoints.append(PlatformTouchPointBuilder(widget, event.touches[i])); |
| 308 | 308 |
| 309 m_dispatchType = toPlatformDispatchType(event.dispatchType); | 309 m_dispatchType = toPlatformDispatchType(event.dispatchType); |
| 310 m_uniqueTouchEventId = event.uniqueTouchEventId; | 310 m_uniqueTouchEventId = event.uniqueTouchEventId; |
| 311 } | 311 } |
| 312 | 312 |
| 313 static FloatPoint convertAbsoluteLocationForLayoutObjectFloat( | 313 static FloatPoint convertAbsoluteLocationForLayoutObjectFloat( |
| 314 const DoublePoint& location, | 314 const DoublePoint& location, |
| 315 const LayoutItem layoutItem) { | 315 const LayoutItem layoutItem) { |
| 316 return layoutItem.absoluteToLocal(FloatPoint(location), UseTransforms); | 316 return layoutItem.absoluteToLocal(FloatPoint(location), UseTransforms); |
| 317 } | 317 } |
| 318 | 318 |
| 319 static IntPoint convertAbsoluteLocationForLayoutObjectInt( | 319 static IntPoint convertAbsoluteLocationForLayoutObjectInt( |
| 320 const DoublePoint& location, | 320 const DoublePoint& location, |
| 321 const LayoutItem layoutItem) { | 321 const LayoutItem layoutItem) { |
| 322 return roundedIntPoint( | 322 return roundedIntPoint( |
| 323 convertAbsoluteLocationForLayoutObjectFloat(location, layoutItem)); | 323 convertAbsoluteLocationForLayoutObjectFloat(location, layoutItem)); |
| 324 } | 324 } |
| 325 | 325 |
| 326 // FIXME: Change |widget| to const Widget& after RemoteFrames get | 326 // FIXME: Change |widget| to const Widget& after RemoteFrames get |
| 327 // RemoteFrameViews. | 327 // RemoteFrameViews. |
| 328 static void updateWebMouseEventFromCoreMouseEvent(const MouseEvent& event, | 328 static void updateWebMouseEventFromCoreMouseEvent(const MouseEvent& event, |
| 329 const Widget* widget, | 329 const Widget* widget, |
| 330 const LayoutItem layoutItem, | 330 const LayoutItem layoutItem, |
| 331 WebMouseEvent& webEvent) { | 331 WebMouseEvent& webEvent) { |
| 332 webEvent.timeStampSeconds = event.platformTimeStamp().InSeconds(); | 332 webEvent.setTimeStampSeconds(event.platformTimeStamp().InSeconds()); |
| 333 webEvent.modifiers = event.modifiers(); | 333 webEvent.setModifiers(event.modifiers()); |
| 334 | 334 |
| 335 FrameView* view = widget ? toFrameView(widget->parent()) : 0; | 335 FrameView* view = widget ? toFrameView(widget->parent()) : 0; |
| 336 // TODO(bokan): If view == nullptr, pointInRootFrame will really be | 336 // TODO(bokan): If view == nullptr, pointInRootFrame will really be |
| 337 // pointInRootContent. | 337 // pointInRootContent. |
| 338 IntPoint pointInRootFrame(event.absoluteLocation().x(), | 338 IntPoint pointInRootFrame(event.absoluteLocation().x(), |
| 339 event.absoluteLocation().y()); | 339 event.absoluteLocation().y()); |
| 340 if (view) | 340 if (view) |
| 341 pointInRootFrame = view->contentsToRootFrame(pointInRootFrame); | 341 pointInRootFrame = view->contentsToRootFrame(pointInRootFrame); |
| 342 webEvent.globalX = event.screenX(); | 342 webEvent.globalX = event.screenX(); |
| 343 webEvent.globalY = event.screenY(); | 343 webEvent.globalY = event.screenY(); |
| 344 webEvent.windowX = pointInRootFrame.x(); | 344 webEvent.windowX = pointInRootFrame.x(); |
| 345 webEvent.windowY = pointInRootFrame.y(); | 345 webEvent.windowY = pointInRootFrame.y(); |
| 346 IntPoint localPoint = convertAbsoluteLocationForLayoutObjectInt( | 346 IntPoint localPoint = convertAbsoluteLocationForLayoutObjectInt( |
| 347 event.absoluteLocation(), layoutItem); | 347 event.absoluteLocation(), layoutItem); |
| 348 webEvent.x = localPoint.x(); | 348 webEvent.x = localPoint.x(); |
| 349 webEvent.y = localPoint.y(); | 349 webEvent.y = localPoint.y(); |
| 350 } | 350 } |
| 351 | 351 |
| 352 WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, | 352 WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, |
| 353 const LayoutItem layoutItem, | 353 const LayoutItem layoutItem, |
| 354 const MouseEvent& event) { | 354 const MouseEvent& event) { |
| 355 if (event.type() == EventTypeNames::mousemove) | 355 if (event.type() == EventTypeNames::mousemove) |
| 356 type = WebInputEvent::MouseMove; | 356 m_type = WebInputEvent::MouseMove; |
| 357 else if (event.type() == EventTypeNames::mouseout) | 357 else if (event.type() == EventTypeNames::mouseout) |
| 358 type = WebInputEvent::MouseLeave; | 358 m_type = WebInputEvent::MouseLeave; |
| 359 else if (event.type() == EventTypeNames::mouseover) | 359 else if (event.type() == EventTypeNames::mouseover) |
| 360 type = WebInputEvent::MouseEnter; | 360 m_type = WebInputEvent::MouseEnter; |
| 361 else if (event.type() == EventTypeNames::mousedown) | 361 else if (event.type() == EventTypeNames::mousedown) |
| 362 type = WebInputEvent::MouseDown; | 362 m_type = WebInputEvent::MouseDown; |
| 363 else if (event.type() == EventTypeNames::mouseup) | 363 else if (event.type() == EventTypeNames::mouseup) |
| 364 type = WebInputEvent::MouseUp; | 364 m_type = WebInputEvent::MouseUp; |
| 365 else if (event.type() == EventTypeNames::contextmenu) | 365 else if (event.type() == EventTypeNames::contextmenu) |
| 366 type = WebInputEvent::ContextMenu; | 366 m_type = WebInputEvent::ContextMenu; |
| 367 else | 367 else |
| 368 return; // Skip all other mouse events. | 368 return; // Skip all other mouse events. |
| 369 | 369 |
| 370 m_timeStampSeconds = event.platformTimeStamp().InSeconds(); |
| 371 m_modifiers = event.modifiers(); |
| 370 updateWebMouseEventFromCoreMouseEvent(event, widget, layoutItem, *this); | 372 updateWebMouseEventFromCoreMouseEvent(event, widget, layoutItem, *this); |
| 371 | 373 |
| 372 switch (event.button()) { | 374 switch (event.button()) { |
| 373 case short(WebPointerProperties::Button::Left): | 375 case short(WebPointerProperties::Button::Left): |
| 374 button = WebMouseEvent::Button::Left; | 376 button = WebMouseEvent::Button::Left; |
| 375 break; | 377 break; |
| 376 case short(WebPointerProperties::Button::Middle): | 378 case short(WebPointerProperties::Button::Middle): |
| 377 button = WebMouseEvent::Button::Middle; | 379 button = WebMouseEvent::Button::Middle; |
| 378 break; | 380 break; |
| 379 case short(WebPointerProperties::Button::Right): | 381 case short(WebPointerProperties::Button::Right): |
| 380 button = WebMouseEvent::Button::Right; | 382 button = WebMouseEvent::Button::Right; |
| 381 break; | 383 break; |
| 382 } | 384 } |
| 383 if (event.buttonDown()) { | 385 if (event.buttonDown()) { |
| 384 switch (event.button()) { | 386 switch (event.button()) { |
| 385 case short(WebPointerProperties::Button::Left): | 387 case short(WebPointerProperties::Button::Left): |
| 386 modifiers |= WebInputEvent::LeftButtonDown; | 388 m_modifiers |= WebInputEvent::LeftButtonDown; |
| 387 break; | 389 break; |
| 388 case short(WebPointerProperties::Button::Middle): | 390 case short(WebPointerProperties::Button::Middle): |
| 389 modifiers |= WebInputEvent::MiddleButtonDown; | 391 m_modifiers |= WebInputEvent::MiddleButtonDown; |
| 390 break; | 392 break; |
| 391 case short(WebPointerProperties::Button::Right): | 393 case short(WebPointerProperties::Button::Right): |
| 392 modifiers |= WebInputEvent::RightButtonDown; | 394 m_modifiers |= WebInputEvent::RightButtonDown; |
| 393 break; | 395 break; |
| 394 } | 396 } |
| 395 } else { | 397 } else { |
| 396 button = WebMouseEvent::Button::NoButton; | 398 button = WebMouseEvent::Button::NoButton; |
| 397 } | 399 } |
| 398 movementX = event.movementX(); | 400 movementX = event.movementX(); |
| 399 movementY = event.movementY(); | 401 movementY = event.movementY(); |
| 400 clickCount = event.detail(); | 402 clickCount = event.detail(); |
| 401 | 403 |
| 402 pointerType = WebPointerProperties::PointerType::Mouse; | 404 pointerType = WebPointerProperties::PointerType::Mouse; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 417 return; | 419 return; |
| 418 } | 420 } |
| 419 | 421 |
| 420 const Touch* touch = event.touches()->length() == 1 | 422 const Touch* touch = event.touches()->length() == 1 |
| 421 ? event.touches()->item(0) | 423 ? event.touches()->item(0) |
| 422 : event.changedTouches()->item(0); | 424 : event.changedTouches()->item(0); |
| 423 if (touch->identifier()) | 425 if (touch->identifier()) |
| 424 return; | 426 return; |
| 425 | 427 |
| 426 if (event.type() == EventTypeNames::touchstart) | 428 if (event.type() == EventTypeNames::touchstart) |
| 427 type = MouseDown; | 429 m_type = MouseDown; |
| 428 else if (event.type() == EventTypeNames::touchmove) | 430 else if (event.type() == EventTypeNames::touchmove) |
| 429 type = MouseMove; | 431 m_type = MouseMove; |
| 430 else if (event.type() == EventTypeNames::touchend) | 432 else if (event.type() == EventTypeNames::touchend) |
| 431 type = MouseUp; | 433 m_type = MouseUp; |
| 432 else | 434 else |
| 433 return; | 435 return; |
| 434 | 436 |
| 435 timeStampSeconds = event.platformTimeStamp().InSeconds(); | 437 m_timeStampSeconds = event.platformTimeStamp().InSeconds(); |
| 436 modifiers = event.modifiers(); | 438 m_modifiers = event.modifiers(); |
| 437 | 439 |
| 438 // The mouse event co-ordinates should be generated from the co-ordinates of | 440 // The mouse event co-ordinates should be generated from the co-ordinates of |
| 439 // the touch point. | 441 // the touch point. |
| 440 FrameView* view = toFrameView(widget->parent()); | 442 FrameView* view = toFrameView(widget->parent()); |
| 441 // FIXME: if view == nullptr, pointInRootFrame will really be | 443 // FIXME: if view == nullptr, pointInRootFrame will really be |
| 442 // pointInRootContent. | 444 // pointInRootContent. |
| 443 IntPoint pointInRootFrame = roundedIntPoint(touch->absoluteLocation()); | 445 IntPoint pointInRootFrame = roundedIntPoint(touch->absoluteLocation()); |
| 444 if (view) | 446 if (view) |
| 445 pointInRootFrame = view->contentsToRootFrame(pointInRootFrame); | 447 pointInRootFrame = view->contentsToRootFrame(pointInRootFrame); |
| 446 IntPoint screenPoint = roundedIntPoint(touch->screenLocation()); | 448 IntPoint screenPoint = roundedIntPoint(touch->screenLocation()); |
| 447 globalX = screenPoint.x(); | 449 globalX = screenPoint.x(); |
| 448 globalY = screenPoint.y(); | 450 globalY = screenPoint.y(); |
| 449 windowX = pointInRootFrame.x(); | 451 windowX = pointInRootFrame.x(); |
| 450 windowY = pointInRootFrame.y(); | 452 windowY = pointInRootFrame.y(); |
| 451 | 453 |
| 452 button = WebMouseEvent::Button::Left; | 454 button = WebMouseEvent::Button::Left; |
| 453 modifiers |= WebInputEvent::LeftButtonDown; | 455 m_modifiers |= WebInputEvent::LeftButtonDown; |
| 454 clickCount = (type == MouseDown || type == MouseUp); | 456 clickCount = (m_type == MouseDown || m_type == MouseUp); |
| 455 | 457 |
| 456 IntPoint localPoint = convertAbsoluteLocationForLayoutObjectInt( | 458 IntPoint localPoint = convertAbsoluteLocationForLayoutObjectInt( |
| 457 DoublePoint(touch->absoluteLocation()), layoutItem); | 459 DoublePoint(touch->absoluteLocation()), layoutItem); |
| 458 x = localPoint.x(); | 460 x = localPoint.x(); |
| 459 y = localPoint.y(); | 461 y = localPoint.y(); |
| 460 | 462 |
| 461 pointerType = WebPointerProperties::PointerType::Touch; | 463 pointerType = WebPointerProperties::PointerType::Touch; |
| 462 } | 464 } |
| 463 | 465 |
| 464 WebKeyboardEventBuilder::WebKeyboardEventBuilder(const KeyboardEvent& event) { | 466 WebKeyboardEventBuilder::WebKeyboardEventBuilder(const KeyboardEvent& event) { |
| 465 if (const WebKeyboardEvent* webEvent = event.keyEvent()) { | 467 if (const WebKeyboardEvent* webEvent = event.keyEvent()) { |
| 466 *static_cast<WebKeyboardEvent*>(this) = *webEvent; | 468 *static_cast<WebKeyboardEvent*>(this) = *webEvent; |
| 467 | 469 |
| 468 // TODO(dtapuska): DOM KeyboardEvents converted back to WebInputEvents | 470 // TODO(dtapuska): DOM KeyboardEvents converted back to WebInputEvents |
| 469 // drop the Raw behaviour. Figure out if this is actually really needed. | 471 // drop the Raw behaviour. Figure out if this is actually really needed. |
| 470 if (type == RawKeyDown) | 472 if (m_type == RawKeyDown) |
| 471 type = KeyDown; | 473 m_type = KeyDown; |
| 472 return; | 474 return; |
| 473 } | 475 } |
| 474 | 476 |
| 475 if (event.type() == EventTypeNames::keydown) | 477 if (event.type() == EventTypeNames::keydown) |
| 476 type = KeyDown; | 478 m_type = KeyDown; |
| 477 else if (event.type() == EventTypeNames::keyup) | 479 else if (event.type() == EventTypeNames::keyup) |
| 478 type = WebInputEvent::KeyUp; | 480 m_type = WebInputEvent::KeyUp; |
| 479 else if (event.type() == EventTypeNames::keypress) | 481 else if (event.type() == EventTypeNames::keypress) |
| 480 type = WebInputEvent::Char; | 482 m_type = WebInputEvent::Char; |
| 481 else | 483 else |
| 482 return; // Skip all other keyboard events. | 484 return; // Skip all other keyboard events. |
| 483 | 485 |
| 484 modifiers = event.modifiers(); | 486 m_modifiers = event.modifiers(); |
| 485 timeStampSeconds = event.platformTimeStamp().InSeconds(); | 487 m_timeStampSeconds = event.platformTimeStamp().InSeconds(); |
| 486 windowsKeyCode = event.keyCode(); | 488 windowsKeyCode = event.keyCode(); |
| 487 } | 489 } |
| 488 | 490 |
| 489 static WebTouchPoint toWebTouchPoint(const Touch* touch, | 491 static WebTouchPoint toWebTouchPoint(const Touch* touch, |
| 490 const LayoutItem layoutItem, | 492 const LayoutItem layoutItem, |
| 491 WebTouchPoint::State state, | 493 WebTouchPoint::State state, |
| 492 WebPointerProperties::PointerType type) { | 494 WebPointerProperties::PointerType type) { |
| 493 WebTouchPoint point; | 495 WebTouchPoint point; |
| 494 point.pointerType = type; | 496 point.pointerType = type; |
| 495 point.id = touch->identifier(); | 497 point.id = touch->identifier(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 touchPoints[pointIndex] = | 538 touchPoints[pointIndex] = |
| 537 toWebTouchPoint(touch, layoutItem, state, pointerType); | 539 toWebTouchPoint(touch, layoutItem, state, pointerType); |
| 538 ++(*touchPointsLength); | 540 ++(*touchPointsLength); |
| 539 } | 541 } |
| 540 } | 542 } |
| 541 } | 543 } |
| 542 | 544 |
| 543 WebTouchEventBuilder::WebTouchEventBuilder(const LayoutItem layoutItem, | 545 WebTouchEventBuilder::WebTouchEventBuilder(const LayoutItem layoutItem, |
| 544 const TouchEvent& event) { | 546 const TouchEvent& event) { |
| 545 if (event.type() == EventTypeNames::touchstart) | 547 if (event.type() == EventTypeNames::touchstart) |
| 546 type = TouchStart; | 548 m_type = TouchStart; |
| 547 else if (event.type() == EventTypeNames::touchmove) | 549 else if (event.type() == EventTypeNames::touchmove) |
| 548 type = TouchMove; | 550 m_type = TouchMove; |
| 549 else if (event.type() == EventTypeNames::touchend) | 551 else if (event.type() == EventTypeNames::touchend) |
| 550 type = TouchEnd; | 552 m_type = TouchEnd; |
| 551 else if (event.type() == EventTypeNames::touchcancel) | 553 else if (event.type() == EventTypeNames::touchcancel) |
| 552 type = TouchCancel; | 554 m_type = TouchCancel; |
| 553 else { | 555 else { |
| 554 NOTREACHED(); | 556 NOTREACHED(); |
| 555 type = Undefined; | 557 m_type = Undefined; |
| 556 return; | 558 return; |
| 557 } | 559 } |
| 558 | 560 |
| 559 timeStampSeconds = event.platformTimeStamp().InSeconds(); | 561 m_timeStampSeconds = event.platformTimeStamp().InSeconds(); |
| 560 modifiers = event.modifiers(); | 562 m_modifiers = event.modifiers(); |
| 561 dispatchType = event.cancelable() ? WebInputEvent::Blocking | 563 dispatchType = event.cancelable() ? WebInputEvent::Blocking |
| 562 : WebInputEvent::EventNonBlocking; | 564 : WebInputEvent::EventNonBlocking; |
| 563 movedBeyondSlopRegion = event.causesScrollingIfUncanceled(); | 565 movedBeyondSlopRegion = event.causesScrollingIfUncanceled(); |
| 564 | 566 |
| 565 // Currently touches[] is empty, add stationary points as-is. | 567 // Currently touches[] is empty, add stationary points as-is. |
| 566 for (unsigned i = 0; | 568 for (unsigned i = 0; |
| 567 i < event.touches()->length() && | 569 i < event.touches()->length() && |
| 568 i < static_cast<unsigned>(WebTouchEvent::kTouchesLengthCap); | 570 i < static_cast<unsigned>(WebTouchEvent::kTouchesLengthCap); |
| 569 ++i) { | 571 ++i) { |
| 570 touches[i] = | 572 touches[i] = |
| 571 toWebTouchPoint(event.touches()->item(i), layoutItem, | 573 toWebTouchPoint(event.touches()->item(i), layoutItem, |
| 572 WebTouchPoint::StateStationary, event.pointerType()); | 574 WebTouchPoint::StateStationary, event.pointerType()); |
| 573 ++touchesLength; | 575 ++touchesLength; |
| 574 } | 576 } |
| 575 // If any existing points are also in the change list, we should update | 577 // If any existing points are also in the change list, we should update |
| 576 // their state, otherwise just add the new points. | 578 // their state, otherwise just add the new points. |
| 577 addTouchPointsUpdateStateIfNecessary( | 579 addTouchPointsUpdateStateIfNecessary( |
| 578 toWebTouchPointState(event.type()), event.changedTouches(), touches, | 580 toWebTouchPointState(event.type()), event.changedTouches(), touches, |
| 579 &touchesLength, layoutItem, event.pointerType()); | 581 &touchesLength, layoutItem, event.pointerType()); |
| 580 } | 582 } |
| 581 | 583 |
| 582 Vector<PlatformMouseEvent> createPlatformMouseEventVector( | 584 Vector<PlatformMouseEvent> createPlatformMouseEventVector( |
| 583 Widget* widget, | 585 Widget* widget, |
| 584 const std::vector<const WebInputEvent*>& coalescedEvents) { | 586 const std::vector<const WebInputEvent*>& coalescedEvents) { |
| 585 Vector<PlatformMouseEvent> result; | 587 Vector<PlatformMouseEvent> result; |
| 586 for (const auto& event : coalescedEvents) { | 588 for (const auto& event : coalescedEvents) { |
| 587 DCHECK(WebInputEvent::isMouseEventType(event->type)); | 589 DCHECK(WebInputEvent::isMouseEventType(event->type())); |
| 588 result.append(PlatformMouseEventBuilder( | 590 result.append(PlatformMouseEventBuilder( |
| 589 widget, static_cast<const WebMouseEvent&>(*event))); | 591 widget, static_cast<const WebMouseEvent&>(*event))); |
| 590 } | 592 } |
| 591 return result; | 593 return result; |
| 592 } | 594 } |
| 593 | 595 |
| 594 Vector<PlatformTouchEvent> createPlatformTouchEventVector( | 596 Vector<PlatformTouchEvent> createPlatformTouchEventVector( |
| 595 Widget* widget, | 597 Widget* widget, |
| 596 const std::vector<const WebInputEvent*>& coalescedEvents) { | 598 const std::vector<const WebInputEvent*>& coalescedEvents) { |
| 597 Vector<PlatformTouchEvent> result; | 599 Vector<PlatformTouchEvent> result; |
| 598 for (const auto& event : coalescedEvents) { | 600 for (const auto& event : coalescedEvents) { |
| 599 DCHECK(WebInputEvent::isTouchEventType(event->type)); | 601 DCHECK(WebInputEvent::isTouchEventType(event->type())); |
| 600 result.append(PlatformTouchEventBuilder( | 602 result.append(PlatformTouchEventBuilder( |
| 601 widget, static_cast<const WebTouchEvent&>(*event))); | 603 widget, static_cast<const WebTouchEvent&>(*event))); |
| 602 } | 604 } |
| 603 return result; | 605 return result; |
| 604 } | 606 } |
| 605 | 607 |
| 606 } // namespace blink | 608 } // namespace blink |
| OLD | NEW |