Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java

Issue 1386403003: Resize only the virtual viewport when the OSK triggers a resize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase master Inset handling logic Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.content.browser; 5 package org.chromium.content.browser;
6 6
7 import android.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.annotation.TargetApi; 8 import android.annotation.TargetApi;
9 import android.app.Activity; 9 import android.app.Activity;
10 import android.app.SearchManager; 10 import android.app.SearchManager;
(...skipping 17 matching lines...) Expand all
28 import android.util.Pair; 28 import android.util.Pair;
29 import android.util.TypedValue; 29 import android.util.TypedValue;
30 import android.view.ActionMode; 30 import android.view.ActionMode;
31 import android.view.HapticFeedbackConstants; 31 import android.view.HapticFeedbackConstants;
32 import android.view.InputDevice; 32 import android.view.InputDevice;
33 import android.view.KeyEvent; 33 import android.view.KeyEvent;
34 import android.view.MotionEvent; 34 import android.view.MotionEvent;
35 import android.view.View; 35 import android.view.View;
36 import android.view.ViewGroup; 36 import android.view.ViewGroup;
37 import android.view.ViewStructure; 37 import android.view.ViewStructure;
38 import android.view.WindowInsets;
38 import android.view.accessibility.AccessibilityManager; 39 import android.view.accessibility.AccessibilityManager;
39 import android.view.accessibility.AccessibilityManager.AccessibilityStateChangeL istener; 40 import android.view.accessibility.AccessibilityManager.AccessibilityStateChangeL istener;
40 import android.view.accessibility.AccessibilityNodeProvider; 41 import android.view.accessibility.AccessibilityNodeProvider;
41 import android.view.inputmethod.EditorInfo; 42 import android.view.inputmethod.EditorInfo;
42 import android.view.inputmethod.InputConnection; 43 import android.view.inputmethod.InputConnection;
43 import android.view.inputmethod.InputMethodManager; 44 import android.view.inputmethod.InputMethodManager;
44 import android.widget.FrameLayout; 45 import android.widget.FrameLayout;
45 46
46 import org.chromium.base.ApiCompatibilityUtils; 47 import org.chromium.base.ApiCompatibilityUtils;
47 import org.chromium.base.CommandLine; 48 import org.chromium.base.CommandLine;
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 private PastePopupMenu mPastePopupMenu; 464 private PastePopupMenu mPastePopupMenu;
464 private boolean mWasPastePopupShowingOnInsertionDragStart; 465 private boolean mWasPastePopupShowingOnInsertionDragStart;
465 466
466 // Size of the viewport in physical pixels as set from onSizeChanged. 467 // Size of the viewport in physical pixels as set from onSizeChanged.
467 private int mViewportWidthPix; 468 private int mViewportWidthPix;
468 private int mViewportHeightPix; 469 private int mViewportHeightPix;
469 private int mPhysicalBackingWidthPix; 470 private int mPhysicalBackingWidthPix;
470 private int mPhysicalBackingHeightPix; 471 private int mPhysicalBackingHeightPix;
471 private int mTopControlsHeightPix; 472 private int mTopControlsHeightPix;
472 private boolean mTopControlsShrinkBlinkSize; 473 private boolean mTopControlsShrinkBlinkSize;
474 private Rect mWindowInsets;
aelias_OOO_until_Jul13 2016/01/28 05:04:55 Please add code that will guarantee this is popula
ymalik 2016/02/11 01:06:22 Done.
473 475
474 // Cached copy of all positions and scales as reported by the renderer. 476 // Cached copy of all positions and scales as reported by the renderer.
475 private final RenderCoordinates mRenderCoordinates; 477 private final RenderCoordinates mRenderCoordinates;
476 478
477 // Provides smooth gamepad joystick-driven scrolling. 479 // Provides smooth gamepad joystick-driven scrolling.
478 private final JoystickScrollProvider mJoystickScrollProvider; 480 private final JoystickScrollProvider mJoystickScrollProvider;
479 481
480 private boolean mIsMobileOptimizedHint; 482 private boolean mIsMobileOptimizedHint;
481 483
482 // Tracks whether a selection is currently active. When applied to selected text, indicates 484 // Tracks whether a selection is currently active. When applied to selected text, indicates
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 } 620 }
619 621
620 /** 622 /**
621 * @return The ViewGroup that all view actions of this ContentViewCore shoul d interact with. 623 * @return The ViewGroup that all view actions of this ContentViewCore shoul d interact with.
622 */ 624 */
623 public ViewGroup getContainerView() { 625 public ViewGroup getContainerView() {
624 return mContainerView; 626 return mContainerView;
625 } 627 }
626 628
627 /** 629 /**
630 * @return The system window insets (from OSK, status bar, etc).
631 */
632 public Rect getWindowInsets() {
633 return mWindowInsets != null ? mWindowInsets : new Rect();
634 }
635
636 /**
637 * @param insets The system window insets Rect (from OSK, status bar, etc).
638 */
639 public void setWindowInsets(Rect insets) {
640 mWindowInsets = insets;
641 }
642
643 /**
644 * @param insets The insets (from OSK, status bar, etc).
645 */
646 @TargetApi(Build.VERSION_CODES.LOLLIPOP)
647 public void setWindowInsets(WindowInsets insets) {
AKV 2016/02/10 11:35:28 private
ymalik 2016/02/11 01:06:23 The setWindowInsets function is used by InsetConsu
648 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return;
AKV 2016/02/10 11:35:28 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LO
ymalik 2016/02/11 01:06:22 Removed this function.
649 if (insets == null) return;
650 mWindowInsets = new Rect(insets.getSystemWindowInsetLeft(),
aelias_OOO_until_Jul13 2016/01/28 05:04:55 Could you create this once at construction time an
ymalik 2016/02/11 01:06:22 I have removed this function and changed it to tak
651 insets.getSystemWindowInsetTop(),
652 insets.getSystemWindowInsetRight(),
653 insets.getSystemWindowInsetBottom());
654 }
655
656 /**
628 * @return The WebContents currently being rendered. 657 * @return The WebContents currently being rendered.
629 */ 658 */
630 public WebContents getWebContents() { 659 public WebContents getWebContents() {
631 return mWebContents; 660 return mWebContents;
632 } 661 }
633 662
634 /** 663 /**
635 * @return The WindowAndroid associated with this ContentViewCore. 664 * @return The WindowAndroid associated with this ContentViewCore.
636 */ 665 */
637 public WindowAndroid getWindowAndroid() { 666 public WindowAndroid getWindowAndroid() {
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 1045
1017 /** 1046 /**
1018 * @return Viewport height in physical pixels as set from onSizeChanged. 1047 * @return Viewport height in physical pixels as set from onSizeChanged.
1019 */ 1048 */
1020 @CalledByNative 1049 @CalledByNative
1021 public int getViewportHeightPix() { 1050 public int getViewportHeightPix() {
1022 return mViewportHeightPix; 1051 return mViewportHeightPix;
1023 } 1052 }
1024 1053
1025 /** 1054 /**
1055 * @return Viewport height when the OSK is hidden in physical pixels as set from onSizeChanged.
1056 */
1057 @CalledByNative
1058 public int getViewportHeightWithOSKHiddenPix() {
1059 return mViewportHeightPix + getWindowInsets().bottom;
aelias_OOO_until_Jul13 2016/01/28 05:04:55 Your design doc says this includes the status bar,
bokan 2016/01/28 15:53:42 The status bar would presumably be in getWindowIns
ymalik 2016/02/11 01:06:22 That's right. The status bar is in getWindowInsets
1060 }
1061
1062 /**
1026 * @return Width of underlying physical surface. 1063 * @return Width of underlying physical surface.
1027 */ 1064 */
1028 @CalledByNative 1065 @CalledByNative
1029 private int getPhysicalBackingWidthPix() { 1066 private int getPhysicalBackingWidthPix() {
1030 return mPhysicalBackingWidthPix; 1067 return mPhysicalBackingWidthPix;
1031 } 1068 }
1032 1069
1033 /** 1070 /**
1034 * @return Height of underlying physical surface. 1071 * @return Height of underlying physical surface.
1035 */ 1072 */
(...skipping 2257 matching lines...) Expand 10 before | Expand all | Expand 10 after
3293 private native void nativeSetTextTrackSettings(long nativeContentViewCoreImp l, 3330 private native void nativeSetTextTrackSettings(long nativeContentViewCoreImp l,
3294 boolean textTracksEnabled, String textTrackBackgroundColor, String t extTrackFontFamily, 3331 boolean textTracksEnabled, String textTrackBackgroundColor, String t extTrackFontFamily,
3295 String textTrackFontStyle, String textTrackFontVariant, String textT rackTextColor, 3332 String textTrackFontStyle, String textTrackFontVariant, String textT rackTextColor,
3296 String textTrackTextShadow, String textTrackTextSize); 3333 String textTrackTextShadow, String textTrackTextSize);
3297 3334
3298 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l, 3335 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l,
3299 int x, int y, int w, int h); 3336 int x, int y, int w, int h);
3300 3337
3301 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque); 3338 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque);
3302 } 3339 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698