| 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 "cc/stubs/int_point.h" | 9 #include "cc/stubs/int_point.h" |
| 10 #include "cc/stubs/int_size.h" | 10 #include "cc/stubs/int_size.h" |
| 11 #include "third_party/WebKit/Source/Platform/chromium/public/WebInputHandlerClie
nt.h" | 11 #include "third_party/WebKit/Source/Platform/chromium/public/WebInputHandlerClie
nt.h" |
| 12 #include "webcore_convert.h" | 12 #include "webcore_convert.h" |
| 13 | 13 |
| 14 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, cc_name) \ | 14 #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, cc_name) \ |
| 15 COMPILE_ASSERT(int(WebKit::webkit_name) == int(cc::cc_name), mismatching_enu
ms) | 15 COMPILE_ASSERT(int(WebKit::webkit_name) == int(cc::cc_name), mismatching_enu
ms) |
| 16 | 16 |
| 17 COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusOnMainThread, CC
InputHandlerClient::ScrollOnMainThread); | 17 COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusOnMainThread, In
putHandlerClient::ScrollOnMainThread); |
| 18 COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusStarted, CCInput
HandlerClient::ScrollStarted); | 18 COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusStarted, InputHa
ndlerClient::ScrollStarted); |
| 19 COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusIgnored, CCInput
HandlerClient::ScrollIgnored); | 19 COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusIgnored, InputHa
ndlerClient::ScrollIgnored); |
| 20 COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollInputTypeGesture, CCIn
putHandlerClient::Gesture); | 20 COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollInputTypeGesture, Inpu
tHandlerClient::Gesture); |
| 21 COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollInputTypeWheel, CCInpu
tHandlerClient::Wheel); | 21 COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollInputTypeWheel, InputH
andlerClient::Wheel); |
| 22 | 22 |
| 23 namespace WebKit { | 23 namespace WebKit { |
| 24 | 24 |
| 25 scoped_ptr<WebToCCInputHandlerAdapter> WebToCCInputHandlerAdapter::create(scoped
_ptr<WebInputHandler> handler) | 25 scoped_ptr<WebToCCInputHandlerAdapter> WebToCCInputHandlerAdapter::create(scoped
_ptr<WebInputHandler> handler) |
| 26 { | 26 { |
| 27 return scoped_ptr<WebToCCInputHandlerAdapter>(new WebToCCInputHandlerAdapter
(handler.Pass())); | 27 return scoped_ptr<WebToCCInputHandlerAdapter>(new WebToCCInputHandlerAdapter
(handler.Pass())); |
| 28 } | 28 } |
| 29 | 29 |
| 30 WebToCCInputHandlerAdapter::WebToCCInputHandlerAdapter(scoped_ptr<WebInputHandle
r> handler) | 30 WebToCCInputHandlerAdapter::WebToCCInputHandlerAdapter(scoped_ptr<WebInputHandle
r> handler) |
| 31 : m_handler(handler.Pass()) | 31 : m_handler(handler.Pass()) |
| 32 { | 32 { |
| 33 } | 33 } |
| 34 | 34 |
| 35 WebToCCInputHandlerAdapter::~WebToCCInputHandlerAdapter() | 35 WebToCCInputHandlerAdapter::~WebToCCInputHandlerAdapter() |
| 36 { | 36 { |
| 37 } | 37 } |
| 38 | 38 |
| 39 class WebToCCInputHandlerAdapter::ClientAdapter : public WebInputHandlerClient { | 39 class WebToCCInputHandlerAdapter::ClientAdapter : public WebInputHandlerClient { |
| 40 public: | 40 public: |
| 41 ClientAdapter(cc::CCInputHandlerClient* client) | 41 ClientAdapter(cc::InputHandlerClient* client) |
| 42 : m_client(client) | 42 : m_client(client) |
| 43 { | 43 { |
| 44 } | 44 } |
| 45 | 45 |
| 46 virtual ~ClientAdapter() | 46 virtual ~ClientAdapter() |
| 47 { | 47 { |
| 48 } | 48 } |
| 49 | 49 |
| 50 virtual ScrollStatus scrollBegin(WebPoint point, ScrollInputType type) OVERR
IDE | 50 virtual ScrollStatus scrollBegin(WebPoint point, ScrollInputType type) OVERR
IDE |
| 51 { | 51 { |
| 52 return static_cast<WebInputHandlerClient::ScrollStatus>(m_client->scroll
Begin(convert(point), static_cast<cc::CCInputHandlerClient::ScrollInputType>(typ
e))); | 52 return static_cast<WebInputHandlerClient::ScrollStatus>(m_client->scroll
Begin(convert(point), static_cast<cc::InputHandlerClient::ScrollInputType>(type)
)); |
| 53 } | 53 } |
| 54 | 54 |
| 55 virtual void scrollBy(WebPoint point, WebSize offset) OVERRIDE | 55 virtual void scrollBy(WebPoint point, WebSize offset) OVERRIDE |
| 56 { | 56 { |
| 57 m_client->scrollBy(convert(point), convert(offset)); | 57 m_client->scrollBy(convert(point), convert(offset)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 virtual void scrollEnd() OVERRIDE | 60 virtual void scrollEnd() OVERRIDE |
| 61 { | 61 { |
| 62 m_client->scrollEnd(); | 62 m_client->scrollEnd(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 85 { | 85 { |
| 86 m_client->startPageScaleAnimation(convert(targetPosition), anchorPoint,
pageScale, startTime, duration); | 86 m_client->startPageScaleAnimation(convert(targetPosition), anchorPoint,
pageScale, startTime, duration); |
| 87 } | 87 } |
| 88 | 88 |
| 89 virtual void scheduleAnimation() OVERRIDE | 89 virtual void scheduleAnimation() OVERRIDE |
| 90 { | 90 { |
| 91 m_client->scheduleAnimation(); | 91 m_client->scheduleAnimation(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 private: | 94 private: |
| 95 cc::CCInputHandlerClient* m_client; | 95 cc::InputHandlerClient* m_client; |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 | 98 |
| 99 void WebToCCInputHandlerAdapter::bindToClient(cc::CCInputHandlerClient* client) | 99 void WebToCCInputHandlerAdapter::bindToClient(cc::InputHandlerClient* client) |
| 100 { | 100 { |
| 101 m_clientAdapter.reset(new ClientAdapter(client)); | 101 m_clientAdapter.reset(new ClientAdapter(client)); |
| 102 m_handler->bindToClient(m_clientAdapter.get()); | 102 m_handler->bindToClient(m_clientAdapter.get()); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void WebToCCInputHandlerAdapter::animate(double monotonicTime) | 105 void WebToCCInputHandlerAdapter::animate(double monotonicTime) |
| 106 { | 106 { |
| 107 m_handler->animate(monotonicTime); | 107 m_handler->animate(monotonicTime); |
| 108 } | 108 } |
| 109 | 109 |
| 110 } | 110 } |
| OLD | NEW |