| 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 45a360b4f9da94ff9fe8607a1c29090fe6c44221..a2addf94c6e7ebeeb8ceedfd2e410c588a8384c6 100644
|
| --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
|
| +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
|
| @@ -79,6 +79,7 @@ import org.chromium.ui.base.ActivityWindowAndroid;
|
| import org.chromium.ui.base.PageTransition;
|
| import org.chromium.ui.base.ViewAndroidDelegate;
|
| import org.chromium.ui.base.WindowAndroid;
|
| +import org.chromium.ui.display.DisplayAndroid.DisplayAndroidObserver;
|
|
|
| import java.io.File;
|
| import java.lang.annotation.Annotation;
|
| @@ -99,8 +100,7 @@ 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 {
|
| private static final String TAG = "AwContents";
|
| private static final boolean TRACE = false;
|
| private static final int NO_WARN = 0;
|
| @@ -287,6 +287,7 @@ public class AwContents implements SmartClipProvider,
|
| private final AwZoomControls mZoomControls;
|
| private final AwScrollOffsetManager mScrollOffsetManager;
|
| private OverScrollGlow mOverScrollGlow;
|
| + private final DisplayAndroidObserver mDisplayObserver;
|
| // This can be accessed on any thread after construction. See AwContentsIoThreadClient.
|
| private final AwSettings mSettings;
|
| private final ScrollAccessibilityHelper mScrollAccessibilityHelper;
|
| @@ -699,6 +700,21 @@ public class AwContents implements SmartClipProvider,
|
| };
|
|
|
| //--------------------------------------------------------------------------------------------
|
| + private class AwDisplayAndroidObserver implements DisplayAndroidObserver {
|
| + @Override
|
| + public void onRotationChanged(int rotation) {}
|
| +
|
| + @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);
|
| + }
|
| + };
|
| +
|
| + //--------------------------------------------------------------------------------------------
|
| /**
|
| * @param browserContext the browsing context to associate this view contents with.
|
| * @param containerView the view-hierarchy item this object will be bound to.
|
| @@ -770,6 +786,7 @@ public class AwContents implements SmartClipProvider,
|
| mBackgroundThreadClient = new BackgroundThreadClientImpl();
|
| mIoThreadClient = new IoThreadClientImpl();
|
| mInterceptNavigationDelegate = new InterceptNavigationDelegateImpl();
|
| + mDisplayObserver = new AwDisplayAndroidObserver();
|
| mUpdateVisibilityRunnable = new Runnable() {
|
| @Override
|
| public void run() {
|
| @@ -1054,10 +1071,8 @@ public class AwContents implements SmartClipProvider,
|
| installWebContentsObserver();
|
| mSettings.setWebContents(webContents);
|
|
|
| - float dipScale = mContentViewCore.getDeviceScaleFactor();
|
| - nativeSetDipScale(mNativeAwContents, dipScale);
|
| - mLayoutSizer.setDIPScale(dipScale);
|
| - mSettings.setDIPScale(dipScale);
|
| + final float dipScale = mWindowAndroid.getWindowAndroid().getDisplay().getDIPScale();
|
| + mDisplayObserver.onDIPScaleChanged(dipScale);
|
|
|
| updateContentViewCoreVisibility();
|
|
|
| @@ -2375,6 +2390,7 @@ public class AwContents implements SmartClipProvider,
|
| if (TRACE) Log.i(TAG, "%s onAttachedToWindow", this);
|
| mTemporarilyDetached = false;
|
| mAwViewMethods.onAttachedToWindow();
|
| + mWindowAndroid.getWindowAndroid().getDisplay().addObserver(mDisplayObserver);
|
| }
|
|
|
| /**
|
| @@ -2383,6 +2399,7 @@ public class AwContents implements SmartClipProvider,
|
| @SuppressLint("MissingSuperCall")
|
| public void onDetachedFromWindow() {
|
| if (TRACE) Log.i(TAG, "%s onDetachedFromWindow", this);
|
| + mWindowAndroid.getWindowAndroid().getDisplay().removeObserver(mDisplayObserver);
|
| mAwViewMethods.onDetachedFromWindow();
|
| }
|
|
|
|
|