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: views/view.cc

Issue 342116: Attempt 2 at:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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 | « chrome/browser/views/notifications/balloon_view.cc ('k') | views/widget/widget.h » ('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) 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 "views/view.h" 5 #include "views/view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #ifndef NDEBUG 8 #ifndef NDEBUG
9 #include <iostream> 9 #include <iostream>
10 #endif 10 #endif
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 int y) { 422 int y) {
423 return NULL; 423 return NULL;
424 } 424 }
425 425
426 bool View::HitTest(const gfx::Point& l) const { 426 bool View::HitTest(const gfx::Point& l) const {
427 if (l.x() >= 0 && l.x() < static_cast<int>(width()) && 427 if (l.x() >= 0 && l.x() < static_cast<int>(width()) &&
428 l.y() >= 0 && l.y() < static_cast<int>(height())) { 428 l.y() >= 0 && l.y() < static_cast<int>(height())) {
429 if (HasHitTestMask()) { 429 if (HasHitTestMask()) {
430 gfx::Path mask; 430 gfx::Path mask;
431 GetHitTestMask(&mask); 431 GetHitTestMask(&mask);
432 ScopedRegion rgn(mask.CreateNativeRegion());
433 // TODO: can this use SkRegion's contains instead?
432 #if defined(OS_WIN) 434 #if defined(OS_WIN)
433 ScopedHRGN rgn(mask.CreateHRGN());
434 return !!PtInRegion(rgn, l.x(), l.y()); 435 return !!PtInRegion(rgn, l.x(), l.y());
435 #elif defined(OS_LINUX) 436 #elif defined(OS_LINUX)
436 GdkRegion* region = mask.CreateGdkRegion(); 437 return gdk_region_point_in(rgn.Get(), l.x(), l.y());
437 bool result = gdk_region_point_in(region, l.x(), l.y());
438 gdk_region_destroy(region);
439 return result;
440 #endif 438 #endif
441 } 439 }
442 // No mask, but inside our bounds. 440 // No mask, but inside our bounds.
443 return true; 441 return true;
444 } 442 }
445 // Outside our bounds. 443 // Outside our bounds.
446 return false; 444 return false;
447 } 445 }
448 446
449 void View::SetContextMenuController(ContextMenuController* menu_controller) { 447 void View::SetContextMenuController(ContextMenuController* menu_controller) {
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after
1435 start_x = start_y = 0; 1433 start_x = start_y = 0;
1436 } 1434 }
1437 1435
1438 void View::DragInfo::PossibleDrag(int x, int y) { 1436 void View::DragInfo::PossibleDrag(int x, int y) {
1439 possible_drag = true; 1437 possible_drag = true;
1440 start_x = x; 1438 start_x = x;
1441 start_y = y; 1439 start_y = y;
1442 } 1440 }
1443 1441
1444 } // namespace 1442 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/views/notifications/balloon_view.cc ('k') | views/widget/widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698