Chromium Code Reviews| 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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 476 static FloatPoint convertAbsoluteLocationForRenderObjectFloat(const LayoutPoint& location, const RenderObject& renderObject) | 476 static FloatPoint convertAbsoluteLocationForRenderObjectFloat(const LayoutPoint& location, const RenderObject& renderObject) |
| 477 { | 477 { |
| 478 return renderObject.absoluteToLocal(location, UseTransforms); | 478 return renderObject.absoluteToLocal(location, UseTransforms); |
| 479 } | 479 } |
| 480 | 480 |
| 481 static IntPoint convertAbsoluteLocationForRenderObject(const LayoutPoint& locati on, const RenderObject& renderObject) | 481 static IntPoint convertAbsoluteLocationForRenderObject(const LayoutPoint& locati on, const RenderObject& renderObject) |
| 482 { | 482 { |
| 483 return roundedIntPoint(convertAbsoluteLocationForRenderObjectFloat(location, renderObject)); | 483 return roundedIntPoint(convertAbsoluteLocationForRenderObjectFloat(location, renderObject)); |
| 484 } | 484 } |
| 485 | 485 |
| 486 static void updateWebMouseEventFromCoreMouseEvent(const MouseRelatedEvent& event , const Widget& widget, const RenderObject& renderObject, WebMouseEvent& webEven t) | 486 // FIXME: Change |widget| to const Widget& after RemoteFrames get |
| 487 // RemoteFrameViews. | |
| 488 static void updateWebMouseEventFromCoreMouseEvent(const MouseRelatedEvent& event , const Widget* widget, const RenderObject& renderObject, WebMouseEvent& webEven t) | |
| 487 { | 489 { |
| 488 webEvent.timeStampSeconds = event.timeStamp() / millisPerSecond; | 490 webEvent.timeStampSeconds = event.timeStamp() / millisPerSecond; |
| 489 webEvent.modifiers = getWebInputModifiers(event); | 491 webEvent.modifiers = getWebInputModifiers(event); |
| 490 | 492 |
| 491 FrameView* view = toFrameView(widget.parent()); | 493 FrameView* view = widget ? toFrameView(widget->parent()) : 0; |
|
Charlie Reis
2014/10/10 21:51:44
Looks like this was updated recently to use FrameV
| |
| 492 IntPoint windowPoint = IntPoint(event.absoluteLocation().x(), event.absolute Location().y()); | 494 IntPoint windowPoint = IntPoint(event.absoluteLocation().x(), event.absolute Location().y()); |
| 493 if (view) | 495 if (view) |
| 494 windowPoint = view->contentsToWindow(windowPoint); | 496 windowPoint = view->contentsToWindow(windowPoint); |
| 495 webEvent.globalX = event.screenX(); | 497 webEvent.globalX = event.screenX(); |
| 496 webEvent.globalY = event.screenY(); | 498 webEvent.globalY = event.screenY(); |
| 497 webEvent.windowX = windowPoint.x(); | 499 webEvent.windowX = windowPoint.x(); |
| 498 webEvent.windowY = windowPoint.y(); | 500 webEvent.windowY = windowPoint.y(); |
| 499 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL ocation(), renderObject); | 501 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL ocation(), renderObject); |
| 500 webEvent.x = localPoint.x(); | 502 webEvent.x = localPoint.x(); |
| 501 webEvent.y = localPoint.y(); | 503 webEvent.y = localPoint.y(); |
| 502 } | 504 } |
| 503 | 505 |
| 504 WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const RenderObj ect* renderObject, const MouseEvent& event) | 506 WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const RenderObj ect* renderObject, const MouseEvent& event) |
| 505 { | 507 { |
| 506 if (event.type() == EventTypeNames::mousemove) | 508 if (event.type() == EventTypeNames::mousemove) |
| 507 type = WebInputEvent::MouseMove; | 509 type = WebInputEvent::MouseMove; |
| 508 else if (event.type() == EventTypeNames::mouseout) | 510 else if (event.type() == EventTypeNames::mouseout) |
| 509 type = WebInputEvent::MouseLeave; | 511 type = WebInputEvent::MouseLeave; |
| 510 else if (event.type() == EventTypeNames::mouseover) | 512 else if (event.type() == EventTypeNames::mouseover) |
| 511 type = WebInputEvent::MouseEnter; | 513 type = WebInputEvent::MouseEnter; |
| 512 else if (event.type() == EventTypeNames::mousedown) | 514 else if (event.type() == EventTypeNames::mousedown) |
| 513 type = WebInputEvent::MouseDown; | 515 type = WebInputEvent::MouseDown; |
| 514 else if (event.type() == EventTypeNames::mouseup) | 516 else if (event.type() == EventTypeNames::mouseup) |
| 515 type = WebInputEvent::MouseUp; | 517 type = WebInputEvent::MouseUp; |
| 516 else if (event.type() == EventTypeNames::contextmenu) | 518 else if (event.type() == EventTypeNames::contextmenu) |
| 517 type = WebInputEvent::ContextMenu; | 519 type = WebInputEvent::ContextMenu; |
| 518 else | 520 else |
| 519 return; // Skip all other mouse events. | 521 return; // Skip all other mouse events. |
| 520 | 522 |
| 521 updateWebMouseEventFromCoreMouseEvent(event, *widget, *renderObject, *this); | 523 updateWebMouseEventFromCoreMouseEvent(event, widget, *renderObject, *this); |
| 522 | 524 |
| 523 switch (event.button()) { | 525 switch (event.button()) { |
| 524 case LeftButton: | 526 case LeftButton: |
| 525 button = WebMouseEvent::ButtonLeft; | 527 button = WebMouseEvent::ButtonLeft; |
| 526 break; | 528 break; |
| 527 case MiddleButton: | 529 case MiddleButton: |
| 528 button = WebMouseEvent::ButtonMiddle; | 530 button = WebMouseEvent::ButtonMiddle; |
| 529 break; | 531 break; |
| 530 case RightButton: | 532 case RightButton: |
| 531 button = WebMouseEvent::ButtonRight; | 533 button = WebMouseEvent::ButtonRight; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 641 | 643 |
| 642 button = static_cast<Button>(event.button()); | 644 button = static_cast<Button>(event.button()); |
| 643 clickCount = event.clickCount(); | 645 clickCount = event.clickCount(); |
| 644 } | 646 } |
| 645 | 647 |
| 646 WebMouseWheelEventBuilder::WebMouseWheelEventBuilder(const Widget* widget, const RenderObject* renderObject, const WheelEvent& event) | 648 WebMouseWheelEventBuilder::WebMouseWheelEventBuilder(const Widget* widget, const RenderObject* renderObject, const WheelEvent& event) |
| 647 { | 649 { |
| 648 if (event.type() != EventTypeNames::wheel && event.type() != EventTypeNames: :mousewheel) | 650 if (event.type() != EventTypeNames::wheel && event.type() != EventTypeNames: :mousewheel) |
| 649 return; | 651 return; |
| 650 type = WebInputEvent::MouseWheel; | 652 type = WebInputEvent::MouseWheel; |
| 651 updateWebMouseEventFromCoreMouseEvent(event, *widget, *renderObject, *this); | 653 updateWebMouseEventFromCoreMouseEvent(event, widget, *renderObject, *this); |
| 652 deltaX = -event.deltaX(); | 654 deltaX = -event.deltaX(); |
| 653 deltaY = -event.deltaY(); | 655 deltaY = -event.deltaY(); |
| 654 wheelTicksX = event.ticksX(); | 656 wheelTicksX = event.ticksX(); |
| 655 wheelTicksY = event.ticksY(); | 657 wheelTicksY = event.ticksY(); |
| 656 scrollByPage = event.deltaMode() == WheelEvent::DOM_DELTA_PAGE; | 658 scrollByPage = event.deltaMode() == WheelEvent::DOM_DELTA_PAGE; |
| 657 } | 659 } |
| 658 | 660 |
| 659 WebKeyboardEventBuilder::WebKeyboardEventBuilder(const KeyboardEvent& event) | 661 WebKeyboardEventBuilder::WebKeyboardEventBuilder(const KeyboardEvent& event) |
| 660 { | 662 { |
| 661 if (event.type() == EventTypeNames::keydown) | 663 if (event.type() == EventTypeNames::keydown) |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 827 modifiers = getWebInputModifiers(event); | 829 modifiers = getWebInputModifiers(event); |
| 828 | 830 |
| 829 globalX = event.screenX(); | 831 globalX = event.screenX(); |
| 830 globalY = event.screenY(); | 832 globalY = event.screenY(); |
| 831 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL ocation(), *renderObject); | 833 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL ocation(), *renderObject); |
| 832 x = localPoint.x(); | 834 x = localPoint.x(); |
| 833 y = localPoint.y(); | 835 y = localPoint.y(); |
| 834 } | 836 } |
| 835 | 837 |
| 836 } // namespace blink | 838 } // namespace blink |
| OLD | NEW |