!48119 无障碍支持屏幕朗读缓存刷新,半模态,menu不支持hover蒙层以下组件

Merge pull request !48119 from 屠吉人/dev2
This commit is contained in:
openharmony_ci 2024-11-10 07:09:51 +00:00 committed by Gitee
commit 19fd550dc5
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 35 additions and 10 deletions

View File

@ -205,6 +205,7 @@ Accessibility::EventType ConvertAceEventType(AccessibilityEventType type)
{ AccessibilityEventType::ANNOUNCE_FOR_ACCESSIBILITY,
Accessibility::EventType::TYPE_VIEW_ANNOUNCE_FOR_ACCESSIBILITY },
{ AccessibilityEventType::PAGE_OPEN, Accessibility::EventType::TYPE_PAGE_OPEN },
{ AccessibilityEventType::ELEMENT_INFO_CHANGE, Accessibility::EventType::TYPE_ELEMENT_INFO_CHANGE },
};
Accessibility::EventType eventType = Accessibility::EventType::TYPE_VIEW_INVALID;
int64_t idx = BinarySearchFindIndex(eventTypeMap, ArraySize(eventTypeMap), type);

View File

@ -111,6 +111,7 @@ enum class AccessibilityEventType : size_t {
PAGE_CLOSE = 0x08000000,
ANNOUNCE_FOR_ACCESSIBILITY = 0x10000000,
PAGE_OPEN = 0x20000000,
ELEMENT_INFO_CHANGE = 0x40000000,
UNKNOWN,
};

View File

@ -769,6 +769,10 @@ bool EventHub::IsDeveloperEnabled() const
void EventHub::SetEnabled(bool enabled)
{
auto host = GetFrameNode();
if (enabled_ != enabled && host) {
host->OnAccessibilityEvent(AccessibilityEventType::ELEMENT_INFO_CHANGE);
}
enabled_ = enabled;
developerEnabled_ = enabled;
}

View File

@ -61,6 +61,13 @@ std::unordered_set<AceAction> AccessibilityProperty::GetSupportAction() const
return supportActions;
}
void AccessibilityProperty::NotifyComponentChangeEvent(AccessibilityEventType eventType)
{
auto frameNode = host_.Upgrade();
CHECK_NULL_VOID(frameNode);
frameNode->OnAccessibilityEvent(eventType);
}
std::string AccessibilityProperty::GetText() const
{
return propText_.value_or("");
@ -710,7 +717,11 @@ void AccessibilityProperty::SetAccessibilityFocusState(bool state)
void AccessibilityProperty::SetAccessibilityGroup(bool accessibilityGroup)
{
if (accessibilityGroup == accessibilityGroup_) {
return;
}
accessibilityGroup_ = accessibilityGroup;
NotifyComponentChangeEvent(AccessibilityEventType::ELEMENT_INFO_CHANGE);
}
void AccessibilityProperty::SetAccessibilityTextPreferred(bool accessibilityTextPreferred)
@ -730,19 +741,20 @@ void AccessibilityProperty::SetChildWindowId(int32_t childWindowId)
void AccessibilityProperty::SetAccessibilityText(const std::string& text)
{
if (text == accessibilityText_.value_or("")) {
return;
}
accessibilityText_ = text;
NotifyComponentChangeEvent(AccessibilityEventType::TEXT_CHANGE);
}
void AccessibilityProperty::SetAccessibilityTextWithEvent(const std::string& text)
{
auto backupStr = accessibilityText_.value_or("");
if (text == backupStr) {
if (text == accessibilityText_.value_or("")) {
return;
}
accessibilityText_ = text;
auto frameNode = host_.Upgrade();
CHECK_NULL_VOID(frameNode);
frameNode->OnAccessibilityEvent(AccessibilityEventType::TEXT_CHANGE, backupStr, text);
NotifyComponentChangeEvent(AccessibilityEventType::TEXT_CHANGE);
}
void AccessibilityProperty::SetAccessibilityTextHint(const std::string& text)
@ -752,19 +764,20 @@ void AccessibilityProperty::SetAccessibilityTextHint(const std::string& text)
void AccessibilityProperty::SetAccessibilityDescription(const std::string& accessibilityDescription)
{
if (accessibilityDescription == accessibilityDescription_.value_or("")) {
return;
}
accessibilityDescription_ = accessibilityDescription;
NotifyComponentChangeEvent(AccessibilityEventType::TEXT_CHANGE);
}
void AccessibilityProperty::SetAccessibilityDescriptionWithEvent(const std::string& accessibilityDescription)
{
auto backupStr = accessibilityDescription_.value_or("");
if (accessibilityDescription == backupStr) {
if (accessibilityDescription == accessibilityDescription_.value_or("")) {
return;
}
accessibilityDescription_ = accessibilityDescription;
auto frameNode = host_.Upgrade();
CHECK_NULL_VOID(frameNode);
frameNode->OnAccessibilityEvent(AccessibilityEventType::TEXT_CHANGE, backupStr, accessibilityDescription);
NotifyComponentChangeEvent(AccessibilityEventType::TEXT_CHANGE);
}
bool AccessibilityProperty::IsAccessibilityGroup() const
@ -819,6 +832,9 @@ std::string AccessibilityProperty::GetTextType() const
void AccessibilityProperty::SetAccessibilityLevel(const std::string& accessibilityLevel)
{
if (accessibilityLevel == accessibilityLevel_.value_or("")) {
return;
}
if (accessibilityLevel == Level::YES_STR ||
accessibilityLevel == Level::NO_STR ||
accessibilityLevel == Level::NO_HIDE_DESCENDANTS) {
@ -826,6 +842,7 @@ void AccessibilityProperty::SetAccessibilityLevel(const std::string& accessibili
} else {
accessibilityLevel_ = Level::AUTO;
}
NotifyComponentChangeEvent(AccessibilityEventType::ELEMENT_INFO_CHANGE);
}
void AccessibilityProperty::SetRelatedElementInfoCallback(const GetRelatedElementInfoImpl& getRelatedElementInfoImpl)

View File

@ -440,6 +440,8 @@ public:
bool IsAccessibilityTextPreferred() const;
void NotifyComponentChangeEvent(AccessibilityEventType eventType);
int32_t GetChildTreeId() const;
int32_t GetChildWindowId() const;