| 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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 } | 480 } |
| 481 | 481 |
| 482 // FIXME: Change |widget| to const Widget& after RemoteFrames get | 482 // FIXME: Change |widget| to const Widget& after RemoteFrames get |
| 483 // RemoteFrameViews. | 483 // RemoteFrameViews. |
| 484 static void updateWebMouseEventFromCoreMouseEvent(const MouseRelatedEvent& event
, const Widget* widget, const LayoutObject& layoutObject, WebMouseEvent& webEven
t) | 484 static void updateWebMouseEventFromCoreMouseEvent(const MouseRelatedEvent& event
, const Widget* widget, const LayoutObject& layoutObject, WebMouseEvent& webEven
t) |
| 485 { | 485 { |
| 486 webEvent.timeStampSeconds = event.timeStamp() / millisPerSecond; | 486 webEvent.timeStampSeconds = event.timeStamp() / millisPerSecond; |
| 487 webEvent.modifiers = getWebInputModifiers(event); | 487 webEvent.modifiers = getWebInputModifiers(event); |
| 488 | 488 |
| 489 FrameView* view = widget ? toFrameView(widget->parent()) : 0; | 489 FrameView* view = widget ? toFrameView(widget->parent()) : 0; |
| 490 IntPoint windowPoint = IntPoint(event.absoluteLocation().x(), event.absolute
Location().y()); | 490 // FIXME: If view == nullptr, pointInRootFrame will really be pointInRootCon
tent. |
| 491 IntPoint pointInRootFrame = IntPoint(event.absoluteLocation().x(), event.abs
oluteLocation().y()); |
| 491 if (view) | 492 if (view) |
| 492 windowPoint = view->contentsToWindow(windowPoint); | 493 pointInRootFrame = view->contentsToRootFrame(pointInRootFrame); |
| 493 webEvent.globalX = event.screenX(); | 494 webEvent.globalX = event.screenX(); |
| 494 webEvent.globalY = event.screenY(); | 495 webEvent.globalY = event.screenY(); |
| 495 webEvent.windowX = windowPoint.x(); | 496 webEvent.windowX = pointInRootFrame.x(); |
| 496 webEvent.windowY = windowPoint.y(); | 497 webEvent.windowY = pointInRootFrame.y(); |
| 497 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(event.absoluteL
ocation(), layoutObject); | 498 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(event.absoluteL
ocation(), layoutObject); |
| 498 webEvent.x = localPoint.x(); | 499 webEvent.x = localPoint.x(); |
| 499 webEvent.y = localPoint.y(); | 500 webEvent.y = localPoint.y(); |
| 500 } | 501 } |
| 501 | 502 |
| 502 WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const LayoutObj
ect* layoutObject, const MouseEvent& event) | 503 WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const LayoutObj
ect* layoutObject, const MouseEvent& event) |
| 503 { | 504 { |
| 504 if (event.type() == EventTypeNames::mousemove) | 505 if (event.type() == EventTypeNames::mousemove) |
| 505 type = WebInputEvent::MouseMove; | 506 type = WebInputEvent::MouseMove; |
| 506 else if (event.type() == EventTypeNames::mouseout) | 507 else if (event.type() == EventTypeNames::mouseout) |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 else if (event.type() == EventTypeNames::touchend) | 571 else if (event.type() == EventTypeNames::touchend) |
| 571 type = MouseUp; | 572 type = MouseUp; |
| 572 else | 573 else |
| 573 return; | 574 return; |
| 574 | 575 |
| 575 timeStampSeconds = event.timeStamp() / millisPerSecond; | 576 timeStampSeconds = event.timeStamp() / millisPerSecond; |
| 576 modifiers = getWebInputModifiers(event); | 577 modifiers = getWebInputModifiers(event); |
| 577 | 578 |
| 578 // The mouse event co-ordinates should be generated from the co-ordinates of
the touch point. | 579 // The mouse event co-ordinates should be generated from the co-ordinates of
the touch point. |
| 579 FrameView* view = toFrameView(widget->parent()); | 580 FrameView* view = toFrameView(widget->parent()); |
| 580 IntPoint windowPoint = roundedIntPoint(touch->absoluteLocation()); | 581 // FIXME: if view == nullptr, pointInRootFrame will really be pointInRootCon
tent. |
| 582 IntPoint pointInRootFrame = roundedIntPoint(touch->absoluteLocation()); |
| 581 if (view) | 583 if (view) |
| 582 windowPoint = view->contentsToWindow(windowPoint); | 584 pointInRootFrame = view->contentsToRootFrame(pointInRootFrame); |
| 583 IntPoint screenPoint = roundedIntPoint(touch->screenLocation()); | 585 IntPoint screenPoint = roundedIntPoint(touch->screenLocation()); |
| 584 globalX = screenPoint.x(); | 586 globalX = screenPoint.x(); |
| 585 globalY = screenPoint.y(); | 587 globalY = screenPoint.y(); |
| 586 windowX = windowPoint.x(); | 588 windowX = pointInRootFrame.x(); |
| 587 windowY = windowPoint.y(); | 589 windowY = pointInRootFrame.y(); |
| 588 | 590 |
| 589 button = WebMouseEvent::ButtonLeft; | 591 button = WebMouseEvent::ButtonLeft; |
| 590 modifiers |= WebInputEvent::LeftButtonDown; | 592 modifiers |= WebInputEvent::LeftButtonDown; |
| 591 clickCount = (type == MouseDown || type == MouseUp); | 593 clickCount = (type == MouseDown || type == MouseUp); |
| 592 | 594 |
| 593 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(touch->absolute
Location(), *layoutObject); | 595 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(touch->absolute
Location(), *layoutObject); |
| 594 x = localPoint.x(); | 596 x = localPoint.x(); |
| 595 y = localPoint.y(); | 597 y = localPoint.y(); |
| 596 } | 598 } |
| 597 | 599 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 modifiers = getWebInputModifiers(event); | 813 modifiers = getWebInputModifiers(event); |
| 812 | 814 |
| 813 globalX = event.screenX(); | 815 globalX = event.screenX(); |
| 814 globalY = event.screenY(); | 816 globalY = event.screenY(); |
| 815 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(event.absoluteL
ocation(), *layoutObject); | 817 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(event.absoluteL
ocation(), *layoutObject); |
| 816 x = localPoint.x(); | 818 x = localPoint.x(); |
| 817 y = localPoint.y(); | 819 y = localPoint.y(); |
| 818 } | 820 } |
| 819 | 821 |
| 820 } // namespace blink | 822 } // namespace blink |
| OLD | NEW |