Commit 56c20df9 authored by Jinsuk Kim's avatar Jinsuk Kim Committed by Commit Bot

Android: Fix cs width upon rotation

WebContents of contextual search panel can be created
after the device gets rotated. The content size to be
used for WebContents should have been updated to pick
up the right size after the rotation happens. This CL
fixes that.

Bug: 820940
Change-Id: I811d52db9d175adf100c0e13c0bfc35ac5d00d5a
Reviewed-on: https://chromium-review.googlesource.com/959408Reviewed-by: default avatarDonn Denman <donnd@chromium.org>
Commit-Queue: Jinsuk Kim <jinsukkim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542991}
parent a753229e
...@@ -793,10 +793,16 @@ public class OverlayPanel extends OverlayPanelAnimation implements ActivityState ...@@ -793,10 +793,16 @@ public class OverlayPanel extends OverlayPanelAnimation implements ActivityState
*/ */
protected void resizePanelContentViewCore(float width, float height) { protected void resizePanelContentViewCore(float width, float height) {
if (!isShowing()) return; if (!isShowing()) return;
if (isFullWidthSizePanel()) height = height - getBarHeight(); OverlayPanelContent panelContent = getOverlayPanelContent();
getOverlayPanelContent().onSizeChanged((int) (width / mPxToDp), (int) (height / mPxToDp)); int widthPx = (int) (width / mPxToDp);
getOverlayPanelContent().onPhysicalBackingSizeChanged( int heightPx = (int) (height / mPxToDp);
(int) (width / mPxToDp), (int) (height / mPxToDp));
// Device could have been rotated before panel webcontent creation. Update content size.
panelContent.setContentViewSize(widthPx, heightPx, isFullWidthSizePanel());
if (isFullWidthSizePanel()) heightPx = (int) ((height - getBarHeight()) / mPxToDp);
panelContent.onSizeChanged(widthPx, heightPx);
panelContent.onPhysicalBackingSizeChanged(widthPx, heightPx);
} }
@Override @Override
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment