Index: ui/views/controls/native/native_view_host_aura.cc |
diff --git a/ui/views/controls/native/native_view_host_aura.cc b/ui/views/controls/native/native_view_host_aura.cc |
index 828a64732340bc4d5fc8f921b9e9ddbd53596d70..2364bb311a6db1eb32f2c3cfcc7b010fb72b3bf3 100644 |
--- a/ui/views/controls/native/native_view_host_aura.cc |
+++ b/ui/views/controls/native/native_view_host_aura.cc |
@@ -82,8 +82,8 @@ void NativeViewHostAura::RemovedFromWidget() { |
void NativeViewHostAura::InstallClip(int x, int y, int w, int h) { |
installed_clip_ = true; |
- clip_rect_ = gfx::Rect(x + orig_bounds_.origin().x(), |
- y + orig_bounds_.origin().y(), |
+ clip_rect_ = gfx::Rect(x + orig_bounds_.x(), |
+ y + orig_bounds_.y(), |
w, |
h); |
UpdateClippingWindow(); |
@@ -103,14 +103,21 @@ void NativeViewHostAura::UninstallClip() { |
void NativeViewHostAura::ShowWidget(int x, int y, int w, int h) { |
if (host_->fast_resize()) { |
- UninstallClip(); |
- InstallClip(x - orig_bounds_.origin().x(), |
- y - orig_bounds_.origin().y(), |
+ gfx::Rect native_view_bounds = host_->native_view()->bounds(); |
+ gfx::Point native_view_origin = |
+ CalculateNativeViewOrigin(clipping_window_.bounds(), |
+ native_view_bounds); |
+ orig_bounds_ = gfx::Rect(x + native_view_origin.x(), |
+ y + native_view_origin.y(), |
+ native_view_bounds.width(), |
+ native_view_bounds.height()); |
+ |
+ InstallClip(x - orig_bounds_.x(), |
+ y - orig_bounds_.y(), |
w, |
h); |
} else { |
- clip_rect_.Offset(x - orig_bounds_.origin().x(), |
- y - orig_bounds_.origin().y()); |
+ clip_rect_.Offset(x - orig_bounds_.x(), y - orig_bounds_.y()); |
orig_bounds_ = gfx::Rect(x, y, w, h); |
UpdateClippingWindow(); |
} |
@@ -188,20 +195,14 @@ void NativeViewHostAura::RemoveClippingWindow() { |
} |
void NativeViewHostAura::UpdateClippingWindow() { |
- if (installed_clip_) { |
- clipping_window_.SetBounds(clip_rect_); |
- gfx::Rect native_view_bounds = host_->native_view()->bounds(); |
- gfx::Point native_view_origin = |
- CalculateNativeViewOrigin(clipping_window_.bounds(), |
- native_view_bounds); |
- |
- native_view_bounds.set_origin(native_view_origin); |
- host_->native_view()->SetBounds(native_view_bounds); |
- } else { |
+ if (!installed_clip_) |
clip_rect_ = orig_bounds_; |
- clipping_window_.SetBounds(orig_bounds_); |
- host_->native_view()->SetBounds(gfx::Rect(orig_bounds_.size())); |
- } |
+ |
+ clipping_window_.SetBounds(clip_rect_); |
+ |
+ gfx::Rect native_view_bounds = orig_bounds_; |
+ native_view_bounds.Offset(-clip_rect_.x(), -clip_rect_.y()); |
+ host_->native_view()->SetBounds(native_view_bounds); |
} |
} // namespace views |