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

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 23478022: [android_webview] Fixes for wrap_content layouts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 "content/browser/android/content_view_core_impl.h" 5 #include "content/browser/android/content_view_core_impl.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 JNIEnv* env = AttachCurrentThread(); 651 JNIEnv* env = AttachCurrentThread();
652 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); 652 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
653 if (j_obj.is_null()) 653 if (j_obj.is_null())
654 return gfx::Size(); 654 return gfx::Size();
655 return gfx::Size( 655 return gfx::Size(
656 Java_ContentViewCore_getViewportSizeOffsetWidthPix(env, j_obj.obj()), 656 Java_ContentViewCore_getViewportSizeOffsetWidthPix(env, j_obj.obj()),
657 Java_ContentViewCore_getViewportSizeOffsetHeightPix(env, j_obj.obj())); 657 Java_ContentViewCore_getViewportSizeOffsetHeightPix(env, j_obj.obj()));
658 } 658 }
659 659
660 gfx::Size ContentViewCoreImpl::GetViewportSizeDip() const { 660 gfx::Size ContentViewCoreImpl::GetViewportSizeDip() const {
661 if (!viewport_dip_size_override_.IsEmpty())
662 return viewport_dip_size_override_;
663
661 return gfx::ToCeiledSize( 664 return gfx::ToCeiledSize(
662 gfx::ScaleSize(GetViewportSizePix(), 1.0f / GetDpiScale())); 665 gfx::ScaleSize(GetViewportSizePix(), 1.0f / GetDpiScale()));
663 } 666 }
664 667
665 gfx::Size ContentViewCoreImpl::GetViewportSizeOffsetDip() const { 668 gfx::Size ContentViewCoreImpl::GetViewportSizeOffsetDip() const {
666 return gfx::ToCeiledSize( 669 return gfx::ToCeiledSize(
667 gfx::ScaleSize(GetViewportSizeOffsetPix(), 1.0f / GetDpiScale())); 670 gfx::ScaleSize(GetViewportSizeOffsetPix(), 1.0f / GetDpiScale()));
668 } 671 }
669 672
670 float ContentViewCoreImpl::GetOverdrawBottomHeightDip() const { 673 float ContentViewCoreImpl::GetOverdrawBottomHeightDip() const {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 } 872 }
870 873
871 void ContentViewCoreImpl::RequestContentClipping( 874 void ContentViewCoreImpl::RequestContentClipping(
872 const gfx::Rect& clipping, 875 const gfx::Rect& clipping,
873 const gfx::Size& content_size) { 876 const gfx::Size& content_size) {
874 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); 877 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid();
875 if (rwhv) 878 if (rwhv)
876 rwhv->RequestContentClipping(clipping, content_size); 879 rwhv->RequestContentClipping(clipping, content_size);
877 } 880 }
878 881
882 void ContentViewCoreImpl::SetViewportSizeDipOverride(
883 const gfx::Size& viewport_size) {
884 viewport_dip_size_override_ = viewport_size;
885 }
886
879 jboolean ContentViewCoreImpl::SendMouseMoveEvent(JNIEnv* env, 887 jboolean ContentViewCoreImpl::SendMouseMoveEvent(JNIEnv* env,
880 jobject obj, 888 jobject obj,
881 jlong time_ms, 889 jlong time_ms,
882 jfloat x, 890 jfloat x,
883 jfloat y) { 891 jfloat y) {
884 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); 892 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid();
885 if (!rwhv) 893 if (!rwhv)
886 return false; 894 return false;
887 895
888 WebKit::WebMouseEvent event = WebMouseEventBuilder::Build( 896 WebKit::WebMouseEvent event = WebMouseEventBuilder::Build(
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
1580 reinterpret_cast<ui::ViewAndroid*>(view_android), 1588 reinterpret_cast<ui::ViewAndroid*>(view_android),
1581 reinterpret_cast<ui::WindowAndroid*>(window_android)); 1589 reinterpret_cast<ui::WindowAndroid*>(window_android));
1582 return reinterpret_cast<jint>(view); 1590 return reinterpret_cast<jint>(view);
1583 } 1591 }
1584 1592
1585 bool RegisterContentViewCore(JNIEnv* env) { 1593 bool RegisterContentViewCore(JNIEnv* env) {
1586 return RegisterNativesImpl(env); 1594 return RegisterNativesImpl(env);
1587 } 1595 }
1588 1596
1589 } // namespace content 1597 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698