Chromium Code Reviews| 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 a3dbd95e3576653464aabdc50a83f32b418d5df6..4aad0c4ee6d0edb55b1313a2971d76c6ea819f4e 100644 |
| --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java |
| +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java |
| @@ -300,7 +300,7 @@ public class AwContents implements SmartClipProvider, |
| private Bitmap mFavicon; |
| private boolean mHasRequestedVisitedHistoryFromClient; |
| // TODO(boliu): This should be in a global context, not per webview. |
| - private final double mDIPScale; |
| + private double mDIPScale; |
| // Whether this WebView is a popup. |
| private boolean mIsPopupWindow = false; |
| @@ -712,6 +712,16 @@ public class AwContents implements SmartClipProvider, |
| public void onConfigurationChanged(Configuration configuration) { |
| setLocale(LocaleUtils.getLocale(configuration.locale)); |
| mSettings.updateAcceptLanguages(); |
| + |
| + DeviceDisplayInfo displayInfo = DeviceDisplayInfo.create(mContext); |
| + // Update all display related parameters. |
| + displayInfo.updateNativeSharedDisplayInfo(); |
| + |
| + final double newDIPScale = displayInfo.getDIPScale(); |
| + if (newDIPScale != mDIPScale) { |
| + mContentViewCore.setDeviceScaleFactor((float) newDIPScale); |
| + setDIPScale(newDIPScale); |
| + } |
| } |
| }; |
| @@ -771,9 +781,7 @@ public class AwContents implements SmartClipProvider, |
| mContentViewClient = new AwContentViewClient(contentsClient, settings, this, mContext); |
| mLayoutSizer = dependencyFactory.createLayoutSizer(); |
| mSettings = settings; |
| - mDIPScale = DeviceDisplayInfo.create(mContext).getDIPScale(); |
| mLayoutSizer.setDelegate(new AwLayoutSizerDelegate()); |
| - mLayoutSizer.setDIPScale(mDIPScale); |
| mWebContentsDelegate = new AwWebContentsDelegateAdapter( |
| this, contentsClient, mContentViewClient, mContext, mContainerView); |
| mContentsClientBridge = new AwContentsClientBridge(mContext, contentsClient, |
| @@ -804,7 +812,6 @@ public class AwContents implements SmartClipProvider, |
| mDefaultVideoPosterRequestHandler = new DefaultVideoPosterRequestHandler(mContentsClient); |
| mSettings.setDefaultVideoPosterURL( |
| mDefaultVideoPosterRequestHandler.getDefaultVideoPosterURL()); |
| - mSettings.setDIPScale(mDIPScale); |
| mScrollOffsetManager = |
| dependencyFactory.createScrollOffsetManager(new AwScrollOffsetManagerDelegate()); |
| mScrollAccessibilityHelper = new ScrollAccessibilityHelper(mContainerView); |
| @@ -829,6 +836,13 @@ public class AwContents implements SmartClipProvider, |
| contentViewCore.setZoomControlsDelegate(zoomControlsDelegate); |
| } |
| + private void setDIPScale(double dipScale) { |
| + mDIPScale = dipScale; |
| + nativeSetDipScale(mNativeAwContents, (float) mDIPScale); |
| + mSettings.setDIPScale(mDIPScale); |
| + mLayoutSizer.setDIPScale(mDIPScale); |
| + } |
| + |
| boolean isFullScreen() { |
| return mFullScreenTransitionsState.isFullScreen(); |
| } |
| @@ -1061,7 +1075,10 @@ public class AwContents implements SmartClipProvider, |
| mNavigationController = mWebContents.getNavigationController(); |
| installWebContentsObserver(); |
| mSettings.setWebContents(webContents); |
| - nativeSetDipScale(mNativeAwContents, (float) mDIPScale); |
| + |
| + // ContentViewCore requests and stores the device scale factor. |
| + setDIPScale(mContentViewCore.getDeviceScaleFactor()); |
| + |
| updateContentViewCoreVisibility(); |
| // The native side object has been bound to this java instance, so now is the time to |
| @@ -3204,8 +3221,7 @@ public class AwContents implements SmartClipProvider, |
| // to enter fixedLayoutSize mode is sent before the first resize |
| // update. |
| mLayoutSizer.onSizeChanged(w, h, ow, oh); |
| - mContentViewCore.onPhysicalBackingSizeChanged(w, h); |
| - mContentViewCore.onSizeChanged(w, h, ow, oh); |
| + mContentViewCore.onPhysicalAndViewportSizeChanged(w, h); |
|
Tima Vaisburd
2016/08/22 19:06:25
I still did not understand why the second call doe
|
| nativeOnSizeChanged(mNativeAwContents, w, h, ow, oh); |
| } |