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

Side by Side Diff: android_webview/native/aw_contents.cc

Issue 23533051: [android_webview] Use a fraction to calculate scroll offset. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: get rid of NaNs 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "android_webview/native/aw_contents.h" 5 #include "android_webview/native/aw_contents.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "android_webview/browser/aw_browser_context.h" 9 #include "android_webview/browser/aw_browser_context.h"
10 #include "android_webview/browser/aw_browser_main_parts.h" 10 #include "android_webview/browser/aw_browser_main_parts.h"
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 if (obj.is_null()) 793 if (obj.is_null())
794 return gfx::Point(); 794 return gfx::Point();
795 std::vector<int> location; 795 std::vector<int> location;
796 base::android::JavaIntArrayToIntVector( 796 base::android::JavaIntArrayToIntVector(
797 env, 797 env,
798 Java_AwContents_getLocationOnScreen(env, obj.obj()).obj(), 798 Java_AwContents_getLocationOnScreen(env, obj.obj()).obj(),
799 &location); 799 &location);
800 return gfx::Point(location[0], location[1]); 800 return gfx::Point(location[0], location[1]);
801 } 801 }
802 802
803 void AwContents::SetMaxContainerViewScrollOffset(gfx::Vector2d new_value) {
804 JNIEnv* env = AttachCurrentThread();
805 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
806 if (obj.is_null())
807 return;
808 Java_AwContents_setMaxContainerViewScrollOffset(
809 env, obj.obj(), new_value.x(), new_value.y());
810 }
811
803 void AwContents::ScrollContainerViewTo(gfx::Vector2d new_value) { 812 void AwContents::ScrollContainerViewTo(gfx::Vector2d new_value) {
804 JNIEnv* env = AttachCurrentThread(); 813 JNIEnv* env = AttachCurrentThread();
805 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 814 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
806 if (obj.is_null()) 815 if (obj.is_null())
807 return; 816 return;
808 Java_AwContents_scrollContainerViewTo( 817 Java_AwContents_scrollContainerViewTo(
809 env, obj.obj(), new_value.x(), new_value.y()); 818 env, obj.obj(), new_value.x(), new_value.y());
810 } 819 }
811 820
812
813 void AwContents::DidOverscroll(gfx::Vector2d overscroll_delta) { 821 void AwContents::DidOverscroll(gfx::Vector2d overscroll_delta) {
814 JNIEnv* env = AttachCurrentThread(); 822 JNIEnv* env = AttachCurrentThread();
815 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 823 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
816 if (obj.is_null()) 824 if (obj.is_null())
817 return; 825 return;
818 Java_AwContents_didOverscroll( 826 Java_AwContents_didOverscroll(
819 env, obj.obj(), overscroll_delta.x(), overscroll_delta.y()); 827 env, obj.obj(), overscroll_delta.x(), overscroll_delta.y());
820 } 828 }
821 829
822 void AwContents::SetDipScale(JNIEnv* env, jobject obj, jfloat dip_scale) { 830 void AwContents::SetDipScale(JNIEnv* env, jobject obj, jfloat dip_scale) {
823 browser_view_renderer_->SetDipScale(dip_scale); 831 browser_view_renderer_->SetDipScale(dip_scale);
824 } 832 }
825 833
826 void AwContents::SetDisplayedPageScaleFactor(JNIEnv* env, 834 void AwContents::SetDisplayedPageScaleFactor(JNIEnv* env,
827 jobject obj, 835 jobject obj,
828 jfloat page_scale_factor) { 836 jfloat page_scale_factor) {
829 browser_view_renderer_->SetPageScaleFactor(page_scale_factor); 837 browser_view_renderer_->SetPageScaleFactor(page_scale_factor);
830 } 838 }
831 839
832 void AwContents::SetFixedLayoutSize(JNIEnv* env, 840 void AwContents::SetFixedLayoutSize(JNIEnv* env,
833 jobject obj, 841 jobject obj,
834 jint width_dip, 842 jint width_dip,
835 jint height_dip) { 843 jint height_dip) {
836 render_view_host_ext_->SetFixedLayoutSize(gfx::Size(width_dip, height_dip)); 844 render_view_host_ext_->SetFixedLayoutSize(gfx::Size(width_dip, height_dip));
837 } 845 }
838 846
839 void AwContents::ScrollTo(JNIEnv* env, jobject obj, jint xPix, jint yPix) { 847 void AwContents::ScrollTo(JNIEnv* env, jobject obj, jint x, jint y) {
840 browser_view_renderer_->ScrollTo(gfx::Vector2d(xPix, yPix)); 848 browser_view_renderer_->ScrollTo(gfx::Vector2d(x, y));
841 } 849 }
842 850
843 void AwContents::OnWebLayoutPageScaleFactorChanged(float page_scale_factor) { 851 void AwContents::OnWebLayoutPageScaleFactorChanged(float page_scale_factor) {
844 JNIEnv* env = AttachCurrentThread(); 852 JNIEnv* env = AttachCurrentThread();
845 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 853 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
846 if (obj.is_null()) 854 if (obj.is_null())
847 return; 855 return;
848 Java_AwContents_onWebLayoutPageScaleFactorChanged(env, obj.obj(), 856 Java_AwContents_onWebLayoutPageScaleFactorChanged(env, obj.obj(),
849 page_scale_factor); 857 page_scale_factor);
850 } 858 }
(...skipping 22 matching lines...) Expand all
873 browser_view_renderer_->EnableOnNewPicture(enabled); 881 browser_view_renderer_->EnableOnNewPicture(enabled);
874 } 882 }
875 883
876 void AwContents::SetJsOnlineProperty(JNIEnv* env, 884 void AwContents::SetJsOnlineProperty(JNIEnv* env,
877 jobject obj, 885 jobject obj,
878 jboolean network_up) { 886 jboolean network_up) {
879 render_view_host_ext_->SetJsOnlineProperty(network_up); 887 render_view_host_ext_->SetJsOnlineProperty(network_up);
880 } 888 }
881 889
882 } // namespace android_webview 890 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698