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