Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ | 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ |
| 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ | 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 // top-left corner of the overall web area. | 101 // top-left corner of the overall web area. |
| 102 gfx::Rect GetLocalBoundsRect(); | 102 gfx::Rect GetLocalBoundsRect(); |
| 103 | 103 |
| 104 // Returns the bounds of this object in screen coordinates. | 104 // Returns the bounds of this object in screen coordinates. |
| 105 gfx::Rect GetGlobalBoundsRect(); | 105 gfx::Rect GetGlobalBoundsRect(); |
| 106 | 106 |
| 107 // Returns the deepest descendant that contains the specified point | 107 // Returns the deepest descendant that contains the specified point |
| 108 // (in global screen coordinates). | 108 // (in global screen coordinates). |
| 109 BrowserAccessibility* BrowserAccessibilityForPoint(const gfx::Point& point); | 109 BrowserAccessibility* BrowserAccessibilityForPoint(const gfx::Point& point); |
| 110 | 110 |
| 111 // Scrolls this element so that the |focus| rect (in local coordinates | |
| 112 // relative to this element) is scrolled to fit within the given | |
| 113 // |viewport| (which is clipped to the actual bounds of this | |
| 114 // object if you specify something larger). If the whole focus area | |
| 115 // doesn't fit, you can specify |subfocus|, which will prioritize | |
| 116 // a smaller area within |focus|. | |
| 117 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
| |
| 118 const gfx::Rect& focus, | |
| 119 const gfx::Rect& viewport); | |
| 120 | |
| 121 // This is a 1-dimensional scroll offset helper function that's applied | |
| 122 // separately in the horizontal and vertical directions, because the | |
| 123 // logic is the same. The goal is to compute the best scroll offset | |
| 124 // in order to make a focused item visible within a viewport. | |
| 125 // | |
| 126 // In case the whole focused item cannot fit, you can specify a | |
| 127 // subfocus - a smaller region within the focus that should | |
| 128 // be prioritized. If the whole focused item can fit, the subfocus is | |
| 129 // ignored. | |
| 130 // | |
| 131 // Example: the viewport is scrolled to the right just enough | |
| 132 // that the focus is in view. | |
| 133 // Before: | |
| 134 // +----------Viewport---------+ | |
| 135 // +----Focus---+ | |
| 136 // +--SubFocus--+ | |
| 137 // | |
| 138 // After: | |
| 139 // +----------Viewport---------+ | |
| 140 // +----Focus---+ | |
| 141 // +--SubFocus--+ | |
| 142 // | |
| 143 // 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.
| |
| 144 // (left/top) position takes precedence over the max (right/bottom). | |
| 145 static int ComputeBestScrollOffset(int current_scroll_offset, | |
| 146 int subfocus_min, int subfocus_max, | |
| 147 int focus_min, int focus_max, | |
| 148 int viewport_min, int viewport_max); | |
| 149 | |
| 111 // | 150 // |
| 112 // Reference counting | 151 // Reference counting |
| 113 // | 152 // |
| 114 // Each object has an internal reference count and many platform | 153 // Each object has an internal reference count and many platform |
| 115 // implementations may also use native reference counting. | 154 // implementations may also use native reference counting. |
| 116 // | 155 // |
| 117 // The internal reference counting is used because sometimes | 156 // The internal reference counting is used because sometimes |
| 118 // multiple references to the same object exist temporarily during | 157 // multiple references to the same object exist temporarily during |
| 119 // an update. When the internal reference count reaches zero, | 158 // an update. When the internal reference count reaches zero, |
| 120 // NativeReleaseReference is called. | 159 // NativeReleaseReference is called. |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 275 // tree, a client may still be holding onto a pointer to this object, so | 314 // tree, a client may still be holding onto a pointer to this object, so |
| 276 // we mark it as inactive so that calls to any of this object's methods | 315 // we mark it as inactive so that calls to any of this object's methods |
| 277 // immediately return failure. | 316 // immediately return failure. |
| 278 bool instance_active_; | 317 bool instance_active_; |
| 279 | 318 |
| 280 private: | 319 private: |
| 281 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); | 320 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); |
| 282 }; | 321 }; |
| 283 | 322 |
| 284 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ | 323 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ |
| OLD | NEW |