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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 static IntPoint convertAbsoluteLocationForRenderObject(const LayoutPoint& locati
on, const WebCore::RenderObject& renderObject) | 426 static IntPoint convertAbsoluteLocationForRenderObject(const LayoutPoint& locati
on, const WebCore::RenderObject& renderObject) |
427 { | 427 { |
428 return roundedIntPoint(renderObject.absoluteToLocal(location, UseTransforms)
); | 428 return roundedIntPoint(renderObject.absoluteToLocal(location, UseTransforms)
); |
429 } | 429 } |
430 | 430 |
431 static void updateWebMouseEventFromWebCoreMouseEvent(const MouseRelatedEvent& ev
ent, const Widget& widget, const WebCore::RenderObject& renderObject, WebMouseEv
ent& webEvent) | 431 static void updateWebMouseEventFromWebCoreMouseEvent(const MouseRelatedEvent& ev
ent, const Widget& widget, const WebCore::RenderObject& renderObject, WebMouseEv
ent& webEvent) |
432 { | 432 { |
433 webEvent.timeStampSeconds = event.timeStamp() / millisPerSecond; | 433 webEvent.timeStampSeconds = event.timeStamp() / millisPerSecond; |
434 webEvent.modifiers = getWebInputModifiers(event); | 434 webEvent.modifiers = getWebInputModifiers(event); |
435 | 435 |
436 ScrollView* view = widget.root(); | 436 ScrollView* view = widget.parent(); |
437 IntPoint windowPoint = view->contentsToWindow(IntPoint(event.absoluteLocatio
n().x(), event.absoluteLocation().y())); | 437 IntPoint windowPoint = IntPoint(event.absoluteLocation().x(), event.absolute
Location().y()); |
| 438 if (view) |
| 439 windowPoint = view->contentsToWindow(windowPoint); |
438 webEvent.globalX = event.screenX(); | 440 webEvent.globalX = event.screenX(); |
439 webEvent.globalY = event.screenY(); | 441 webEvent.globalY = event.screenY(); |
440 webEvent.windowX = windowPoint.x(); | 442 webEvent.windowX = windowPoint.x(); |
441 webEvent.windowY = windowPoint.y(); | 443 webEvent.windowY = windowPoint.y(); |
442 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL
ocation(), renderObject); | 444 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL
ocation(), renderObject); |
443 webEvent.x = localPoint.x(); | 445 webEvent.x = localPoint.x(); |
444 webEvent.y = localPoint.y(); | 446 webEvent.y = localPoint.y(); |
445 } | 447 } |
446 | 448 |
447 WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const WebCore::
RenderObject* renderObject, const MouseEvent& event) | 449 WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const WebCore::
RenderObject* renderObject, const MouseEvent& event) |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 | 649 |
648 globalX = event.screenX(); | 650 globalX = event.screenX(); |
649 globalY = event.screenY(); | 651 globalY = event.screenY(); |
650 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL
ocation(), *renderObject); | 652 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL
ocation(), *renderObject); |
651 x = localPoint.x(); | 653 x = localPoint.x(); |
652 y = localPoint.y(); | 654 y = localPoint.y(); |
653 } | 655 } |
654 #endif // ENABLE(GESTURE_EVENTS) | 656 #endif // ENABLE(GESTURE_EVENTS) |
655 | 657 |
656 } // namespace WebKit | 658 } // namespace WebKit |
OLD | NEW |