mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 07:01:24 +00:00
!47449 无障碍uiextension修复重复播报问题
Merge pull request !47449 from 屠吉人/OpenHarmony-5.0.1-Release
This commit is contained in:
commit
1ff7249f8c
@ -905,12 +905,13 @@ void GetFrameNodeChildren(
|
||||
}
|
||||
}
|
||||
|
||||
bool GetNodeAccessibilityVisible(const RefPtr<NG::FrameNode>& frameNode, bool isAllAncestorAccessibilityVisible)
|
||||
bool GetNodeAccessibilityVisible(const RefPtr<NG::FrameNode>& frameNode, bool isAllAncestorAccessibilityVisible,
|
||||
bool clipVisible)
|
||||
{
|
||||
if (frameNode->IsFirstVirtualNode()) {
|
||||
return frameNode->IsVisible() && isAllAncestorAccessibilityVisible;
|
||||
return frameNode->IsVisible() && isAllAncestorAccessibilityVisible && clipVisible;
|
||||
} else {
|
||||
return frameNode->IsActive() && frameNode->IsVisible() && isAllAncestorAccessibilityVisible;
|
||||
return frameNode->IsActive() && frameNode->IsVisible() && isAllAncestorAccessibilityVisible && clipVisible;
|
||||
}
|
||||
}
|
||||
|
||||
@ -957,7 +958,17 @@ void SetRootAccessibilityVisible(const RefPtr<NG::UINode>& uiNode, Accessibility
|
||||
{
|
||||
RefPtr<NG::UINode> parent = GetInitialParent(uiNode);
|
||||
bool isAllAncestorAccessibilityVisible = true;
|
||||
|
||||
bool clipVisible = true;
|
||||
auto frameNode = AceType::DynamicCast<NG::FrameNode>(uiNode);
|
||||
CHECK_NULL_VOID(frameNode);
|
||||
OHOS::Ace::NG::RectF frameRect;
|
||||
OHOS::Ace::NG::RectF visibleInnerRect;
|
||||
OHOS::Ace::NG::RectF visibleRect;
|
||||
frameNode->GetVisibleRectWithClip(visibleRect, visibleInnerRect, frameRect);
|
||||
bool isClipCheckSkip = NearEqual(visibleRect.Width(), 0.0) && NearEqual(visibleRect.Height(), 0.0) &&
|
||||
NearEqual(visibleInnerRect.Width(), 0.0) && NearEqual(visibleInnerRect.Height(), 0.0);
|
||||
clipVisible = (GreatNotEqual(visibleInnerRect.Width(), 0.0) && GreatNotEqual(visibleInnerRect.Height(), 0.0)) ||
|
||||
isClipCheckSkip;
|
||||
std::string parentPath;
|
||||
while (parent) {
|
||||
if (AceType::InstanceOf<NG::FrameNode>(parent)) {
|
||||
@ -970,14 +981,14 @@ void SetRootAccessibilityVisible(const RefPtr<NG::UINode>& uiNode, Accessibility
|
||||
TAG_LOGD(AceLogTag::ACE_ACCESSIBILITY, "Complete parent path:current id %{public}" PRId64 " %{public}s",
|
||||
nodeInfo.GetAccessibilityId(), parentPath.c_str());
|
||||
|
||||
auto frameNode = AceType::DynamicCast<NG::FrameNode>(uiNode);
|
||||
bool nodeAccessibilityVisible = GetNodeAccessibilityVisible(frameNode, isAllAncestorAccessibilityVisible);
|
||||
bool nodeAccessibilityVisible =
|
||||
GetNodeAccessibilityVisible(frameNode, isAllAncestorAccessibilityVisible, clipVisible);
|
||||
if (!nodeAccessibilityVisible) {
|
||||
TAG_LOGD(AceLogTag::ACE_ACCESSIBILITY,
|
||||
"Element %{public}" PRId64 " is invisible. isActive %{public}d, isVisible %{public}d"
|
||||
" isAllAncestorAccessibilityVisible:%{public}d",
|
||||
" isAllAncestorAccessibilityVisible:%{public}d clipVisible:%{public}d",
|
||||
nodeInfo.GetAccessibilityId(), frameNode->IsActive(), frameNode->IsVisible(),
|
||||
isAllAncestorAccessibilityVisible);
|
||||
isAllAncestorAccessibilityVisible, clipVisible);
|
||||
}
|
||||
|
||||
if (frameNode->GetTag() != V2::PAGE_ETS_TAG) {
|
||||
@ -1627,7 +1638,7 @@ void JsAccessibilityManager::UpdateWebAccessibilityElementInfo(
|
||||
nodeInfo.SetFocused(node->GetIsFocused());
|
||||
nodeInfo.SetAccessibilityFocus(node->GetIsAccessibilityFocus());
|
||||
nodeInfo.SetVisible(node->GetIsVisible());
|
||||
|
||||
|
||||
if (node->GetIsVisible()) {
|
||||
CHECK_NULL_VOID(webPattern);
|
||||
auto webNode = webPattern->GetHost();
|
||||
|
@ -34,4 +34,9 @@ void AccessibilitySessionAdapterUIExtension::TransferHoverEvent(const PointF &po
|
||||
sessionWrapper->TransferAccessibilityHoverEvent(point.GetX(), point.GetY(),
|
||||
static_cast<int32_t>(source), static_cast<int32_t>(eventType), timeMs);
|
||||
}
|
||||
|
||||
bool AccessibilitySessionAdapterUIExtension::IgnoreHostNode() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
|
||||
void TransferHoverEvent(const PointF& point, SourceType source,
|
||||
AccessibilityHoverEventType eventType, TimeStamp time) override;
|
||||
|
||||
bool IgnoreHostNode() const override;
|
||||
private:
|
||||
WeakPtr<SessionWrapper> sessionWrapper_;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user