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

Side by Side Diff: ui/views/window/non_client_view.cc

Issue 10827198: Change View::HitTest to View::HitTestRect (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed errors reported by trybots Created 8 years, 4 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 | « ui/views/window/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) 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 "ui/views/window/non_client_view.h" 5 #include "ui/views/window/non_client_view.h"
6 6
7 #include "ui/base/accessibility/accessible_view_state.h" 7 #include "ui/base/accessibility/accessible_view_state.h"
8 #include "ui/base/hit_test.h" 8 #include "ui/base/hit_test.h"
9 #include "ui/views/widget/root_view.h" 9 #include "ui/views/widget/root_view.h"
10 #include "ui/views/widget/widget.h" 10 #include "ui/views/widget/widget.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // events for the window controls. We override this method here so that we can 171 // events for the window controls. We override this method here so that we can
172 // detect this condition and re-route the events to the non-client frame view. 172 // detect this condition and re-route the events to the non-client frame view.
173 // The assumption is that the frame view's implementation of HitTest will only 173 // The assumption is that the frame view's implementation of HitTest will only
174 // return true for area not occupied by the client view. 174 // return true for area not occupied by the client view.
175 if (frame_view_->parent() == this) { 175 if (frame_view_->parent() == this) {
176 // During the reset of the frame_view_ it's possible to be in this code 176 // During the reset of the frame_view_ it's possible to be in this code
177 // after it's been removed from the view hierarchy but before it's been 177 // after it's been removed from the view hierarchy but before it's been
178 // removed from the NonClientView. 178 // removed from the NonClientView.
179 gfx::Point point_in_child_coords(point); 179 gfx::Point point_in_child_coords(point);
180 View::ConvertPointToView(this, frame_view_.get(), &point_in_child_coords); 180 View::ConvertPointToView(this, frame_view_.get(), &point_in_child_coords);
181 if (frame_view_->HitTest(point_in_child_coords)) 181 if (frame_view_->HitTestPoint(point_in_child_coords))
182 return frame_view_->GetEventHandlerForPoint(point_in_child_coords); 182 return frame_view_->GetEventHandlerForPoint(point_in_child_coords);
183 } 183 }
184 184
185 return View::GetEventHandlerForPoint(point); 185 return View::GetEventHandlerForPoint(point);
186 } 186 }
187 187
188 //////////////////////////////////////////////////////////////////////////////// 188 ////////////////////////////////////////////////////////////////////////////////
189 // NonClientFrameView, public: 189 // NonClientFrameView, public:
190 190
191 void NonClientFrameView::SetInactiveRenderingDisabled(bool disable) { 191 void NonClientFrameView::SetInactiveRenderingDisabled(bool disable) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 } 240 }
241 241
242 // If the window can't be resized, there are no resize boundaries, just 242 // If the window can't be resized, there are no resize boundaries, just
243 // window borders. 243 // window borders.
244 return can_resize ? component : HTBORDER; 244 return can_resize ? component : HTBORDER;
245 } 245 }
246 246
247 //////////////////////////////////////////////////////////////////////////////// 247 ////////////////////////////////////////////////////////////////////////////////
248 // NonClientFrameView, View overrides: 248 // NonClientFrameView, View overrides:
249 249
250 bool NonClientFrameView::HitTest(const gfx::Point& l) const { 250 bool NonClientFrameView::HitTestRect(const gfx::Rect& rect) const {
251 // For the default case, we assume the non-client frame view never overlaps 251 // For the default case, we assume the non-client frame view never overlaps
252 // the client view. 252 // the client view.
253 return !GetWidget()->client_view()->bounds().Contains(l); 253 return !GetWidget()->client_view()->bounds().Intersects(rect);
254 } 254 }
255 255
256 //////////////////////////////////////////////////////////////////////////////// 256 ////////////////////////////////////////////////////////////////////////////////
257 // NonClientFrameView, protected: 257 // NonClientFrameView, protected:
258 258
259 bool NonClientFrameView::ShouldPaintAsActive() const { 259 bool NonClientFrameView::ShouldPaintAsActive() const {
260 return GetWidget()->IsActive() || paint_as_active_; 260 return GetWidget()->IsActive() || paint_as_active_;
261 } 261 }
262 262
263 void NonClientFrameView::ShouldPaintAsActiveChanged() { 263 void NonClientFrameView::ShouldPaintAsActiveChanged() {
264 if (!paint_as_active_) 264 if (!paint_as_active_)
265 SchedulePaint(); 265 SchedulePaint();
266 } 266 }
267 267
268 void NonClientFrameView::GetAccessibleState(ui::AccessibleViewState* state) { 268 void NonClientFrameView::GetAccessibleState(ui::AccessibleViewState* state) {
269 state->role = ui::AccessibilityTypes::ROLE_WINDOW; 269 state->role = ui::AccessibilityTypes::ROLE_WINDOW;
270 } 270 }
271 271
272 std::string NonClientFrameView::GetClassName() const { 272 std::string NonClientFrameView::GetClassName() const {
273 return kViewClassName; 273 return kViewClassName;
274 } 274 }
275 275
276 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) { 276 void NonClientFrameView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
277 // Overridden to do nothing. The NonClientView manually calls Layout on the 277 // Overridden to do nothing. The NonClientView manually calls Layout on the
278 // FrameView when it is itself laid out, see comment in NonClientView::Layout. 278 // FrameView when it is itself laid out, see comment in NonClientView::Layout.
279 } 279 }
280 280
281 } // namespace views 281 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/window/non_client_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698