summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorJonah <jonahshafran@gmail.com>2022-12-11 10:52:58 -0600
committerSam Atkins <atkinssj@gmail.com>2023-01-07 10:51:53 +0000
commitef48bd1878479595241c81ad69c22a63aa18a669 (patch)
tree921f8648e267f924c92d2d33f6efb6ebe66cb738 /Userland/Libraries
parente63d9d4925936caf3dbd9594299ab30ab7ada706 (diff)
downloadserenity-ef48bd1878479595241c81ad69c22a63aa18a669.zip
LibWeb: Add has_global_aria_attribute
This helper will be used to help determine tree inclusion.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibWeb/DOM/ARIAMixin.cpp26
-rw-r--r--Userland/Libraries/LibWeb/DOM/ARIAMixin.h2
2 files changed, 28 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/ARIAMixin.cpp b/Userland/Libraries/LibWeb/DOM/ARIAMixin.cpp
index f2a49568e4..04b472c31e 100644
--- a/Userland/Libraries/LibWeb/DOM/ARIAMixin.cpp
+++ b/Userland/Libraries/LibWeb/DOM/ARIAMixin.cpp
@@ -32,4 +32,30 @@ FlyString ARIAMixin::role_or_default() const
return default_role();
}
+// https://www.w3.org/TR/wai-aria-1.2/#global_states
+bool ARIAMixin::has_global_aria_attribute() const
+{
+ return !aria_atomic().is_null()
+ || !aria_busy().is_null()
+ || !aria_controls().is_null()
+ || !aria_current().is_null()
+ || !aria_described_by().is_null()
+ || !aria_details().is_null()
+ || !aria_disabled().is_null()
+ || !aria_drop_effect().is_null()
+ || !aria_error_message().is_null()
+ || !aria_flow_to().is_null()
+ || !aria_grabbed().is_null()
+ || !aria_has_popup().is_null()
+ || !aria_hidden().is_null()
+ || !aria_invalid().is_null()
+ || !aria_key_shortcuts().is_null()
+ || !aria_label().is_null()
+ || !aria_labelled_by().is_null()
+ || !aria_live().is_null()
+ || !aria_owns().is_null()
+ || !aria_relevant().is_null()
+ || !aria_role_description().is_null();
+}
+
}
diff --git a/Userland/Libraries/LibWeb/DOM/ARIAMixin.h b/Userland/Libraries/LibWeb/DOM/ARIAMixin.h
index ec97d69f11..a894ccbd5a 100644
--- a/Userland/Libraries/LibWeb/DOM/ARIAMixin.h
+++ b/Userland/Libraries/LibWeb/DOM/ARIAMixin.h
@@ -136,6 +136,8 @@ public:
FlyString role_or_default() const;
+ bool has_global_aria_attribute() const;
+
protected:
ARIAMixin() = default;
};