Chromium Code Reviews| 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 // Adjust rect top & bottom coordinates based on viewport for handling s croll scenarios. | |
| 834 int viewportRectTop = viewLocation[1] + (int) mRenderCoordinates.getCont entOffsetYPix(); | |
| 835 int viewportRectBottom = viewportRectTop + mContentViewCore.getViewportH eightPix(); | |
| 836 if (rect.top < viewportRectTop) { | |
|
AKV
2015/08/19 10:20:46
if (rect.top < viewportRectTop) rect.top = viewpor
| |
| 837 rect.top = viewportRectTop; | |
| 838 } | |
| 839 if (rect.bottom > viewportRectBottom) { | |
| 840 rect.bottom = viewportRectBottom; | |
| 841 } | |
| 833 node.setBoundsInScreen(rect); | 842 node.setBoundsInScreen(rect); |
| 834 | 843 |
| 835 // Work around a bug in the Android framework where if the object with a ccessibility | 844 // 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, | 845 // 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, | 846 // 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 | 847 // 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. | 848 // move focus right back to it, which tricks Android into updating its b ounds. |
| 840 if (virtualViewId == mAccessibilityFocusId && virtualViewId != mCurrentR ootId) { | 849 if (virtualViewId == mAccessibilityFocusId && virtualViewId != mCurrentR ootId) { |
| 841 if (mAccessibilityFocusRect == null) { | 850 if (mAccessibilityFocusRect == null) { |
| 842 mAccessibilityFocusRect = rect; | 851 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); | 1037 int selectionGranularity, boolean extendSelection, int id, int curso rIndex); |
| 1029 private native boolean nativeAdjustSlider( | 1038 private native boolean nativeAdjustSlider( |
| 1030 long nativeBrowserAccessibilityManagerAndroid, int id, boolean incre ment); | 1039 long nativeBrowserAccessibilityManagerAndroid, int id, boolean incre ment); |
| 1031 private native void nativeSetAccessibilityFocus( | 1040 private native void nativeSetAccessibilityFocus( |
| 1032 long nativeBrowserAccessibilityManagerAndroid, int id); | 1041 long nativeBrowserAccessibilityManagerAndroid, int id); |
| 1033 private native boolean nativeIsSlider( | 1042 private native boolean nativeIsSlider( |
| 1034 long nativeBrowserAccessibilityManagerAndroid, int id); | 1043 long nativeBrowserAccessibilityManagerAndroid, int id); |
| 1035 private native boolean nativeScroll( | 1044 private native boolean nativeScroll( |
| 1036 long nativeBrowserAccessibilityManagerAndroid, int id, int direction ); | 1045 long nativeBrowserAccessibilityManagerAndroid, int id, int direction ); |
| 1037 } | 1046 } |
| OLD | NEW |