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

Side by Side Diff: chrome/browser/ui/web_contents_sizer.mm

Issue 2695093005: Remove RWHV::SetBounds() from the public API, and make comments clearer.
Patch Set: Revert web_contents_sizer to its previous shenanigans (http://crbug.com/693953). Created 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/ui/web_contents_sizer.h" 5 #include "chrome/browser/ui/web_contents_sizer.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "content/public/browser/web_contents.h" 9 #include "content/public/browser/web_contents.h"
10 10
11 void ResizeWebContents(content::WebContents* web_contents, 11 void ResizeWebContents(content::WebContents* web_contents,
12 const gfx::Rect& new_bounds) { 12 const gfx::Rect& new_bounds) {
13 // TODO(miu): This direct manipulation of the NSView needs to be removed.
14 // Currently, this is requried because some callers of ResizeWebContents() do
15 // so just after a new WebContents is created, but before the
16 // RenderWidgetHostView for the main frame has not been created yet.
17 // http://crbug.com/693953
13 NSView* view = web_contents->GetNativeView(); 18 NSView* view = web_contents->GetNativeView();
14 NSRect old_wcv_frame = [view frame]; 19 NSRect old_wcv_frame = [view frame];
15 CGFloat new_x = old_wcv_frame.origin.x; 20 CGFloat new_x = old_wcv_frame.origin.x;
16 CGFloat new_y = 21 CGFloat new_y =
17 old_wcv_frame.origin.y 22 old_wcv_frame.origin.y
18 + (old_wcv_frame.size.height - new_bounds.size().height()); 23 + (old_wcv_frame.size.height - new_bounds.size().height());
19 NSRect new_wcv_frame = 24 NSRect new_wcv_frame =
20 NSMakeRect(new_x, new_y, 25 NSMakeRect(new_x, new_y,
21 new_bounds.size().width(), 26 new_bounds.size().width(),
22 new_bounds.size().height()); 27 new_bounds.size().height());
23 [view setFrame:new_wcv_frame]; 28 [view setFrame:new_wcv_frame];
24 } 29 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/web_contents_sizer.cc ('k') | content/browser/frame_host/cross_process_frame_connector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698