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

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

Issue 699333003: Support InputMethodManager#updateCursorAnchorInfo for Android 5.0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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.app.Activity; 8 import android.app.Activity;
9 import android.app.SearchManager; 9 import android.app.SearchManager;
10 import android.content.ClipboardManager; 10 import android.content.ClipboardManager;
11 import android.content.ContentResolver; 11 import android.content.ContentResolver;
12 import android.content.Context; 12 import android.content.Context;
13 import android.content.Intent; 13 import android.content.Intent;
14 import android.content.pm.PackageManager; 14 import android.content.pm.PackageManager;
15 import android.content.res.Configuration; 15 import android.content.res.Configuration;
16 import android.database.ContentObserver; 16 import android.database.ContentObserver;
17 import android.graphics.Bitmap; 17 import android.graphics.Bitmap;
18 import android.graphics.Canvas; 18 import android.graphics.Canvas;
19 import android.graphics.Matrix;
19 import android.graphics.Rect; 20 import android.graphics.Rect;
20 import android.net.Uri; 21 import android.net.Uri;
21 import android.os.Build; 22 import android.os.Build;
22 import android.os.Bundle; 23 import android.os.Bundle;
23 import android.os.Handler; 24 import android.os.Handler;
24 import android.os.ResultReceiver; 25 import android.os.ResultReceiver;
25 import android.os.SystemClock; 26 import android.os.SystemClock;
26 import android.provider.Browser; 27 import android.provider.Browser;
27 import android.provider.Settings; 28 import android.provider.Settings;
28 import android.text.Editable; 29 import android.text.Editable;
(...skipping 2069 matching lines...) Expand 10 before | Expand all | Expand 10 after
2098 getContentViewClient().onImeStateChangeRequested(false); 2099 getContentViewClient().onImeStateChangeRequested(false);
2099 } 2100 }
2100 2101
2101 @SuppressWarnings("unused") 2102 @SuppressWarnings("unused")
2102 @CalledByNative 2103 @CalledByNative
2103 private void updateFrameInfo( 2104 private void updateFrameInfo(
2104 float scrollOffsetX, float scrollOffsetY, 2105 float scrollOffsetX, float scrollOffsetY,
2105 float pageScaleFactor, float minPageScaleFactor, float maxPageScaleF actor, 2106 float pageScaleFactor, float minPageScaleFactor, float maxPageScaleF actor,
2106 float contentWidth, float contentHeight, 2107 float contentWidth, float contentHeight,
2107 float viewportWidth, float viewportHeight, 2108 float viewportWidth, float viewportHeight,
2108 float controlsOffsetYCss, float contentOffsetYCss) { 2109 float controlsOffsetYCss, float contentOffsetYCss,
2110 boolean hasInsertionMarker, float insertionMarkerX,
2111 float insertionMarkerTop, float insertionMarkerBottom) {
2109 TraceEvent.begin("ContentViewCore:updateFrameInfo"); 2112 TraceEvent.begin("ContentViewCore:updateFrameInfo");
2110 // Adjust contentWidth/Height to be always at least as big as 2113 // Adjust contentWidth/Height to be always at least as big as
2111 // the actual viewport (as set by onSizeChanged). 2114 // the actual viewport (as set by onSizeChanged).
2112 final float deviceScale = mRenderCoordinates.getDeviceScaleFactor(); 2115 final float deviceScale = mRenderCoordinates.getDeviceScaleFactor();
2113 contentWidth = Math.max(contentWidth, 2116 contentWidth = Math.max(contentWidth,
2114 mViewportWidthPix / (deviceScale * pageScaleFactor)); 2117 mViewportWidthPix / (deviceScale * pageScaleFactor));
2115 contentHeight = Math.max(contentHeight, 2118 contentHeight = Math.max(contentHeight,
2116 mViewportHeightPix / (deviceScale * pageScaleFactor)); 2119 mViewportHeightPix / (deviceScale * pageScaleFactor));
2117 final float contentOffsetYPix = mRenderCoordinates.fromDipToPix(contentO ffsetYCss); 2120 final float contentOffsetYPix = mRenderCoordinates.fromDipToPix(contentO ffsetYCss);
2118 2121
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2164 2167
2165 // Update offsets for fullscreen. 2168 // Update offsets for fullscreen.
2166 final float controlsOffsetPix = controlsOffsetYCss * deviceScale; 2169 final float controlsOffsetPix = controlsOffsetYCss * deviceScale;
2167 // TODO(aelias): Remove last argument after downstream removes it. 2170 // TODO(aelias): Remove last argument after downstream removes it.
2168 getContentViewClient().onOffsetsForFullscreenChanged( 2171 getContentViewClient().onOffsetsForFullscreenChanged(
2169 controlsOffsetPix, contentOffsetYPix, 0); 2172 controlsOffsetPix, contentOffsetYPix, 0);
2170 2173
2171 if (mBrowserAccessibilityManager != null) { 2174 if (mBrowserAccessibilityManager != null) {
2172 mBrowserAccessibilityManager.notifyFrameInfoInitialized(); 2175 mBrowserAccessibilityManager.notifyFrameInfoInitialized();
2173 } 2176 }
2177
2178 if (mImeAdapter.isCursorAnchorInfoSupported()) {
2179 int[] viewOrigin = new int[2];
2180 mContainerView.getLocationOnScreen(viewOrigin);
2181 float viewOriginX = viewOrigin[0];
2182 float viewOriginY = viewOrigin[1];
2183
2184 RenderCoordinates.NormalizedPoint normalizedPoint =
2185 mRenderCoordinates.createNormalizedPoint();
2186 normalizedPoint.setAbsoluteCss(0.0f, 0.0f);
2187 float tx = normalizedPoint.getXPix();
2188 float ty = normalizedPoint.getYPix();
2189 normalizedPoint.setAbsoluteCss(1.0f, 0.0f);
2190 float ax = normalizedPoint.getXPix();
2191 float ay = normalizedPoint.getYPix();
2192 normalizedPoint.setAbsoluteCss(0.0f, 1.0f);
2193 float bx = normalizedPoint.getXPix();
2194 float by = normalizedPoint.getYPix();
2195
2196 Matrix matrix = new Matrix();
2197 matrix.setValues(new float[]{
2198 ax - tx, bx - tx, tx + viewOriginX,
2199 ay - ty, by - ty, ty + viewOriginY,
2200 0.0f, 0.0f, 1.0f});
2201 mImeAdapter.updateCursorAnchorInfo(mContainerView, matrix, hasInsert ionMarker,
2202 insertionMarkerX, insertionMarkerTop, insertionMarkerBottom) ;
2203 }
2204
2174 TraceEvent.end("ContentViewCore:updateFrameInfo"); 2205 TraceEvent.end("ContentViewCore:updateFrameInfo");
2175 } 2206 }
2176 2207
2177 @CalledByNative 2208 @CalledByNative
2178 private void updateImeAdapter(long nativeImeAdapterAndroid, int textInputTyp e, 2209 private void updateImeAdapter(long nativeImeAdapterAndroid, int textInputTyp e,
2179 int textInputFlags, String text, int selectionStart, int selectionEn d, 2210 int textInputFlags, String text, int selectionStart, int selectionEn d,
2180 int compositionStart, int compositionEnd, boolean showImeIfNeeded, 2211 int compositionStart, int compositionEnd, boolean showImeIfNeeded,
2181 boolean isNonImeChange) { 2212 boolean isNonImeChange) {
2182 TraceEvent.begin(); 2213 TraceEvent.begin();
2183 mFocusedNodeEditable = (textInputType != ImeAdapter.getTextInputTypeNone ()); 2214 mFocusedNodeEditable = (textInputType != ImeAdapter.getTextInputTypeNone ());
2184 if (!mFocusedNodeEditable) hidePastePopup(); 2215 if (!mFocusedNodeEditable) hidePastePopup();
2185 2216
2217 mImeAdapter.updateCursorAnchorInfoSource(text, selectionStart, selection End,
2218 compositionStart, compositionEnd);
2219
2186 mImeAdapter.updateKeyboardVisibility( 2220 mImeAdapter.updateKeyboardVisibility(
2187 nativeImeAdapterAndroid, textInputType, textInputFlags, showImeI fNeeded); 2221 nativeImeAdapterAndroid, textInputType, textInputFlags, showImeI fNeeded);
2188 2222
2189 if (mInputConnection != null) { 2223 if (mInputConnection != null) {
2190 mInputConnection.updateState(text, selectionStart, selectionEnd, com positionStart, 2224 mInputConnection.updateState(text, selectionStart, selectionEnd, com positionStart,
2191 compositionEnd, isNonImeChange); 2225 compositionEnd, isNonImeChange);
2192 } 2226 }
2193 2227
2194 if (mActionMode != null) mActionMode.invalidate(); 2228 if (mActionMode != null) mActionMode.invalidate();
2195 TraceEvent.end(); 2229 TraceEvent.end();
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
3028 private native void nativeWasResized(long nativeContentViewCoreImpl); 3062 private native void nativeWasResized(long nativeContentViewCoreImpl);
3029 3063
3030 private native void nativeSetAccessibilityEnabled( 3064 private native void nativeSetAccessibilityEnabled(
3031 long nativeContentViewCoreImpl, boolean enabled); 3065 long nativeContentViewCoreImpl, boolean enabled);
3032 3066
3033 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l, 3067 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l,
3034 int x, int y, int w, int h); 3068 int x, int y, int w, int h);
3035 3069
3036 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque); 3070 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque);
3037 } 3071 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698