| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.accessibility; | 5 package org.chromium.content.browser.accessibility; |
| 6 | 6 |
| 7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
| 8 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.graphics.Rect; | 9 import android.graphics.Rect; |
| 10 import android.os.Build; | 10 import android.os.Build; |
| (...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 | 823 |
| 824 // Offset by the location of the web content within the view. | 824 // Offset by the location of the web content within the view. |
| 825 rect.offset(0, | 825 rect.offset(0, |
| 826 (int) mRenderCoordinates.getContentOffsetYPix()); | 826 (int) mRenderCoordinates.getContentOffsetYPix()); |
| 827 | 827 |
| 828 // Finally offset by the location of the view within the screen. | 828 // Finally offset by the location of the view within the screen. |
| 829 final int[] viewLocation = new int[2]; | 829 final int[] viewLocation = new int[2]; |
| 830 mView.getLocationOnScreen(viewLocation); | 830 mView.getLocationOnScreen(viewLocation); |
| 831 rect.offset(viewLocation[0], viewLocation[1]); | 831 rect.offset(viewLocation[0], viewLocation[1]); |
| 832 | 832 |
| 833 // Clip the node's bounding rect to the viewport bounds. |
| 834 int viewportRectTop = viewLocation[1] + (int) mRenderCoordinates.getCont
entOffsetYPix(); |
| 835 int viewportRectBottom = viewportRectTop + mContentViewCore.getViewportH
eightPix(); |
| 836 if (rect.top < viewportRectTop) rect.top = viewportRectTop; |
| 837 if (rect.bottom > viewportRectBottom) rect.bottom = viewportRectBottom; |
| 838 |
| 833 node.setBoundsInScreen(rect); | 839 node.setBoundsInScreen(rect); |
| 834 | 840 |
| 835 // Work around a bug in the Android framework where if the object with a
ccessibility | 841 // Work around a bug in the Android framework where if the object with a
ccessibility |
| 836 // focus moves, the accessibility focus rect is not updated - both the v
isual highlight, | 842 // focus moves, the accessibility focus rect is not updated - both the v
isual highlight, |
| 837 // and the location on the screen that's clicked if you double-tap. To w
ork around this, | 843 // and the location on the screen that's clicked if you double-tap. To w
ork around this, |
| 838 // when we know the object with accessibility focus moved, move focus aw
ay and then | 844 // when we know the object with accessibility focus moved, move focus aw
ay and then |
| 839 // move focus right back to it, which tricks Android into updating its b
ounds. | 845 // move focus right back to it, which tricks Android into updating its b
ounds. |
| 840 if (virtualViewId == mAccessibilityFocusId && virtualViewId != mCurrentR
ootId) { | 846 if (virtualViewId == mAccessibilityFocusId && virtualViewId != mCurrentR
ootId) { |
| 841 if (mAccessibilityFocusRect == null) { | 847 if (mAccessibilityFocusRect == null) { |
| 842 mAccessibilityFocusRect = rect; | 848 mAccessibilityFocusRect = rect; |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 int selectionGranularity, boolean extendSelection, int id, int curso
rIndex); | 1034 int selectionGranularity, boolean extendSelection, int id, int curso
rIndex); |
| 1029 private native boolean nativeAdjustSlider( | 1035 private native boolean nativeAdjustSlider( |
| 1030 long nativeBrowserAccessibilityManagerAndroid, int id, boolean incre
ment); | 1036 long nativeBrowserAccessibilityManagerAndroid, int id, boolean incre
ment); |
| 1031 private native void nativeSetAccessibilityFocus( | 1037 private native void nativeSetAccessibilityFocus( |
| 1032 long nativeBrowserAccessibilityManagerAndroid, int id); | 1038 long nativeBrowserAccessibilityManagerAndroid, int id); |
| 1033 private native boolean nativeIsSlider( | 1039 private native boolean nativeIsSlider( |
| 1034 long nativeBrowserAccessibilityManagerAndroid, int id); | 1040 long nativeBrowserAccessibilityManagerAndroid, int id); |
| 1035 private native boolean nativeScroll( | 1041 private native boolean nativeScroll( |
| 1036 long nativeBrowserAccessibilityManagerAndroid, int id, int direction
); | 1042 long nativeBrowserAccessibilityManagerAndroid, int id, int direction
); |
| 1037 } | 1043 } |
| OLD | NEW |