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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java b/content/public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java
index 3b049e9533ac06e2b36860bb25e210aa189d67ac..85421334bf4358909656c4bc059eb7f34facfcf7 100644
--- a/content/public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java
+++ b/content/public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java
@@ -830,6 +830,15 @@ public class BrowserAccessibilityManager {
mView.getLocationOnScreen(viewLocation);
rect.offset(viewLocation[0], viewLocation[1]);
+ // Adjust rect top & bottom coordinates based on viewport for handling scroll scenarios.
+ int viewportRectTop = viewLocation[1] + (int) mRenderCoordinates.getContentOffsetYPix();
+ int viewportRectBottom = viewportRectTop + mContentViewCore.getViewportHeightPix();
+ if (rect.top < viewportRectTop) {
AKV 2015/08/19 10:20:46 if (rect.top < viewportRectTop) rect.top = viewpor
+ rect.top = viewportRectTop;
+ }
+ if (rect.bottom > viewportRectBottom) {
+ rect.bottom = viewportRectBottom;
+ }
node.setBoundsInScreen(rect);
// Work around a bug in the Android framework where if the object with accessibility
« 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