Chromium Code Reviews| 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 12e658bee619c6abd9f161af5d9551f39a7a8ac4..7752b4a58b3b354f52402350e1af612642515399 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 |
| @@ -16,6 +16,7 @@ import android.content.res.Configuration; |
| import android.database.ContentObserver; |
| import android.graphics.Bitmap; |
| import android.graphics.Canvas; |
| +import android.graphics.Matrix; |
| import android.graphics.Rect; |
| import android.net.Uri; |
| import android.os.Build; |
| @@ -2105,7 +2106,9 @@ public class ContentViewCore |
| float pageScaleFactor, float minPageScaleFactor, float maxPageScaleFactor, |
| float contentWidth, float contentHeight, |
| float viewportWidth, float viewportHeight, |
| - float controlsOffsetYCss, float contentOffsetYCss) { |
| + float controlsOffsetYCss, float contentOffsetYCss, |
| + boolean hasInsertionMarker, float insertionMarkerX, |
| + float insertionMarkerTop, float insertionMarkerBottom) { |
| TraceEvent.begin("ContentViewCore:updateFrameInfo"); |
| // Adjust contentWidth/Height to be always at least as big as |
| // the actual viewport (as set by onSizeChanged). |
| @@ -2171,6 +2174,34 @@ public class ContentViewCore |
| if (mBrowserAccessibilityManager != null) { |
| mBrowserAccessibilityManager.notifyFrameInfoInitialized(); |
| } |
| + |
| + if (mImeAdapter.isCursorAnchorInfoSupported()) { |
| + int[] viewOrigin = new int[2]; |
| + mContainerView.getLocationOnScreen(viewOrigin); |
| + float viewOriginX = viewOrigin[0]; |
| + float viewOriginY = viewOrigin[1]; |
| + |
| + RenderCoordinates.NormalizedPoint normalizedPoint = |
|
jdduke (slow)
2014/11/07 01:49:04
This work could potentially be triggered every fra
aelias_OOO_until_Jul13
2014/11/07 02:04:29
Could you add a method to RenderCoordinates to cre
yukawa
2014/11/12 10:21:50
I've eliminated per-frame object creations in patc
yukawa
2014/11/12 10:21:50
Sounds reasonable. I've moved the logic to ImeAdap
|
| + mRenderCoordinates.createNormalizedPoint(); |
| + normalizedPoint.setAbsoluteCss(0.0f, 0.0f); |
| + float tx = normalizedPoint.getXPix(); |
| + float ty = normalizedPoint.getYPix(); |
| + normalizedPoint.setAbsoluteCss(1.0f, 0.0f); |
| + float ax = normalizedPoint.getXPix(); |
| + float ay = normalizedPoint.getYPix(); |
| + normalizedPoint.setAbsoluteCss(0.0f, 1.0f); |
| + float bx = normalizedPoint.getXPix(); |
|
aelias_OOO_until_Jul13
2014/11/07 02:04:29
This cannot have any rotation/skew so these lines
yukawa
2014/11/12 10:21:50
Yeah, that's really helpful suggestion. Done in t
|
| + float by = normalizedPoint.getYPix(); |
| + |
| + Matrix matrix = new Matrix(); |
| + matrix.setValues(new float[]{ |
| + ax - tx, bx - tx, tx + viewOriginX, |
| + ay - ty, by - ty, ty + viewOriginY, |
| + 0.0f, 0.0f, 1.0f}); |
| + mImeAdapter.updateCursorAnchorInfo(mContainerView, matrix, hasInsertionMarker, |
| + insertionMarkerX, insertionMarkerTop, insertionMarkerBottom); |
| + } |
| + |
| TraceEvent.end("ContentViewCore:updateFrameInfo"); |
| } |
| @@ -2183,6 +2214,9 @@ public class ContentViewCore |
| mFocusedNodeEditable = (textInputType != ImeAdapter.getTextInputTypeNone()); |
| if (!mFocusedNodeEditable) hidePastePopup(); |
| + mImeAdapter.updateCursorAnchorInfoSource(text, selectionStart, selectionEnd, |
| + compositionStart, compositionEnd); |
| + |
| mImeAdapter.updateKeyboardVisibility( |
| nativeImeAdapterAndroid, textInputType, textInputFlags, showImeIfNeeded); |