summaryrefslogtreecommitdiffstats
path: root/content/browser/accessibility/browser_accessibility.h
diff options
context:
space:
mode:
authordmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-03 07:36:33 +0000
committerdmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-03 07:36:33 +0000
commit72f3f55b7fa7c0a2bb272bc250cc9b04826a8ca5 (patch)
tree46fb28291b141a3f431aeddfb51e0a02174be72c /content/browser/accessibility/browser_accessibility.h
parent4e039f24f17dd7b3bd12e572e82cca978188055a (diff)
downloadchromium_src-72f3f55b7fa7c0a2bb272bc250cc9b04826a8ca5.zip
chromium_src-72f3f55b7fa7c0a2bb272bc250cc9b04826a8ca5.tar.gz
chromium_src-72f3f55b7fa7c0a2bb272bc250cc9b04826a8ca5.tar.bz2
Initial implementation of IAccessible2 scrollTo and setTextSelection and
related methods. Scrolling currently only handles the main frame, though it's designed to be extended to support scrolling any scrollable container shortly. Setting the text selection is only implemented for <input> elements, pending WebKit enhancements. BUG=104468,104469 TEST=Adds new test for scrolling logic, manual testing with accProbe. Review URL: http://codereview.chromium.org/8770021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112880 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/accessibility/browser_accessibility.h')
-rw-r--r--content/browser/accessibility/browser_accessibility.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/content/browser/accessibility/browser_accessibility.h b/content/browser/accessibility/browser_accessibility.h
index 5b86072..b07518b 100644
--- a/content/browser/accessibility/browser_accessibility.h
+++ b/content/browser/accessibility/browser_accessibility.h
@@ -108,6 +108,53 @@ class CONTENT_EXPORT BrowserAccessibility {
// (in global screen coordinates).
BrowserAccessibility* BrowserAccessibilityForPoint(const gfx::Point& point);
+ // Scrolls this element so that the |focus| rect (in local coordinates
+ // relative to this element) is scrolled to fit within the given
+ // |viewport| (which is clipped to the actual bounds of this
+ // object if you specify something larger). If the whole focus area
+ // doesn't fit, you can specify |subfocus|, which will prioritize
+ // a smaller area within |focus|.
+ //
+ // Note that "focus" doesn't necessarily mean the rectangle must correspond
+ // to a focused element on the page; assistive technology might request
+ // that any object be made visible.
+ void ScrollToMakeVisible(const gfx::Rect& subfocus,
+ const gfx::Rect& focus,
+ const gfx::Rect& viewport);
+
+ // This is a 1-dimensional scroll offset helper function that's applied
+ // separately in the horizontal and vertical directions, because the
+ // logic is the same. The goal is to compute the best scroll offset
+ // in order to make a focused item visible within a viewport.
+ //
+ // In case the whole focused item cannot fit, you can specify a
+ // subfocus - a smaller region within the focus that should
+ // be prioritized. If the whole focused item can fit, the subfocus is
+ // ignored.
+ //
+ // Example: the viewport is scrolled to the right just enough
+ // that the focus is in view.
+ // Before:
+ // +----------Viewport---------+
+ // +----Focus---+
+ // +--SubFocus--+
+ //
+ // After:
+ // +----------Viewport---------+
+ // +----Focus---+
+ // +--SubFocus--+
+ //
+ // When constraints cannot be fully satisfied, the min
+ // (left/top) position takes precedence over the max (right/bottom).
+ //
+ // Note that the return value represents the ideal new scroll offset.
+ // This may be out of range - the calling function should clip this
+ // to the available range.
+ static int ComputeBestScrollOffset(int current_scroll_offset,
+ int subfocus_min, int subfocus_max,
+ int focus_min, int focus_max,
+ int viewport_min, int viewport_max);
+
//
// Reference counting
//