| Index: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
|
| diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
|
| index 7de8b4ae1d59448eb065e245f793592f7f3cf859..76c8487bed22e1cfa170937f8c71cf4b23061048 100644
|
| --- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
|
| +++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
|
| @@ -227,7 +227,7 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
|
|
| // The anchor view should not go outside the bounds of the ContainerView.
|
| int leftMargin = Math.round(x * scale);
|
| - int topMargin = Math.round(mRenderCoordinates.getContentOffsetYPix() + y * scale);
|
| + int topMargin = Math.round(mRenderCoordinates.getTopControlsShownYPix() + y * scale);
|
| int scaledWidth = Math.round(width * scale);
|
| // ContentViewCore currently only supports these two container view types.
|
| if (containerView instanceof FrameLayout) {
|
| @@ -501,6 +501,7 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| private int mPhysicalBackingWidthPix;
|
| private int mPhysicalBackingHeightPix;
|
| private int mTopControlsHeightPix;
|
| + private int mBottomControlsHeightPix;
|
| private boolean mTopControlsShrinkBlinkSize;
|
|
|
| // Cached copy of all positions and scales as reported by the renderer.
|
| @@ -698,6 +699,15 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| }
|
|
|
| /**
|
| + * Sets the height of the bottom controls. If necessary, triggers a renderer resize.
|
| + */
|
| + public void setBottomControlsHeight(int bottomControlHeightPix) {
|
| + if (mBottomControlsHeightPix == bottomControlHeightPix) return;
|
| + mBottomControlsHeightPix = bottomControlHeightPix;
|
| + if (mNativeContentViewCore != 0) nativeWasResized(mNativeContentViewCore);
|
| + }
|
| +
|
| + /**
|
| * Returns a delegate that can be used to add and remove views from the current
|
| * container view. Clients can safely hold to instances of this class as it handles the
|
| * replacement of container views transparently.
|
| @@ -1096,6 +1106,11 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| return mTopControlsHeightPix;
|
| }
|
|
|
| + @CalledByNative
|
| + public int getBottomControlsHeightPix() {
|
| + return mBottomControlsHeightPix;
|
| + }
|
| +
|
| /**
|
| * @return Current device scale factor (maps DIP pixels to physical pixels).
|
| */
|
| @@ -2126,7 +2141,7 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| // The selection coordinates are relative to the content viewport, but we need
|
| // coordinates relative to the containing View.
|
| outRect.set(mSelectionRect);
|
| - outRect.offset(0, (int) mRenderCoordinates.getContentOffsetYPix());
|
| + outRect.offset(0, (int) mRenderCoordinates.getTopControlsShownYPix());
|
| }
|
|
|
| @Override
|
| @@ -2372,7 +2387,8 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| float pageScaleFactor, float minPageScaleFactor, float maxPageScaleFactor,
|
| float contentWidth, float contentHeight,
|
| float viewportWidth, float viewportHeight,
|
| - float controlsOffsetYCss, float contentOffsetYCss,
|
| + float topBarTranslateYCss, float topBarShownYCss,
|
| + float bottomBarTranslateYCss, float bottomBarShownYCss,
|
| boolean isMobileOptimizedHint,
|
| boolean hasInsertionMarker, boolean isInsertionMarkerVisible,
|
| float insertionMarkerHorizontal, float insertionMarkerTop,
|
| @@ -2386,7 +2402,7 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| mViewportWidthPix / (deviceScale * pageScaleFactor));
|
| contentHeight = Math.max(contentHeight,
|
| mViewportHeightPix / (deviceScale * pageScaleFactor));
|
| - final float contentOffsetYPix = mRenderCoordinates.fromDipToPix(contentOffsetYCss);
|
| + final float topBarShownPix = mRenderCoordinates.fromDipToPix(topBarShownYCss);
|
|
|
| final boolean contentSizeChanged =
|
| contentWidth != mRenderCoordinates.getContentWidthCss()
|
| @@ -2400,8 +2416,8 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| pageScaleChanged
|
| || scrollOffsetX != mRenderCoordinates.getScrollX()
|
| || scrollOffsetY != mRenderCoordinates.getScrollY();
|
| - final boolean contentOffsetChanged =
|
| - contentOffsetYPix != mRenderCoordinates.getContentOffsetYPix();
|
| + final boolean topBarChanged = topBarShownPix != mRenderCoordinates
|
| + .getTopControlsShownYPix();
|
|
|
| final boolean needHidePopupZoomer = contentSizeChanged || scrollChanged;
|
| final boolean needUpdateZoomControls = scaleLimitsChanged || scrollChanged;
|
| @@ -2421,9 +2437,9 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| contentWidth, contentHeight,
|
| viewportWidth, viewportHeight,
|
| pageScaleFactor, minPageScaleFactor, maxPageScaleFactor,
|
| - contentOffsetYPix);
|
| + topBarShownPix);
|
|
|
| - if (scrollChanged || contentOffsetChanged) {
|
| + if (scrollChanged || topBarChanged) {
|
| for (mGestureStateListenersIterator.rewind();
|
| mGestureStateListenersIterator.hasNext();) {
|
| mGestureStateListenersIterator.next().onScrollOffsetOrExtentChanged(
|
| @@ -2435,10 +2451,10 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| if (needUpdateZoomControls) mZoomControlsDelegate.updateZoomControls();
|
|
|
| // Update offsets for fullscreen.
|
| - final float controlsOffsetPix = controlsOffsetYCss * deviceScale;
|
| - // TODO(aelias): Remove last argument after downstream removes it.
|
| - getContentViewClient().onOffsetsForFullscreenChanged(
|
| - controlsOffsetPix, contentOffsetYPix);
|
| + final float topBarTranslatePix = topBarTranslateYCss * deviceScale;
|
| + getContentViewClient().onTopControlsChanged(topBarTranslatePix, topBarShownPix);
|
| + getContentViewClient().onBottomControlsChanged(bottomBarTranslateYCss * deviceScale,
|
| + bottomBarShownYCss * deviceScale);
|
|
|
| if (mBrowserAccessibilityManager != null) {
|
| mBrowserAccessibilityManager.notifyFrameInfoInitialized();
|
| @@ -2649,11 +2665,11 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| }
|
|
|
| if (!mHasInsertion || !canPaste()) return false;
|
| - final float contentOffsetYPix = mRenderCoordinates.getContentOffsetYPix();
|
| + final float topControlsShown = mRenderCoordinates.getTopControlsShownYPix();
|
| PastePopupMenu pastePopupMenu = getPastePopup();
|
| if (pastePopupMenu == null) return false;
|
| try {
|
| - pastePopupMenu.show(x, (int) (y + contentOffsetYPix));
|
| + pastePopupMenu.show(x, (int) (y + topControlsShown));
|
| } catch (WindowManager.BadTokenException e) {
|
| return false;
|
| }
|
| @@ -3106,7 +3122,7 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| Rect boundsInParent = new Rect(left, top, left + width, top + height);
|
| if (node.isRootNode) {
|
| // Offset of the web content relative to the View.
|
| - boundsInParent.offset(0, (int) mRenderCoordinates.getContentOffsetYPix());
|
| + boundsInParent.offset(0, (int) mRenderCoordinates.getTopControlsShownYPix());
|
| if (!ignoreScrollOffset) {
|
| boundsInParent.offset(-(int) mRenderCoordinates.getScrollXPix(),
|
| -(int) mRenderCoordinates.getScrollYPix());
|
|
|