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

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java

Issue 1297643003: Adjust talkback focus rect to stay within viewport size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modified comment to being short and precise. Created 5 years, 4 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698