Index: content/browser/accessibility/browser_accessibility_win.h |
diff --git a/content/browser/accessibility/browser_accessibility_win.h b/content/browser/accessibility/browser_accessibility_win.h |
index b237be91a4ea8261423be379e3bc0e6039035b27..285cd2c78d73145dcc36cf219d11277ed0546a6a 100644 |
--- a/content/browser/accessibility/browser_accessibility_win.h |
+++ b/content/browser/accessibility/browser_accessibility_win.h |
@@ -15,6 +15,7 @@ |
#include <vector> |
#include "base/compiler_specific.h" |
+#include "base/containers/hash_tables.h" |
#include "base/gtest_prod_util.h" |
#include "base/macros.h" |
#include "content/browser/accessibility/browser_accessibility.h" |
@@ -723,6 +724,10 @@ BrowserAccessibilityWin |
base::string16 name() const { return win_attributes_->name; } |
base::string16 description() const { return win_attributes_->description; } |
base::string16 value() const { return win_attributes_->value; } |
+ const base::hash_map<int, std::vector<base::string16>>& |
+ offset_to_text_attributes() const { |
+ return win_attributes_->offset_to_text_attributes; |
+ } |
std::map<int32_t, int32_t>& hyperlink_offset_to_index() const { |
return win_attributes_->hyperlink_offset_to_index; |
} |
@@ -731,6 +736,9 @@ BrowserAccessibilityWin |
} |
private: |
+ // Returns the IA2 text attributes for this object. |
+ std::vector<base::string16> ComputeTextAttributes() const; |
+ |
// Add one to the reference count and return the same object. Always |
// use this method when returning a BrowserAccessibilityWin object as |
// an output parameter to a COM interface, never use it otherwise. |
@@ -786,6 +794,9 @@ BrowserAccessibilityWin |
// Returns true if the current object is an IA2 hyperlink. |
bool IsHyperlink() const; |
+ // Returns the hyperlink at the given text position, or nullptr if no |
+ // hyperlink can be found. |
+ BrowserAccessibilityWin* GetHyperlinkFromHypertextOffset(int offset) const; |
// Functions for retrieving offsets for hyperlinks and hypertext. |
// Return -1 in case of failure. |
@@ -832,6 +843,10 @@ BrowserAccessibilityWin |
void ComputeHypertextRemovedAndInserted( |
int* start, int* old_len, int* new_len); |
+ // Computes and caches the IA2 text style attributes for the text and other |
+ // embedded child objects. |
+ void MayBeComputeStyles(); |
+ |
// If offset is a member of IA2TextSpecialOffsets this function updates the |
// value of offset and returns, otherwise offset remains unchanged. |
void HandleSpecialTextOffset(const base::string16& text, LONG* offset); |
@@ -847,22 +862,32 @@ BrowserAccessibilityWin |
LONG start_offset, |
ui::TextBoundaryDirection direction); |
- // Return a pointer to the object corresponding to the given id, |
- // does not make a new reference. |
- BrowserAccessibilityWin* GetFromID(int32_t id); |
+ // Searches forward from the given offset until the start of the next style |
+ // is found, or searches backward from the given offset until the start of the |
+ // current style is found. |
+ LONG FindStartOfStyle(LONG start_offset, |
+ ui::TextBoundaryDirection direction) const; |
+ |
+ // ID refers to the node ID in the current tree, not the globally unique ID. |
+ // TODO(nektar): Could we use globally unique IDs everywhere? |
+ // TODO(nektar): Rename this function to GetFromNodeID. |
+ BrowserAccessibilityWin* GetFromID(int32_t id) const; |
// Returns true if this is a list box option with a parent of type list box, |
// or a menu list option with a parent of type menu list popup. |
bool IsListBoxOptionOrMenuListOption(); |
- // Updates object attributes of IA2 with html attributes. |
- void UpdateRequiredAttributes(); |
- |
// Given an int list attribute containing the ids of related elements, |
// add a new IAccessibleRelation for this object with the given type name. |
void AddRelations(ui::AXIntListAttribute src_attr, |
const base::string16& iaccessiblerelation_type); |
+ // Updates object attributes of IA2 with html attributes. |
+ void UpdateRequiredAttributes(); |
+ |
+ // Updates the IA2 text style attributes. |
+ void UpdateTextAttributes(); |
+ |
struct WinAttributes { |
WinAttributes(); |
~WinAttributes(); |
@@ -887,6 +912,9 @@ BrowserAccessibilityWin |
// Hypertext. |
base::string16 hypertext; |
+ // Maps each style span to its start offset in hypertext. |
+ base::hash_map<int, std::vector<base::string16>> offset_to_text_attributes; |
+ |
// Maps the |hypertext_| embedded character offset to an index in |
// |hyperlinks_|. |
std::map<int32_t, int32_t> hyperlink_offset_to_index; |