Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 422 const gfx::SizeF& viewport_size, | 422 const gfx::SizeF& viewport_size, |
| 423 const gfx::Vector2dF& controls_offset, | 423 const gfx::Vector2dF& controls_offset, |
| 424 const gfx::Vector2dF& content_offset, | 424 const gfx::Vector2dF& content_offset, |
| 425 bool is_mobile_optimized_hint, | 425 bool is_mobile_optimized_hint, |
| 426 const gfx::SelectionBound& selection_start) { | 426 const gfx::SelectionBound& selection_start) { |
| 427 JNIEnv* env = AttachCurrentThread(); | 427 JNIEnv* env = AttachCurrentThread(); |
| 428 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 428 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 429 if (obj.is_null() || !view_.GetWindowAndroid()) | 429 if (obj.is_null() || !view_.GetWindowAndroid()) |
| 430 return; | 430 return; |
| 431 | 431 |
| 432 view_.GetWindowAndroid()->set_content_offset( | 432 view_.GetWindowAndroid()->set_content_offset(content_offset); |
|
boliu
2016/08/16 15:03:03
this change and it's fallout can be in a separate
Tima Vaisburd
2016/08/16 20:55:28
Created https://codereview.chromium.org/2249243002
| |
| 433 gfx::ScaleVector2d(content_offset, dpi_scale_)); | |
| 434 | 433 |
| 435 page_scale_ = page_scale_factor; | 434 page_scale_ = page_scale_factor; |
| 436 | 435 |
| 437 // The CursorAnchorInfo API in Android only supports zero width selection | 436 // The CursorAnchorInfo API in Android only supports zero width selection |
| 438 // bounds. | 437 // bounds. |
| 439 const jboolean has_insertion_marker = | 438 const jboolean has_insertion_marker = |
| 440 selection_start.type() == gfx::SelectionBound::CENTER; | 439 selection_start.type() == gfx::SelectionBound::CENTER; |
| 441 const jboolean is_insertion_marker_visible = selection_start.visible(); | 440 const jboolean is_insertion_marker_visible = selection_start.visible(); |
| 442 const jfloat insertion_marker_horizontal = | 441 const jfloat insertion_marker_horizontal = |
| 443 has_insertion_marker ? selection_start.edge_top().x() : 0.0f; | 442 has_insertion_marker ? selection_start.edge_top().x() : 0.0f; |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 902 WebContents* ContentViewCoreImpl::GetWebContents() const { | 901 WebContents* ContentViewCoreImpl::GetWebContents() const { |
| 903 return web_contents_; | 902 return web_contents_; |
| 904 } | 903 } |
| 905 | 904 |
| 906 void ContentViewCoreImpl::SetFocus(JNIEnv* env, | 905 void ContentViewCoreImpl::SetFocus(JNIEnv* env, |
| 907 const JavaParamRef<jobject>& obj, | 906 const JavaParamRef<jobject>& obj, |
| 908 jboolean focused) { | 907 jboolean focused) { |
| 909 SetFocusInternal(focused); | 908 SetFocusInternal(focused); |
| 910 } | 909 } |
| 911 | 910 |
| 911 void ContentViewCoreImpl::SetDeviceScaleFactor(JNIEnv* env, | |
| 912 const JavaParamRef<jobject>& obj, | |
| 913 jfloat device_scale) { | |
| 914 DVLOG(1) << __FUNCTION__ << " " << device_scale; | |
| 915 dpi_scale_ = device_scale; | |
|
boliu
2016/08/16 15:03:03
what about all the places where dpi_scale() is cal
| |
| 916 } | |
| 917 | |
| 912 void ContentViewCoreImpl::SetFocusInternal(bool focused) { | 918 void ContentViewCoreImpl::SetFocusInternal(bool focused) { |
| 913 if (!GetRenderWidgetHostViewAndroid()) | 919 if (!GetRenderWidgetHostViewAndroid()) |
| 914 return; | 920 return; |
| 915 | 921 |
| 916 if (focused) | 922 if (focused) |
| 917 GetRenderWidgetHostViewAndroid()->Focus(); | 923 GetRenderWidgetHostViewAndroid()->Focus(); |
| 918 else | 924 else |
| 919 GetRenderWidgetHostViewAndroid()->Blur(); | 925 GetRenderWidgetHostViewAndroid()->Blur(); |
| 920 } | 926 } |
| 921 | 927 |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1638 return ScopedJavaLocalRef<jobject>(); | 1644 return ScopedJavaLocalRef<jobject>(); |
| 1639 | 1645 |
| 1640 return view->GetJavaObject(); | 1646 return view->GetJavaObject(); |
| 1641 } | 1647 } |
| 1642 | 1648 |
| 1643 bool RegisterContentViewCore(JNIEnv* env) { | 1649 bool RegisterContentViewCore(JNIEnv* env) { |
| 1644 return RegisterNativesImpl(env); | 1650 return RegisterNativesImpl(env); |
| 1645 } | 1651 } |
| 1646 | 1652 |
| 1647 } // namespace content | 1653 } // namespace content |
| OLD | NEW |