Index: chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorViewHolder.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorViewHolder.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorViewHolder.java |
index 9b32070fdfc628f8acae970170a811b9c6f2d644..1e1b48d96ad7e8f3d11c205758d029ca7617ab9d 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorViewHolder.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorViewHolder.java |
@@ -124,11 +124,12 @@ public class CompositorViewHolder extends CoordinatorLayout |
private boolean mHasDrawnOnce; |
/** |
- * The desired size of this view in {@link MeasureSpec}. Set by the host |
- * when it should be different from that of the parent. |
+ * The information about {@link ContentView} for overlay panel. Used to adjust the backing |
+ * size of the content accordingly. |
*/ |
- private int mDesiredWidthMeasureSpec = ContentView.DEFAULT_MEASURE_SPEC; |
- private int mDesiredHeightMeasureSpec = ContentView.DEFAULT_MEASURE_SPEC; |
+ private ContentView mOverlayContentView; |
+ private int mOverlayContentWidthMeasureSpec = ContentView.DEFAULT_MEASURE_SPEC; |
+ private int mOverlayContentHeightMeasureSpec = ContentView.DEFAULT_MEASURE_SPEC; |
/** |
* This view is created on demand to display debugging information. |
@@ -247,13 +248,15 @@ public class CompositorViewHolder extends CoordinatorLayout |
} |
/** |
- * Set the desired size of the view. The values are in {@link MeasureSpec}. |
- * @param width The width of the content view. |
- * @param height The height of the content view. |
+ * Set the desired size of the overlay content view. |
+ * @param overlayContentView {@link ContentView} used for overlay panel. |
+ * @param width The width of the content view in {@link MeasureSpec}. |
+ * @param height The height of the content view in {@link MeasureSpec}. |
*/ |
- public void setDesiredMeasureSpec(int width, int height) { |
- mDesiredWidthMeasureSpec = width; |
- mDesiredHeightMeasureSpec = height; |
+ public void setOverlayContentInfo(ContentView overlayContentView, int width, int height) { |
+ mOverlayContentView = overlayContentView; |
+ mOverlayContentWidthMeasureSpec = width; |
+ mOverlayContentHeightMeasureSpec = height; |
} |
/** |
@@ -943,11 +946,10 @@ public class CompositorViewHolder extends CoordinatorLayout |
* @param height The default height. |
*/ |
private void adjustPhysicalBackingSize(ContentViewCore contentViewCore, int width, int height) { |
- if (mDesiredWidthMeasureSpec != ContentView.DEFAULT_MEASURE_SPEC) { |
- width = MeasureSpec.getSize(mDesiredWidthMeasureSpec); |
- } |
- if (mDesiredHeightMeasureSpec != ContentView.DEFAULT_MEASURE_SPEC) { |
- height = MeasureSpec.getSize(mDesiredHeightMeasureSpec); |
+ ContentView contentView = (ContentView) contentViewCore.getContainerView(); |
+ if (contentView == mOverlayContentView) { |
+ width = MeasureSpec.getSize(mOverlayContentWidthMeasureSpec); |
+ height = MeasureSpec.getSize(mOverlayContentHeightMeasureSpec); |
} |
contentViewCore.onPhysicalBackingSizeChanged(width, height); |
} |