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

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

Issue 2654413002: Stretching NativeViewHost, and misc tab capture fixes.
Patch Set: Gettin' it all working on ui/cocoa and MacViews too. Created 3 years, 10 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
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 6bf4ce8a3db8b3376e5d6436414bd0d549e84902..38162b485af56faf4181114fd7f1c66a16c5f76b 100644
--- a/ui/views/controls/native/native_view_host_aura.cc
+++ b/ui/views/controls/native/native_view_host_aura.cc
@@ -94,6 +94,7 @@ void NativeViewHostAura::AttachNativeView() {
host_->native_view()->AddObserver(this);
host_->native_view()->SetProperty(views::kHostViewKey,
static_cast<View*>(host_));
+ original_transform_ = host_->native_view()->transform();
AddClippingWindow();
}
@@ -104,6 +105,7 @@ void NativeViewHostAura::NativeViewDetaching(bool destroyed) {
host_->native_view()->RemoveObserver(this);
host_->native_view()->ClearProperty(views::kHostViewKey);
host_->native_view()->ClearProperty(aura::client::kHostWindowKey);
+ host_->native_view()->SetTransform(original_transform_);
host_->native_view()->Hide();
if (host_->native_view()->parent())
Widget::ReparentNativeView(host_->native_view(), NULL);
@@ -145,22 +147,32 @@ void NativeViewHostAura::UninstallClip() {
clip_rect_.reset();
}
-void NativeViewHostAura::ShowWidget(int x, int y, int w, int h) {
- int width = w;
- int height = h;
+void NativeViewHostAura::ShowWidget(int x,
+ int y,
+ int w,
+ int h,
+ int render_w,
+ int render_h) {
if (host_->fast_resize()) {
gfx::Point origin(x, y);
views::View::ConvertPointFromWidget(host_, &origin);
InstallClip(origin.x(), origin.y(), w, h);
- width = host_->native_view()->bounds().width();
- height = host_->native_view()->bounds().height();
+ render_w = host_->native_view()->bounds().width();
+ render_h = host_->native_view()->bounds().height();
+ } else {
+ gfx::Transform transform = original_transform_;
+ if (w > 0 && h > 0 && render_w > 0 && render_h > 0) {
+ transform.Scale(static_cast<SkMScalar>(w) / render_w,
+ static_cast<SkMScalar>(h) / render_h);
+ }
+ host_->native_view()->SetTransform(transform);
}
+
clipping_window_.SetBounds(clip_rect_ ? *clip_rect_
: gfx::Rect(x, y, w, h));
-
gfx::Point clip_offset = clipping_window_.bounds().origin();
host_->native_view()->SetBounds(
- gfx::Rect(x - clip_offset.x(), y - clip_offset.y(), width, height));
+ gfx::Rect(x - clip_offset.x(), y - clip_offset.y(), render_w, render_h));
host_->native_view()->Show();
clipping_window_.Show();
}
« no previous file with comments | « ui/views/controls/native/native_view_host_aura.h ('k') | 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