Skip to content

Commit 04464f3

Browse files
Voice Guidance reads iframe when added to DOM.
Make Voice Guidance to differentiate between an actual page load and an iframe being added to the DOM.
1 parent 59bb24f commit 04464f3

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ void AccessibilityObjectAtspi::elementDestroyed()
150150
AccessibilityAtspi::singleton().unregisterObject(*this);
151151
}
152152

153-
static Atspi::Role atspiRole(AccessibilityRole role)
153+
static Atspi::Role atspiRole(AXCoreObject* coreObject)
154154
{
155-
switch (role) {
155+
switch (coreObject->roleValue()) {
156156
case AccessibilityRole::ApplicationAlert:
157157
return Atspi::Role::Notification;
158158
case AccessibilityRole::ApplicationAlertDialog:
@@ -308,7 +308,16 @@ static Atspi::Role atspiRole(AccessibilityRole role)
308308
case AccessibilityRole::UserInterfaceTooltip:
309309
return Atspi::Role::ToolTip;
310310
case AccessibilityRole::WebArea:
311+
{
312+
RefPtr liveObject = dynamicDowncast<AccessibilityObject>(coreObject);
313+
if (liveObject) {
314+
WebCore::Frame *frame = liveObject->frame();
315+
if (frame)
316+
return frame->WebCore::Frame::isMainFrame() ? Atspi::Role::DocumentWeb : Atspi::Role::DocumentFrame;
317+
}
318+
311319
return Atspi::Role::DocumentWeb;
320+
}
312321
case AccessibilityRole::WebApplication:
313322
return Atspi::Role::Embedded;
314323
case AccessibilityRole::ApplicationLog:
@@ -1241,7 +1250,7 @@ Atspi::Role AccessibilityObjectAtspi::role() const
12411250
if (auto effective = effectiveRole())
12421251
return *effective;
12431252

1244-
return atspiRole(m_coreObject->roleValue());
1253+
return atspiRole(m_coreObject);
12451254
}
12461255

12471256
String AccessibilityObjectAtspi::effectiveRoleName() const

0 commit comments

Comments
 (0)