| 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 Release(); | 264 Release(); |
| 265 } | 265 } |
| 266 | 266 |
| 267 void RenderWidget::OnResize(const gfx::Size& new_size, | 267 void RenderWidget::OnResize(const gfx::Size& new_size, |
| 268 const gfx::Rect& resizer_rect, | 268 const gfx::Rect& resizer_rect, |
| 269 bool is_fullscreen) { | 269 bool is_fullscreen) { |
| 270 // During shutdown we can just ignore this message. | 270 // During shutdown we can just ignore this message. |
| 271 if (!webwidget_) | 271 if (!webwidget_) |
| 272 return; | 272 return; |
| 273 | 273 |
| 274 // We shouldn't be asked to resize to our current size. | |
| 275 DCHECK(size_ != new_size || resizer_rect_ != resizer_rect); | |
| 276 | |
| 277 // Remember the rect where the resize corner will be drawn. | 274 // Remember the rect where the resize corner will be drawn. |
| 278 resizer_rect_ = resizer_rect; | 275 resizer_rect_ = resizer_rect; |
| 279 | 276 |
| 280 // NOTE: We may have entered fullscreen mode without changing our size. | 277 // NOTE: We may have entered fullscreen mode without changing our size. |
| 281 bool fullscreen_change = is_fullscreen_ != is_fullscreen; | 278 bool fullscreen_change = is_fullscreen_ != is_fullscreen; |
| 282 if (fullscreen_change) | 279 if (fullscreen_change) |
| 283 WillToggleFullscreen(); | 280 WillToggleFullscreen(); |
| 284 is_fullscreen_ = is_fullscreen; | 281 is_fullscreen_ = is_fullscreen; |
| 285 | 282 |
| 286 if (size_ != new_size) { | 283 if (size_ != new_size) { |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 // within the plugin. There is a related optimization in PaintRect for the | 814 // within the plugin. There is a related optimization in PaintRect for the |
| 818 // case where there may be multiple invalid regions. | 815 // case where there may be multiple invalid regions. |
| 819 TransportDIB* dib = NULL; | 816 TransportDIB* dib = NULL; |
| 820 gfx::Rect optimized_copy_rect, optimized_copy_location; | 817 gfx::Rect optimized_copy_rect, optimized_copy_location; |
| 821 DCHECK(!pending_update_params_.get()); | 818 DCHECK(!pending_update_params_.get()); |
| 822 pending_update_params_.reset(new ViewHostMsg_UpdateRect_Params); | 819 pending_update_params_.reset(new ViewHostMsg_UpdateRect_Params); |
| 823 pending_update_params_->dx = update.scroll_delta.x(); | 820 pending_update_params_->dx = update.scroll_delta.x(); |
| 824 pending_update_params_->dy = update.scroll_delta.y(); | 821 pending_update_params_->dy = update.scroll_delta.y(); |
| 825 pending_update_params_->scroll_rect = update.scroll_rect; | 822 pending_update_params_->scroll_rect = update.scroll_rect; |
| 826 pending_update_params_->view_size = size_; | 823 pending_update_params_->view_size = size_; |
| 827 pending_update_params_->resizer_rect = resizer_rect_; | |
| 828 pending_update_params_->plugin_window_moves.swap(plugin_window_moves_); | 824 pending_update_params_->plugin_window_moves.swap(plugin_window_moves_); |
| 829 pending_update_params_->flags = next_paint_flags_; | 825 pending_update_params_->flags = next_paint_flags_; |
| 830 pending_update_params_->scroll_offset = GetScrollOffset(); | 826 pending_update_params_->scroll_offset = GetScrollOffset(); |
| 831 pending_update_params_->needs_ack = true; | 827 pending_update_params_->needs_ack = true; |
| 832 next_paint_flags_ = 0; | 828 next_paint_flags_ = 0; |
| 833 | 829 |
| 834 if (update.scroll_rect.IsEmpty() && | 830 if (update.scroll_rect.IsEmpty() && |
| 835 !is_accelerated_compositing_active_ && | 831 !is_accelerated_compositing_active_ && |
| 836 GetBitmapForOptimizedPluginPaint(bounds, &dib, &optimized_copy_location, | 832 GetBitmapForOptimizedPluginPaint(bounds, &dib, &optimized_copy_location, |
| 837 &optimized_copy_rect)) { | 833 &optimized_copy_rect)) { |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 | 1038 |
| 1043 void RenderWidget::didCompleteSwapBuffers() { | 1039 void RenderWidget::didCompleteSwapBuffers() { |
| 1044 if (update_reply_pending_) | 1040 if (update_reply_pending_) |
| 1045 return; | 1041 return; |
| 1046 | 1042 |
| 1047 if (!next_paint_flags_ && !plugin_window_moves_.size()) | 1043 if (!next_paint_flags_ && !plugin_window_moves_.size()) |
| 1048 return; | 1044 return; |
| 1049 | 1045 |
| 1050 ViewHostMsg_UpdateRect_Params params; | 1046 ViewHostMsg_UpdateRect_Params params; |
| 1051 params.view_size = size_; | 1047 params.view_size = size_; |
| 1052 params.resizer_rect = resizer_rect_; | |
| 1053 params.plugin_window_moves.swap(plugin_window_moves_); | 1048 params.plugin_window_moves.swap(plugin_window_moves_); |
| 1054 params.flags = next_paint_flags_; | 1049 params.flags = next_paint_flags_; |
| 1055 params.scroll_offset = GetScrollOffset(); | 1050 params.scroll_offset = GetScrollOffset(); |
| 1056 params.needs_ack = false; | 1051 params.needs_ack = false; |
| 1057 | 1052 |
| 1058 Send(new ViewHostMsg_UpdateRect(routing_id_, params)); | 1053 Send(new ViewHostMsg_UpdateRect(routing_id_, params)); |
| 1059 next_paint_flags_ = 0; | 1054 next_paint_flags_ = 0; |
| 1060 } | 1055 } |
| 1061 | 1056 |
| 1062 void RenderWidget::scheduleComposite() { | 1057 void RenderWidget::scheduleComposite() { |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1564 } | 1559 } |
| 1565 } | 1560 } |
| 1566 | 1561 |
| 1567 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { | 1562 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { |
| 1568 return false; | 1563 return false; |
| 1569 } | 1564 } |
| 1570 | 1565 |
| 1571 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { | 1566 bool RenderWidget::WebWidgetHandlesCompositorScheduling() const { |
| 1572 return false; | 1567 return false; |
| 1573 } | 1568 } |
| OLD | NEW |