| Index: android_webview/java/src/org/chromium/android_webview/AwContents.java
|
| diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
|
| index 64f957629819ae073a7fa5a0b1ce869a19640fdb..0f93669bf461375e04fb0c7860db45d9d499ea3b 100644
|
| --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
|
| +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
|
| @@ -72,6 +72,7 @@ import org.chromium.content_public.common.Referrer;
|
| import org.chromium.net.NetError;
|
| import org.chromium.net.NetworkChangeNotifier;
|
| import org.chromium.ui.base.ActivityWindowAndroid;
|
| +import org.chromium.ui.base.DIPScaleListener;
|
| import org.chromium.ui.base.PageTransition;
|
| import org.chromium.ui.base.ViewAndroidDelegate;
|
| import org.chromium.ui.base.WindowAndroid;
|
| @@ -96,8 +97,8 @@ import java.util.concurrent.Callable;
|
| * continuous build & test in the open source SDK-based tree).
|
| */
|
| @JNINamespace("android_webview")
|
| -public class AwContents implements SmartClipProvider,
|
| - PostMessageSender.PostMessageSenderDelegate {
|
| +public class AwContents implements SmartClipProvider, PostMessageSender.PostMessageSenderDelegate,
|
| + DIPScaleListener {
|
| private static final String TAG = "AwContents";
|
| private static final boolean TRACE = false;
|
| private static final int NO_WARN = 0;
|
| @@ -1061,12 +1062,7 @@ public class AwContents implements SmartClipProvider,
|
| installWebContentsObserver();
|
| mSettings.setWebContents(webContents);
|
|
|
| - float dipScale = mContentViewCore.getDeviceScaleFactor();
|
| - nativeSetDipScale(mNativeAwContents, dipScale);
|
| - mLayoutSizer.setDIPScale(dipScale);
|
| - mSettings.setDIPScale(dipScale);
|
| -
|
| - updateContentViewCoreVisibility();
|
| + onDIPScaleChanged(mWindowAndroid.getWindowAndroid().getDIPScale());
|
|
|
| // The native side object has been bound to this java instance, so now is the time to
|
| // bind all the native->java relationships.
|
| @@ -2284,6 +2280,16 @@ public class AwContents implements SmartClipProvider,
|
| sentPortIds);
|
| }
|
|
|
| + // Implements DIPScaleListener interface method.
|
| + @Override
|
| + public void onDIPScaleChanged(float dipScale) {
|
| + if (TRACE) Log.i(TAG, "%s onDIPScaleChanged dipScale=%f", this, dipScale);
|
| +
|
| + nativeSetDipScale(mNativeAwContents, dipScale);
|
| + mLayoutSizer.setDIPScale(dipScale);
|
| + mSettings.setDIPScale(dipScale);
|
| + }
|
| +
|
| /**
|
| * Creates a message channel and returns the ports for each end of the channel.
|
| */
|
| @@ -2393,6 +2399,7 @@ public class AwContents implements SmartClipProvider,
|
| if (TRACE) Log.i(TAG, "%s onAttachedToWindow", this);
|
| mTemporarilyDetached = false;
|
| mAwViewMethods.onAttachedToWindow();
|
| + mWindowAndroid.getWindowAndroid().addDIPScaleListener(this);
|
| }
|
|
|
| /**
|
| @@ -2401,6 +2408,7 @@ public class AwContents implements SmartClipProvider,
|
| @SuppressLint("MissingSuperCall")
|
| public void onDetachedFromWindow() {
|
| if (TRACE) Log.i(TAG, "%s onDetachedFromWindow", this);
|
| + mWindowAndroid.getWindowAndroid().removeDIPScaleListener(this);
|
| mAwViewMethods.onDetachedFromWindow();
|
| }
|
|
|
|
|