Commit 68e42afd authored by Chris Hall's avatar Chris Hall Committed by Commit Bot

Migrating ErrorMessage method from AXLayoutObject to AXNodeObject.

AX-Relnotes: N/A
Bug: 1093651
Change-Id: Iabc78cb0eb2ca3f583cf5eeaf8c07502d50da280
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2239142Reviewed-by: default avatarMeredith Lane <meredithl@chromium.org>
Reviewed-by: default avatarAlice Boxhall <aboxhall@chromium.org>
Commit-Queue: Chris Hall <chrishall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#779182}
parent 6dda5f61
...@@ -2060,22 +2060,6 @@ void AXLayoutObject::TextChanged() { ...@@ -2060,22 +2060,6 @@ void AXLayoutObject::TextChanged() {
AXNodeObject::TextChanged(); AXNodeObject::TextChanged();
} }
AXObject* AXLayoutObject::ErrorMessage() const {
// Check for aria-errormessage.
Element* existing_error_message =
GetAOMPropertyOrARIAAttribute(AOMRelationProperty::kErrorMessage);
if (existing_error_message)
return AXObjectCache().GetOrCreate(existing_error_message);
// Check for visible validationMessage. This can only be visible for a focused
// control. Corollary: if there is a visible validationMessage alert box, then
// it is related to the current focus.
if (this != AXObjectCache().FocusedObject())
return nullptr;
return AXObjectCache().ValidationMessageObjectIfInvalid();
}
// The following is a heuristic used to determine if a // The following is a heuristic used to determine if a
// <table> should be with ax::mojom::blink::Role::kTable or // <table> should be with ax::mojom::blink::Role::kTable or
// ax::mojom::blink::Role::kLayoutTable. // ax::mojom::blink::Role::kLayoutTable.
......
...@@ -176,10 +176,6 @@ class MODULES_EXPORT AXLayoutObject : public AXNodeObject { ...@@ -176,10 +176,6 @@ class MODULES_EXPORT AXLayoutObject : public AXNodeObject {
// For a table row or column. // For a table row or column.
AXObject* HeaderObject() const override; AXObject* HeaderObject() const override;
// The aria-errormessage object or native object from a validationMessage
// alert.
AXObject* ErrorMessage() const override;
// //
// Layout object specific methods. // Layout object specific methods.
// //
......
...@@ -3700,6 +3700,22 @@ void AXNodeObject::TextChanged() { ...@@ -3700,6 +3700,22 @@ void AXNodeObject::TextChanged() {
} }
} }
AXObject* AXNodeObject::ErrorMessage() const {
// Check for aria-errormessage.
Element* existing_error_message =
GetAOMPropertyOrARIAAttribute(AOMRelationProperty::kErrorMessage);
if (existing_error_message)
return AXObjectCache().GetOrCreate(existing_error_message);
// Check for visible validationMessage. This can only be visible for a focused
// control. Corollary: if there is a visible validationMessage alert box, then
// it is related to the current focus.
if (this != AXObjectCache().FocusedObject())
return nullptr;
return AXObjectCache().ValidationMessageObjectIfInvalid();
}
void AXNodeObject::ComputeAriaOwnsChildren( void AXNodeObject::ComputeAriaOwnsChildren(
HeapVector<Member<AXObject>>& owned_children) const { HeapVector<Member<AXObject>>& owned_children) const {
Vector<String> id_vector; Vector<String> id_vector;
......
...@@ -241,6 +241,10 @@ class MODULES_EXPORT AXNodeObject : public AXObject { ...@@ -241,6 +241,10 @@ class MODULES_EXPORT AXNodeObject : public AXObject {
void SelectionChanged() final; void SelectionChanged() final;
void TextChanged() override; void TextChanged() override;
// The aria-errormessage object or native object from a validationMessage
// alert.
AXObject* ErrorMessage() const override;
// Position in set and Size of set // Position in set and Size of set
int PosInSet() const override; int PosInSet() const override;
int SetSize() const override; int SetSize() const override;
......
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