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

Side by Side Diff: ui/views/widget/root_view.cc

Issue 10082029: Ash: Fix hit testing for the bottom pixels of tabs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « ui/views/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/widget/root_view.h" 5 #include "ui/views/widget/root_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 &drag_info_); 210 &drag_info_);
211 return true; 211 return true;
212 } 212 }
213 DCHECK(!explicit_mouse_handler_); 213 DCHECK(!explicit_mouse_handler_);
214 214
215 bool hit_disabled_view = false; 215 bool hit_disabled_view = false;
216 // Walk up the tree until we find a view that wants the mouse event. 216 // Walk up the tree until we find a view that wants the mouse event.
217 for (mouse_pressed_handler_ = GetEventHandlerForPoint(e.location()); 217 for (mouse_pressed_handler_ = GetEventHandlerForPoint(e.location());
218 mouse_pressed_handler_ && (mouse_pressed_handler_ != this); 218 mouse_pressed_handler_ && (mouse_pressed_handler_ != this);
219 mouse_pressed_handler_ = mouse_pressed_handler_->parent()) { 219 mouse_pressed_handler_ = mouse_pressed_handler_->parent()) {
220 DVLOG(1) << "OnMousePressed testing "
221 << mouse_pressed_handler_->GetClassName();
220 if (!mouse_pressed_handler_->enabled()) { 222 if (!mouse_pressed_handler_->enabled()) {
221 // Disabled views should eat events instead of propagating them upwards. 223 // Disabled views should eat events instead of propagating them upwards.
222 hit_disabled_view = true; 224 hit_disabled_view = true;
223 break; 225 break;
224 } 226 }
225 227
226 // See if this view wants to handle the mouse press. 228 // See if this view wants to handle the mouse press.
227 MouseEvent mouse_pressed_event(e, this, mouse_pressed_handler_); 229 MouseEvent mouse_pressed_event(e, this, mouse_pressed_handler_);
228 230
229 // Remove the double-click flag if the handler is different than the 231 // Remove the double-click flag if the handler is different than the
(...skipping 13 matching lines...) Expand all
243 // NOTE: Don't return true here, because we don't want the frame to 245 // NOTE: Don't return true here, because we don't want the frame to
244 // forward future events to us when there's no handler. 246 // forward future events to us when there's no handler.
245 if (!mouse_pressed_handler_) 247 if (!mouse_pressed_handler_)
246 break; 248 break;
247 249
248 // If the view handled the event, leave mouse_pressed_handler_ set and 250 // If the view handled the event, leave mouse_pressed_handler_ set and
249 // return true, which will cause subsequent drag/release events to get 251 // return true, which will cause subsequent drag/release events to get
250 // forwarded to that view. 252 // forwarded to that view.
251 if (handled) { 253 if (handled) {
252 last_click_handler_ = mouse_pressed_handler_; 254 last_click_handler_ = mouse_pressed_handler_;
255 DVLOG(1) << "OnMousePressed handled by "
256 << mouse_pressed_handler_->GetClassName();
253 return true; 257 return true;
254 } 258 }
255 } 259 }
256 260
257 // Reset mouse_pressed_handler_ to indicate that no processing is occurring. 261 // Reset mouse_pressed_handler_ to indicate that no processing is occurring.
258 mouse_pressed_handler_ = NULL; 262 mouse_pressed_handler_ = NULL;
259 263
260 // In the event that a double-click is not handled after traversing the 264 // In the event that a double-click is not handled after traversing the
261 // entire hierarchy (even as a single-click when sent to a different view), 265 // entire hierarchy (even as a single-click when sent to a different view),
262 // it must be marked as handled to avoid anything happening from default 266 // it must be marked as handled to avoid anything happening from default
263 // processing if it the first click-part was handled by us. 267 // processing if it the first click-part was handled by us.
264 if (last_click_handler_ && e.flags() & ui::EF_IS_DOUBLE_CLICK) 268 if (last_click_handler_ && (e.flags() & ui::EF_IS_DOUBLE_CLICK))
265 hit_disabled_view = true; 269 hit_disabled_view = true;
266 270
267 last_click_handler_ = NULL; 271 last_click_handler_ = NULL;
268 return hit_disabled_view; 272 return hit_disabled_view;
269 } 273 }
270 274
271 bool RootView::OnMouseDragged(const MouseEvent& event) { 275 bool RootView::OnMouseDragged(const MouseEvent& event) {
272 if (mouse_pressed_handler_) { 276 if (mouse_pressed_handler_) {
273 MouseEvent e(event, this); 277 MouseEvent e(event, this);
274 SetMouseLocationAndFlags(e); 278 SetMouseLocationAndFlags(e);
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 } 528 }
525 529
526 void RootView::SetMouseLocationAndFlags(const MouseEvent& event) { 530 void RootView::SetMouseLocationAndFlags(const MouseEvent& event) {
527 last_mouse_event_flags_ = event.flags(); 531 last_mouse_event_flags_ = event.flags();
528 last_mouse_event_x_ = event.x(); 532 last_mouse_event_x_ = event.x();
529 last_mouse_event_y_ = event.y(); 533 last_mouse_event_y_ = event.y();
530 } 534 }
531 535
532 } // namespace internal 536 } // namespace internal
533 } // namespace views 537 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698