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 updateWebMouseEventFromWebCoreMouseEvent(const MouseRelatedEvent& ev
ent, const Widget& widget, const RenderObject& renderObject, WebMouseEvent& webE
vent) | 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 = toScrollView(widget.parent()); |
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(); |
(...skipping 14 matching lines...) Expand all Loading... |
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 updateWebMouseEventFromWebCoreMouseEvent(event, *widget, *renderObject, *thi
s); | 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 updateWebMouseEventFromWebCoreMouseEvent(event, *widget, *renderObject, *thi
s); | 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 modifiers = getWebInputModifiers(event); | 810 modifiers = getWebInputModifiers(event); |
811 | 811 |
812 globalX = event.screenX(); | 812 globalX = event.screenX(); |
813 globalY = event.screenY(); | 813 globalY = event.screenY(); |
814 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL
ocation(), *renderObject); | 814 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL
ocation(), *renderObject); |
815 x = localPoint.x(); | 815 x = localPoint.x(); |
816 y = localPoint.y(); | 816 y = localPoint.y(); |
817 } | 817 } |
818 | 818 |
819 } // namespace blink | 819 } // namespace blink |
OLD | NEW |