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

Side by Side Diff: chrome/views/non_client_view.cc

Issue 42062: Merge r11424... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/branches/169/src/
Patch Set: Created 11 years, 9 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 | « chrome/views/non_client_view.h ('k') | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/views/non_client_view.h" 5 #include "chrome/views/non_client_view.h"
6 6
7 #include "chrome/common/win_util.h" 7 #include "chrome/common/win_util.h"
8 #include "chrome/views/root_view.h" 8 #include "chrome/views/root_view.h"
9 #include "chrome/views/window.h" 9 #include "chrome/views/window.h"
10 10
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 gfx::Size NonClientView::GetPreferredSize() { 144 gfx::Size NonClientView::GetPreferredSize() {
145 gfx::Rect client_bounds(gfx::Point(), client_view_->GetPreferredSize()); 145 gfx::Rect client_bounds(gfx::Point(), client_view_->GetPreferredSize());
146 return GetWindowBoundsForClientBounds(client_bounds).size(); 146 return GetWindowBoundsForClientBounds(client_bounds).size();
147 } 147 }
148 148
149 void NonClientView::Layout() { 149 void NonClientView::Layout() {
150 // First layout the NonClientFrameView, which determines the size of the 150 // First layout the NonClientFrameView, which determines the size of the
151 // ClientView... 151 // ClientView...
152 frame_view_->SetBounds(0, 0, width(), height()); 152 frame_view_->SetBounds(0, 0, width(), height());
153 153
154 // We need to manually call Layout here because layout for the frame view can
155 // change independently of the bounds changing - e.g. after the initial
156 // display of the window the metrics of the native window controls can change,
157 // which does not change the bounds of the window but requires a re-layout to
158 // trigger a repaint. We override DidChangeBounds for the NonClientFrameView
159 // to do nothing so that SetBounds above doesn't cause Layout to be called
160 // twice.
161 frame_view_->Layout();
162
154 // Then layout the ClientView, using those bounds. 163 // Then layout the ClientView, using those bounds.
155 client_view_->SetBounds(frame_view_->GetBoundsForClientView()); 164 client_view_->SetBounds(frame_view_->GetBoundsForClientView());
165
166 // We need to manually call Layout on the ClientView as well for the same
167 // reason as above.
168 client_view_->Layout();
156 } 169 }
157 170
158 void NonClientView::ViewHierarchyChanged(bool is_add, View* parent, 171 void NonClientView::ViewHierarchyChanged(bool is_add, View* parent,
159 View* child) { 172 View* child) {
160 // Add our two child views here as we are added to the Widget so that if we 173 // Add our two child views here as we are added to the Widget so that if we
161 // are subsequently resized all the parent-child relationships are 174 // are subsequently resized all the parent-child relationships are
162 // established. 175 // established.
163 if (is_add && GetWidget() && child == this) { 176 if (is_add && GetWidget() && child == this) {
164 AddChildView(kFrameViewIndex, frame_view_.get()); 177 AddChildView(kFrameViewIndex, frame_view_.get());
165 AddChildView(kClientViewIndex, client_view_); 178 AddChildView(kClientViewIndex, client_view_);
(...skipping 23 matching lines...) Expand all
189 202
190 //////////////////////////////////////////////////////////////////////////////// 203 ////////////////////////////////////////////////////////////////////////////////
191 // NonClientFrameView, View overrides: 204 // NonClientFrameView, View overrides:
192 205
193 bool NonClientFrameView::HitTest(const gfx::Point& l) const { 206 bool NonClientFrameView::HitTest(const gfx::Point& l) const {
194 // For the default case, we assume the non-client frame view never overlaps 207 // For the default case, we assume the non-client frame view never overlaps
195 // the client view. 208 // the client view.
196 return !GetWidget()->AsWindow()->client_view()->bounds().Contains(l); 209 return !GetWidget()->AsWindow()->client_view()->bounds().Contains(l);
197 } 210 }
198 211
212 void NonClientFrameView::DidChangeBounds(const gfx::Rect& previous,
213 const gfx::Rect& current) {
214 // Overridden to do nothing. The NonClientView manually calls Layout on the
215 // FrameView when it is itself laid out, see comment in NonClientView::Layout.
216 }
217
199 //////////////////////////////////////////////////////////////////////////////// 218 ////////////////////////////////////////////////////////////////////////////////
200 // NonClientFrameView, protected: 219 // NonClientFrameView, protected:
201 220
202 int NonClientFrameView::GetHTComponentForFrame(const gfx::Point& point, 221 int NonClientFrameView::GetHTComponentForFrame(const gfx::Point& point,
203 int top_resize_border_height, 222 int top_resize_border_height,
204 int resize_border_thickness, 223 int resize_border_thickness,
205 int top_resize_corner_height, 224 int top_resize_corner_height,
206 int resize_corner_width, 225 int resize_corner_width,
207 bool can_resize) { 226 bool can_resize) {
208 // Tricky: In XP, native behavior is to return HTTOPLEFT and HTTOPRIGHT for 227 // Tricky: In XP, native behavior is to return HTTOPLEFT and HTTOPRIGHT for
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 return HTNOWHERE; 262 return HTNOWHERE;
244 } 263 }
245 264
246 // If the window can't be resized, there are no resize boundaries, just 265 // If the window can't be resized, there are no resize boundaries, just
247 // window borders. 266 // window borders.
248 return can_resize ? component : HTBORDER; 267 return can_resize ? component : HTBORDER;
249 } 268 }
250 269
251 } // namespace views 270 } // namespace views
252 271
OLDNEW
« no previous file with comments | « chrome/views/non_client_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698