OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "WebToCCInputHandlerAdapter.h" | 7 #include "WebToCCInputHandlerAdapter.h" |
8 | 8 |
| 9 #include "IntPoint.h" |
| 10 #include "IntSize.h" |
| 11 #include "webcore_convert.h" |
9 #include <public/WebInputHandlerClient.h> | 12 #include <public/WebInputHandlerClient.h> |
10 | 13 |
11 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, webcore_name) \ | 14 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, webcore_name) \ |
12 COMPILE_ASSERT(int(WebKit::webkit_name) == int(WebCore::webcore_name), misma
tching_enums) | 15 COMPILE_ASSERT(int(WebKit::webkit_name) == int(WebCore::webcore_name), misma
tching_enums) |
13 | 16 |
14 COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusOnMainThread, CC
InputHandlerClient::ScrollOnMainThread); | 17 COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusOnMainThread, CC
InputHandlerClient::ScrollOnMainThread); |
15 COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusStarted, CCInput
HandlerClient::ScrollStarted); | 18 COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusStarted, CCInput
HandlerClient::ScrollStarted); |
16 COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusIgnored, CCInput
HandlerClient::ScrollIgnored); | 19 COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusIgnored, CCInput
HandlerClient::ScrollIgnored); |
17 COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollInputTypeGesture, CCIn
putHandlerClient::Gesture); | 20 COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollInputTypeGesture, CCIn
putHandlerClient::Gesture); |
18 COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollInputTypeWheel, CCInpu
tHandlerClient::Wheel); | 21 COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollInputTypeWheel, CCInpu
tHandlerClient::Wheel); |
(...skipping 20 matching lines...) Expand all Loading... |
39 : m_client(client) | 42 : m_client(client) |
40 { | 43 { |
41 } | 44 } |
42 | 45 |
43 virtual ~ClientAdapter() | 46 virtual ~ClientAdapter() |
44 { | 47 { |
45 } | 48 } |
46 | 49 |
47 virtual ScrollStatus scrollBegin(WebPoint point, ScrollInputType type) OVERR
IDE | 50 virtual ScrollStatus scrollBegin(WebPoint point, ScrollInputType type) OVERR
IDE |
48 { | 51 { |
49 return static_cast<WebInputHandlerClient::ScrollStatus>(m_client->scroll
Begin(point, static_cast<WebCore::CCInputHandlerClient::ScrollInputType>(type)))
; | 52 return static_cast<WebInputHandlerClient::ScrollStatus>(m_client->scroll
Begin(convert(point), static_cast<WebCore::CCInputHandlerClient::ScrollInputType
>(type))); |
50 } | 53 } |
51 | 54 |
52 virtual void scrollBy(WebPoint point, WebSize offset) OVERRIDE | 55 virtual void scrollBy(WebPoint point, WebSize offset) OVERRIDE |
53 { | 56 { |
54 m_client->scrollBy(point, offset); | 57 m_client->scrollBy(convert(point), convert(offset)); |
55 } | 58 } |
56 | 59 |
57 virtual void scrollEnd() OVERRIDE | 60 virtual void scrollEnd() OVERRIDE |
58 { | 61 { |
59 m_client->scrollEnd(); | 62 m_client->scrollEnd(); |
60 } | 63 } |
61 | 64 |
62 virtual void pinchGestureBegin() OVERRIDE | 65 virtual void pinchGestureBegin() OVERRIDE |
63 { | 66 { |
64 m_client->pinchGestureBegin(); | 67 m_client->pinchGestureBegin(); |
65 } | 68 } |
66 | 69 |
67 virtual void pinchGestureUpdate(float magnifyDelta, WebPoint anchor) OVERRID
E | 70 virtual void pinchGestureUpdate(float magnifyDelta, WebPoint anchor) OVERRID
E |
68 { | 71 { |
69 m_client->pinchGestureUpdate(magnifyDelta, anchor); | 72 m_client->pinchGestureUpdate(magnifyDelta, convert(anchor)); |
70 } | 73 } |
71 | 74 |
72 virtual void pinchGestureEnd() OVERRIDE | 75 virtual void pinchGestureEnd() OVERRIDE |
73 { | 76 { |
74 m_client->pinchGestureEnd(); | 77 m_client->pinchGestureEnd(); |
75 } | 78 } |
76 | 79 |
77 virtual void startPageScaleAnimation(WebSize targetPosition, | 80 virtual void startPageScaleAnimation(WebSize targetPosition, |
78 bool anchorPoint, | 81 bool anchorPoint, |
79 float pageScale, | 82 float pageScale, |
80 double startTime, | 83 double startTime, |
81 double duration) OVERRIDE | 84 double duration) OVERRIDE |
82 { | 85 { |
83 m_client->startPageScaleAnimation(targetPosition, anchorPoint, pageScale
, startTime, duration); | 86 m_client->startPageScaleAnimation(convert(targetPosition), anchorPoint,
pageScale, startTime, duration); |
84 } | 87 } |
85 | 88 |
86 virtual void scheduleAnimation() OVERRIDE | 89 virtual void scheduleAnimation() OVERRIDE |
87 { | 90 { |
88 m_client->scheduleAnimation(); | 91 m_client->scheduleAnimation(); |
89 } | 92 } |
90 | 93 |
91 private: | 94 private: |
92 WebCore::CCInputHandlerClient* m_client; | 95 WebCore::CCInputHandlerClient* m_client; |
93 }; | 96 }; |
94 | 97 |
95 | 98 |
96 void WebToCCInputHandlerAdapter::bindToClient(WebCore::CCInputHandlerClient* cli
ent) | 99 void WebToCCInputHandlerAdapter::bindToClient(WebCore::CCInputHandlerClient* cli
ent) |
97 { | 100 { |
98 m_clientAdapter = adoptPtr(new ClientAdapter(client)); | 101 m_clientAdapter = adoptPtr(new ClientAdapter(client)); |
99 m_handler->bindToClient(m_clientAdapter.get()); | 102 m_handler->bindToClient(m_clientAdapter.get()); |
100 } | 103 } |
101 | 104 |
102 void WebToCCInputHandlerAdapter::animate(double monotonicTime) | 105 void WebToCCInputHandlerAdapter::animate(double monotonicTime) |
103 { | 106 { |
104 m_handler->animate(monotonicTime); | 107 m_handler->animate(monotonicTime); |
105 } | 108 } |
106 | 109 |
107 } | 110 } |
108 | 111 |
OLD | NEW |