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

Side by Side Diff: ui/android/java/src/org/chromium/ui/base/CursorAnchorInfoBuilder.java

Issue 643193003: Support InputMethodManager#updateCursorAnchorInfo for Android 5.0 (C++ version) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Send ImeCompositionRangeChanged only when necessary Created 5 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
« no previous file with comments | « tools/metrics/histograms/histograms.xml ('k') | ui/base/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.ui.base;
6
7 import android.graphics.Matrix;
8 import android.os.Build;
9 import android.view.inputmethod.CursorAnchorInfo;
10
11 import org.chromium.base.CalledByNative;
12 import org.chromium.base.JNINamespace;
13
14 import java.lang.CharSequence;
15
16 /**
17 * A simple class to allow native code to call instance methods of {@link Cursor AnchorInfo.Builder}.
18 * This class itself is designed to be stateless. All the methods are thread-saf e.
19 */
20 @JNINamespace("ui")
21 public final class CursorAnchorInfoBuilder {
22
23 private static final Matrix sMatrix = new Matrix();
24
25 @CalledByNative
26 public static CursorAnchorInfo.Builder create() {
27 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
28 return null;
29 }
30 return new CursorAnchorInfo.Builder();
31 }
32
33 @CalledByNative
34 public static void reset(CursorAnchorInfo.Builder builder) {
35 builder.reset();
36 }
37
38 @CalledByNative
39 public static void setSelectionRange(CursorAnchorInfo.Builder builder, int n ewStart,
40 int newEnd) {
41 builder.setSelectionRange(newStart, newEnd);
42 }
43
44 @CalledByNative
45 public static void setComposingText(CursorAnchorInfo.Builder builder, int co mposingTextStart,
46 CharSequence composingText) {
47 builder.setComposingText(composingTextStart, composingText);
48 }
49
50 @CalledByNative
51 public static void setInsertionMarkerLocation(CursorAnchorInfo.Builder build er,
52 float horizontalPosition, float lineTop, float lineBaseline, float l ineBottom,
53 int flags) {
54 builder.setInsertionMarkerLocation(horizontalPosition, lineTop, lineBase line, lineBottom,
55 flags);
56 }
57
58 @CalledByNative
59 public static void addCharacterBounds(CursorAnchorInfo.Builder builder, int index, float left,
60 float top, float right, float bottom, int flags) {
61 builder.addCharacterBounds(index, left, top, right, bottom, flags);
62 }
63
64 @CalledByNative
65 public static void setScaleAndTranslate(CursorAnchorInfo.Builder builder, fl oat scale,
66 float translateX, float translateY) {
67 synchronized (sMatrix) {
68 sMatrix.setScale(scale, scale);
69 sMatrix.postTranslate(translateX, translateY);
70 builder.setMatrix(sMatrix);
71 }
72 }
73
74 @CalledByNative
75 public static CursorAnchorInfo build(CursorAnchorInfo.Builder builder) {
76 return builder.build();
77 }
78 }
OLDNEW
« no previous file with comments | « tools/metrics/histograms/histograms.xml ('k') | ui/base/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698