diff options
author | ctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-08 00:02:37 +0000 |
---|---|---|
committer | ctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-08 00:02:37 +0000 |
commit | 27b40e1d14ffa70ed9d46039ea251d7b9f417fed (patch) | |
tree | 50f4c07e05ba1fdfc462de6858b59fff18ba0d22 | |
parent | 33a6db37d419babe707a987ab4a3ce7585ffa0ca (diff) | |
download | chromium_src-27b40e1d14ffa70ed9d46039ea251d7b9f417fed.zip chromium_src-27b40e1d14ffa70ed9d46039ea251d7b9f417fed.tar.gz chromium_src-27b40e1d14ffa70ed9d46039ea251d7b9f417fed.tar.bz2 |
Implement ISimpleDOM COM interface in BrowserAccessibility. Also update
a few IAccessible2 functions with some of the new attributes that are
available now.
BUG=48185
TEST=None
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=58491
Review URL: http://codereview.chromium.org/3219009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58776 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/accessibility_win_browsertest.cc | 12 | ||||
-rw-r--r-- | chrome/browser/browser_accessibility_win.cc | 458 | ||||
-rw-r--r-- | chrome/browser/browser_accessibility_win.h | 144 |
3 files changed, 543 insertions, 71 deletions
diff --git a/chrome/browser/accessibility_win_browsertest.cc b/chrome/browser/accessibility_win_browsertest.cc index a917f67..b75554e 100644 --- a/chrome/browser/accessibility_win_browsertest.cc +++ b/chrome/browser/accessibility_win_browsertest.cc @@ -362,12 +362,12 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, AccessibleChecker button_checker(L"push", ROLE_SYSTEM_PUSHBUTTON, L"push"); AccessibleChecker checkbox_checker(L"", ROLE_SYSTEM_CHECKBUTTON, L""); - AccessibleChecker grouping_checker(L"", L"div", L""); - grouping_checker.AppendExpectedChild(&button_checker); - grouping_checker.AppendExpectedChild(&checkbox_checker); + AccessibleChecker body_checker(L"", L"BODY", L""); + body_checker.AppendExpectedChild(&button_checker); + body_checker.AppendExpectedChild(&checkbox_checker); AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); - document_checker.AppendExpectedChild(&grouping_checker); + document_checker.AppendExpectedChild(&body_checker); // Check the accessible tree of the renderer. document_checker.CheckAccessible(document_accessible); @@ -406,14 +406,14 @@ IN_PROC_BROWSER_TEST_F(AccessibilityWinBrowserTest, AccessibleChecker text_checker(L"", ROLE_SYSTEM_TEXT, L"old text"); - AccessibleChecker div1_checker(L"", L"div", L""); + AccessibleChecker div1_checker(L"", L"DIV", L""); div1_checker.AppendExpectedChild(&text_checker); AccessibleChecker checkbox_checker(L"", ROLE_SYSTEM_CHECKBUTTON, L""); checkbox_checker.SetExpectedState( STATE_SYSTEM_FOCUSABLE | STATE_SYSTEM_READONLY); - AccessibleChecker div2_checker(L"", L"div", L""); + AccessibleChecker div2_checker(L"", L"DIV", L""); div2_checker.AppendExpectedChild(&checkbox_checker); AccessibleChecker document_checker(L"", ROLE_SYSTEM_DOCUMENT, L""); diff --git a/chrome/browser/browser_accessibility_win.cc b/chrome/browser/browser_accessibility_win.cc index 404d73e..adb539f 100644 --- a/chrome/browser/browser_accessibility_win.cc +++ b/chrome/browser/browser_accessibility_win.cc @@ -5,7 +5,10 @@ #include "chrome/browser/browser_accessibility_win.h" #include "base/logging.h" +#include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "chrome/browser/browser_accessibility_manager_win.h" +#include "net/base/escape.h" using webkit_glue::WebAccessibility; @@ -39,6 +42,7 @@ void BrowserAccessibility::Initialize( name_ = src.name; value_ = src.value; attributes_ = src.attributes; + html_attributes_ = src.html_attributes; location_ = src.location; InitRoleAndState(src.role, src.state); @@ -105,6 +109,7 @@ BrowserAccessibility* BrowserAccessibility::GetPreviousSibling() { BrowserAccessibility* BrowserAccessibility::GetNextSibling() { if (parent_ && + index_in_parent_ >= 0 && index_in_parent_ < static_cast<int>(parent_->children_.size() - 1)) { return parent_->children_[index_in_parent_ + 1]; } @@ -271,17 +276,8 @@ STDMETHODIMP BrowserAccessibility::get_accDefaultAction(VARIANT var_id, if (!target) return E_INVALIDARG; - string16 action; - if (!target->GetAttribute(WebAccessibility::ATTR_SHORTCUT, &action)) - return S_FALSE; - - if (action.empty()) - return S_FALSE; - - *def_action = SysAllocString(action.c_str()); - - DCHECK(*def_action); - return S_OK; + return target->GetAttributeAsBstr( + WebAccessibility::ATTR_SHORTCUT, def_action); } STDMETHODIMP BrowserAccessibility::get_accDescription(VARIANT var_id, @@ -296,17 +292,7 @@ STDMETHODIMP BrowserAccessibility::get_accDescription(VARIANT var_id, if (!target) return E_INVALIDARG; - string16 description; - if (!target->GetAttribute(WebAccessibility::ATTR_DESCRIPTION, &description)) - return S_FALSE; - - if (description.empty()) - return S_FALSE; - - *desc = SysAllocString(description.c_str()); - - DCHECK(*desc); - return S_OK; + return target->GetAttributeAsBstr(WebAccessibility::ATTR_DESCRIPTION, desc); } STDMETHODIMP BrowserAccessibility::get_accFocus(VARIANT* focus_child) { @@ -341,17 +327,7 @@ STDMETHODIMP BrowserAccessibility::get_accHelp(VARIANT var_id, BSTR* help) { if (!target) return E_INVALIDARG; - string16 help_str; - if (!target->GetAttribute(WebAccessibility::ATTR_HELP, &help_str)) - return S_FALSE; - - if (help_str.empty()) - return S_FALSE; - - *help = SysAllocString(help_str.c_str()); - - DCHECK(*help); - return S_OK; + return target->GetAttributeAsBstr(WebAccessibility::ATTR_HELP, help); } STDMETHODIMP BrowserAccessibility::get_accKeyboardShortcut(VARIANT var_id, @@ -366,17 +342,7 @@ STDMETHODIMP BrowserAccessibility::get_accKeyboardShortcut(VARIANT var_id, if (!target) return E_INVALIDARG; - string16 shortcut; - if (!target->GetAttribute(WebAccessibility::ATTR_SHORTCUT, &shortcut)) - return S_FALSE; - - if (shortcut.empty()) - return S_FALSE; - - *acc_key = SysAllocString(shortcut.c_str()); - - DCHECK(*acc_key); - return S_OK; + return target->GetAttributeAsBstr(WebAccessibility::ATTR_SHORTCUT, acc_key); } STDMETHODIMP BrowserAccessibility::get_accName(VARIANT var_id, BSTR* name) { @@ -524,7 +490,23 @@ STDMETHODIMP BrowserAccessibility::get_attributes(BSTR* attributes) { if (!attributes) return E_INVALIDARG; - return S_FALSE; + // Follow Firefox's convention, which is to return a set of key-value pairs + // separated by semicolons, with a colon between the key and the value. + string16 str; + for (unsigned int i = 0; i < html_attributes_.size(); i++) { + if (i != 0) + str += L';'; + str += Escape(html_attributes_[i].first); + str += L':'; + str += Escape(html_attributes_[i].second); + } + + if (str.empty()) + return S_FALSE; + + *attributes = SysAllocString(str.c_str()); + DCHECK(*attributes); + return S_OK; } STDMETHODIMP BrowserAccessibility::get_states(AccessibleStates* states) { @@ -583,17 +565,7 @@ STDMETHODIMP BrowserAccessibility::get_description(BSTR* desc) { if (!desc) return E_INVALIDARG; - string16 description; - if (!GetAttribute(WebAccessibility::ATTR_DESCRIPTION, &description)) - return S_FALSE; - - if (description.empty()) - return S_FALSE; - - *desc = SysAllocString(description.c_str()); - - DCHECK(*desc); - return S_OK; + return GetAttributeAsBstr(WebAccessibility::ATTR_DESCRIPTION, desc); } STDMETHODIMP BrowserAccessibility::get_imagePosition( @@ -665,17 +637,342 @@ STDMETHODIMP BrowserAccessibility::get_text( if (end_offset > len) end_offset = len; - *text = SysAllocString( - name_.substr(start_offset, end_offset - start_offset).c_str()); + string16 substr = name_.substr(start_offset, end_offset - start_offset); + if (substr.empty()) + return S_FALSE; + + *text = SysAllocString(substr.c_str()); + DCHECK(*text); return S_OK; } STDMETHODIMP BrowserAccessibility::get_caretOffset(long* offset) { + if (!instance_active_) + return E_FAIL; + + if (!offset) + return E_INVALIDARG; + *offset = 0; return S_OK; } // +// ISimpleDOMDocument methods. +// + +STDMETHODIMP BrowserAccessibility::get_URL(BSTR* url) { + if (!instance_active_) + return E_FAIL; + + if (!url) + return E_INVALIDARG; + + return GetAttributeAsBstr(WebAccessibility::ATTR_DOC_URL, url); +} + +STDMETHODIMP BrowserAccessibility::get_title(BSTR* title) { + if (!instance_active_) + return E_FAIL; + + if (!title) + return E_INVALIDARG; + + return GetAttributeAsBstr(WebAccessibility::ATTR_DOC_TITLE, title); +} + +STDMETHODIMP BrowserAccessibility::get_mimeType(BSTR* mime_type) { + if (!instance_active_) + return E_FAIL; + + if (!mime_type) + return E_INVALIDARG; + + return GetAttributeAsBstr(WebAccessibility::ATTR_DOC_MIMETYPE, mime_type); +} + +STDMETHODIMP BrowserAccessibility::get_docType(BSTR* doc_type) { + if (!instance_active_) + return E_FAIL; + + if (!doc_type) + return E_INVALIDARG; + + return GetAttributeAsBstr(WebAccessibility::ATTR_DOC_DOCTYPE, doc_type); +} + +// +// ISimpleDOMNode methods. +// + +STDMETHODIMP BrowserAccessibility::get_nodeInfo( + BSTR* node_name, + short* name_space_id, + BSTR* node_value, + unsigned int* num_children, + unsigned int* unique_id, + unsigned short* node_type) { + if (!instance_active_) + return E_FAIL; + + if (!node_name || !name_space_id || !node_value || !num_children || + !unique_id || !node_type) { + return E_INVALIDARG; + } + + string16 tag; + if (GetAttribute(WebAccessibility::ATTR_HTML_TAG, &tag)) + *node_name = SysAllocString(tag.c_str()); + else + *node_name = NULL; + + *name_space_id = 0; + *node_value = SysAllocString(value_.c_str()); + *num_children = children_.size(); + *unique_id = child_id_; + + if (role_ == ROLE_SYSTEM_DOCUMENT) { + *node_type = NODETYPE_DOCUMENT; + } else if (role_ == ROLE_SYSTEM_TEXT && + ((ia2_state_ & IA2_STATE_EDITABLE) == 0)) { + *node_type = NODETYPE_TEXT; + } else { + *node_type = NODETYPE_ELEMENT; + } + + return S_OK; +} + +STDMETHODIMP BrowserAccessibility::get_attributes( + unsigned short max_attribs, + BSTR* attrib_names, + short* name_space_id, + BSTR* attrib_values, + unsigned short* num_attribs) { + if (!instance_active_) + return E_FAIL; + + if (!attrib_names || !name_space_id || !attrib_values || !num_attribs) + return E_INVALIDARG; + + *num_attribs = max_attribs; + if (*num_attribs > html_attributes_.size()) + *num_attribs = html_attributes_.size(); + + for (unsigned short i = 0; i < *num_attribs; ++i) { + attrib_names[i] = SysAllocString(html_attributes_[i].first.c_str()); + name_space_id[i] = 0; + attrib_values[i] = SysAllocString(html_attributes_[i].second.c_str()); + } + return S_OK; +} + +STDMETHODIMP BrowserAccessibility::get_attributesForNames( + unsigned short num_attribs, + BSTR* attrib_names, + short* name_space_id, + BSTR* attrib_values) { + if (!instance_active_) + return E_FAIL; + + if (!attrib_names || !name_space_id || !attrib_values) + return E_INVALIDARG; + + for (unsigned short i = 0; i < num_attribs; ++i) { + name_space_id[i] = 0; + bool found = false; + string16 name = (LPCWSTR)attrib_names[i]; + for (unsigned int j = 0; j < html_attributes_.size(); ++j) { + if (html_attributes_[j].first == name) { + attrib_values[i] = SysAllocString(html_attributes_[j].second.c_str()); + found = true; + break; + } + } + if (!found) { + attrib_values[i] = NULL; + } + } + return S_OK; +} + +STDMETHODIMP BrowserAccessibility::get_computedStyle( + unsigned short max_style_properties, + boolean use_alternate_view, + BSTR *style_properties, + BSTR *style_values, + unsigned short *num_style_properties) { + if (!instance_active_) + return E_FAIL; + + if (!style_properties || !style_values) + return E_INVALIDARG; + + // We only cache a single style property for now: DISPLAY + + if (max_style_properties == 0 || + !HasAttribute(WebAccessibility::ATTR_DISPLAY)) { + *num_style_properties = 0; + return S_OK; + } + + string16 display; + GetAttribute(WebAccessibility::ATTR_DISPLAY, &display); + *num_style_properties = 1; + style_properties[0] = SysAllocString(L"display"); + style_values[0] = SysAllocString(display.c_str()); + + return S_OK; +} + +STDMETHODIMP BrowserAccessibility::get_computedStyleForProperties( + unsigned short num_style_properties, + boolean use_alternate_view, + BSTR* style_properties, + BSTR* style_values) { + if (!instance_active_) + return E_FAIL; + + if (!style_properties || !style_values) + return E_INVALIDARG; + + // We only cache a single style property for now: DISPLAY + + for (unsigned short i = 0; i < num_style_properties; i++) { + string16 name = (LPCWSTR)style_properties[i]; + StringToLowerASCII(&name); + if (name == L"display") { + string16 display; + GetAttribute(WebAccessibility::ATTR_DISPLAY, &display); + style_values[i] = SysAllocString(display.c_str()); + } else { + style_values[i] = NULL; + } + } + + return S_OK; +} + +STDMETHODIMP BrowserAccessibility::scrollTo(boolean placeTopLeft) { + return E_NOTIMPL; +} + +STDMETHODIMP BrowserAccessibility::get_parentNode(ISimpleDOMNode** node) { + if (!instance_active_) + return E_FAIL; + + if (!node) + return E_INVALIDARG; + + *node = parent_->NewReference(); + return S_OK; +} + +STDMETHODIMP BrowserAccessibility::get_firstChild(ISimpleDOMNode** node) { + if (!instance_active_) + return E_FAIL; + + if (!node) + return E_INVALIDARG; + + if (children_.size()) { + *node = children_[0]->NewReference(); + return S_OK; + } else { + *node = NULL; + return S_FALSE; + } +} + +STDMETHODIMP BrowserAccessibility::get_lastChild(ISimpleDOMNode** node) { + if (!instance_active_) + return E_FAIL; + + if (!node) + return E_INVALIDARG; + + if (children_.size()) { + *node = children_[children_.size() - 1]->NewReference(); + return S_OK; + } else { + *node = NULL; + return S_FALSE; + } +} + +STDMETHODIMP BrowserAccessibility::get_previousSibling( + ISimpleDOMNode** node) { + if (!instance_active_) + return E_FAIL; + + if (!node) + return E_INVALIDARG; + + if (parent_ && index_in_parent_ > 0) { + *node = parent_->children_[index_in_parent_ - 1]->NewReference(); + return S_OK; + } else { + *node = NULL; + return S_FALSE; + } +} + +STDMETHODIMP BrowserAccessibility::get_nextSibling(ISimpleDOMNode** node) { + if (!instance_active_) + return E_FAIL; + + if (!node) + return E_INVALIDARG; + + if (parent_ && + index_in_parent_ >= 0 && + index_in_parent_ < static_cast<int>(parent_->children_.size()) - 1) { + *node = parent_->children_[index_in_parent_ + 1]->NewReference(); + return S_OK; + } else { + *node = NULL; + return S_FALSE; + } +} + +STDMETHODIMP BrowserAccessibility::get_childAt( + unsigned int child_index, + ISimpleDOMNode** node) { + if (!instance_active_) + return E_FAIL; + + if (!node) + return E_INVALIDARG; + + if (child_index < children_.size()) { + *node = children_[child_index]->NewReference(); + return S_OK; + } else { + *node = NULL; + return S_FALSE; + } +} + +// +// ISimpleDOMText methods. +// + +STDMETHODIMP BrowserAccessibility::get_domText(BSTR* dom_text) { + if (!instance_active_) + return E_FAIL; + + if (!dom_text) + return E_INVALIDARG; + + if (name_.empty()) + return S_FALSE; + + *dom_text = SysAllocString(name_.c_str()); + DCHECK(*dom_text); + return S_OK; +} + +// // IServiceProvider methods. // @@ -684,8 +981,15 @@ STDMETHODIMP BrowserAccessibility::QueryService( if (!instance_active_) return E_FAIL; - if (guidService == IID_IAccessible || guidService == IID_IAccessible2) + if (guidService == IID_IAccessible || + guidService == IID_IAccessible2 || + guidService == IID_IAccessibleImage || + guidService == IID_IAccessibleText || + guidService == IID_ISimpleDOMDocument || + guidService == IID_ISimpleDOMNode || + guidService == IID_ISimpleDOMText) { return QueryInterface(riid, object); + } *object = NULL; return E_FAIL; @@ -710,6 +1014,11 @@ HRESULT WINAPI BrowserAccessibility::InternalQueryInterface( *object = NULL; return E_NOINTERFACE; } + } else if (iid == IID_ISimpleDOMDocument) { + if (role_ != ROLE_SYSTEM_DOCUMENT) { + *object = NULL; + return E_NOINTERFACE; + } } return CComObjectRootBase::InternalQueryInterface( @@ -750,6 +1059,26 @@ bool BrowserAccessibility::GetAttribute( return false; } +HRESULT BrowserAccessibility::GetAttributeAsBstr( + WebAccessibility::Attribute attribute, BSTR* value_bstr) { + string16 str; + + if (!GetAttribute(attribute, &str)) + return S_FALSE; + + if (str.empty()) + return S_FALSE; + + *value_bstr = SysAllocString(str.c_str()); + DCHECK(*value_bstr); + + return S_OK; +} + +string16 BrowserAccessibility::Escape(string16 str) { + return UTF8ToUTF16(EscapeNonASCII(UTF16ToUTF8(str))); +} + void BrowserAccessibility::InitRoleAndState(LONG web_role, LONG web_state) { state_ = 0; @@ -817,7 +1146,7 @@ void BrowserAccessibility::InitRoleAndState(LONG web_role, role_ = ROLE_SYSTEM_COMBOBOX; break; case WebAccessibility::ROLE_DEFINITION_LIST_DEFINITION: - role_name_ = L"dd"; + GetAttribute(WebAccessibility::ATTR_HTML_TAG, &role_name_); ia2_role_ = IA2_ROLE_PARAGRAPH; break; case WebAccessibility::ROLE_DEFINITION_LIST_TERM: @@ -841,19 +1170,20 @@ void BrowserAccessibility::InitRoleAndState(LONG web_role, role_ = ROLE_SYSTEM_TABLE; break; case WebAccessibility::ROLE_GROUP: - role_name_ = L"div"; + GetAttribute(WebAccessibility::ATTR_HTML_TAG, &role_name_); + if (role_name_.empty()) + role_name_ = L"DIV"; ia2_role_ = IA2_ROLE_SECTION; break; case WebAccessibility::ROLE_HEADING: - // TODO(dmazzoni): support all heading levels - role_name_ = L"h1"; + GetAttribute(WebAccessibility::ATTR_HTML_TAG, &role_name_); ia2_role_ = IA2_ROLE_HEADING; break; case WebAccessibility::ROLE_IMAGE: role_ = ROLE_SYSTEM_GRAPHIC; break; case WebAccessibility::ROLE_IMAGE_MAP: - role_name_ = L"map"; + GetAttribute(WebAccessibility::ATTR_HTML_TAG, &role_name_); ia2_role_ = IA2_ROLE_IMAGE_MAP; break; case WebAccessibility::ROLE_IMAGE_MAP_LINK: diff --git a/chrome/browser/browser_accessibility_win.h b/chrome/browser/browser_accessibility_win.h index c9135f3..76cb59d 100644 --- a/chrome/browser/browser_accessibility_win.h +++ b/chrome/browser/browser_accessibility_win.h @@ -15,6 +15,9 @@ #include "chrome/browser/browser_accessibility_manager_win.h" #include "ia2_api_all.h" // Generated +#include "ISimpleDOMDocument.h" // Generated +#include "ISimpleDOMNode.h" // Generated +#include "ISimpleDOMText.h" // Generated #include "webkit/glue/webaccessibility.h" using webkit_glue::WebAccessibility; @@ -34,7 +37,10 @@ class ATL_NO_VTABLE BrowserAccessibility &LIBID_IAccessible2Lib>, public IAccessibleImage, public IAccessibleText, - public IServiceProvider { + public IServiceProvider, + public ISimpleDOMDocument, + public ISimpleDOMNode, + public ISimpleDOMText { public: BEGIN_COM_MAP(BrowserAccessibility) COM_INTERFACE_ENTRY2(IDispatch, IAccessible2) @@ -43,6 +49,9 @@ class ATL_NO_VTABLE BrowserAccessibility COM_INTERFACE_ENTRY(IAccessibleImage) COM_INTERFACE_ENTRY(IAccessibleText) COM_INTERFACE_ENTRY(IServiceProvider) + COM_INTERFACE_ENTRY(ISimpleDOMDocument) + COM_INTERFACE_ENTRY(ISimpleDOMNode) + COM_INTERFACE_ENTRY(ISimpleDOMText) END_COM_MAP() BrowserAccessibility(); @@ -338,6 +347,129 @@ class ATL_NO_VTABLE BrowserAccessibility } // + // ISimpleDOMDocument methods. + // + + STDMETHODIMP get_URL(BSTR* url); + + STDMETHODIMP get_title(BSTR* title); + + STDMETHODIMP get_mimeType(BSTR* mime_type); + + STDMETHODIMP get_docType(BSTR* doc_type); + + STDMETHODIMP get_nameSpaceURIForID( + short name_space_id, BSTR *name_space_uri) { + return E_NOTIMPL; + } + STDMETHODIMP put_alternateViewMediaTypes( + BSTR *comma_separated_media_types) { + return E_NOTIMPL; + } + + // + // ISimpleDOMNode methods. + // + + STDMETHODIMP get_nodeInfo( + BSTR* node_name, + short* name_space_id, + BSTR* node_value, + unsigned int* num_children, + unsigned int* unique_id, + unsigned short* node_type); + + STDMETHODIMP get_attributes( + unsigned short max_attribs, + BSTR* attrib_names, + short* name_space_id, + BSTR* attrib_values, + unsigned short* num_attribs); + + STDMETHODIMP get_attributesForNames( + unsigned short num_attribs, + BSTR* attrib_names, + short* name_space_id, + BSTR* attrib_values); + + STDMETHODIMP get_computedStyle( + unsigned short max_style_properties, + boolean use_alternate_view, + BSTR *style_properties, + BSTR *style_values, + unsigned short *num_style_properties); + + STDMETHODIMP get_computedStyleForProperties( + unsigned short num_style_properties, + boolean use_alternate_view, + BSTR* style_properties, + BSTR* style_values); + + STDMETHODIMP scrollTo(boolean placeTopLeft); + + STDMETHODIMP get_parentNode(ISimpleDOMNode** node); + + STDMETHODIMP get_firstChild(ISimpleDOMNode** node); + + STDMETHODIMP get_lastChild(ISimpleDOMNode** node); + + STDMETHODIMP get_previousSibling(ISimpleDOMNode** node); + + STDMETHODIMP get_nextSibling(ISimpleDOMNode** node); + + STDMETHODIMP get_childAt( + unsigned int child_index, + ISimpleDOMNode** node); + + STDMETHODIMP get_innerHTML(BSTR* innerHTML) { + return E_NOTIMPL; + } + + STDMETHODIMP get_localInterface(void** local_interface) { + return E_NOTIMPL; + } + + STDMETHODIMP get_language(BSTR* language) { + return E_NOTIMPL; + } + + // + // ISimpleDOMText methods. + // + + STDMETHODIMP get_domText(BSTR* dom_text); + + STDMETHODIMP get_clippedSubstringBounds( + unsigned int start_index, + unsigned int end_index, + int* x, + int* y, + int* width, + int* height) { + return E_NOTIMPL; + } + + STDMETHODIMP get_unclippedSubstringBounds( + unsigned int start_index, + unsigned int end_index, + int* x, + int* y, + int* width, + int* height) { + return E_NOTIMPL; + } + + STDMETHODIMP scrollToSubstring( + unsigned int start_index, + unsigned int end_index) { + return E_NOTIMPL; + } + + STDMETHODIMP get_fontFamily(BSTR *font_family) { + return E_NOTIMPL; + } + + // // IServiceProvider methods. // @@ -372,6 +504,15 @@ class ATL_NO_VTABLE BrowserAccessibility // returns true if found. bool GetAttribute(WebAccessibility::Attribute attribute, string16* value); + // Retrieve the string value of an attribute from the attribute map and + // if found and nonempty, allocate a new BSTR (with SysAllocString) + // and return S_OK. If not found or empty, return S_FALSE. + HRESULT GetAttributeAsBstr( + WebAccessibility::Attribute attribute, BSTR* value_bstr); + + // Escape a string like it would be escaped for a URL or HTML form. + string16 Escape(string16 str); + // The manager of this tree of accessibility objects; needed for // global operations like focus tracking. BrowserAccessibilityManager* manager_; @@ -392,6 +533,7 @@ class ATL_NO_VTABLE BrowserAccessibility string16 name_; string16 value_; std::map<int32, string16> attributes_; + std::vector<std::pair<string16, string16> > html_attributes_; LONG role_; LONG state_; |