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

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: 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 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..1a09b72ba9dd9e9212884d35608ae8ece410e0a5 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,12 @@ public class BrowserAccessibilityManager {
mView.getLocationOnScreen(viewLocation);
rect.offset(viewLocation[0], viewLocation[1]);
+ // Clip the node's bounding rect to the viewport bounds.
+ int viewportRectTop = viewLocation[1] + (int) mRenderCoordinates.getContentOffsetYPix();
+ int viewportRectBottom = viewportRectTop + mContentViewCore.getViewportHeightPix();
+ if (rect.top < viewportRectTop) 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