Skip to content

Commit a93e511

Browse files
pgorszkowski-igaliamagomez
authored andcommitted
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 0638743 commit a93e511

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

Source/WebCore/accessibility/atspi/AccessibilityObjectAtspi.cpp

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

152-
static Atspi::Role atspiRole(AccessibilityRole role)
152+
static Atspi::Role atspiRole(AXCoreObject* coreObject)
153153
{
154-
switch (role) {
154+
switch (coreObject->roleValue()) {
155155
case AccessibilityRole::ApplicationAlert:
156156
return Atspi::Role::Notification;
157157
case AccessibilityRole::ApplicationAlertDialog:
@@ -305,7 +305,16 @@ static Atspi::Role atspiRole(AccessibilityRole role)
305305
case AccessibilityRole::UserInterfaceTooltip:
306306
return Atspi::Role::ToolTip;
307307
case AccessibilityRole::WebArea:
308+
{
309+
RefPtr liveObject = dynamicDowncast<AccessibilityObject>(coreObject);
310+
if (liveObject) {
311+
WebCore::Frame *frame = liveObject->frame();
312+
if (frame)
313+
return frame->WebCore::Frame::isMainFrame() ? Atspi::Role::DocumentWeb : Atspi::Role::DocumentFrame;
314+
}
315+
308316
return Atspi::Role::DocumentWeb;
317+
}
309318
case AccessibilityRole::WebApplication:
310319
return Atspi::Role::Embedded;
311320
case AccessibilityRole::ApplicationLog:
@@ -1238,7 +1247,7 @@ Atspi::Role AccessibilityObjectAtspi::role() const
12381247
if (auto effective = effectiveRole())
12391248
return *effective;
12401249

1241-
return atspiRole(m_coreObject->roleValue());
1250+
return atspiRole(m_coreObject);
12421251
}
12431252

12441253
String AccessibilityObjectAtspi::effectiveRoleName() const

0 commit comments

Comments
 (0)