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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 namespace WebKit { | 53 namespace WebKit { |
54 | 54 |
55 static const double millisPerSecond = 1000.0; | 55 static const double millisPerSecond = 1000.0; |
56 | 56 |
57 static float widgetInputEventsScaleFactor(const Widget* widget) | 57 static float widgetInputEventsScaleFactor(const Widget* widget) |
58 { | 58 { |
59 if (!widget) | 59 if (!widget) |
60 return 1; | 60 return 1; |
61 | 61 |
62 ScrollView* rootView = widget->root(); | 62 ScrollView* rootView = toScrollView(widget->root()); |
63 if (!rootView) | 63 if (!rootView) |
64 return 1; | 64 return 1; |
65 | 65 |
66 return rootView->inputEventsScaleFactor(); | 66 return rootView->inputEventsScaleFactor(); |
67 } | 67 } |
68 | 68 |
69 // MakePlatformMouseEvent ----------------------------------------------------- | 69 // MakePlatformMouseEvent ----------------------------------------------------- |
70 | 70 |
71 PlatformMouseEventBuilder::PlatformMouseEventBuilder(Widget* widget, const WebMo
useEvent& e) | 71 PlatformMouseEventBuilder::PlatformMouseEventBuilder(Widget* widget, const WebMo
useEvent& e) |
72 { | 72 { |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 static IntPoint convertAbsoluteLocationForRenderObject(const LayoutPoint& locati
on, const WebCore::RenderObject& renderObject) | 431 static IntPoint convertAbsoluteLocationForRenderObject(const LayoutPoint& locati
on, const WebCore::RenderObject& renderObject) |
432 { | 432 { |
433 return roundedIntPoint(renderObject.absoluteToLocal(location, UseTransforms)
); | 433 return roundedIntPoint(renderObject.absoluteToLocal(location, UseTransforms)
); |
434 } | 434 } |
435 | 435 |
436 static void updateWebMouseEventFromWebCoreMouseEvent(const MouseRelatedEvent& ev
ent, const Widget& widget, const WebCore::RenderObject& renderObject, WebMouseEv
ent& webEvent) | 436 static void updateWebMouseEventFromWebCoreMouseEvent(const MouseRelatedEvent& ev
ent, const Widget& widget, const WebCore::RenderObject& renderObject, WebMouseEv
ent& webEvent) |
437 { | 437 { |
438 webEvent.timeStampSeconds = event.timeStamp() / millisPerSecond; | 438 webEvent.timeStampSeconds = event.timeStamp() / millisPerSecond; |
439 webEvent.modifiers = getWebInputModifiers(event); | 439 webEvent.modifiers = getWebInputModifiers(event); |
440 | 440 |
441 ScrollView* view = widget.parent(); | 441 ScrollView* view = toScrollView(widget.parent()); |
442 IntPoint windowPoint = IntPoint(event.absoluteLocation().x(), event.absolute
Location().y()); | 442 IntPoint windowPoint = IntPoint(event.absoluteLocation().x(), event.absolute
Location().y()); |
443 if (view) | 443 if (view) |
444 windowPoint = view->contentsToWindow(windowPoint); | 444 windowPoint = view->contentsToWindow(windowPoint); |
445 webEvent.globalX = event.screenX(); | 445 webEvent.globalX = event.screenX(); |
446 webEvent.globalY = event.screenY(); | 446 webEvent.globalY = event.screenY(); |
447 webEvent.windowX = windowPoint.x(); | 447 webEvent.windowX = windowPoint.x(); |
448 webEvent.windowY = windowPoint.y(); | 448 webEvent.windowY = windowPoint.y(); |
449 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL
ocation(), renderObject); | 449 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL
ocation(), renderObject); |
450 webEvent.x = localPoint.x(); | 450 webEvent.x = localPoint.x(); |
451 webEvent.y = localPoint.y(); | 451 webEvent.y = localPoint.y(); |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 modifiers = getWebInputModifiers(event); | 743 modifiers = getWebInputModifiers(event); |
744 | 744 |
745 globalX = event.screenX(); | 745 globalX = event.screenX(); |
746 globalY = event.screenY(); | 746 globalY = event.screenY(); |
747 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL
ocation(), *renderObject); | 747 IntPoint localPoint = convertAbsoluteLocationForRenderObject(event.absoluteL
ocation(), *renderObject); |
748 x = localPoint.x(); | 748 x = localPoint.x(); |
749 y = localPoint.y(); | 749 y = localPoint.y(); |
750 } | 750 } |
751 | 751 |
752 } // namespace WebKit | 752 } // namespace WebKit |
OLD | NEW |