Index: content/browser/android/content_view_core_impl.cc |
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc |
index 7854c3e44ecb2dd4432142a395239ddef0b483d0..4c056c0fc80b89f50ba982f97e2b4cee89aa7dd3 100644 |
--- a/content/browser/android/content_view_core_impl.cc |
+++ b/content/browser/android/content_view_core_impl.cc |
@@ -215,7 +215,7 @@ ContentViewCoreImpl::ContentViewCoreImpl( |
view_(view_android_delegate), |
web_contents_(static_cast<WebContentsImpl*>(web_contents)), |
page_scale_(1), |
- dpi_scale_(ui::GetScaleFactorForNativeView(&view_)), |
+ dpi_scale_(1), |
boliu
2016/10/18 00:26:25
why is this change needed?
Tima Vaisburd
2016/10/19 01:15:54
It is actually not needed, but I wanted to make it
|
device_orientation_(0), |
accessibility_enabled_(false) { |
CHECK(web_contents) << |
@@ -803,6 +803,15 @@ float ContentViewCoreImpl::GetBottomControlsHeightDip() const { |
return GetBottomControlsHeightPix() / dpi_scale(); |
} |
+void ContentViewCoreImpl::ForceLayout() { |
boliu
2016/10/18 00:26:25
just call this "WasResized"?
Tima Vaisburd
2016/10/19 01:15:54
WasResized() already existed, now it sets the phys
|
+ RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); |
+ if (view) { |
+ // |SendScreenRects()| indirectly calls GetViewSize() that asks Java layer. |
+ web_contents_->SendScreenRects(); |
+ view->WasResized(); |
+ } |
+} |
+ |
void ContentViewCoreImpl::MoveRangeSelectionExtent(const gfx::PointF& extent) { |
if (!web_contents_) |
return; |
@@ -868,6 +877,15 @@ void ContentViewCoreImpl::SetFocus(JNIEnv* env, |
SetFocusInternal(focused); |
} |
+void ContentViewCoreImpl::SetDIPScale(JNIEnv* env, |
+ const JavaParamRef<jobject>& obj, |
+ jfloat dipScale, |
+ jboolean forceLayout) { |
+ dpi_scale_ = dipScale; |
+ if (forceLayout) |
+ ForceLayout(); |
+} |
+ |
void ContentViewCoreImpl::SetFocusInternal(bool focused) { |
if (!GetRenderWidgetHostViewAndroid()) |
return; |
@@ -1236,16 +1254,12 @@ void ContentViewCoreImpl::RemoveJavascriptInterface( |
void ContentViewCoreImpl::WasResized(JNIEnv* env, |
const JavaParamRef<jobject>& obj) { |
- RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); |
gfx::Size physical_size( |
Java_ContentViewCore_getPhysicalBackingWidthPix(env, obj), |
Java_ContentViewCore_getPhysicalBackingHeightPix(env, obj)); |
view_.GetLayer()->SetBounds(physical_size); |
- if (view) { |
- web_contents_->SendScreenRects(); |
- view->WasResized(); |
- } |
+ ForceLayout(); |
} |
long ContentViewCoreImpl::GetNativeImeAdapter( |