| Index: ui/views/controls/native/native_view_host.cc
|
| diff --git a/ui/views/controls/native/native_view_host.cc b/ui/views/controls/native/native_view_host.cc
|
| index 7ec512a5e50e110a7080e8772f2577dc3a5c07da..1ef0abe9fe8626a41d63f6955e356cf12201bf58 100644
|
| --- a/ui/views/controls/native/native_view_host.cc
|
| +++ b/ui/views/controls/native/native_view_host.cc
|
| @@ -33,6 +33,7 @@ NativeViewHost::NativeViewHost()
|
| : native_view_(NULL),
|
| fast_resize_(false),
|
| fast_resize_at_last_layout_(false),
|
| + fast_resize_gravity_(GRAVITY_NORTHWEST),
|
| focus_view_(NULL) {
|
| }
|
|
|
| @@ -47,11 +48,9 @@ void NativeViewHost::Attach(gfx::NativeView native_view) {
|
| // be seen as focused when the native view receives focus.
|
| if (!focus_view_)
|
| focus_view_ = this;
|
| - native_wrapper_->NativeViewWillAttach();
|
| - Widget::ReparentNativeView(native_view_, GetWidget()->GetNativeView());
|
| + native_wrapper_->AttachNativeView();
|
| Layout();
|
| -
|
| - Widget* widget = Widget::GetWidgetForNativeView(native_view);
|
| + Widget* widget = Widget::GetWidgetForNativeView(native_view_);
|
| if (widget)
|
| widget->SetNativeWindowProperty(kWidgetNativeViewHostKey, this);
|
| }
|
| @@ -65,6 +64,56 @@ void NativeViewHost::SetPreferredSize(const gfx::Size& size) {
|
| PreferredSizeChanged();
|
| }
|
|
|
| +float NativeViewHost::GetWidthScaleFactor() const {
|
| + switch (fast_resize_gravity_) {
|
| + case GRAVITY_NORTHWEST:
|
| + return 0.0;
|
| + case GRAVITY_NORTH:
|
| + return 0.5;
|
| + case GRAVITY_NORTHEAST:
|
| + return 1.0;
|
| + case GRAVITY_EAST:
|
| + return 1.0;
|
| + case GRAVITY_SOUTHEAST:
|
| + return 1.0;
|
| + case GRAVITY_SOUTH:
|
| + return 0.5;
|
| + case GRAVITY_SOUTHWEST:
|
| + return 0.0;
|
| + case GRAVITY_WEST:
|
| + return 0.0;
|
| + case GRAVITY_CENTER:
|
| + return 0.5;
|
| + }
|
| + NOTREACHED();
|
| + return 0.0;
|
| +}
|
| +
|
| +float NativeViewHost::GetHeightScaleFactor() const {
|
| + switch (fast_resize_gravity_) {
|
| + case GRAVITY_NORTHWEST:
|
| + return 0.0;
|
| + case GRAVITY_NORTH:
|
| + return 0.0;
|
| + case GRAVITY_NORTHEAST:
|
| + return 0.0;
|
| + case GRAVITY_EAST:
|
| + return 0.5;
|
| + case GRAVITY_SOUTHEAST:
|
| + return 1.0;
|
| + case GRAVITY_SOUTH:
|
| + return 1.0;
|
| + case GRAVITY_SOUTHWEST:
|
| + return 1.0;
|
| + case GRAVITY_WEST:
|
| + return 0.5;
|
| + case GRAVITY_CENTER:
|
| + return 0.5;
|
| + }
|
| + NOTREACHED();
|
| + return 0.0;
|
| +}
|
| +
|
| void NativeViewHost::NativeViewDestroyed() {
|
| // Detach so we can clear our state and notify the native_wrapper_ to release
|
| // ref on the native view.
|
|
|