| Index: content/browser/accessibility/browser_accessibility_win.cc
|
| diff --git a/content/browser/accessibility/browser_accessibility_win.cc b/content/browser/accessibility/browser_accessibility_win.cc
|
| index 74994bd94aa4882f768d713dd2bfa72dc3f247d5..14e4bc791a68b25d1de57eebde58d21ed5789d5b 100644
|
| --- a/content/browser/accessibility/browser_accessibility_win.cc
|
| +++ b/content/browser/accessibility/browser_accessibility_win.cc
|
| @@ -605,16 +605,14 @@ STDMETHODIMP BrowserAccessibilityWin::get_accValue(VARIANT var_id,
|
|
|
| // Expose color well value.
|
| if (target->ia2_role() == IA2_ROLE_COLOR_CHOOSER) {
|
| - int r = target->GetIntAttribute(
|
| - ui::AX_ATTR_COLOR_VALUE_RED);
|
| - int g = target->GetIntAttribute(
|
| - ui::AX_ATTR_COLOR_VALUE_GREEN);
|
| - int b = target->GetIntAttribute(
|
| - ui::AX_ATTR_COLOR_VALUE_BLUE);
|
| + int color = target->GetIntAttribute(ui::AX_ATTR_COLOR_VALUE);
|
| + int red = (color >> 16) & 0xFF;
|
| + int green = (color >> 8) & 0xFF;
|
| + int blue = color & 0xFF;
|
| base::string16 value_text;
|
| - value_text = base::IntToString16((r * 100) / 255) + L"% red " +
|
| - base::IntToString16((g * 100) / 255) + L"% green " +
|
| - base::IntToString16((b * 100) / 255) + L"% blue";
|
| + value_text = base::IntToString16((red * 100) / 255) + L"% red " +
|
| + base::IntToString16((green * 100) / 255) + L"% green " +
|
| + base::IntToString16((blue * 100) / 255) + L"% blue";
|
| *value = SysAllocString(value_text.c_str());
|
| DCHECK(*value);
|
| return S_OK;
|
| @@ -2382,15 +2380,37 @@ STDMETHODIMP BrowserAccessibilityWin::setSelection(LONG selection_index,
|
| return S_OK;
|
| }
|
|
|
| -//
|
| -// IAccessibleText methods not implemented.
|
| -//
|
| -
|
| STDMETHODIMP BrowserAccessibilityWin::get_attributes(LONG offset,
|
| LONG* start_offset,
|
| LONG* end_offset,
|
| BSTR* text_attributes) {
|
| - return E_NOTIMPL;
|
| + if (!instance_active())
|
| + return E_FAIL;
|
| +
|
| + if (!start_offset || !end_offset || !text_attributes)
|
| + return E_INVALIDARG;
|
| +
|
| + const base::string16& text_str = TextForIAccessibleText();
|
| + HandleSpecialTextOffset(text_str, &offset);
|
| + if (offset < 0)
|
| + return E_INVALIDARG;
|
| +
|
| + LONG text_len = text_str.length();
|
| + if (offset > text_len)
|
| + return E_INVALIDARG;
|
| +
|
| + base::string16 attributes_str = GetTextAttributes();
|
| + if (attributes_str.empty()) {
|
| + *start_offset = 0;
|
| + *end_offset = 0;
|
| + return S_FALSE;
|
| + }
|
| +
|
| + *text_attributes = SysAllocString(attributes_str.c_str());
|
| + DCHECK(*text_attributes);
|
| + *start_offset = GetStyleChangeBoundary(offset, ui::BACKWARDS_DIRECTION);
|
| + *end_offset = GetStyleChangeBoundary(offset, ui::FORWARDS_DIRECTION);
|
| + return S_OK;
|
| }
|
|
|
| //
|
| @@ -3565,6 +3585,27 @@ void BrowserAccessibilityWin::OnLocationChanged() {
|
| EVENT_OBJECT_LOCATIONCHANGE, this);
|
| }
|
|
|
| +//
|
| +// Private methods.
|
| +//
|
| +
|
| +base::string16 BrowserAccessibilityWin::GetTextAttributes() const {
|
| + base::string16 text_attributes;
|
| + int background_color = GetIntAttribute(ui::AX_ATTR_BACKGROUND_COLOR);
|
| + int color = GetIntAttribute(ui::AX_ATTR_COLOR);
|
| + float font_size = GetFloatAttribute(ui::AX_ATTR_FONT_SIZE);
|
| + int red = (color >> 16) & 0xFF;
|
| + int green = (color >> 8) & 0xFF;
|
| + int blue = color & 0xFF;
|
| + base::string16 value_text;
|
| + value_text = base::IntToString16((red * 100) / 255) + L"% red " +
|
| + base::IntToString16((green * 100) / 255) + L"% green " +
|
| + base::IntToString16((blue * 100) / 255) + L"% blue";
|
| + *value = SysAllocString(value_text.c_str());
|
| + DCHECK(*value);
|
| + return text_attributes;
|
| +}
|
| +
|
| BrowserAccessibilityWin* BrowserAccessibilityWin::NewReference() {
|
| AddRef();
|
| return this;
|
|
|