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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
477 static FloatPoint convertAbsoluteLocationForRenderObjectFloat(const LayoutPoint& location, const RenderObject& renderObject) | 477 static FloatPoint convertAbsoluteLocationForRenderObjectFloat(const LayoutPoint& location, const RenderObject& renderObject) |
478 { | 478 { |
479 return renderObject.absoluteToLocal(location, UseTransforms); | 479 return renderObject.absoluteToLocal(location, UseTransforms); |
480 } | 480 } |
481 | 481 |
482 static IntPoint convertAbsoluteLocationForRenderObject(const LayoutPoint& locati on, const RenderObject& renderObject) | 482 static IntPoint convertAbsoluteLocationForRenderObject(const LayoutPoint& locati on, const RenderObject& renderObject) |
483 { | 483 { |
484 return roundedIntPoint(convertAbsoluteLocationForRenderObjectFloat(location, renderObject)); | 484 return roundedIntPoint(convertAbsoluteLocationForRenderObjectFloat(location, renderObject)); |
485 } | 485 } |
486 | 486 |
487 static void updateWebMouseEventFromCoreMouseEvent(const MouseRelatedEvent& event , const Widget& widget, const RenderObject& renderObject, WebMouseEvent& webEven t) | 487 static void updateWebMouseEventFromCoreMouseEvent(const MouseRelatedEvent& event , const Widget* widget, const RenderObject& renderObject, WebMouseEvent& webEven t) |
488 { | 488 { |
489 webEvent.timeStampSeconds = event.timeStamp() / millisPerSecond; | 489 webEvent.timeStampSeconds = event.timeStamp() / millisPerSecond; |
490 webEvent.modifiers = getWebInputModifiers(event); | 490 webEvent.modifiers = getWebInputModifiers(event); |
491 | 491 |
492 ScrollView* view = toScrollView(widget.parent()); | 492 ScrollView* view = widget ? toScrollView(widget->parent()) : 0; |
Charlie Reis
2014/10/10 03:42:39
This was a bit awkward, but we don't have a widget
kenrb
2014/10/10 19:59:08
I am guessing webFrame->frame()->view() is null in
Charlie Reis
2014/10/10 20:25:24
Yes, and done.
| |
493 IntPoint windowPoint = IntPoint(event.absoluteLocation().x(), event.absolute Location().y()); | 493 IntPoint windowPoint = IntPoint(event.absoluteLocation().x(), event.absolute Location().y()); |
494 if (view) | 494 if (view) |
495 windowPoint = view->contentsToWindow(windowPoint); | 495 windowPoint = view->contentsToWindow(windowPoint); |
496 webEvent.globalX = event.screenX(); | 496 webEvent.globalX = event.screenX(); |
497 webEvent.globalY = event.screenY(); | 497 webEvent.globalY = event.screenY(); |
498 webEvent.windowX = windowPoint.x(); | 498 webEvent.windowX = windowPoint.x(); |
499 webEvent.windowY = windowPoint.y(); | 499 webEvent.windowY = windowPoint.y(); |
500 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL ocation(), renderObject); | 500 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL ocation(), renderObject); |
501 webEvent.x = localPoint.x(); | 501 webEvent.x = localPoint.x(); |
502 webEvent.y = localPoint.y(); | 502 webEvent.y = localPoint.y(); |
503 } | 503 } |
504 | 504 |
505 WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const RenderObj ect* renderObject, const MouseEvent& event) | 505 WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const RenderObj ect* renderObject, const MouseEvent& event) |
506 { | 506 { |
507 if (event.type() == EventTypeNames::mousemove) | 507 if (event.type() == EventTypeNames::mousemove) |
508 type = WebInputEvent::MouseMove; | 508 type = WebInputEvent::MouseMove; |
509 else if (event.type() == EventTypeNames::mouseout) | 509 else if (event.type() == EventTypeNames::mouseout) |
510 type = WebInputEvent::MouseLeave; | 510 type = WebInputEvent::MouseLeave; |
511 else if (event.type() == EventTypeNames::mouseover) | 511 else if (event.type() == EventTypeNames::mouseover) |
512 type = WebInputEvent::MouseEnter; | 512 type = WebInputEvent::MouseEnter; |
513 else if (event.type() == EventTypeNames::mousedown) | 513 else if (event.type() == EventTypeNames::mousedown) |
514 type = WebInputEvent::MouseDown; | 514 type = WebInputEvent::MouseDown; |
515 else if (event.type() == EventTypeNames::mouseup) | 515 else if (event.type() == EventTypeNames::mouseup) |
516 type = WebInputEvent::MouseUp; | 516 type = WebInputEvent::MouseUp; |
517 else if (event.type() == EventTypeNames::contextmenu) | 517 else if (event.type() == EventTypeNames::contextmenu) |
518 type = WebInputEvent::ContextMenu; | 518 type = WebInputEvent::ContextMenu; |
519 else | 519 else |
520 return; // Skip all other mouse events. | 520 return; // Skip all other mouse events. |
521 | 521 |
522 updateWebMouseEventFromCoreMouseEvent(event, *widget, *renderObject, *this); | 522 updateWebMouseEventFromCoreMouseEvent(event, widget, *renderObject, *this); |
523 | 523 |
524 switch (event.button()) { | 524 switch (event.button()) { |
525 case LeftButton: | 525 case LeftButton: |
526 button = WebMouseEvent::ButtonLeft; | 526 button = WebMouseEvent::ButtonLeft; |
527 break; | 527 break; |
528 case MiddleButton: | 528 case MiddleButton: |
529 button = WebMouseEvent::ButtonMiddle; | 529 button = WebMouseEvent::ButtonMiddle; |
530 break; | 530 break; |
531 case RightButton: | 531 case RightButton: |
532 button = WebMouseEvent::ButtonRight; | 532 button = WebMouseEvent::ButtonRight; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
642 | 642 |
643 button = static_cast<Button>(event.button()); | 643 button = static_cast<Button>(event.button()); |
644 clickCount = event.clickCount(); | 644 clickCount = event.clickCount(); |
645 } | 645 } |
646 | 646 |
647 WebMouseWheelEventBuilder::WebMouseWheelEventBuilder(const Widget* widget, const RenderObject* renderObject, const WheelEvent& event) | 647 WebMouseWheelEventBuilder::WebMouseWheelEventBuilder(const Widget* widget, const RenderObject* renderObject, const WheelEvent& event) |
648 { | 648 { |
649 if (event.type() != EventTypeNames::wheel && event.type() != EventTypeNames: :mousewheel) | 649 if (event.type() != EventTypeNames::wheel && event.type() != EventTypeNames: :mousewheel) |
650 return; | 650 return; |
651 type = WebInputEvent::MouseWheel; | 651 type = WebInputEvent::MouseWheel; |
652 updateWebMouseEventFromCoreMouseEvent(event, *widget, *renderObject, *this); | 652 updateWebMouseEventFromCoreMouseEvent(event, widget, *renderObject, *this); |
653 deltaX = -event.deltaX(); | 653 deltaX = -event.deltaX(); |
654 deltaY = -event.deltaY(); | 654 deltaY = -event.deltaY(); |
655 wheelTicksX = event.ticksX(); | 655 wheelTicksX = event.ticksX(); |
656 wheelTicksY = event.ticksY(); | 656 wheelTicksY = event.ticksY(); |
657 scrollByPage = event.deltaMode() == WheelEvent::DOM_DELTA_PAGE; | 657 scrollByPage = event.deltaMode() == WheelEvent::DOM_DELTA_PAGE; |
658 } | 658 } |
659 | 659 |
660 WebKeyboardEventBuilder::WebKeyboardEventBuilder(const KeyboardEvent& event) | 660 WebKeyboardEventBuilder::WebKeyboardEventBuilder(const KeyboardEvent& event) |
661 { | 661 { |
662 if (event.type() == EventTypeNames::keydown) | 662 if (event.type() == EventTypeNames::keydown) |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
828 modifiers = getWebInputModifiers(event); | 828 modifiers = getWebInputModifiers(event); |
829 | 829 |
830 globalX = event.screenX(); | 830 globalX = event.screenX(); |
831 globalY = event.screenY(); | 831 globalY = event.screenY(); |
832 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL ocation(), *renderObject); | 832 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL ocation(), *renderObject); |
833 x = localPoint.x(); | 833 x = localPoint.x(); |
834 y = localPoint.y(); | 834 y = localPoint.y(); |
835 } | 835 } |
836 | 836 |
837 } // namespace blink | 837 } // namespace blink |
OLD | NEW |