OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/frame_host/cross_process_frame_connector.h" | 5 #include "content/browser/frame_host/cross_process_frame_connector.h" |
6 | 6 |
7 #include "cc/surfaces/surface.h" | 7 #include "cc/surfaces/surface.h" |
8 #include "cc/surfaces/surface_manager.h" | 8 #include "cc/surfaces/surface_manager.h" |
9 #include "content/browser/compositor/surface_utils.h" | 9 #include "content/browser/compositor/surface_utils.h" |
10 #include "content/browser/frame_host/frame_tree.h" | 10 #include "content/browser/frame_host/frame_tree.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 void CrossProcessFrameConnector::OnInitializeChildFrame(float scale_factor) { | 115 void CrossProcessFrameConnector::OnInitializeChildFrame(float scale_factor) { |
116 if (scale_factor != device_scale_factor_) | 116 if (scale_factor != device_scale_factor_) |
117 SetDeviceScaleFactor(scale_factor); | 117 SetDeviceScaleFactor(scale_factor); |
118 } | 118 } |
119 | 119 |
120 gfx::Rect CrossProcessFrameConnector::ChildFrameRect() { | 120 gfx::Rect CrossProcessFrameConnector::ChildFrameRect() { |
121 return child_frame_rect_; | 121 return child_frame_rect_; |
122 } | 122 } |
123 | 123 |
124 void CrossProcessFrameConnector::GetScreenInfo(blink::WebScreenInfo* results) { | 124 void CrossProcessFrameConnector::GetScreenInfo(blink::WebScreenInfo* results) { |
125 auto parent_view = GetParentRenderWidgetHostView(); | 125 auto* parent_view = GetParentRenderWidgetHostView(); |
126 if (parent_view) { | 126 if (parent_view) { |
127 parent_view->GetScreenInfo(results); | 127 parent_view->GetScreenInfo(results); |
128 } | 128 } |
129 } | 129 } |
130 | 130 |
131 void CrossProcessFrameConnector::UpdateCursor(const WebCursor& cursor) { | 131 void CrossProcessFrameConnector::UpdateCursor(const WebCursor& cursor) { |
132 RenderWidgetHostViewBase* root_view = GetRootRenderWidgetHostView(); | 132 RenderWidgetHostViewBase* root_view = GetRootRenderWidgetHostView(); |
133 if (root_view) | 133 if (root_view) |
134 root_view->UpdateCursor(cursor); | 134 root_view->UpdateCursor(cursor); |
135 } | 135 } |
136 | 136 |
137 gfx::Point CrossProcessFrameConnector::TransformPointToRootCoordSpace( | 137 gfx::Point CrossProcessFrameConnector::TransformPointToRootCoordSpace( |
138 const gfx::Point& point, | 138 const gfx::Point& point, |
139 cc::SurfaceId surface_id) { | 139 cc::SurfaceId surface_id) { |
140 gfx::Point transformed_point = point; | 140 gfx::Point transformed_point = point; |
141 RenderWidgetHostViewBase* root_view = GetRootRenderWidgetHostView(); | 141 RenderWidgetHostViewBase* root_view = GetRootRenderWidgetHostView(); |
142 if (root_view) | 142 if (root_view) |
143 root_view->TransformPointToLocalCoordSpace(point, surface_id, | 143 root_view->TransformPointToLocalCoordSpace(point, surface_id, |
144 &transformed_point); | 144 &transformed_point); |
145 return transformed_point; | 145 return transformed_point; |
146 } | 146 } |
147 | 147 |
148 void CrossProcessFrameConnector::ForwardProcessAckedTouchEvent( | 148 void CrossProcessFrameConnector::ForwardProcessAckedTouchEvent( |
149 const TouchEventWithLatencyInfo& touch, | 149 const TouchEventWithLatencyInfo& touch, |
150 InputEventAckState ack_result) { | 150 InputEventAckState ack_result) { |
151 auto main_view = GetRootRenderWidgetHostView(); | 151 auto* main_view = GetRootRenderWidgetHostView(); |
152 if (main_view) | 152 if (main_view) |
153 main_view->ProcessAckedTouchEvent(touch, ack_result); | 153 main_view->ProcessAckedTouchEvent(touch, ack_result); |
154 } | 154 } |
155 | 155 |
156 void CrossProcessFrameConnector::BubbleScrollEvent( | 156 void CrossProcessFrameConnector::BubbleScrollEvent( |
157 const blink::WebGestureEvent& event) { | 157 const blink::WebGestureEvent& event) { |
158 DCHECK(event.type == blink::WebInputEvent::GestureScrollUpdate || | 158 DCHECK(event.type == blink::WebInputEvent::GestureScrollUpdate || |
159 event.type == blink::WebInputEvent::GestureScrollEnd); | 159 event.type == blink::WebInputEvent::GestureScrollEnd); |
160 auto parent_view = GetParentRenderWidgetHostView(); | 160 auto* parent_view = GetParentRenderWidgetHostView(); |
161 | 161 |
162 if (!parent_view) | 162 if (!parent_view) |
163 return; | 163 return; |
164 | 164 |
165 auto event_router = | 165 auto* event_router = |
166 RenderWidgetHostImpl::From(parent_view->GetRenderWidgetHost()) | 166 RenderWidgetHostImpl::From(parent_view->GetRenderWidgetHost()) |
167 ->delegate() | 167 ->delegate() |
168 ->GetInputEventRouter(); | 168 ->GetInputEventRouter(); |
169 | 169 |
170 gfx::Vector2d offset_from_parent = child_frame_rect_.OffsetFromOrigin(); | 170 gfx::Vector2d offset_from_parent = child_frame_rect_.OffsetFromOrigin(); |
171 blink::WebGestureEvent resent_gesture_event(event); | 171 blink::WebGestureEvent resent_gesture_event(event); |
172 // TODO(kenrb, wjmaclean): Do we need to account for transforms here? | 172 // TODO(kenrb, wjmaclean): Do we need to account for transforms here? |
173 // See https://crbug.com/626020. | 173 // See https://crbug.com/626020. |
174 resent_gesture_event.x += offset_from_parent.x(); | 174 resent_gesture_event.x += offset_from_parent.x(); |
175 resent_gesture_event.y += offset_from_parent.y(); | 175 resent_gesture_event.y += offset_from_parent.y(); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 | 350 |
351 if (parent) { | 351 if (parent) { |
352 return static_cast<RenderWidgetHostViewBase*>( | 352 return static_cast<RenderWidgetHostViewBase*>( |
353 parent->current_frame_host()->GetView()); | 353 parent->current_frame_host()->GetView()); |
354 } | 354 } |
355 | 355 |
356 return nullptr; | 356 return nullptr; |
357 } | 357 } |
358 | 358 |
359 } // namespace content | 359 } // namespace content |
OLD | NEW |