Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1187)

Unified Diff: ui/views/controls/native/native_view_host_aura.cc

Issue 27768003: aura: Fix NativeViewHostAura non fast resize clipping. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/views/controls/native/native_view_host_aura_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | ui/views/controls/native/native_view_host_aura_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698