 Chromium Code Reviews
 Chromium Code Reviews Issue 10938009:
  Views fuzzing for Aura and Windows  (Closed) 
  Base URL: http://git.chromium.org/chromium/src.git@master
    
  
    Issue 10938009:
  Views fuzzing for Aura and Windows  (Closed) 
  Base URL: http://git.chromium.org/chromium/src.git@master| OLD | NEW | 
|---|---|
| 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 #ifndef UI_VIEWS_VIEW_H_ | 5 #ifndef UI_VIEWS_VIEW_H_ | 
| 6 #define UI_VIEWS_VIEW_H_ | 6 #define UI_VIEWS_VIEW_H_ | 
| 7 | 7 | 
| 8 #include <algorithm> | 8 #include <algorithm> | 
| 9 #include <map> | 9 #include <map> | 
| 10 #include <set> | 10 #include <set> | 
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 403 | 403 | 
| 404 // Convert a point from the coordinate system of one View to another. | 404 // Convert a point from the coordinate system of one View to another. | 
| 405 // | 405 // | 
| 406 // |source| and |target| must be in the same widget, but doesn't need to be in | 406 // |source| and |target| must be in the same widget, but doesn't need to be in | 
| 407 // the same view hierarchy. | 407 // the same view hierarchy. | 
| 408 // |source| can be NULL in which case it means the screen coordinate system. | 408 // |source| can be NULL in which case it means the screen coordinate system. | 
| 409 static void ConvertPointToTarget(const View* source, | 409 static void ConvertPointToTarget(const View* source, | 
| 410 const View* target, | 410 const View* target, | 
| 411 gfx::Point* point); | 411 gfx::Point* point); | 
| 412 | 412 | 
| 413 // Convert |rect| from the coordinate system of one View to another. | |
| 414 // | |
| 415 // |source| and |target| must be in the same widget, but doesn't need to be in | |
| 416 // the same view hierarchy. | |
| 417 // |source| can be NULL in which case it means the screen coordinate system. | |
| 418 static void ConvertRectToTarget(const View* source, | |
| 419 const View* target, | |
| 420 gfx::Rect* rect); | |
| 
tdanderson
2012/09/18 19:19:02
nit: spacing
 | |
| 421 | |
| 413 // Convert a point from a View's coordinate system to that of its Widget. | 422 // Convert a point from a View's coordinate system to that of its Widget. | 
| 414 static void ConvertPointToWidget(const View* src, gfx::Point* point); | 423 static void ConvertPointToWidget(const View* src, gfx::Point* point); | 
| 415 | 424 | 
| 416 // Convert a point from the coordinate system of a View's Widget to that | 425 // Convert a point from the coordinate system of a View's Widget to that | 
| 417 // View's coordinate system. | 426 // View's coordinate system. | 
| 418 static void ConvertPointFromWidget(const View* dest, gfx::Point* p); | 427 static void ConvertPointFromWidget(const View* dest, gfx::Point* p); | 
| 419 | 428 | 
| 420 // Convert a point from a View's coordinate system to that of the screen. | 429 // Convert a point from a View's coordinate system to that of the screen. | 
| 421 static void ConvertPointToScreen(const View* src, gfx::Point* point); | 430 static void ConvertPointToScreen(const View* src, gfx::Point* point); | 
| 422 | 431 | 
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 493 | 502 | 
| 494 // Enable/Disable accelerated compositing. | 503 // Enable/Disable accelerated compositing. | 
| 495 static void set_use_acceleration_when_possible(bool use); | 504 static void set_use_acceleration_when_possible(bool use); | 
| 496 static bool get_use_acceleration_when_possible(); | 505 static bool get_use_acceleration_when_possible(); | 
| 497 | 506 | 
| 498 // Input --------------------------------------------------------------------- | 507 // Input --------------------------------------------------------------------- | 
| 499 // The points (and mouse locations) in the following functions are in the | 508 // The points (and mouse locations) in the following functions are in the | 
| 500 // view's coordinates, except for a RootView. | 509 // view's coordinates, except for a RootView. | 
| 501 | 510 | 
| 502 // Returns the deepest visible descendant that contains the specified point. | 511 // Returns the deepest visible descendant that contains the specified point. | 
| 503 virtual View* GetEventHandlerForPoint(const gfx::Point& point); | 512 View* GetEventHandlerForPoint(const gfx::Point& point); | 
| 513 | |
| 514 // Returns the appropriate event handler for the given touch rect. | |
| 
sky
2012/09/18 19:51:41
If this is specific to touch, it should be named s
 | |
| 515 View* GetEventHandlerForRect(const gfx::Rect& rect); | |
| 504 | 516 | 
| 505 // Return the cursor that should be used for this view or the default cursor. | 517 // Return the cursor that should be used for this view or the default cursor. | 
| 506 // The event location is in the receiver's coordinate system. The caller is | 518 // The event location is in the receiver's coordinate system. The caller is | 
| 507 // responsible for managing the lifetime of the returned object, though that | 519 // responsible for managing the lifetime of the returned object, though that | 
| 508 // lifetime may vary from platform to platform. On Windows and Aura, | 520 // lifetime may vary from platform to platform. On Windows and Aura, | 
| 509 // the cursor is a shared resource. | 521 // the cursor is a shared resource. | 
| 510 virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event); | 522 virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event); | 
| 511 | 523 | 
| 512 // A convenience function which calls HitTestRect() with a rect of size | 524 // A convenience function which calls HitTestRect() with a rect of size | 
| 513 // 1x1 and an origin of |point|. | 525 // 1x1 and an origin of |point|. | 
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1034 | 1046 | 
| 1035 // Called by HitTestRect() to see if this View has a custom hit test mask. If | 1047 // Called by HitTestRect() to see if this View has a custom hit test mask. If | 
| 1036 // the return value is true, GetHitTestMask() will be called to obtain the | 1048 // the return value is true, GetHitTestMask() will be called to obtain the | 
| 1037 // mask. Default value is false, in which case the View will hit-test against | 1049 // mask. Default value is false, in which case the View will hit-test against | 
| 1038 // its bounds. | 1050 // its bounds. | 
| 1039 virtual bool HasHitTestMask() const; | 1051 virtual bool HasHitTestMask() const; | 
| 1040 | 1052 | 
| 1041 // Called by HitTestRect() to retrieve a mask for hit-testing against. | 1053 // Called by HitTestRect() to retrieve a mask for hit-testing against. | 
| 1042 // Subclasses override to provide custom shaped hit test regions. | 1054 // Subclasses override to provide custom shaped hit test regions. | 
| 1043 virtual void GetHitTestMask(gfx::Path* mask) const; | 1055 virtual void GetHitTestMask(gfx::Path* mask) const; | 
| 1056 public: | |
| 
girard
2012/09/18 16:58:52
make protected.
This will mess up all the other he
 
sky
2012/09/18 19:51:41
Huh? Move the enum and function to the right secti
 | |
| 1057 // Flags the event type, so that a single GetEvent routine can handle both. | |
| 1058 enum EventType { MOUSE, TOUCH }; | |
| 
sky
2012/09/18 19:51:41
Make these more descriptive. Maybe EventHandlerTyp
 | |
| 1044 | 1059 | 
| 1060 // Returns the appropriate event handler for the given |rect|. Location will | |
| 1061 // either be a rect (for a touch event) or a point (as a 1X1 rect) for a | |
| 1062 // mouse event. | |
| 1063 // Considers the bounding rectangles of all leaf descendant views that have | |
| 1064 // at least views::kFuzzingOverlapPercentage of their area covered by | |
| 1065 // |rect|. Among these rectangles, choose one that is closest to the center | |
| 1066 // line of |rect| and return its corresponding View. If there are no such | |
| 1067 // rectangles, NULL is returned. | |
| 
tdanderson
2012/09/18 19:19:02
I think this description is from my old patch. Are
 | |
| 1068 virtual View* GetEventHandler(const gfx::Rect& rect, EventType type); | |
| 1069 protected: | |
| 1045 // Focus --------------------------------------------------------------------- | 1070 // Focus --------------------------------------------------------------------- | 
| 1046 | 1071 | 
| 1047 // Override to be notified when focus has changed either to or from this View. | 1072 // Override to be notified when focus has changed either to or from this View. | 
| 1048 virtual void OnFocus(); | 1073 virtual void OnFocus(); | 
| 1049 virtual void OnBlur(); | 1074 virtual void OnBlur(); | 
| 1050 | 1075 | 
| 1051 // Handle view focus/blur events for this view. | 1076 // Handle view focus/blur events for this view. | 
| 1052 void Focus(); | 1077 void Focus(); | 
| 1053 void Blur(); | 1078 void Blur(); | 
| 1054 | 1079 | 
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1472 base::win::ScopedComPtr<NativeViewAccessibilityWin> | 1497 base::win::ScopedComPtr<NativeViewAccessibilityWin> | 
| 1473 native_view_accessibility_win_; | 1498 native_view_accessibility_win_; | 
| 1474 #endif | 1499 #endif | 
| 1475 | 1500 | 
| 1476 DISALLOW_COPY_AND_ASSIGN(View); | 1501 DISALLOW_COPY_AND_ASSIGN(View); | 
| 1477 }; | 1502 }; | 
| 1478 | 1503 | 
| 1479 } // namespace views | 1504 } // namespace views | 
| 1480 | 1505 | 
| 1481 #endif // UI_VIEWS_VIEW_H_ | 1506 #endif // UI_VIEWS_VIEW_H_ | 
| OLD | NEW |