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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 } | 321 } |
322 | 322 |
323 // If given a messsage without a routing ID, then assign our routing ID. | 323 // If given a messsage without a routing ID, then assign our routing ID. |
324 if (message->routing_id() == MSG_ROUTING_NONE) | 324 if (message->routing_id() == MSG_ROUTING_NONE) |
325 message->set_routing_id(routing_id_); | 325 message->set_routing_id(routing_id_); |
326 | 326 |
327 return RenderThread::Get()->Send(message); | 327 return RenderThread::Get()->Send(message); |
328 } | 328 } |
329 | 329 |
330 void RenderWidget::Resize(const gfx::Size& new_size, | 330 void RenderWidget::Resize(const gfx::Size& new_size, |
| 331 const gfx::Size& physical_backing_size, |
331 const gfx::Rect& resizer_rect, | 332 const gfx::Rect& resizer_rect, |
332 bool is_fullscreen, | 333 bool is_fullscreen, |
333 ResizeAck resize_ack) { | 334 ResizeAck resize_ack) { |
334 // A resize ack shouldn't be requested if we have not ACK'd the previous one. | 335 // A resize ack shouldn't be requested if we have not ACK'd the previous one. |
335 DCHECK(resize_ack != SEND_RESIZE_ACK || !next_paint_is_resize_ack()); | 336 DCHECK(resize_ack != SEND_RESIZE_ACK || !next_paint_is_resize_ack()); |
336 DCHECK(resize_ack == SEND_RESIZE_ACK || resize_ack == NO_RESIZE_ACK); | 337 DCHECK(resize_ack == SEND_RESIZE_ACK || resize_ack == NO_RESIZE_ACK); |
337 | 338 |
338 // Ignore this during shutdown. | 339 // Ignore this during shutdown. |
339 if (!webwidget_) | 340 if (!webwidget_) |
340 return; | 341 return; |
341 | 342 |
342 // Remember the rect where the resize corner will be drawn. | 343 if (size_ != new_size || physical_backing_size_ != physical_backing_size_) |
| 344 compositor_->setViewportSize(new_size, physical_backing_size); |
| 345 |
| 346 physical_backing_size_ = physical_backing_size_; |
343 resizer_rect_ = resizer_rect; | 347 resizer_rect_ = resizer_rect; |
344 | 348 |
345 // NOTE: We may have entered fullscreen mode without changing our size. | 349 // NOTE: We may have entered fullscreen mode without changing our size. |
346 bool fullscreen_change = is_fullscreen_ != is_fullscreen; | 350 bool fullscreen_change = is_fullscreen_ != is_fullscreen; |
347 if (fullscreen_change) | 351 if (fullscreen_change) |
348 WillToggleFullscreen(); | 352 WillToggleFullscreen(); |
349 is_fullscreen_ = is_fullscreen; | 353 is_fullscreen_ = is_fullscreen; |
350 | 354 |
351 if (size_ != new_size) { | 355 if (size_ != new_size) { |
352 // TODO(darin): We should not need to reset this here. | 356 // TODO(darin): We should not need to reset this here. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 | 410 |
407 // Got a response from the browser after the renderer decided to create a new | 411 // Got a response from the browser after the renderer decided to create a new |
408 // view. | 412 // view. |
409 void RenderWidget::OnCreatingNewAck() { | 413 void RenderWidget::OnCreatingNewAck() { |
410 DCHECK(routing_id_ != MSG_ROUTING_NONE); | 414 DCHECK(routing_id_ != MSG_ROUTING_NONE); |
411 | 415 |
412 CompleteInit(); | 416 CompleteInit(); |
413 } | 417 } |
414 | 418 |
415 void RenderWidget::OnResize(const gfx::Size& new_size, | 419 void RenderWidget::OnResize(const gfx::Size& new_size, |
| 420 const gfx::Size& physical_backing_size, |
416 const gfx::Rect& resizer_rect, | 421 const gfx::Rect& resizer_rect, |
417 bool is_fullscreen) { | 422 bool is_fullscreen) { |
418 Resize(new_size, resizer_rect, is_fullscreen, SEND_RESIZE_ACK); | 423 Resize(new_size, physical_backing_size, resizer_rect, is_fullscreen, |
| 424 SEND_RESIZE_ACK); |
419 } | 425 } |
420 | 426 |
421 void RenderWidget::OnChangeResizeRect(const gfx::Rect& resizer_rect) { | 427 void RenderWidget::OnChangeResizeRect(const gfx::Rect& resizer_rect) { |
422 if (resizer_rect_ != resizer_rect) { | 428 if (resizer_rect_ != resizer_rect) { |
423 gfx::Rect view_rect(size_); | 429 gfx::Rect view_rect(size_); |
424 | 430 |
425 gfx::Rect old_damage_rect = gfx::IntersectRects(view_rect, resizer_rect_); | 431 gfx::Rect old_damage_rect = gfx::IntersectRects(view_rect, resizer_rect_); |
426 if (!old_damage_rect.IsEmpty()) | 432 if (!old_damage_rect.IsEmpty()) |
427 paint_aggregator_.InvalidateRect(old_damage_rect); | 433 paint_aggregator_.InvalidateRect(old_damage_rect); |
428 | 434 |
(...skipping 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2137 bool RenderWidget::WillHandleGestureEvent( | 2143 bool RenderWidget::WillHandleGestureEvent( |
2138 const WebKit::WebGestureEvent& event) { | 2144 const WebKit::WebGestureEvent& event) { |
2139 return false; | 2145 return false; |
2140 } | 2146 } |
2141 | 2147 |
2142 bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const { | 2148 bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const { |
2143 return true; | 2149 return true; |
2144 } | 2150 } |
2145 | 2151 |
2146 } // namespace content | 2152 } // namespace content |
OLD | NEW |