Chromium Code Reviews| Index: content/browser/accessibility/browser_accessibility.h |
| =================================================================== |
| --- content/browser/accessibility/browser_accessibility.h (revision 112482) |
| +++ content/browser/accessibility/browser_accessibility.h (working copy) |
| @@ -108,7 +108,46 @@ |
| // (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|. |
| + void ScrollToMakeVisible(const gfx::Rect& subfocus, |
|
David Tseng
2011/12/02 00:02:17
Curious why this isn't taking a more general param
dmazzoni
2011/12/03 00:37:10
Yes - the item to be made visible isn't necessaril
|
| + 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 satistied, the min |
|
David Tseng
2011/12/02 00:02:17
satistied -> satisfied
dmazzoni
2011/12/03 00:37:10
Done.
|
| + // (left/top) position takes precedence over the max (right/bottom). |
| + 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 |
| // |
| // Each object has an internal reference count and many platform |