OLD | NEW |
---|---|
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; |
(...skipping 2083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2094 getContentViewClient().onImeStateChangeRequested(false); | 2094 getContentViewClient().onImeStateChangeRequested(false); |
2095 } | 2095 } |
2096 | 2096 |
2097 @SuppressWarnings("unused") | 2097 @SuppressWarnings("unused") |
2098 @CalledByNative | 2098 @CalledByNative |
2099 private void updateFrameInfo( | 2099 private void updateFrameInfo( |
2100 float scrollOffsetX, float scrollOffsetY, | 2100 float scrollOffsetX, float scrollOffsetY, |
2101 float pageScaleFactor, float minPageScaleFactor, float maxPageScaleF actor, | 2101 float pageScaleFactor, float minPageScaleFactor, float maxPageScaleF actor, |
2102 float contentWidth, float contentHeight, | 2102 float contentWidth, float contentHeight, |
2103 float viewportWidth, float viewportHeight, | 2103 float viewportWidth, float viewportHeight, |
2104 float controlsOffsetYCss, float contentOffsetYCss) { | 2104 float controlsOffsetYCss, float contentOffsetYCss, |
2105 int frameMetadataSelectionStartType, float frameMetadataSelectionSta rtEdgeTopX, | |
2106 float frameMetadataSelectionStartEdgeTopY, | |
2107 float frameMetadataSelectionStartEdgeBottomY) { | |
2105 TraceEvent.begin("ContentViewCore:updateFrameInfo"); | 2108 TraceEvent.begin("ContentViewCore:updateFrameInfo"); |
2106 // Adjust contentWidth/Height to be always at least as big as | 2109 // Adjust contentWidth/Height to be always at least as big as |
2107 // the actual viewport (as set by onSizeChanged). | 2110 // the actual viewport (as set by onSizeChanged). |
2108 final float deviceScale = mRenderCoordinates.getDeviceScaleFactor(); | 2111 final float deviceScale = mRenderCoordinates.getDeviceScaleFactor(); |
2109 contentWidth = Math.max(contentWidth, | 2112 contentWidth = Math.max(contentWidth, |
2110 mViewportWidthPix / (deviceScale * pageScaleFactor)); | 2113 mViewportWidthPix / (deviceScale * pageScaleFactor)); |
2111 contentHeight = Math.max(contentHeight, | 2114 contentHeight = Math.max(contentHeight, |
2112 mViewportHeightPix / (deviceScale * pageScaleFactor)); | 2115 mViewportHeightPix / (deviceScale * pageScaleFactor)); |
2113 final float contentOffsetYPix = mRenderCoordinates.fromDipToPix(contentO ffsetYCss); | 2116 final float contentOffsetYPix = mRenderCoordinates.fromDipToPix(contentO ffsetYCss); |
2114 | 2117 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2160 | 2163 |
2161 // Update offsets for fullscreen. | 2164 // Update offsets for fullscreen. |
2162 final float controlsOffsetPix = controlsOffsetYCss * deviceScale; | 2165 final float controlsOffsetPix = controlsOffsetYCss * deviceScale; |
2163 // TODO(aelias): Remove last argument after downstream removes it. | 2166 // TODO(aelias): Remove last argument after downstream removes it. |
2164 getContentViewClient().onOffsetsForFullscreenChanged( | 2167 getContentViewClient().onOffsetsForFullscreenChanged( |
2165 controlsOffsetPix, contentOffsetYPix, 0); | 2168 controlsOffsetPix, contentOffsetYPix, 0); |
2166 | 2169 |
2167 if (mBrowserAccessibilityManager != null) { | 2170 if (mBrowserAccessibilityManager != null) { |
2168 mBrowserAccessibilityManager.notifyFrameInfoInitialized(); | 2171 mBrowserAccessibilityManager.notifyFrameInfoInitialized(); |
2169 } | 2172 } |
2173 | |
2174 if (mImeAdapter.isCursorAnchorInfoSupported()) { | |
2175 final float scale = mRenderCoordinates.getPageScaleFactor() | |
2176 * mRenderCoordinates.getDeviceScaleFactor(); | |
2177 final float translationX = -mRenderCoordinates.getScrollX() * scale; | |
2178 final float translationY = -mRenderCoordinates.getScrollY() * scale | |
2179 + mRenderCoordinates.getContentOffsetYPix(); | |
2180 mImeAdapter.onUpdateFrameInfo(scale, translationX, translationY, | |
2181 frameMetadataSelectionStartType, frameMetadataSelectionStart EdgeTopX, | |
jdduke (slow)
2014/11/12 19:05:06
Should we be plumbing this data if we don't have a
yukawa
2014/12/05 07:42:19
Now the logic here is completely implemented in th
| |
2182 frameMetadataSelectionStartEdgeTopY, frameMetadataSelectionS tartEdgeBottomY); | |
2183 } | |
2184 | |
2170 TraceEvent.end("ContentViewCore:updateFrameInfo"); | 2185 TraceEvent.end("ContentViewCore:updateFrameInfo"); |
2171 } | 2186 } |
2172 | 2187 |
2173 @CalledByNative | 2188 @CalledByNative |
2174 private void updateImeAdapter(long nativeImeAdapterAndroid, int textInputTyp e, | 2189 private void updateImeAdapter(long nativeImeAdapterAndroid, int textInputTyp e, |
2175 int textInputFlags, String text, int selectionStart, int selectionEn d, | 2190 int textInputFlags, String text, int selectionStart, int selectionEn d, |
2176 int compositionStart, int compositionEnd, boolean showImeIfNeeded, | 2191 int compositionStart, int compositionEnd, boolean showImeIfNeeded, |
2177 boolean isNonImeChange) { | 2192 boolean isNonImeChange) { |
2178 TraceEvent.begin(); | 2193 TraceEvent.begin(); |
2179 mFocusedNodeEditable = (textInputType != ImeAdapter.getTextInputTypeNone ()); | 2194 mFocusedNodeEditable = (textInputType != ImeAdapter.getTextInputTypeNone ()); |
2180 if (!mFocusedNodeEditable) hidePastePopup(); | 2195 if (!mFocusedNodeEditable) hidePastePopup(); |
2181 | 2196 |
2197 mImeAdapter.updateTextAndSelection(text, selectionStart, selectionEnd, c ompositionStart, | |
2198 compositionEnd); | |
2199 | |
2182 mImeAdapter.updateKeyboardVisibility( | 2200 mImeAdapter.updateKeyboardVisibility( |
2183 nativeImeAdapterAndroid, textInputType, textInputFlags, showImeI fNeeded); | 2201 nativeImeAdapterAndroid, textInputType, textInputFlags, showImeI fNeeded); |
2184 | 2202 |
2185 if (mInputConnection != null) { | 2203 if (mInputConnection != null) { |
2186 mInputConnection.updateState(text, selectionStart, selectionEnd, com positionStart, | 2204 mInputConnection.updateState(text, selectionStart, selectionEnd, com positionStart, |
2187 compositionEnd, isNonImeChange); | 2205 compositionEnd, isNonImeChange); |
2188 } | 2206 } |
2189 | 2207 |
2190 if (mActionMode != null) mActionMode.invalidate(); | 2208 if (mActionMode != null) mActionMode.invalidate(); |
2191 TraceEvent.end(); | 2209 TraceEvent.end(); |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3027 private native void nativeWasResized(long nativeContentViewCoreImpl); | 3045 private native void nativeWasResized(long nativeContentViewCoreImpl); |
3028 | 3046 |
3029 private native void nativeSetAccessibilityEnabled( | 3047 private native void nativeSetAccessibilityEnabled( |
3030 long nativeContentViewCoreImpl, boolean enabled); | 3048 long nativeContentViewCoreImpl, boolean enabled); |
3031 | 3049 |
3032 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l, | 3050 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l, |
3033 int x, int y, int w, int h); | 3051 int x, int y, int w, int h); |
3034 | 3052 |
3035 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque); | 3053 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque); |
3036 } | 3054 } |
OLD | NEW |