| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 // (which is relative to its nearest scrollable ancestor) to | 165 // (which is relative to its nearest scrollable ancestor) to |
| 166 // absolute bounds, either in page coordinates (when |frameOnly| is | 166 // absolute bounds, either in page coordinates (when |frameOnly| is |
| 167 // false), or in frame coordinates (when |frameOnly| is true). | 167 // false), or in frame coordinates (when |frameOnly| is true). |
| 168 virtual gfx::Rect RelativeToAbsoluteBounds(gfx::RectF bounds, | 168 virtual gfx::Rect RelativeToAbsoluteBounds(gfx::RectF bounds, |
| 169 bool frame_only) const; | 169 bool frame_only) const; |
| 170 | 170 |
| 171 // This is to handle the cases such as ARIA textbox, where the value should | 171 // This is to handle the cases such as ARIA textbox, where the value should |
| 172 // be calculated from the object's inner text. | 172 // be calculated from the object's inner text. |
| 173 virtual base::string16 GetValue() const; | 173 virtual base::string16 GetValue() const; |
| 174 | 174 |
| 175 // Starting at the given character offset, locates the start of the next or | |
| 176 // previous line and returns its character offset. | |
| 177 int GetLineStartBoundary(int start, | |
| 178 ui::TextBoundaryDirection direction, | |
| 179 ui::AXTextAffinity affinity) const; | |
| 180 | |
| 181 // Starting at the given character offset, locates the start of the next or | |
| 182 // previous word and returns its character offset. | |
| 183 // In case there is no word boundary before or after the given offset, it | |
| 184 // returns one past the last character. | |
| 185 // If the given offset is already at the start of a word, returns the start | |
| 186 // of the next word if the search is forwards, and the given offset if it is | |
| 187 // backwards. | |
| 188 // If the start offset is equal to -1 and the search is in the forwards | |
| 189 // direction, returns the start boundary of the first word. | |
| 190 // Start offsets that are not in the range -1 to text length are invalid. | |
| 191 int GetWordStartBoundary(int start, | |
| 192 ui::TextBoundaryDirection direction) const; | |
| 193 | |
| 194 // This is an approximate hit test that only uses the information in | 175 // This is an approximate hit test that only uses the information in |
| 195 // the browser process to compute the correct result. It will not return | 176 // the browser process to compute the correct result. It will not return |
| 196 // correct results in many cases of z-index, overflow, and absolute | 177 // correct results in many cases of z-index, overflow, and absolute |
| 197 // positioning, so BrowserAccessibilityManager::CachingAsyncHitTest | 178 // positioning, so BrowserAccessibilityManager::CachingAsyncHitTest |
| 198 // should be used instead, which falls back on calling ApproximateHitTest | 179 // should be used instead, which falls back on calling ApproximateHitTest |
| 199 // automatically. | 180 // automatically. |
| 200 BrowserAccessibility* ApproximateHitTest(const gfx::Point& screen_point); | 181 BrowserAccessibility* ApproximateHitTest(const gfx::Point& screen_point); |
| 201 | 182 |
| 202 // Marks this object for deletion, releases our reference to it, and | 183 // Marks this object for deletion, releases our reference to it, and |
| 203 // nulls out the pointer to the underlying AXNode. May not delete | 184 // nulls out the pointer to the underlying AXNode. May not delete |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 bool IsMenuRelated() const; | 330 bool IsMenuRelated() const; |
| 350 bool IsNativeTextControl() const; | 331 bool IsNativeTextControl() const; |
| 351 bool IsSimpleTextControl() const; | 332 bool IsSimpleTextControl() const; |
| 352 // Indicates if this object is at the root of a rich edit text control. | 333 // Indicates if this object is at the root of a rich edit text control. |
| 353 bool IsRichTextControl() const; | 334 bool IsRichTextControl() const; |
| 354 | 335 |
| 355 // If an object is focusable but has no accessible name, use this | 336 // If an object is focusable but has no accessible name, use this |
| 356 // to compute a name from its descendants. | 337 // to compute a name from its descendants. |
| 357 std::string ComputeAccessibleNameFromDescendants(); | 338 std::string ComputeAccessibleNameFromDescendants(); |
| 358 | 339 |
| 359 // Creates a position rooted at this object. | 340 // Creates a text position rooted at this object. |
| 360 // This is a text position on all platforms except IA2 and ATK, where tree | 341 AXPlatformPosition::AXPositionInstance CreatePositionAt( |
| 361 // positions are created for non-text objects representing hypertext offsets. | 342 int offset, |
| 362 virtual AXPlatformPosition::AXPositionInstance CreatePositionAt( | 343 ui::AXTextAffinity affinity = ui::AX_TEXT_AFFINITY_DOWNSTREAM) const; |
| 363 int offset) const; | |
| 364 | 344 |
| 365 // Gets the text offsets where new lines start. | 345 // Gets the text offsets where new lines start. |
| 366 std::vector<int> GetLineStartOffsets() const; | 346 std::vector<int> GetLineStartOffsets() const; |
| 367 | 347 |
| 368 // AXPlatformNodeDelegate. | 348 // AXPlatformNodeDelegate. |
| 369 const ui::AXNodeData& GetData() const override; | 349 const ui::AXNodeData& GetData() const override; |
| 370 gfx::NativeWindow GetTopLevelWidget() override; | 350 gfx::NativeWindow GetTopLevelWidget() override; |
| 371 gfx::NativeViewAccessible GetParent() override; | 351 gfx::NativeViewAccessible GetParent() override; |
| 372 int GetChildCount() override; | 352 int GetChildCount() override; |
| 373 gfx::NativeViewAccessible ChildAtIndex(int index) override; | 353 gfx::NativeViewAccessible ChildAtIndex(int index) override; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 // bounds, but "virtual" elements in the accessibility tree that don't | 385 // bounds, but "virtual" elements in the accessibility tree that don't |
| 406 // correspond to a layed-out element sometimes don't have bounds. | 386 // correspond to a layed-out element sometimes don't have bounds. |
| 407 void FixEmptyBounds(gfx::RectF* bounds) const; | 387 void FixEmptyBounds(gfx::RectF* bounds) const; |
| 408 | 388 |
| 409 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); | 389 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); |
| 410 }; | 390 }; |
| 411 | 391 |
| 412 } // namespace content | 392 } // namespace content |
| 413 | 393 |
| 414 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ | 394 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ |
| OLD | NEW |