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

Side by Side Diff: content/browser/accessibility/browser_accessibility.h

Issue 2806773002: Switched to using |AXPosition| for calculating word and line boundaries on Windows. (Closed)
Patch Set: Fixed unit tests. Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // (which is relative to its nearest scrollable ancestor) to 163 // (which is relative to its nearest scrollable ancestor) to
164 // absolute bounds, either in page coordinates (when |frameOnly| is 164 // absolute bounds, either in page coordinates (when |frameOnly| is
165 // false), or in frame coordinates (when |frameOnly| is true). 165 // false), or in frame coordinates (when |frameOnly| is true).
166 virtual gfx::Rect RelativeToAbsoluteBounds(gfx::RectF bounds, 166 virtual gfx::Rect RelativeToAbsoluteBounds(gfx::RectF bounds,
167 bool frame_only) const; 167 bool frame_only) const;
168 168
169 // This is to handle the cases such as ARIA textbox, where the value should 169 // This is to handle the cases such as ARIA textbox, where the value should
170 // be calculated from the object's inner text. 170 // be calculated from the object's inner text.
171 virtual base::string16 GetValue() const; 171 virtual base::string16 GetValue() const;
172 172
173 // Starting at the given character offset, locates the start of the next or
174 // previous line and returns its character offset.
175 int GetLineStartBoundary(int start,
176 ui::TextBoundaryDirection direction,
177 ui::AXTextAffinity affinity) const;
178
179 // Starting at the given character offset, locates the start of the next or
180 // previous word and returns its character offset.
181 // In case there is no word boundary before or after the given offset, it
182 // returns one past the last character.
183 // If the given offset is already at the start of a word, returns the start
184 // of the next word if the search is forwards, and the given offset if it is
185 // backwards.
186 // If the start offset is equal to -1 and the search is in the forwards
187 // direction, returns the start boundary of the first word.
188 // Start offsets that are not in the range -1 to text length are invalid.
189 int GetWordStartBoundary(int start,
190 ui::TextBoundaryDirection direction) const;
191
192 // This is an approximate hit test that only uses the information in 173 // This is an approximate hit test that only uses the information in
193 // the browser process to compute the correct result. It will not return 174 // the browser process to compute the correct result. It will not return
194 // correct results in many cases of z-index, overflow, and absolute 175 // correct results in many cases of z-index, overflow, and absolute
195 // positioning, so BrowserAccessibilityManager::CachingAsyncHitTest 176 // positioning, so BrowserAccessibilityManager::CachingAsyncHitTest
196 // should be used instead, which falls back on calling ApproximateHitTest 177 // should be used instead, which falls back on calling ApproximateHitTest
197 // automatically. 178 // automatically.
198 BrowserAccessibility* ApproximateHitTest(const gfx::Point& screen_point); 179 BrowserAccessibility* ApproximateHitTest(const gfx::Point& screen_point);
199 180
200 // Marks this object for deletion, releases our reference to it, and 181 // Marks this object for deletion, releases our reference to it, and
201 // nulls out the pointer to the underlying AXNode. May not delete 182 // nulls out the pointer to the underlying AXNode. May not delete
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 bool IsMenuRelated() const; 375 bool IsMenuRelated() const;
395 bool IsNativeTextControl() const; 376 bool IsNativeTextControl() const;
396 bool IsSimpleTextControl() const; 377 bool IsSimpleTextControl() const;
397 // Indicates if this object is at the root of a rich edit text control. 378 // Indicates if this object is at the root of a rich edit text control.
398 bool IsRichTextControl() const; 379 bool IsRichTextControl() const;
399 380
400 // If an object is focusable but has no accessible name, use this 381 // If an object is focusable but has no accessible name, use this
401 // to compute a name from its descendants. 382 // to compute a name from its descendants.
402 std::string ComputeAccessibleNameFromDescendants(); 383 std::string ComputeAccessibleNameFromDescendants();
403 384
404 // Creates a position rooted at this object. 385 // Creates a text position rooted at this object.
405 // This is a text position on all platforms except IA2 and ATK, where tree 386 AXPlatformPosition::AXPositionInstance CreatePositionAt(
406 // positions are created for non-text objects representing hypertext offsets. 387 int offset,
407 virtual AXPlatformPosition::AXPositionInstance CreatePositionAt( 388 ui::AXTextAffinity affinity = ui::AX_TEXT_AFFINITY_DOWNSTREAM) const;
408 int offset) const;
409 389
410 // Gets the text offsets where new lines start. 390 // Gets the text offsets where new lines start.
411 std::vector<int> GetLineStartOffsets() const; 391 std::vector<int> GetLineStartOffsets() const;
412 392
413 // AXPlatformNodeDelegate. 393 // AXPlatformNodeDelegate.
414 const ui::AXNodeData& GetData() const override; 394 const ui::AXNodeData& GetData() const override;
415 gfx::NativeWindow GetTopLevelWidget() override; 395 gfx::NativeWindow GetTopLevelWidget() override;
416 gfx::NativeViewAccessible GetParent() override; 396 gfx::NativeViewAccessible GetParent() override;
417 int GetChildCount() override; 397 int GetChildCount() override;
418 gfx::NativeViewAccessible ChildAtIndex(int index) override; 398 gfx::NativeViewAccessible ChildAtIndex(int index) override;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 // bounds, but "virtual" elements in the accessibility tree that don't 436 // bounds, but "virtual" elements in the accessibility tree that don't
457 // correspond to a layed-out element sometimes don't have bounds. 437 // correspond to a layed-out element sometimes don't have bounds.
458 void FixEmptyBounds(gfx::RectF* bounds) const; 438 void FixEmptyBounds(gfx::RectF* bounds) const;
459 439
460 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); 440 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility);
461 }; 441 };
462 442
463 } // namespace content 443 } // namespace content
464 444
465 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ 445 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_
OLDNEW
« no previous file with comments | « content/browser/accessibility/ax_platform_position.cc ('k') | content/browser/accessibility/browser_accessibility.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698