Chromium Code Reviews| Index: ui/views/controls/native/native_view_host.h |
| diff --git a/ui/views/controls/native/native_view_host.h b/ui/views/controls/native/native_view_host.h |
| index bdc51510550ca1569853639a0d615f1158159f28..15e286b135e352bd2ce1458a272caf5be35d7b8f 100644 |
| --- a/ui/views/controls/native/native_view_host.h |
| +++ b/ui/views/controls/native/native_view_host.h |
| @@ -15,6 +15,38 @@ namespace views { |
| class NativeViewHostAuraTest; |
| class NativeViewHostWrapper; |
| +// When performing fast resizes the contents is not actually resized, but |
| +// instead the contents is positioned and clipped to give the impression of |
| +// resizing. Gravity indicates the positioning of the content relative to the |
| +// clipping. The default value, northwest, indicates that the top left corner of |
| +// the clip and the content should align, so the bottom and left sides of the |
|
sky
2013/09/24 20:23:25
left -> right
rharrison
2013/09/26 20:36:48
Done.
|
| +// content will be clipped. For a value like south the bottom edges will align |
| +// at their respective middles, thus the full vertical resize will be reflected |
| +// on the top, but half of the horizontal resize will be reflected on the left |
| +// and right sides. The following list is the gravity values and their alignment |
| +// points for reference, coordinates relative to the respective system for the |
| +// clip or contents: |
| +// NorthWest (0, 0) |
| +// North (width/2, 0) |
| +// NorthEast (width, 0) |
| +// East (width, height/2) |
| +// SouthEast (width, height) |
| +// South (width/2, height) |
| +// SouthWest (0, height) |
| +// West (0, height/2) |
| +// Center (width/2, height/2) |
| +enum FastResizeGravity { |
|
sky
2013/09/24 20:23:25
I'm not opposed to all of these, but do we really
sky
2013/09/24 20:23:25
Could you also make this a member of NativeViewHos
rharrison
2013/09/26 20:36:48
The default is NW and I would need a southern one
rharrison
2013/09/26 20:36:48
Done.
|
| + FAST_RESIZE_GRAVITY_NORTHWEST, |
| + FAST_RESIZE_GRAVITY_NORTH, |
| + FAST_RESIZE_GRAVITY_NORTHEAST, |
| + FAST_RESIZE_GRAVITY_EAST, |
| + FAST_RESIZE_GRAVITY_SOUTHEAST, |
| + FAST_RESIZE_GRAVITY_SOUTH, |
| + FAST_RESIZE_GRAVITY_SOUTHWEST, |
| + FAST_RESIZE_GRAVITY_WEST, |
| + FAST_RESIZE_GRAVITY_CENTER, |
| +}; |
| + |
| // If a NativeViewHost's native view is a Widget, this native window |
| // property is set on the widget, pointing to the owning NativeViewHost. |
| extern const char kWidgetNativeViewHostKey[]; |
| @@ -74,6 +106,18 @@ class VIEWS_EXPORT NativeViewHost : public View { |
| return fast_resize_at_last_layout_; |
| } |
| + // Gravity controls how the clip is positioned relative to the native |
| + // view. The specifics of this are discussed in the comment above the related |
| + // enum. This call only sets the value being used, but does not cause a |
| + // re-layout, so ShowWidget, via Layout, must be called before the new gravity |
| + // will have an effect. |
| + void set_fast_resize_gravity(FastResizeGravity gravity) { |
| + fast_resize_gravity_ = gravity; |
| + } |
| + FastResizeGravity fast_resize_gravity() { |
| + return fast_resize_gravity_; |
| + } |
| + |
| // Accessor for |native_view_|. |
| gfx::NativeView native_view() const { return native_view_; } |
| @@ -123,6 +167,9 @@ class VIEWS_EXPORT NativeViewHost : public View { |
| // Value of |fast_resize_| during the last call to Layout. |
| bool fast_resize_at_last_layout_; |
| + // gravity value to be used on the next call to ShowWidget. |
| + FastResizeGravity fast_resize_gravity_; |
| + |
| // The view that should be given focus when this NativeViewHost is focused. |
| View* focus_view_; |