| 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/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 IPC_MESSAGE_HANDLER(ViewMsg_SwapBuffers_ACK, | 330 IPC_MESSAGE_HANDLER(ViewMsg_SwapBuffers_ACK, |
| 331 OnViewContextSwapBuffersComplete) | 331 OnViewContextSwapBuffersComplete) |
| 332 IPC_MESSAGE_HANDLER(ViewMsg_SetInputMethodActive, OnSetInputMethodActive) | 332 IPC_MESSAGE_HANDLER(ViewMsg_SetInputMethodActive, OnSetInputMethodActive) |
| 333 IPC_MESSAGE_HANDLER(ViewMsg_ImeSetComposition, OnImeSetComposition) | 333 IPC_MESSAGE_HANDLER(ViewMsg_ImeSetComposition, OnImeSetComposition) |
| 334 IPC_MESSAGE_HANDLER(ViewMsg_ImeConfirmComposition, OnImeConfirmComposition) | 334 IPC_MESSAGE_HANDLER(ViewMsg_ImeConfirmComposition, OnImeConfirmComposition) |
| 335 IPC_MESSAGE_HANDLER(ViewMsg_PaintAtSize, OnPaintAtSize) | 335 IPC_MESSAGE_HANDLER(ViewMsg_PaintAtSize, OnPaintAtSize) |
| 336 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint) | 336 IPC_MESSAGE_HANDLER(ViewMsg_Repaint, OnRepaint) |
| 337 IPC_MESSAGE_HANDLER(ViewMsg_SmoothScrollCompleted, OnSmoothScrollCompleted) | 337 IPC_MESSAGE_HANDLER(ViewMsg_SmoothScrollCompleted, OnSmoothScrollCompleted) |
| 338 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) | 338 IPC_MESSAGE_HANDLER(ViewMsg_SetTextDirection, OnSetTextDirection) |
| 339 IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck) | 339 IPC_MESSAGE_HANDLER(ViewMsg_Move_ACK, OnRequestMoveAck) |
| 340 IPC_MESSAGE_HANDLER(ViewMsg_ScreenInfoChanged, OnScreenInfoChanged) | |
| 341 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) | 340 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) |
| 342 #if defined(OS_ANDROID) | 341 #if defined(OS_ANDROID) |
| 343 IPC_MESSAGE_HANDLER(ViewMsg_ImeBatchStateChanged, OnImeBatchStateChanged) | 342 IPC_MESSAGE_HANDLER(ViewMsg_ImeBatchStateChanged, OnImeBatchStateChanged) |
| 344 IPC_MESSAGE_HANDLER(ViewMsg_ShowImeIfNeeded, OnShowImeIfNeeded) | 343 IPC_MESSAGE_HANDLER(ViewMsg_ShowImeIfNeeded, OnShowImeIfNeeded) |
| 345 #endif | 344 #endif |
| 346 IPC_MESSAGE_HANDLER(ViewMsg_Snapshot, OnSnapshot) | 345 IPC_MESSAGE_HANDLER(ViewMsg_Snapshot, OnSnapshot) |
| 347 IPC_MESSAGE_UNHANDLED(handled = false) | 346 IPC_MESSAGE_UNHANDLED(handled = false) |
| 348 IPC_END_MESSAGE_MAP() | 347 IPC_END_MESSAGE_MAP() |
| 349 return handled; | 348 return handled; |
| 350 } | 349 } |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 } | 454 } |
| 456 | 455 |
| 457 // Got a response from the browser after the renderer decided to create a new | 456 // Got a response from the browser after the renderer decided to create a new |
| 458 // view. | 457 // view. |
| 459 void RenderWidget::OnCreatingNewAck() { | 458 void RenderWidget::OnCreatingNewAck() { |
| 460 DCHECK(routing_id_ != MSG_ROUTING_NONE); | 459 DCHECK(routing_id_ != MSG_ROUTING_NONE); |
| 461 | 460 |
| 462 CompleteInit(); | 461 CompleteInit(); |
| 463 } | 462 } |
| 464 | 463 |
| 465 void RenderWidget::OnResize(const gfx::Size& new_size, | 464 void RenderWidget::OnResize(const ViewMsg_Resize_Params& params) { |
| 466 const gfx::Size& physical_backing_size, | 465 screen_info_ = params.screen_info; |
| 467 float overdraw_bottom_height, | 466 SetDeviceScaleFactor(screen_info_.deviceScaleFactor); |
| 468 const gfx::Rect& resizer_rect, | 467 Resize(params.new_size, params.physical_backing_size, |
| 469 bool is_fullscreen) { | 468 params.overdraw_bottom_height, params.resizer_rect, |
| 470 Resize(new_size, physical_backing_size, overdraw_bottom_height, resizer_rect, | 469 params.is_fullscreen, SEND_RESIZE_ACK); |
| 471 is_fullscreen, SEND_RESIZE_ACK); | 470 size_browser_expects_ = params.new_size; |
| 472 size_browser_expects_ = new_size; | |
| 473 } | 471 } |
| 474 | 472 |
| 475 void RenderWidget::OnChangeResizeRect(const gfx::Rect& resizer_rect) { | 473 void RenderWidget::OnChangeResizeRect(const gfx::Rect& resizer_rect) { |
| 476 if (resizer_rect_ != resizer_rect) { | 474 if (resizer_rect_ != resizer_rect) { |
| 477 gfx::Rect view_rect(size_); | 475 gfx::Rect view_rect(size_); |
| 478 | 476 |
| 479 gfx::Rect old_damage_rect = gfx::IntersectRects(view_rect, resizer_rect_); | 477 gfx::Rect old_damage_rect = gfx::IntersectRects(view_rect, resizer_rect_); |
| 480 if (!old_damage_rect.IsEmpty()) | 478 if (!old_damage_rect.IsEmpty()) |
| 481 paint_aggregator_.InvalidateRect(old_damage_rect); | 479 paint_aggregator_.InvalidateRect(old_damage_rect); |
| 482 | 480 |
| (...skipping 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1950 void RenderWidget::OnSmoothScrollCompleted() { | 1948 void RenderWidget::OnSmoothScrollCompleted() { |
| 1951 pending_smooth_scroll_gesture_.Run(); | 1949 pending_smooth_scroll_gesture_.Run(); |
| 1952 } | 1950 } |
| 1953 | 1951 |
| 1954 void RenderWidget::OnSetTextDirection(WebTextDirection direction) { | 1952 void RenderWidget::OnSetTextDirection(WebTextDirection direction) { |
| 1955 if (!webwidget_) | 1953 if (!webwidget_) |
| 1956 return; | 1954 return; |
| 1957 webwidget_->setTextDirection(direction); | 1955 webwidget_->setTextDirection(direction); |
| 1958 } | 1956 } |
| 1959 | 1957 |
| 1960 void RenderWidget::OnScreenInfoChanged( | |
| 1961 const WebKit::WebScreenInfo& screen_info) { | |
| 1962 screen_info_ = screen_info; | |
| 1963 SetDeviceScaleFactor(screen_info.deviceScaleFactor); | |
| 1964 } | |
| 1965 | |
| 1966 void RenderWidget::OnUpdateScreenRects(const gfx::Rect& view_screen_rect, | 1958 void RenderWidget::OnUpdateScreenRects(const gfx::Rect& view_screen_rect, |
| 1967 const gfx::Rect& window_screen_rect) { | 1959 const gfx::Rect& window_screen_rect) { |
| 1968 view_screen_rect_ = view_screen_rect; | 1960 view_screen_rect_ = view_screen_rect; |
| 1969 window_screen_rect_ = window_screen_rect; | 1961 window_screen_rect_ = window_screen_rect; |
| 1970 Send(new ViewHostMsg_UpdateScreenRects_ACK(routing_id())); | 1962 Send(new ViewHostMsg_UpdateScreenRects_ACK(routing_id())); |
| 1971 } | 1963 } |
| 1972 | 1964 |
| 1973 #if defined(OS_ANDROID) | 1965 #if defined(OS_ANDROID) |
| 1974 void RenderWidget::OnImeBatchStateChanged(bool is_begin) { | 1966 void RenderWidget::OnImeBatchStateChanged(bool is_begin) { |
| 1975 Send(new ViewHostMsg_ImeBatchStateChanged_ACK(routing_id(), is_begin)); | 1967 Send(new ViewHostMsg_ImeBatchStateChanged_ACK(routing_id(), is_begin)); |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2375 | 2367 |
| 2376 if (!context->Initialize( | 2368 if (!context->Initialize( |
| 2377 attributes, | 2369 attributes, |
| 2378 false /* bind generates resources */, | 2370 false /* bind generates resources */, |
| 2379 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) | 2371 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
) |
| 2380 return NULL; | 2372 return NULL; |
| 2381 return context.release(); | 2373 return context.release(); |
| 2382 } | 2374 } |
| 2383 | 2375 |
| 2384 } // namespace content | 2376 } // namespace content |
| OLD | NEW |