OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/browser/renderer_host/render_widget_host_view_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1193 bad_message::RWH_BAD_FRAME_SINK_REQUEST); | 1193 bad_message::RWH_BAD_FRAME_SINK_REQUEST); |
1194 return; | 1194 return; |
1195 } | 1195 } |
1196 delegated_frame_host_->CompositorFrameSinkChanged(); | 1196 delegated_frame_host_->CompositorFrameSinkChanged(); |
1197 renderer_compositor_frame_sink_ = renderer_compositor_frame_sink; | 1197 renderer_compositor_frame_sink_ = renderer_compositor_frame_sink; |
1198 // Accumulated resources belong to the old RendererCompositorFrameSink and | 1198 // Accumulated resources belong to the old RendererCompositorFrameSink and |
1199 // should not be returned. | 1199 // should not be returned. |
1200 surface_returned_resources_.clear(); | 1200 surface_returned_resources_.clear(); |
1201 } | 1201 } |
1202 | 1202 |
| 1203 void RenderWidgetHostViewAndroid::EvictFrameIfNecessary() { |
| 1204 if (host_->delegate()->IsFullscreenForCurrentTab() && |
| 1205 current_surface_size_ != view_.GetPhysicalBackingSize()) { |
| 1206 // When we're in a fullscreen and the frame size doesn't match the view |
| 1207 // size (e.g. during a fullscreen rotation), we show black instead of the |
| 1208 // incorrectly-sized frame. |
| 1209 EvictDelegatedFrame(); |
| 1210 UpdateBackgroundColor(SK_ColorBLACK); |
| 1211 } |
| 1212 } |
| 1213 |
1203 void RenderWidgetHostViewAndroid::SubmitCompositorFrame( | 1214 void RenderWidgetHostViewAndroid::SubmitCompositorFrame( |
1204 const cc::LocalSurfaceId& local_surface_id, | 1215 const cc::LocalSurfaceId& local_surface_id, |
1205 cc::CompositorFrame frame) { | 1216 cc::CompositorFrame frame) { |
1206 if (!delegated_frame_host_) { | 1217 if (!delegated_frame_host_) { |
1207 DCHECK(!using_browser_compositor_); | 1218 DCHECK(!using_browser_compositor_); |
1208 return; | 1219 return; |
1209 } | 1220 } |
1210 | 1221 |
1211 last_scroll_offset_ = frame.metadata.root_scroll_offset; | 1222 last_scroll_offset_ = frame.metadata.root_scroll_offset; |
1212 DCHECK(!frame.render_pass_list.empty()); | 1223 DCHECK(!frame.render_pass_list.empty()); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1252 frame_evictor_->HasFrame()); | 1263 frame_evictor_->HasFrame()); |
1253 | 1264 |
1254 if (!delegated_frame_host_) | 1265 if (!delegated_frame_host_) |
1255 return; | 1266 return; |
1256 | 1267 |
1257 if (!delegated_frame_host_->HasDelegatedContent()) | 1268 if (!delegated_frame_host_->HasDelegatedContent()) |
1258 return; | 1269 return; |
1259 | 1270 |
1260 frame_evictor_->DiscardedFrame(); | 1271 frame_evictor_->DiscardedFrame(); |
1261 delegated_frame_host_->DestroyDelegatedContent(); | 1272 delegated_frame_host_->DestroyDelegatedContent(); |
| 1273 current_surface_size_.SetSize(0, 0); |
1262 } | 1274 } |
1263 | 1275 |
1264 void RenderWidgetHostViewAndroid::OnDidNotProduceFrame( | 1276 void RenderWidgetHostViewAndroid::OnDidNotProduceFrame( |
1265 const cc::BeginFrameAck& ack) { | 1277 const cc::BeginFrameAck& ack) { |
1266 if (!delegated_frame_host_) { | 1278 if (!delegated_frame_host_) { |
1267 // We are not using the browser compositor and there's no DisplayScheduler | 1279 // We are not using the browser compositor and there's no DisplayScheduler |
1268 // that needs to be notified about the BeginFrameAck, so we can drop it. | 1280 // that needs to be notified about the BeginFrameAck, so we can drop it. |
1269 DCHECK(!using_browser_compositor_); | 1281 DCHECK(!using_browser_compositor_); |
1270 return; | 1282 return; |
1271 } | 1283 } |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1512 prev_bottom_shown_pix_ = bottom_shown_pix; | 1524 prev_bottom_shown_pix_ = bottom_shown_pix; |
1513 } | 1525 } |
1514 | 1526 |
1515 // All offsets and sizes are in CSS pixels. | 1527 // All offsets and sizes are in CSS pixels. |
1516 content_view_core_->UpdateFrameInfo( | 1528 content_view_core_->UpdateFrameInfo( |
1517 frame_metadata.root_scroll_offset, frame_metadata.page_scale_factor, | 1529 frame_metadata.root_scroll_offset, frame_metadata.page_scale_factor, |
1518 gfx::Vector2dF(frame_metadata.min_page_scale_factor, | 1530 gfx::Vector2dF(frame_metadata.min_page_scale_factor, |
1519 frame_metadata.max_page_scale_factor), | 1531 frame_metadata.max_page_scale_factor), |
1520 frame_metadata.root_layer_size, frame_metadata.scrollable_viewport_size, | 1532 frame_metadata.root_layer_size, frame_metadata.scrollable_viewport_size, |
1521 top_content_offset, top_shown_pix, top_changed, is_mobile_optimized); | 1533 top_content_offset, top_shown_pix, top_changed, is_mobile_optimized); |
| 1534 |
| 1535 EvictFrameIfNecessary(); |
1522 } | 1536 } |
1523 | 1537 |
1524 void RenderWidgetHostViewAndroid::ShowInternal() { | 1538 void RenderWidgetHostViewAndroid::ShowInternal() { |
1525 bool show = is_showing_ && is_window_activity_started_ && is_window_visible_; | 1539 bool show = is_showing_ && is_window_activity_started_ && is_window_visible_; |
1526 if (!show) | 1540 if (!show) |
1527 return; | 1541 return; |
1528 | 1542 |
1529 if (!host_ || !host_->is_hidden()) | 1543 if (!host_ || !host_->is_hidden()) |
1530 return; | 1544 return; |
1531 | 1545 |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2136 // unintended shift+click interpretation of all accessibility clicks. | 2150 // unintended shift+click interpretation of all accessibility clicks. |
2137 // See crbug.com/443247. | 2151 // See crbug.com/443247. |
2138 if (web_gesture.GetType() == blink::WebInputEvent::kGestureTap && | 2152 if (web_gesture.GetType() == blink::WebInputEvent::kGestureTap && |
2139 web_gesture.GetModifiers() == blink::WebInputEvent::kShiftKey) { | 2153 web_gesture.GetModifiers() == blink::WebInputEvent::kShiftKey) { |
2140 web_gesture.SetModifiers(blink::WebInputEvent::kNoModifiers); | 2154 web_gesture.SetModifiers(blink::WebInputEvent::kNoModifiers); |
2141 } | 2155 } |
2142 SendGestureEvent(web_gesture); | 2156 SendGestureEvent(web_gesture); |
2143 } | 2157 } |
2144 | 2158 |
2145 void RenderWidgetHostViewAndroid::OnPhysicalBackingSizeChanged() { | 2159 void RenderWidgetHostViewAndroid::OnPhysicalBackingSizeChanged() { |
| 2160 EvictFrameIfNecessary(); |
2146 WasResized(); | 2161 WasResized(); |
2147 } | 2162 } |
2148 | 2163 |
2149 void RenderWidgetHostViewAndroid::OnContentViewCoreDestroyed() { | 2164 void RenderWidgetHostViewAndroid::OnContentViewCoreDestroyed() { |
2150 SetContentViewCore(NULL); | 2165 SetContentViewCore(NULL); |
2151 overscroll_controller_.reset(); | 2166 overscroll_controller_.reset(); |
2152 } | 2167 } |
2153 | 2168 |
2154 void RenderWidgetHostViewAndroid::OnRootWindowVisibilityChanged(bool visible) { | 2169 void RenderWidgetHostViewAndroid::OnRootWindowVisibilityChanged(bool visible) { |
2155 TRACE_EVENT1("browser", | 2170 TRACE_EVENT1("browser", |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2354 | 2369 |
2355 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); | 2370 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); |
2356 if (!compositor) | 2371 if (!compositor) |
2357 return; | 2372 return; |
2358 | 2373 |
2359 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( | 2374 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( |
2360 overscroll_refresh_handler, compositor, view_.GetDipScale()); | 2375 overscroll_refresh_handler, compositor, view_.GetDipScale()); |
2361 } | 2376 } |
2362 | 2377 |
2363 } // namespace content | 2378 } // namespace content |
OLD | NEW |