Skip to content

Commit

Permalink
AX: VoiceOver frames are broken on ToT
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=270023
rdar://problem/123534425

Reviewed by Chris Fleizach.

After 274955@main, we never returned cached relative frames, resulting in all frames being the same
as the WebArea's. This patch fixes frames, and resolves the failing test, initial-relative-frame-cached.html.

* Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::relativeFrame const):

Canonical link: https://commits.webkit.org/275290@main
  • Loading branch information
hoffmanjoshua committed Feb 25, 2024
1 parent 463c4d3 commit ba3ffca
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1290,18 +1290,21 @@ FloatRect AXIsolatedObject::relativeFrame() const
});
}

// InitialFrameRect stores the correct size, but not position, of the element before it is painted.
// We find the position of the nearest painted ancestor to use as the position until the object's frame
// is cached during painting.
auto* ancestor = Accessibility::findAncestor<AXIsolatedObject>(*this, false, [] (const auto& object) {
return object.hasCachedRelativeFrame();
});
auto frameRect = rectAttributeValue<FloatRect>(AXPropertyName::InitialFrameRect);
if (ancestor && frameRect.location() == FloatPoint())
frameRect.setLocation(ancestor->relativeFrame().location());
// Having an empty relative frame at this point means a frame hasn't been cached yet.
if (relativeFrame.isEmpty()) {
// InitialFrameRect stores the correct size, but not position, of the element before it is painted.
// We find the position of the nearest painted ancestor to use as the position until the object's frame
// is cached during painting.
auto* ancestor = Accessibility::findAncestor<AXIsolatedObject>(*this, false, [] (const auto& object) {
return object.hasCachedRelativeFrame();
});
relativeFrame = rectAttributeValue<FloatRect>(AXPropertyName::InitialFrameRect);
if (ancestor && relativeFrame.location() == FloatPoint())
relativeFrame.setLocation(ancestor->relativeFrame().location());
}

frameRect.moveBy({ remoteFrameOffset() });
return frameRect;
relativeFrame.moveBy({ remoteFrameOffset() });
return relativeFrame;
}

FloatRect AXIsolatedObject::relativeFrameFromChildren() const
Expand Down

0 comments on commit ba3ffca

Please sign in to comment.