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

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

Issue 24299004: Implement features in NativeViewHostAura for scroll end effect (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Responded to sky's comments and added some testing Created 7 years, 3 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.cc
diff --git a/ui/views/controls/native/native_view_host.cc b/ui/views/controls/native/native_view_host.cc
index 7ec512a5e50e110a7080e8772f2577dc3a5c07da..649ff1a59ebe505b1c6827d0d5431805cd1a93b9 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) {
}
@@ -54,6 +55,7 @@ void NativeViewHost::Attach(gfx::NativeView native_view) {
Widget* widget = Widget::GetWidgetForNativeView(native_view);
if (widget)
widget->SetNativeWindowProperty(kWidgetNativeViewHostKey, this);
+ native_wrapper_->NativeViewAttached();
}
void NativeViewHost::Detach() {
@@ -65,6 +67,74 @@ void NativeViewHost::SetPreferredSize(const gfx::Size& size) {
PreferredSizeChanged();
}
+float NativeViewHost::GetWidthScaleFactor() const {
+ float ret_val = 0.0;
+ switch (fast_resize_gravity_) {
+ case GRAVITY_NORTHWEST:
+ ret_val = 0.0;
sky 2013/09/26 22:10:54 There is no point in assigning to ret_val, break,
rharrison 2013/09/30 20:48:45 Done.
+ break;
+ case GRAVITY_NORTH:
+ ret_val = 0.5;
+ break;
+ case GRAVITY_NORTHEAST:
+ ret_val = 1.0;
+ break;
+ case GRAVITY_EAST:
+ ret_val = 1.0;
+ break;
+ case GRAVITY_SOUTHEAST:
+ ret_val = 1.0;
+ break;
+ case GRAVITY_SOUTH:
+ ret_val = 0.5;
+ break;
+ case GRAVITY_SOUTHWEST:
+ ret_val = 0.0;
+ break;
+ case GRAVITY_WEST:
+ ret_val = 0.0;
+ break;
+ case GRAVITY_CENTER:
+ ret_val = 0.5;
+ break;
+ }
+ return ret_val;
+}
+
+float NativeViewHost::GetHeightScaleFactor() const {
+ float ret_val = 0.0;
+ switch (fast_resize_gravity_) {
+ case GRAVITY_NORTHWEST:
+ ret_val = 0.0;
+ break;
+ case GRAVITY_NORTH:
+ ret_val = 0.0;
+ break;
+ case GRAVITY_NORTHEAST:
+ ret_val = 0.0;
+ break;
+ case GRAVITY_EAST:
+ ret_val = 0.5;
+ break;
+ case GRAVITY_SOUTHEAST:
+ ret_val = 1.0;
+ break;
+ case GRAVITY_SOUTH:
+ ret_val = 1.0;
+ break;
+ case GRAVITY_SOUTHWEST:
+ ret_val = 1.0;
+ break;
+ case GRAVITY_WEST:
+ ret_val = 0.5;
+ break;
+ case GRAVITY_CENTER:
+ ret_val = 0.5;
+ break;
+ }
+ return ret_val;
+}
+
void NativeViewHost::NativeViewDestroyed() {
// Detach so we can clear our state and notify the native_wrapper_ to release
// ref on the native view.

Powered by Google App Engine
This is Rietveld 408576698