Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Side by Side Diff: content/renderer/render_widget.cc

Issue 894193003: ResizeSynchronously should resize the visible viewport as well. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed variable names Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/render_widget.h ('k') | content/renderer/render_widget_fullscreen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 826 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 set_next_paint_is_resize_ack(); 837 set_next_paint_is_resize_ack();
838 838
839 if (fullscreen_change) 839 if (fullscreen_change)
840 DidToggleFullscreen(); 840 DidToggleFullscreen();
841 841
842 // If a resize ack is requested and it isn't set-up, then no more resizes will 842 // If a resize ack is requested and it isn't set-up, then no more resizes will
843 // come in and in general things will go wrong. 843 // come in and in general things will go wrong.
844 DCHECK(resize_ack != SEND_RESIZE_ACK || next_paint_is_resize_ack()); 844 DCHECK(resize_ack != SEND_RESIZE_ACK || next_paint_is_resize_ack());
845 } 845 }
846 846
847 void RenderWidget::ResizeSynchronously( 847 void RenderWidget::SetWindowRectSynchronously(
848 const gfx::Rect& new_position, 848 const gfx::Rect& new_window_rect) {
849 const gfx::Size& visible_viewport_size) { 849 Resize(new_window_rect.size(),
850 Resize(new_position.size(), 850 new_window_rect.size(),
851 new_position.size(),
852 top_controls_shrink_blink_size_, 851 top_controls_shrink_blink_size_,
853 top_controls_height_, 852 top_controls_height_,
854 visible_viewport_size, 853 new_window_rect.size(),
855 gfx::Rect(), 854 gfx::Rect(),
856 is_fullscreen_, 855 is_fullscreen_,
857 NO_RESIZE_ACK); 856 NO_RESIZE_ACK);
858 view_screen_rect_ = new_position; 857 view_screen_rect_ = new_window_rect;
859 window_screen_rect_ = new_position; 858 window_screen_rect_ = new_window_rect;
860 if (!did_show_) 859 if (!did_show_)
861 initial_pos_ = new_position; 860 initial_rect_ = new_window_rect;
862 } 861 }
863 862
864 void RenderWidget::OnClose() { 863 void RenderWidget::OnClose() {
865 if (closing_) 864 if (closing_)
866 return; 865 return;
867 closing_ = true; 866 closing_ = true;
868 867
869 // Browser correspondence is no longer needed at this point. 868 // Browser correspondence is no longer needed at this point.
870 if (routing_id_ != MSG_ROUTING_NONE) { 869 if (routing_id_ != MSG_ROUTING_NONE) {
871 if (RenderThreadImpl::current()) 870 if (RenderThreadImpl::current())
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
1518 // 1517 //
1519 void RenderWidget::show(WebNavigationPolicy) { 1518 void RenderWidget::show(WebNavigationPolicy) {
1520 DCHECK(!did_show_) << "received extraneous Show call"; 1519 DCHECK(!did_show_) << "received extraneous Show call";
1521 DCHECK(routing_id_ != MSG_ROUTING_NONE); 1520 DCHECK(routing_id_ != MSG_ROUTING_NONE);
1522 DCHECK(opener_id_ != MSG_ROUTING_NONE); 1521 DCHECK(opener_id_ != MSG_ROUTING_NONE);
1523 1522
1524 if (did_show_) 1523 if (did_show_)
1525 return; 1524 return;
1526 1525
1527 did_show_ = true; 1526 did_show_ = true;
1528 // NOTE: initial_pos_ may still have its default values at this point, but 1527 // NOTE: initial_rect_ may still have its default values at this point, but
1529 // that's okay. It'll be ignored if as_popup is false, or the browser 1528 // that's okay. It'll be ignored if as_popup is false, or the browser
1530 // process will impose a default position otherwise. 1529 // process will impose a default position otherwise.
1531 Send(new ViewHostMsg_ShowWidget(opener_id_, routing_id_, initial_pos_)); 1530 Send(new ViewHostMsg_ShowWidget(opener_id_, routing_id_, initial_rect_));
1532 SetPendingWindowRect(initial_pos_); 1531 SetPendingWindowRect(initial_rect_);
1533 } 1532 }
1534 1533
1535 void RenderWidget::didFocus() { 1534 void RenderWidget::didFocus() {
1536 } 1535 }
1537 1536
1538 void RenderWidget::didBlur() { 1537 void RenderWidget::didBlur() {
1539 } 1538 }
1540 1539
1541 void RenderWidget::DoDeferredClose() { 1540 void RenderWidget::DoDeferredClose() {
1542 WillCloseLayerTreeView(); 1541 WillCloseLayerTreeView();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1593 1592
1594 return view_screen_rect_; 1593 return view_screen_rect_;
1595 } 1594 }
1596 1595
1597 void RenderWidget::setToolTipText(const blink::WebString& text, 1596 void RenderWidget::setToolTipText(const blink::WebString& text,
1598 WebTextDirection hint) { 1597 WebTextDirection hint) {
1599 Send(new ViewHostMsg_SetTooltipText(routing_id_, text, hint)); 1598 Send(new ViewHostMsg_SetTooltipText(routing_id_, text, hint));
1600 } 1599 }
1601 1600
1602 void RenderWidget::setWindowRect(const WebRect& rect) { 1601 void RenderWidget::setWindowRect(const WebRect& rect) {
1603 WebRect pos = rect; 1602 WebRect window_rect = rect;
1604 if (popup_origin_scale_for_emulation_) { 1603 if (popup_origin_scale_for_emulation_) {
1605 float scale = popup_origin_scale_for_emulation_; 1604 float scale = popup_origin_scale_for_emulation_;
1606 pos.x = popup_screen_origin_for_emulation_.x() + 1605 window_rect.x = popup_screen_origin_for_emulation_.x() +
1607 (pos.x - popup_view_origin_for_emulation_.x()) * scale; 1606 (window_rect.x - popup_view_origin_for_emulation_.x()) * scale;
1608 pos.y = popup_screen_origin_for_emulation_.y() + 1607 window_rect.y = popup_screen_origin_for_emulation_.y() +
1609 (pos.y - popup_view_origin_for_emulation_.y()) * scale; 1608 (window_rect.y - popup_view_origin_for_emulation_.y()) * scale;
1610 } 1609 }
1611 1610
1612 if (!resizing_mode_selector_->is_synchronous_mode()) { 1611 if (!resizing_mode_selector_->is_synchronous_mode()) {
1613 if (did_show_) { 1612 if (did_show_) {
1614 Send(new ViewHostMsg_RequestMove(routing_id_, pos)); 1613 Send(new ViewHostMsg_RequestMove(routing_id_, window_rect));
1615 SetPendingWindowRect(pos); 1614 SetPendingWindowRect(window_rect);
1616 } else { 1615 } else {
1617 initial_pos_ = pos; 1616 initial_rect_ = window_rect;
1618 } 1617 }
1619 } else { 1618 } else {
1620 ResizeSynchronously(pos, visible_viewport_size_); 1619 SetWindowRectSynchronously(window_rect);
1621 } 1620 }
1622 } 1621 }
1623 1622
1624 void RenderWidget::SetPendingWindowRect(const WebRect& rect) { 1623 void RenderWidget::SetPendingWindowRect(const WebRect& rect) {
1625 pending_window_rect_ = rect; 1624 pending_window_rect_ = rect;
1626 pending_window_rect_count_++; 1625 pending_window_rect_count_++;
1627 } 1626 }
1628 1627
1629 WebRect RenderWidget::rootWindowRect() { 1628 WebRect RenderWidget::rootWindowRect() {
1630 if (pending_window_rect_count_) { 1629 if (pending_window_rect_count_) {
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
2428 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) { 2427 void RenderWidget::RegisterVideoHoleFrame(RenderFrameImpl* frame) {
2429 video_hole_frames_.AddObserver(frame); 2428 video_hole_frames_.AddObserver(frame);
2430 } 2429 }
2431 2430
2432 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) { 2431 void RenderWidget::UnregisterVideoHoleFrame(RenderFrameImpl* frame) {
2433 video_hole_frames_.RemoveObserver(frame); 2432 video_hole_frames_.RemoveObserver(frame);
2434 } 2433 }
2435 #endif // defined(VIDEO_HOLE) 2434 #endif // defined(VIDEO_HOLE)
2436 2435
2437 } // namespace content 2436 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget.h ('k') | content/renderer/render_widget_fullscreen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698