Loading core/java/android/webkit/AccessibilityInjector.java +11 −0 Original line number Diff line number Diff line Loading @@ -113,6 +113,11 @@ class AccessibilityInjector { * @return True if the event was processed. */ public boolean onKeyEvent(KeyEvent event) { // We do not handle ENTER in any circumstances. if (isEnterActionKey(event.getKeyCode())) { return false; } if (event.getAction() == KeyEvent.ACTION_UP) { return mLastDownEventHandled; } Loading Loading @@ -367,6 +372,12 @@ class AccessibilityInjector { } } private boolean isEnterActionKey(int keyCode) { return keyCode == KeyEvent.KEYCODE_DPAD_CENTER || keyCode == KeyEvent.KEYCODE_ENTER || keyCode == KeyEvent.KEYCODE_NUMPAD_ENTER; } /** * Represents a web content key-binding. */ Loading core/java/android/webkit/WebView.java +10 −25 Original line number Diff line number Diff line Loading @@ -16,9 +16,6 @@ package android.webkit; import android.view.HardwareCanvas; import com.android.internal.R; import android.annotation.Widget; import android.app.AlertDialog; import android.content.BroadcastReceiver; Loading @@ -31,7 +28,6 @@ import android.content.IntentFilter; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.res.Configuration; import android.content.res.Resources; import android.database.DataSetObserver; import android.graphics.Bitmap; import android.graphics.BitmapFactory; Loading @@ -57,7 +53,6 @@ import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.os.SystemClock; import android.provider.Settings; import android.speech.tts.TextToSpeech; import android.text.Selection; Loading @@ -66,6 +61,7 @@ import android.util.AttributeSet; import android.util.EventLog; import android.util.Log; import android.view.Gravity; import android.view.HardwareCanvas; import android.view.KeyCharacterMap; import android.view.KeyEvent; import android.view.LayoutInflater; Loading @@ -92,7 +88,6 @@ import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.CheckedTextView; import android.widget.EdgeGlow; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.OverScroller; Loading Loading @@ -677,6 +672,8 @@ public class WebView extends AbsoluteLayout static final int SET_AUTOFILLABLE = 133; static final int AUTOFILL_COMPLETE = 134; static final int SELECT_AT = 135; private static final int FIRST_PACKAGE_MSG_ID = SCROLL_TO_MSG_ID; private static final int LAST_PACKAGE_MSG_ID = SET_TOUCH_HIGHLIGHT_RECTS; Loading Loading @@ -728,7 +725,8 @@ public class WebView extends AbsoluteLayout "SET_TOUCH_HIGHLIGHT_RECTS", // = 131; "SAVE_WEBARCHIVE_FINISHED", // = 132; "SET_AUTOFILLABLE", // = 133; "AUTOFILL_COMPLETE" // = 134; "AUTOFILL_COMPLETE", // = 134; "SELECT_AT" // = 135; }; // If the site doesn't use the viewport meta tag to specify the viewport, Loading Loading @@ -7600,6 +7598,10 @@ public class WebView extends AbsoluteLayout } break; case SELECT_AT: nativeSelectAt(msg.arg1, msg.arg2); break; default: super.handleMessage(msg); break; Loading Loading @@ -7957,24 +7959,6 @@ public class WebView extends AbsoluteLayout cursorData()); } /* * Called from JNI when the cursor has moved. This method * sends a message to the WebCore requesting the given * nodePtr in the given framePrt to be selected which will * result in firing an accessibility event announing its * content. * * Note: Accessibility support. */ @SuppressWarnings("unused") // called from JNI private void sendMoveSelection(int framePtr, int nodePtr) { if (AccessibilityManager.getInstance(mContext).isEnabled() && mAccessibilityInjector != null) { mWebViewCore.sendMessage(EventHub.MOVE_SELECTION, framePtr, nodePtr); } } /** * Called by JNI to send a message to the webcore thread that the user * touched the webpage. Loading Loading @@ -8286,6 +8270,7 @@ public class WebView extends AbsoluteLayout private native Point nativeSelectableText(); private native void nativeSelectAll(); private native void nativeSelectBestAt(Rect rect); private native void nativeSelectAt(int x, int y); private native int nativeSelectionX(); private native int nativeSelectionY(); private native int nativeFindIndex(); Loading core/java/android/webkit/WebViewCore.java +8 −21 Original line number Diff line number Diff line Loading @@ -636,18 +636,6 @@ final class WebViewCore { */ private native String nativeModifySelection(int direction, int granularity); /** * Moves the selection to given node i.e. selects that node. * * Note: Accessibility support. * * @param framePtr Pointer to the frame containing the node to be selected. * @param nodePtr Pointer to the node to be selected. * * @return The selection string. */ private native String nativeMoveSelection(int framePtr, int nodePtr); // EventHub for processing messages private final EventHub mEventHub; // WebCore thread handler Loading Loading @@ -1013,9 +1001,6 @@ final class WebViewCore { static final int PROXY_CHANGED = 193; // accessibility support static final int MOVE_SELECTION = 194; // private message ids private static final int DESTROY = 200; Loading Loading @@ -1434,12 +1419,6 @@ final class WebViewCore { modifiedSelectionString).sendToTarget(); break; case MOVE_SELECTION: String movedSelectionString = nativeMoveSelection(msg.arg1, msg.arg2); mWebView.mPrivateHandler.obtainMessage(WebView.SELECTION_STRING_CHANGED, movedSelectionString).sendToTarget(); break; case LISTBOX_CHOICES: SparseBooleanArray choices = (SparseBooleanArray) msg.obj; Loading Loading @@ -2709,6 +2688,14 @@ final class WebViewCore { hMode, vMode).sendToTarget(); } // called by JNI @SuppressWarnings("unused") private void selectAt(int x, int y) { if (mWebView != null) { mWebView.mPrivateHandler.obtainMessage(WebView.SELECT_AT, x, y).sendToTarget(); } } private void useMockDeviceOrientation() { mDeviceMotionAndOrientationManager.useMock(); } Loading core/tests/coretests/src/android/webkit/AccessibilityInjectorTest.java +563 −7 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
core/java/android/webkit/AccessibilityInjector.java +11 −0 Original line number Diff line number Diff line Loading @@ -113,6 +113,11 @@ class AccessibilityInjector { * @return True if the event was processed. */ public boolean onKeyEvent(KeyEvent event) { // We do not handle ENTER in any circumstances. if (isEnterActionKey(event.getKeyCode())) { return false; } if (event.getAction() == KeyEvent.ACTION_UP) { return mLastDownEventHandled; } Loading Loading @@ -367,6 +372,12 @@ class AccessibilityInjector { } } private boolean isEnterActionKey(int keyCode) { return keyCode == KeyEvent.KEYCODE_DPAD_CENTER || keyCode == KeyEvent.KEYCODE_ENTER || keyCode == KeyEvent.KEYCODE_NUMPAD_ENTER; } /** * Represents a web content key-binding. */ Loading
core/java/android/webkit/WebView.java +10 −25 Original line number Diff line number Diff line Loading @@ -16,9 +16,6 @@ package android.webkit; import android.view.HardwareCanvas; import com.android.internal.R; import android.annotation.Widget; import android.app.AlertDialog; import android.content.BroadcastReceiver; Loading @@ -31,7 +28,6 @@ import android.content.IntentFilter; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.res.Configuration; import android.content.res.Resources; import android.database.DataSetObserver; import android.graphics.Bitmap; import android.graphics.BitmapFactory; Loading @@ -57,7 +53,6 @@ import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.os.SystemClock; import android.provider.Settings; import android.speech.tts.TextToSpeech; import android.text.Selection; Loading @@ -66,6 +61,7 @@ import android.util.AttributeSet; import android.util.EventLog; import android.util.Log; import android.view.Gravity; import android.view.HardwareCanvas; import android.view.KeyCharacterMap; import android.view.KeyEvent; import android.view.LayoutInflater; Loading @@ -92,7 +88,6 @@ import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import android.widget.CheckedTextView; import android.widget.EdgeGlow; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.OverScroller; Loading Loading @@ -677,6 +672,8 @@ public class WebView extends AbsoluteLayout static final int SET_AUTOFILLABLE = 133; static final int AUTOFILL_COMPLETE = 134; static final int SELECT_AT = 135; private static final int FIRST_PACKAGE_MSG_ID = SCROLL_TO_MSG_ID; private static final int LAST_PACKAGE_MSG_ID = SET_TOUCH_HIGHLIGHT_RECTS; Loading Loading @@ -728,7 +725,8 @@ public class WebView extends AbsoluteLayout "SET_TOUCH_HIGHLIGHT_RECTS", // = 131; "SAVE_WEBARCHIVE_FINISHED", // = 132; "SET_AUTOFILLABLE", // = 133; "AUTOFILL_COMPLETE" // = 134; "AUTOFILL_COMPLETE", // = 134; "SELECT_AT" // = 135; }; // If the site doesn't use the viewport meta tag to specify the viewport, Loading Loading @@ -7600,6 +7598,10 @@ public class WebView extends AbsoluteLayout } break; case SELECT_AT: nativeSelectAt(msg.arg1, msg.arg2); break; default: super.handleMessage(msg); break; Loading Loading @@ -7957,24 +7959,6 @@ public class WebView extends AbsoluteLayout cursorData()); } /* * Called from JNI when the cursor has moved. This method * sends a message to the WebCore requesting the given * nodePtr in the given framePrt to be selected which will * result in firing an accessibility event announing its * content. * * Note: Accessibility support. */ @SuppressWarnings("unused") // called from JNI private void sendMoveSelection(int framePtr, int nodePtr) { if (AccessibilityManager.getInstance(mContext).isEnabled() && mAccessibilityInjector != null) { mWebViewCore.sendMessage(EventHub.MOVE_SELECTION, framePtr, nodePtr); } } /** * Called by JNI to send a message to the webcore thread that the user * touched the webpage. Loading Loading @@ -8286,6 +8270,7 @@ public class WebView extends AbsoluteLayout private native Point nativeSelectableText(); private native void nativeSelectAll(); private native void nativeSelectBestAt(Rect rect); private native void nativeSelectAt(int x, int y); private native int nativeSelectionX(); private native int nativeSelectionY(); private native int nativeFindIndex(); Loading
core/java/android/webkit/WebViewCore.java +8 −21 Original line number Diff line number Diff line Loading @@ -636,18 +636,6 @@ final class WebViewCore { */ private native String nativeModifySelection(int direction, int granularity); /** * Moves the selection to given node i.e. selects that node. * * Note: Accessibility support. * * @param framePtr Pointer to the frame containing the node to be selected. * @param nodePtr Pointer to the node to be selected. * * @return The selection string. */ private native String nativeMoveSelection(int framePtr, int nodePtr); // EventHub for processing messages private final EventHub mEventHub; // WebCore thread handler Loading Loading @@ -1013,9 +1001,6 @@ final class WebViewCore { static final int PROXY_CHANGED = 193; // accessibility support static final int MOVE_SELECTION = 194; // private message ids private static final int DESTROY = 200; Loading Loading @@ -1434,12 +1419,6 @@ final class WebViewCore { modifiedSelectionString).sendToTarget(); break; case MOVE_SELECTION: String movedSelectionString = nativeMoveSelection(msg.arg1, msg.arg2); mWebView.mPrivateHandler.obtainMessage(WebView.SELECTION_STRING_CHANGED, movedSelectionString).sendToTarget(); break; case LISTBOX_CHOICES: SparseBooleanArray choices = (SparseBooleanArray) msg.obj; Loading Loading @@ -2709,6 +2688,14 @@ final class WebViewCore { hMode, vMode).sendToTarget(); } // called by JNI @SuppressWarnings("unused") private void selectAt(int x, int y) { if (mWebView != null) { mWebView.mPrivateHandler.obtainMessage(WebView.SELECT_AT, x, y).sendToTarget(); } } private void useMockDeviceOrientation() { mDeviceMotionAndOrientationManager.useMock(); } Loading
core/tests/coretests/src/android/webkit/AccessibilityInjectorTest.java +563 −7 File changed.Preview size limit exceeded, changes collapsed. Show changes