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 5cf60383a7dab..08c12917e7bf2 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 @@ -197,8 +197,8 @@ void initializeCompositorContent(LayoutManagerImpl layoutManager, View urlBar, @VirtualKeyboardMode.EnumType private int mVirtualKeyboardMode = ChromeFeatureList.sOSKResizesVisualViewportByDefault.isEnabled() - ? VirtualKeyboardMode.RESIZE_VISUAL - : VirtualKeyboardMode.RESIZE_LAYOUT; + ? VirtualKeyboardMode.RESIZES_VISUAL + : VirtualKeyboardMode.RESIZES_CONTENT; private OnscreenContentProvider mOnscreenContentProvider; @@ -918,7 +918,7 @@ private boolean oskResizesVisualViewport() { // UNSET means the author hasn't explicitly set a preference but the mode should have been // set to the default in that case. assert mVirtualKeyboardMode != VirtualKeyboardMode.UNSET; - return mVirtualKeyboardMode == VirtualKeyboardMode.RESIZE_VISUAL; + return mVirtualKeyboardMode == VirtualKeyboardMode.RESIZES_VISUAL; } /** @@ -1550,8 +1550,8 @@ private void updateViewStateListener(ContentView newContentView) { void updateVirtualKeyboardMode(@VirtualKeyboardMode.EnumType int newMode) { if (newMode == VirtualKeyboardMode.UNSET) { newMode = ChromeFeatureList.sOSKResizesVisualViewportByDefault.isEnabled() - ? VirtualKeyboardMode.RESIZE_VISUAL - : VirtualKeyboardMode.RESIZE_LAYOUT; + ? VirtualKeyboardMode.RESIZES_VISUAL + : VirtualKeyboardMode.RESIZES_CONTENT; } if (mVirtualKeyboardMode == newMode) return; @@ -1563,8 +1563,8 @@ void updateVirtualKeyboardMode(@VirtualKeyboardMode.EnumType int newMode) { // If we're going into or out of the default OSK resizes visual viewport mode // we're changing whether the ApplicationViewportInsetSupplier needs to listen to // the keyboard since its responsible for insetting the visual viewport. - if (oldMode == VirtualKeyboardMode.RESIZE_VISUAL - || newMode == VirtualKeyboardMode.RESIZE_VISUAL) { + if (oldMode == VirtualKeyboardMode.RESIZES_VISUAL + || newMode == VirtualKeyboardMode.RESIZES_VISUAL) { updateApplicationViewportInsetSuppliers(); } } diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/VirtualKeyboardResizeTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/VirtualKeyboardResizeTest.java index ac53408b08ad2..8d8cb4f5b4e4a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/VirtualKeyboardResizeTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/VirtualKeyboardResizeTest.java @@ -215,14 +215,15 @@ public void testVirtualKeyboardResizesVisualViewportFlag() throws Throwable { } /** - * Tests the tag causes the + * Tests the tag causes the * page to resize only the visual viewport. */ @Test @MediumTest @EnableFeatures({ChromeFeatureList.OSK_RESIZES_VISUAL_VIEWPORT}) - public void testResizeVisualMetaTag() throws Throwable { - startMainActivityWithURL("/chrome/test/data/android/page_with_editable.html?resize-visual"); + public void testResizesVisualMetaTag() throws Throwable { + startMainActivityWithURL( + "/chrome/test/data/android/page_with_editable.html?resizes-visual"); int initialHeight = getPageInnerHeight(); double initialVVHeight = getVisualViewportHeight(); @@ -257,8 +258,9 @@ public void testResizeVisualMetaTag() throws Throwable { @MediumTest @DisableFeatures({ChromeFeatureList.OSK_RESIZES_VISUAL_VIEWPORT}) @CommandLineFlags.Add({"enable-blink-features=ViewportMetaInteractiveWidgetProperty"}) - public void testResizeVisualMetaTagFlagDisabled() throws Throwable { - startMainActivityWithURL("/chrome/test/data/android/page_with_editable.html?resize-visual"); + public void testResizesVisualMetaTagFlagDisabled() throws Throwable { + startMainActivityWithURL( + "/chrome/test/data/android/page_with_editable.html?resizes-visual"); int initialHeight = getPageInnerHeight(); double initialVVHeight = getVisualViewportHeight(); @@ -283,14 +285,15 @@ public void testResizeVisualMetaTagFlagDisabled() throws Throwable { } /** - * Tests the tag opts the + * Tests the tag opts the * page back into a mode where the keyboard resizes layout. */ @Test @MediumTest @EnableFeatures({ChromeFeatureList.OSK_RESIZES_VISUAL_VIEWPORT}) - public void testResizeLayoutMetaTag() throws Throwable { - startMainActivityWithURL("/chrome/test/data/android/page_with_editable.html?resize-layout"); + public void testResizesLayoutMetaTag() throws Throwable { + startMainActivityWithURL( + "/chrome/test/data/android/page_with_editable.html?resizes-content"); int initialHeight = getPageInnerHeight(); double initialVVHeight = getVisualViewportHeight(); @@ -316,7 +319,7 @@ public void testResizeLayoutMetaTag() throws Throwable { } /** - * Tests the tag causes + * Tests the tag causes * the page to avoid resizing any viewports. */ @Test @@ -356,20 +359,20 @@ public void testModeAfterNavigation() throws Throwable { Assert.assertEquals(mActivityTestRule.getActivity() .getCompositorViewHolderForTesting() .getVirtualKeyboardModeForTesting(), - VirtualKeyboardMode.RESIZE_VISUAL); + VirtualKeyboardMode.RESIZES_VISUAL); - navigateToURL("/chrome/test/data/android/page_with_editable.html?resize-layout"); + navigateToURL("/chrome/test/data/android/page_with_editable.html?resizes-content"); Assert.assertEquals(mActivityTestRule.getActivity() .getCompositorViewHolderForTesting() .getVirtualKeyboardModeForTesting(), - VirtualKeyboardMode.RESIZE_LAYOUT); + VirtualKeyboardMode.RESIZES_CONTENT); navigateToURL("/chrome/test/data/android/page_with_editable.html"); Assert.assertEquals(mActivityTestRule.getActivity() .getCompositorViewHolderForTesting() .getVirtualKeyboardModeForTesting(), - VirtualKeyboardMode.RESIZE_VISUAL); + VirtualKeyboardMode.RESIZES_VISUAL); navigateToURL("/chrome/test/data/android/page_with_editable.html?overlays-content"); @@ -378,11 +381,11 @@ public void testModeAfterNavigation() throws Throwable { .getVirtualKeyboardModeForTesting(), VirtualKeyboardMode.OVERLAYS_CONTENT); - openInNewTab("/chrome/test/data/android/page_with_editable.html?resize-layout"); + openInNewTab("/chrome/test/data/android/page_with_editable.html?resizes-content"); Assert.assertEquals(mActivityTestRule.getActivity() .getCompositorViewHolderForTesting() .getVirtualKeyboardModeForTesting(), - VirtualKeyboardMode.RESIZE_LAYOUT); + VirtualKeyboardMode.RESIZES_CONTENT); // Ensure showing the keyboard and going through the resize flow uses the current virtual // keyboard mode. diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/compositor/CompositorViewHolderUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/compositor/CompositorViewHolderUnitTest.java index ca4a5efa62d48..a3a13d09b9457 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/compositor/CompositorViewHolderUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/compositor/CompositorViewHolderUnitTest.java @@ -331,7 +331,7 @@ public void testOverlayGeometryNotTriggeredDueToNoKeyboard() { @EnableFeatures(ChromeFeatureList.OSK_RESIZES_VISUAL_VIEWPORT) public void testWebContentResizeWhenInOSKResizeVisualMode() { // Ensure the default virtual keyboard mode is used. - mCompositorViewHolder.updateVirtualKeyboardMode(VirtualKeyboardMode.RESIZE_VISUAL); + mCompositorViewHolder.updateVirtualKeyboardMode(VirtualKeyboardMode.RESIZES_VISUAL); // show the keyboard and set height of the webcontent. // totalAdjustedHeight = height passed to #setSize (200). // The reduced height is because of the keyboard taking up the bottom space. @@ -342,7 +342,7 @@ public void testWebContentResizeWhenInOSKResizeVisualMode() { mCompositorViewHolder.setSize( mWebContents, mContainerView, totalAdjustedWidth, totalAdjustedHeight); - // In RESIZE_VISUAL mode, the virtual keyboard will not resize the web contents. + // In RESIZES_VISUAL mode, the virtual keyboard will not resize the web contents. int expectedWebContentsHeight = 941; verify(mWebContents, times(1)).setSize(totalAdjustedWidth, expectedWebContentsHeight); verify(mCompositorViewHolder, times(0)) @@ -352,7 +352,7 @@ public void testWebContentResizeWhenInOSKResizeVisualMode() { @Test public void testWebContentResizeWhenInOSKResizeLayoutMode() { // Ensure the default virtual keyboard mode is used. - mCompositorViewHolder.updateVirtualKeyboardMode(VirtualKeyboardMode.RESIZE_LAYOUT); + mCompositorViewHolder.updateVirtualKeyboardMode(VirtualKeyboardMode.RESIZES_CONTENT); // show the keyboard and set height of the webcontent. // totalAdjustedHeight = height passed to #setSize (200). // The reduced height is because of the keyboard taking up the bottom space. @@ -363,7 +363,7 @@ public void testWebContentResizeWhenInOSKResizeLayoutMode() { mCompositorViewHolder.setSize( mWebContents, mContainerView, totalAdjustedWidth, totalAdjustedHeight); - // In RESIZE_LAYOUT mode, the web contents are resized to exclude the keyboard height. + // In RESIZES_CONTENT mode, the web contents are resized to exclude the keyboard height. int expectedWebContentsHeight = totalAdjustedHeight; verify(mWebContents, times(1)).setSize(totalAdjustedWidth, expectedWebContentsHeight); verify(mCompositorViewHolder, times(0)) diff --git a/chrome/test/data/android/page_with_editable.html b/chrome/test/data/android/page_with_editable.html index 28ca3f036aabd..de4f1cb9f389e 100644 --- a/chrome/test/data/android/page_with_editable.html +++ b/chrome/test/data/android/page_with_editable.html @@ -4,12 +4,12 @@