Commit 264fce03 authored by dougt's avatar dougt Committed by Commit Bot

Move ia2_attributes handling to AXPlatformNodeWin.

BUG=703369

Review-Url: https://codereview.chromium.org/2975413002
Cr-Commit-Position: refs/heads/master@{#487194}
parent 9c1d421f
...@@ -788,19 +788,6 @@ class __declspec(uuid("562072fe-3390-43b1-9e2c-dd4118f5ac79")) ...@@ -788,19 +788,6 @@ class __declspec(uuid("562072fe-3390-43b1-9e2c-dd4118f5ac79"))
// Sets the selection given a start and end offset in IA2 Hypertext. // Sets the selection given a start and end offset in IA2 Hypertext.
void SetIA2HypertextSelection(LONG start_offset, LONG end_offset); void SetIA2HypertextSelection(LONG start_offset, LONG end_offset);
// If the string attribute |attribute| is present, add its value as an
// IAccessible2 attribute with the name |ia2_attr|.
void StringAttributeToIA2(ui::AXStringAttribute attribute,
const char* ia2_attr);
// If the bool attribute |attribute| is present, add its value as an
// IAccessible2 attribute with the name |ia2_attr|.
void BoolAttributeToIA2(ui::AXBoolAttribute attribute, const char* ia2_attr);
// If the int attribute |attribute| is present, add its value as an
// IAccessible2 attribute with the name |ia2_attr|.
void IntAttributeToIA2(ui::AXIntAttribute attribute, const char* ia2_attr);
// //
// Helper methods for IA2 hyperlinks. // Helper methods for IA2 hyperlinks.
// //
...@@ -850,13 +837,6 @@ class __declspec(uuid("562072fe-3390-43b1-9e2c-dd4118f5ac79")) ...@@ -850,13 +837,6 @@ class __declspec(uuid("562072fe-3390-43b1-9e2c-dd4118f5ac79"))
// selection.) // selection.)
void GetSelectionOffsets(int* selection_start, int* selection_end) const; void GetSelectionOffsets(int* selection_start, int* selection_end) const;
// Get the range value text, which might come from aria-valuetext or
// a floating-point value. This is different from the value string
// attribute used in input controls such as text boxes and combo boxes.
base::string16 GetRangeValueText();
// Return true for roles that support the value interface
bool IsRangeValueSupported();
bool IsSameHypertextCharacter(size_t old_char_index, size_t new_char_index); bool IsSameHypertextCharacter(size_t old_char_index, size_t new_char_index);
void ComputeHypertextRemovedAndInserted(int* start, void ComputeHypertextRemovedAndInserted(int* start,
...@@ -911,9 +891,6 @@ class __declspec(uuid("562072fe-3390-43b1-9e2c-dd4118f5ac79")) ...@@ -911,9 +891,6 @@ class __declspec(uuid("562072fe-3390-43b1-9e2c-dd4118f5ac79"))
void RemoveTargetFromRelation(const base::string16& relation_type, void RemoveTargetFromRelation(const base::string16& relation_type,
int target_id); int target_id);
// Updates object attributes of IA2 with html attributes.
void UpdateRequiredAttributes();
// Fire a Windows-specific accessibility event notification on this node. // Fire a Windows-specific accessibility event notification on this node.
void FireNativeEvent(LONG win_event_type) const; void FireNativeEvent(LONG win_event_type) const;
struct WinAttributes { struct WinAttributes {
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "ui/accessibility/platform/ax_platform_node_base.h" #include "ui/accessibility/platform/ax_platform_node_base.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "ui/accessibility/ax_action_data.h" #include "ui/accessibility/ax_action_data.h"
#include "ui/accessibility/ax_node_data.h" #include "ui/accessibility/ax_node_data.h"
...@@ -337,6 +338,16 @@ bool AXPlatformNodeBase::IsRangeValueSupported() const { ...@@ -337,6 +338,16 @@ bool AXPlatformNodeBase::IsRangeValueSupported() const {
} }
} }
base::string16 AXPlatformNodeBase::GetRangeValueText() {
float fval;
base::string16 value = GetString16Attribute(ui::AX_ATTR_VALUE);
if (value.empty() && GetFloatAttribute(ui::AX_ATTR_VALUE_FOR_RANGE, &fval)) {
value = base::UTF8ToUTF16(base::DoubleToString(fval));
}
return value;
}
AXPlatformNodeBase* AXPlatformNodeBase::GetTable() const { AXPlatformNodeBase* AXPlatformNodeBase::GetTable() const {
if (!delegate_) if (!delegate_)
return nullptr; return nullptr;
......
...@@ -130,6 +130,11 @@ class AX_EXPORT AXPlatformNodeBase : public AXPlatformNode { ...@@ -130,6 +130,11 @@ class AX_EXPORT AXPlatformNodeBase : public AXPlatformNode {
bool IsRichTextControl(); bool IsRichTextControl();
bool IsRangeValueSupported() const; bool IsRangeValueSupported() const;
// Get the range value text, which might come from aria-valuetext or
// a floating-point value. This is different from the value string
// attribute used in input controls such as text boxes and combo boxes.
base::string16 GetRangeValueText();
// |GetInnerText| recursively includes all the text from descendants such as // |GetInnerText| recursively includes all the text from descendants such as
// text found in any embedded object. // text found in any embedded object.
base::string16 GetInnerText(); base::string16 GetInnerText();
......
...@@ -593,9 +593,11 @@ class AX_EXPORT __declspec(uuid("26f5641a-246d-457b-a96d-07f3fae6acf2")) ...@@ -593,9 +593,11 @@ class AX_EXPORT __declspec(uuid("26f5641a-246d-457b-a96d-07f3fae6acf2"))
int MSAARole(); int MSAARole();
std::string StringOverrideForMSAARole(); std::string StringOverrideForMSAARole();
int32_t IA2State(); int32_t ComputeIA2State();
int32_t IA2Role(); int32_t ComputeIA2Role();
std::vector<base::string16> ComputeIA2Attributes();
// AXPlatformNodeBase overrides. // AXPlatformNodeBase overrides.
void Dispose() override; void Dispose() override;
...@@ -610,6 +612,32 @@ class AX_EXPORT __declspec(uuid("26f5641a-246d-457b-a96d-07f3fae6acf2")) ...@@ -610,6 +612,32 @@ class AX_EXPORT __declspec(uuid("26f5641a-246d-457b-a96d-07f3fae6acf2"))
ui::AXStringAttribute attribute, ui::AXStringAttribute attribute,
BSTR* value_bstr) const; BSTR* value_bstr) const;
// Escapes characters in string attributes as required by the IA2 Spec.
// It's okay for input to be the same as output.
static void SanitizeStringAttributeForIA2(const base::string16& input,
base::string16* output);
// Sets the selection given a start and end offset in IA2 Hypertext.
void SetIA2HypertextSelection(LONG start_offset, LONG end_offset);
// If the string attribute |attribute| is present, add its value as an
// IAccessible2 attribute with the name |ia2_attr|.
void StringAttributeToIA2(std::vector<base::string16>& attributes,
ui::AXStringAttribute attribute,
const char* ia2_attr);
// If the bool attribute |attribute| is present, add its value as an
// IAccessible2 attribute with the name |ia2_attr|.
void BoolAttributeToIA2(std::vector<base::string16>& attributes,
ui::AXBoolAttribute attribute,
const char* ia2_attr);
// If the int attribute |attribute| is present, add its value as an
// IAccessible2 attribute with the name |ia2_attr|.
void IntAttributeToIA2(std::vector<base::string16>& attributes,
ui::AXIntAttribute attribute,
const char* ia2_attr);
void AddAlertTarget(); void AddAlertTarget();
void RemoveAlertTarget(); void RemoveAlertTarget();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment