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

Unified Diff: content/browser/accessibility/browser_accessibility.h

Issue 1130733006: Adds color, font size, text direction and text styles to the accessibility tree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt at exposing style info to the native APIs. Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/accessibility/browser_accessibility.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/accessibility/browser_accessibility.h
diff --git a/content/browser/accessibility/browser_accessibility.h b/content/browser/accessibility/browser_accessibility.h
index 4f6b308619dc7983ae7d12d4d111ef9fa1b7dd7c..5d0c0a7c127e51ac0ea5be15d5e32bd099a8cd4a 100644
--- a/content/browser/accessibility/browser_accessibility.h
+++ b/content/browser/accessibility/browser_accessibility.h
@@ -112,18 +112,28 @@ class CONTENT_EXPORT BrowserAccessibility {
// the role is WebAXRoleStaticText.
gfx::Rect GetGlobalBoundsForRange(int start, int len) const;
- // Searches in the given text and from the given offset until the start of
- // the next or previous word is found and returns its position.
+ // Starting at the given offset, searches through this object's text until the
+ // beginning of the next or previous word is found and returns its position.
// In case there is no word boundary before or after the given offset, it
// returns one past the last character, i.e. the text's length.
// If the given offset is already at the start of a word, returns the start
- // of the next word if the search is forwards and the given offset if it is
- // backwards.
+ // of the next word if the search is forwards. It returns the given offset
+ // if the search is backwards.
// If the start offset is equal to -1 and the search is in the forwards
- // direction, returns the start boundary of the first word.
+ // direction, it returns the start boundary of the first word.
// Start offsets that are not in the range -1 to text length are invalid.
int GetWordStartBoundary(
- int start, ui::TextBoundaryDirection direction) const;
+ int offset, ui::TextBoundaryDirection direction) const;
+
+ // Starting at the given offset, searches either forwards or backwards through
+ // this object's text until it finds a change in text style. If the search is
+ // in the forwards direction, it returns the start of the next style span. If
+ // the search is in the backwards direction, it returns the start of the
+ // current style span.
+ // In case there is no style change after the given offset, it returns one
+ // past the last character, i.e. the text's length.
+ int GetStyleChangeBoundary(
+ int offset, ui::TextBoundaryDirection direction) const;
// Returns the deepest descendant that contains the specified point
// (in global screen coordinates).
@@ -265,6 +275,10 @@ class CONTENT_EXPORT BrowserAccessibility {
protected:
BrowserAccessibility();
+ // Returns the first deepest descendant that is an object with complete text
+ // information.
+ BrowserAccessibility* GetFirstTextLeaf() const;
+
// The manager of this tree of accessibility objects.
BrowserAccessibilityManager* manager_;
@@ -272,10 +286,27 @@ class CONTENT_EXPORT BrowserAccessibility {
ui::AXNode* node_;
private:
- // Return the sum of the lengths of all static text descendants,
- // including this object if it's static text.
+ // Returns true if the object is a leaf for purposes of text retrieval.
+ bool IsTextLeaf() const;
+
+ // Return the sum of the lengths of all text leaf descendants,
+ // including this object if it's a text leaf.
int GetStaticTextLenRecursive() const;
+ // Returns the text leaf in which the given text offset lies and the offset
+ // at which the leaf's text starts.
+ BrowserAccessibility* GetTextLeafAtOffset(int offset, int* leaf_start_offset) const;
+
+ // Returns the last deepest descendant that is an object with complete text
+ // information.
+ BrowserAccessibility* GetLastTextLeaf() const;
+
+ // Returns the next object that is a text leaf, if any.
+ BrowserAccessibility* GetNextTextLeaf() const;
+
+ // Returns the previous object that is a text leaf, if any.
+ BrowserAccessibility* GetPreviousTextLeaf() const;
+
// Similar to GetParent(), but includes nodes that are the host of a
// subtree rather than skipping over them - because they contain important
// bounds offsets.
@@ -286,6 +317,10 @@ class CONTENT_EXPORT BrowserAccessibility {
// to the top of the web accessibility tree).
gfx::Rect ElementBoundsToLocalBounds(gfx::Rect bounds) const;
+ // Returns true if the two objects have the same text style attributes.
+ static bool HaveSameStyle(BrowserAccessibility& object1,
+ BrowserAccessibility& object2);
+
DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility);
};
« no previous file with comments | « no previous file | content/browser/accessibility/browser_accessibility.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698