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

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

Issue 30993004: Reland: Implement features in NativeViewHostAura for scroll end effect (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing compile failure on the bots 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 | « ui/views/controls/native/native_view_host.h ('k') | ui/views/controls/native/native_view_host_aura.h » ('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.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.
« no previous file with comments | « ui/views/controls/native/native_view_host.h ('k') | ui/views/controls/native/native_view_host_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698