Chromium Code Reviews| 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/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 771 return RenderThread::Get()->Send(message); | 771 return RenderThread::Get()->Send(message); |
| 772 } | 772 } |
| 773 | 773 |
| 774 void RenderWidget::Resize(const gfx::Size& new_size, | 774 void RenderWidget::Resize(const gfx::Size& new_size, |
| 775 const gfx::Size& physical_backing_size, | 775 const gfx::Size& physical_backing_size, |
| 776 bool top_controls_shrink_blink_size, | 776 bool top_controls_shrink_blink_size, |
| 777 float top_controls_height, | 777 float top_controls_height, |
| 778 const gfx::Size& visible_viewport_size, | 778 const gfx::Size& visible_viewport_size, |
| 779 const gfx::Rect& resizer_rect, | 779 const gfx::Rect& resizer_rect, |
| 780 bool is_fullscreen, | 780 bool is_fullscreen, |
| 781 ResizeAck resize_ack) { | 781 const ResizeAck resize_ack) { |
| 782 if (resizing_mode_selector_->NeverUsesSynchronousResize()) { | 782 if (resizing_mode_selector_->NeverUsesSynchronousResize()) { |
| 783 // A resize ack shouldn't be requested if we have not ACK'd the previous | 783 // A resize ack shouldn't be requested if we have not ACK'd the previous |
| 784 // one. | 784 // one. |
| 785 DCHECK(resize_ack != SEND_RESIZE_ACK || !next_paint_is_resize_ack()); | 785 DCHECK(resize_ack != SEND_RESIZE_ACK || !next_paint_is_resize_ack()); |
| 786 DCHECK(resize_ack == SEND_RESIZE_ACK || resize_ack == NO_RESIZE_ACK); | 786 DCHECK(resize_ack == SEND_RESIZE_ACK || resize_ack == NO_RESIZE_ACK); |
| 787 } | 787 } |
| 788 | 788 |
| 789 // Ignore this during shutdown. | 789 // Ignore this during shutdown. |
| 790 if (!webwidget_) | 790 if (!webwidget_) |
| 791 return; | 791 return; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 809 webwidget_->setTopControlsHeight(top_controls_height, | 809 webwidget_->setTopControlsHeight(top_controls_height, |
| 810 top_controls_shrink_blink_size_); | 810 top_controls_shrink_blink_size_); |
| 811 | 811 |
| 812 if (size_ != new_size) { | 812 if (size_ != new_size) { |
| 813 size_ = new_size; | 813 size_ = new_size; |
| 814 | 814 |
| 815 // When resizing, we want to wait to paint before ACK'ing the resize. This | 815 // When resizing, we want to wait to paint before ACK'ing the resize. This |
| 816 // ensures that we only resize as fast as we can paint. We only need to | 816 // ensures that we only resize as fast as we can paint. We only need to |
| 817 // send an ACK if we are resized to a non-empty rect. | 817 // send an ACK if we are resized to a non-empty rect. |
| 818 webwidget_->resize(new_size); | 818 webwidget_->resize(new_size); |
| 819 } else if (!resizing_mode_selector_->is_synchronous_mode()) { | |
|
no sievers
2015/02/25 00:58:59
Now I'm probably missing to make sure that resize_
no sievers
2015/02/25 01:11:46
Ok, this is for webkit layout tests. So I guess I
piman
2015/02/25 01:38:32
Yeah... +jochen.
| |
| 820 resize_ack = NO_RESIZE_ACK; | |
| 821 } | 819 } |
| 822 | 820 |
| 823 webwidget()->resizePinchViewport(gfx::Size( | 821 webwidget()->resizePinchViewport(gfx::Size( |
| 824 visible_viewport_size.width(), | 822 visible_viewport_size.width(), |
| 825 visible_viewport_size.height())); | 823 visible_viewport_size.height())); |
| 826 | 824 |
| 827 if (new_size.IsEmpty() || physical_backing_size.IsEmpty()) { | 825 if (new_size.IsEmpty() || physical_backing_size.IsEmpty()) { |
| 828 // For empty size or empty physical_backing_size, there is no next paint | 826 // In this case there is no paint/composite and therefore no |
| 829 // (along with which to send the ack) until they are set to non-empty. | 827 // ViewHostMsg_UpdateRect to send the resize ack with. We'd need to send the |
| 830 resize_ack = NO_RESIZE_ACK; | 828 // ack through a fake ViewHostMsg_UpdateRect or a different message. |
| 829 DCHECK_EQ(resize_ack, NO_RESIZE_ACK); | |
| 831 } | 830 } |
| 832 | 831 |
| 833 // Send the Resize_ACK flag once we paint again if requested. | 832 // Send the Resize_ACK flag once we paint again if requested. |
| 834 if (resize_ack == SEND_RESIZE_ACK) | 833 if (resize_ack == SEND_RESIZE_ACK) |
| 835 set_next_paint_is_resize_ack(); | 834 set_next_paint_is_resize_ack(); |
| 836 | 835 |
| 837 if (fullscreen_change) | 836 if (fullscreen_change) |
| 838 DidToggleFullscreen(); | 837 DidToggleFullscreen(); |
| 839 | 838 |
| 840 // If a resize ack is requested and it isn't set-up, then no more resizes will | 839 // If a resize ack is requested and it isn't set-up, then no more resizes will |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 903 | 902 |
| 904 screen_info_ = params.screen_info; | 903 screen_info_ = params.screen_info; |
| 905 SetDeviceScaleFactor(screen_info_.deviceScaleFactor); | 904 SetDeviceScaleFactor(screen_info_.deviceScaleFactor); |
| 906 Resize(params.new_size, | 905 Resize(params.new_size, |
| 907 params.physical_backing_size, | 906 params.physical_backing_size, |
| 908 params.top_controls_shrink_blink_size, | 907 params.top_controls_shrink_blink_size, |
| 909 params.top_controls_height, | 908 params.top_controls_height, |
| 910 params.visible_viewport_size, | 909 params.visible_viewport_size, |
| 911 params.resizer_rect, | 910 params.resizer_rect, |
| 912 params.is_fullscreen, | 911 params.is_fullscreen, |
| 913 SEND_RESIZE_ACK); | 912 params.needs_resize_ack ? SEND_RESIZE_ACK : NO_RESIZE_ACK); |
| 914 | 913 |
| 915 if (orientation_changed) | 914 if (orientation_changed) |
| 916 OnOrientationChange(); | 915 OnOrientationChange(); |
| 917 } | 916 } |
| 918 | 917 |
| 919 void RenderWidget::OnColorProfile(const std::vector<char>& color_profile) { | 918 void RenderWidget::OnColorProfile(const std::vector<char>& color_profile) { |
| 920 SetDeviceColorProfile(color_profile); | 919 SetDeviceColorProfile(color_profile); |
| 921 } | 920 } |
| 922 | 921 |
| 923 void RenderWidget::OnChangeResizeRect(const gfx::Rect& resizer_rect) { | 922 void RenderWidget::OnChangeResizeRect(const gfx::Rect& resizer_rect) { |
| (...skipping 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2415 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { | 2414 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2416 video_hole_frames_.AddObserver(frame); | 2415 video_hole_frames_.AddObserver(frame); |
| 2417 } | 2416 } |
| 2418 | 2417 |
| 2419 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { | 2418 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { |
| 2420 video_hole_frames_.RemoveObserver(frame); | 2419 video_hole_frames_.RemoveObserver(frame); |
| 2421 } | 2420 } |
| 2422 #endif // defined(VIDEO_HOLE) | 2421 #endif // defined(VIDEO_HOLE) |
| 2423 | 2422 |
| 2424 } // namespace content | 2423 } // namespace content |
| OLD | NEW |