summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/modules/accessibility/ax_sparse_attribute_setter.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/modules/accessibility/ax_sparse_attribute_setter.cc')
-rw-r--r--chromium/third_party/blink/renderer/modules/accessibility/ax_sparse_attribute_setter.cc85
1 files changed, 37 insertions, 48 deletions
diff --git a/chromium/third_party/blink/renderer/modules/accessibility/ax_sparse_attribute_setter.cc b/chromium/third_party/blink/renderer/modules/accessibility/ax_sparse_attribute_setter.cc
index 03304d21c14..9b37988098f 100644
--- a/chromium/third_party/blink/renderer/modules/accessibility/ax_sparse_attribute_setter.cc
+++ b/chromium/third_party/blink/renderer/modules/accessibility/ax_sparse_attribute_setter.cc
@@ -5,9 +5,16 @@
#include "third_party/blink/renderer/modules/accessibility/ax_sparse_attribute_setter.h"
#include "third_party/blink/renderer/core/dom/qualified_name.h"
#include "third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.h"
+#include "third_party/blink/renderer/platform/wtf/functional.h"
namespace blink {
+void SetIntAttribute(ax::mojom::blink::IntAttribute attribute,
+ ui::AXNodeData* node_data,
+ const AtomicString& value) {
+ node_data->AddIntAttribute(attribute, value.ToInt());
+}
+
class BoolAttributeSetter : public AXSparseAttributeSetter {
public:
BoolAttributeSetter(AXBoolAttribute attribute) : attribute_(attribute) {}
@@ -26,34 +33,6 @@ class BoolAttributeSetter : public AXSparseAttributeSetter {
}
};
-class IntAttributeSetter : public AXSparseAttributeSetter {
- public:
- IntAttributeSetter(AXIntAttribute attribute) : attribute_(attribute) {}
-
- private:
- AXIntAttribute attribute_;
-
- void Run(const AXObject& obj,
- AXSparseAttributeClient& attribute_map,
- const AtomicString& value) override {
- attribute_map.AddIntAttribute(attribute_, value.ToInt());
- }
-};
-
-class UIntAttributeSetter : public AXSparseAttributeSetter {
- public:
- UIntAttributeSetter(AXUIntAttribute attribute) : attribute_(attribute) {}
-
- private:
- AXUIntAttribute attribute_;
-
- void Run(const AXObject& obj,
- AXSparseAttributeClient& attribute_map,
- const AtomicString& value) override {
- attribute_map.AddUIntAttribute(attribute_, value.ToInt());
- }
-};
-
class StringAttributeSetter : public AXSparseAttributeSetter {
public:
StringAttributeSetter(AXStringAttribute attribute) : attribute_(attribute) {}
@@ -188,26 +167,43 @@ AXSparseAttributeSetterMap& GetSparseAttributeSetterMap() {
ax_sparse_attribute_setter_map.Set(
html_names::kAriaBusyAttr,
new BoolAttributeSetter(AXBoolAttribute::kAriaBusy));
- ax_sparse_attribute_setter_map.Set(
+ }
+ return ax_sparse_attribute_setter_map;
+}
+
+// TODO(meredithl): move the rest of the sparse attributes to this map.
+TempSetterMap& GetTempSetterMap(ui::AXNodeData* node_data) {
+ DEFINE_STATIC_LOCAL(TempSetterMap, temp_setter_map, ());
+ if (temp_setter_map.IsEmpty()) {
+ temp_setter_map.Set(
html_names::kAriaColcountAttr,
- new IntAttributeSetter(AXIntAttribute::kAriaColumnCount));
- ax_sparse_attribute_setter_map.Set(
+ WTF::BindRepeating(&SetIntAttribute,
+ ax::mojom::blink::IntAttribute::kAriaColumnCount));
+ temp_setter_map.Set(
html_names::kAriaColindexAttr,
- new UIntAttributeSetter(AXUIntAttribute::kAriaColumnIndex));
- ax_sparse_attribute_setter_map.Set(
+ WTF::BindRepeating(
+ &SetIntAttribute,
+ ax::mojom::blink::IntAttribute::kAriaCellColumnIndex));
+ temp_setter_map.Set(
html_names::kAriaColspanAttr,
- new UIntAttributeSetter(AXUIntAttribute::kAriaColumnSpan));
- ax_sparse_attribute_setter_map.Set(
+ WTF::BindRepeating(
+ &SetIntAttribute,
+ ax::mojom::blink::IntAttribute::kAriaCellColumnSpan));
+ temp_setter_map.Set(
html_names::kAriaRowcountAttr,
- new IntAttributeSetter(AXIntAttribute::kAriaRowCount));
- ax_sparse_attribute_setter_map.Set(
+ WTF::BindRepeating(&SetIntAttribute,
+ ax::mojom::blink::IntAttribute::kAriaRowCount));
+ temp_setter_map.Set(
html_names::kAriaRowindexAttr,
- new UIntAttributeSetter(AXUIntAttribute::kAriaRowIndex));
- ax_sparse_attribute_setter_map.Set(
+ WTF::BindRepeating(&SetIntAttribute,
+ ax::mojom::blink::IntAttribute::kAriaCellRowIndex));
+ temp_setter_map.Set(
html_names::kAriaRowspanAttr,
- new UIntAttributeSetter(AXUIntAttribute::kAriaRowSpan));
+ WTF::BindRepeating(&SetIntAttribute,
+ ax::mojom::blink::IntAttribute::kAriaCellRowSpan));
}
- return ax_sparse_attribute_setter_map;
+
+ return temp_setter_map;
}
void AXSparseAttributeAOMPropertyClient::AddStringProperty(
@@ -241,13 +237,6 @@ void AXSparseAttributeAOMPropertyClient::AddBooleanProperty(
sparse_attribute_client_.AddBoolAttribute(attribute, value);
}
-void AXSparseAttributeAOMPropertyClient::AddIntProperty(AOMIntProperty property,
- int32_t value) {}
-
-void AXSparseAttributeAOMPropertyClient::AddUIntProperty(
- AOMUIntProperty property,
- uint32_t value) {}
-
void AXSparseAttributeAOMPropertyClient::AddFloatProperty(
AOMFloatProperty property,
float value) {}