Chromium Code Reviews| Index: content/browser/accessibility/browser_accessibility.cc |
| =================================================================== |
| --- content/browser/accessibility/browser_accessibility.cc (revision 98225) |
| +++ content/browser/accessibility/browser_accessibility.cc (working copy) |
| @@ -6,8 +6,12 @@ |
| #include "base/logging.h" |
| #include "base/string_number_conversions.h" |
| +#include "base/string_util.h" |
| #include "content/browser/accessibility/browser_accessibility_manager.h" |
| +#include "content/common/view_messages.h" |
| +typedef WebAccessibility::BoolAttribute BoolAttribute; |
| +typedef WebAccessibility::FloatAttribute FloatAttribute; |
| typedef WebAccessibility::IntAttribute IntAttribute; |
| typedef WebAccessibility::StringAttribute StringAttribute; |
| @@ -55,18 +59,22 @@ |
| child_id_ = child_id; |
| index_in_parent_ = index_in_parent; |
| - renderer_id_ = src.id; |
| + // Update all of the rest of the attributes. |
| name_ = src.name; |
| value_ = src.value; |
| + role_ = src.role; |
| + state_ = src.state; |
| + renderer_id_ = src.id; |
| string_attributes_ = src.string_attributes; |
| int_attributes_ = src.int_attributes; |
| + float_attributes_ = src.float_attributes; |
| + bool_attributes_ = src.bool_attributes; |
| html_attributes_ = src.html_attributes; |
| location_ = src.location; |
| - role_ = src.role; |
| - state_ = src.state; |
| indirect_child_ids_ = src.indirect_child_ids; |
| line_breaks_ = src.line_breaks; |
| cell_ids_ = src.cell_ids; |
| + unique_cell_ids_ = src.unique_cell_ids; |
| Initialize(); |
| } |
| @@ -166,6 +174,16 @@ |
| ref_count_--; |
| if (ref_count_ == 0) { |
| + // Allow the object to fire a TEXT_REMOVED notification. |
| + name_.clear(); |
| + value_.clear(); |
| + SendNodeUpdateEvents(); |
| + |
| + manager_->NotifyAccessibilityEvent( |
| + ViewHostMsg_AccessibilityNotification_Type:: |
| + NOTIFICATION_TYPE_OBJECT_HIDE, |
| + this); |
|
David Tseng
2011/08/26 16:14:37
I think you want to align this with "ViewHostMsg_A
dmazzoni
2011/08/29 18:08:51
You're right, thanks!
|
| + |
| instance_active_ = false; |
| children_.clear(); |
| manager_->Remove(child_id_, renderer_id_); |
| @@ -201,3 +219,45 @@ |
| return false; |
| } |
| + |
| +bool BrowserAccessibility::GetFloatAttribute( |
| + FloatAttribute attribute, float* value) { |
| + std::map<FloatAttribute, float>::iterator iter = |
| + float_attributes_.find(attribute); |
| + if (iter != float_attributes_.end()) { |
| + *value = iter->second; |
| + return true; |
| + } |
| + |
| + return false; |
| +} |
| + |
| +bool BrowserAccessibility::GetBoolAttribute( |
| + BoolAttribute attribute, bool* value) { |
| + std::map<BoolAttribute, bool>::iterator iter = |
| + bool_attributes_.find(attribute); |
| + if (iter != bool_attributes_.end()) { |
| + *value = iter->second; |
| + return true; |
| + } |
| + |
| + return false; |
| +} |
| + |
| +bool BrowserAccessibility::GetHtmlAttribute( |
| + const char* html_attr, string16* value) { |
| + for (size_t i = 0; i < html_attributes_.size(); i++) { |
| + string16& attr = html_attributes_[i].first; |
| + if (LowerCaseEqualsASCII(attr, html_attr)) { |
| + *value = html_attributes_[i].second; |
| + return true; |
| + } |
| + } |
| + |
| + return false; |
| +} |
| + |
| +bool BrowserAccessibility::IsEditableText() { |
|
David Tseng
2011/08/26 16:14:37
const method?
dmazzoni
2011/08/29 18:08:51
Done. I made some other methods const as well.
|
| + return (role_ == WebAccessibility::ROLE_TEXT_FIELD || |
| + role_ == WebAccessibility::ROLE_TEXTAREA); |
| +} |