-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AX: Serve initial AXRelativeFrame for elements without cached frames …
…off of the main thread https://bugs.webkit.org/show_bug.cgi?id=268035 rdar://120764228 Reviewed by Tyler Wilcock. We only serve relative frames for objects on the secondary thread once they are cached during the Accessibility paint phase. This means that when we move to objects that were offscreen or haven't been painted, we have to use the main thread to serve the relative frame. This patch instead serves a rough frame from the AX thread initally, until the object's frame is cached during painting. This rough frame is constructed by using the frame rect of the element for its size, and it's closest painted ancestor for its position. As soon as the element's precise frame is cached duiring paint, this is updated. * LayoutTests/accessibility/mac/initial-relative-frame-cached-expected.txt: Added. * LayoutTests/accessibility/mac/initial-relative-frame-cached.html: Added. * LayoutTests/platform/mac-wk1/TestExpectations: * Source/WebCore/accessibility/AXObjectCache.cpp: (WebCore::AXObjectCache::setForceInitialFrameCaching): (WebCore::AXObjectCache::shouldServeInitialCachedFrame): * Source/WebCore/accessibility/AXObjectCache.h: (WebCore::AXObjectCache::forceInitialFrameCaching): * Source/WebCore/accessibility/AccessibilityObject.h: (WebCore::AccessibilityObject::frameRect const): (WebCore::AccessibilityObject::isNonLayerSVGObject const): * Source/WebCore/accessibility/AccessibilityRenderObject.cpp: (WebCore::AccessibilityRenderObject::isNonLayerSVGObject const): (WebCore::AccessibilityRenderObject::frameRect const): * Source/WebCore/accessibility/AccessibilityRenderObject.h: * Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp: (WebCore::AXIsolatedObject::initializeProperties): (WebCore::AXIsolatedObject::relativeFrame const): * Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h: * Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.cpp: (WebCore::AXIsolatedTree::updateFrame): * Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h: * Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp: (WKAccessibilitySetForceInitialFrameCaching): * Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePagePrivate.h: * Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.cpp: (WTR::AccessibilityController::setForceInitialFrameCaching): * Tools/WebKitTestRunner/InjectedBundle/AccessibilityController.h: * Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityController.idl: Canonical link: https://commits.webkit.org/274472@main
- Loading branch information
1 parent
9c97e55
commit e6c6fde
Showing
17 changed files
with
158 additions
and
6 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
LayoutTests/accessibility/mac/initial-relative-frame-cached-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
This test verifies that when initial rough frame caching is enabled, frames are eventually correct. | ||
|
||
heading1 has relative frame NSRect: {{8, 278}, {754, 37}}. | ||
image has relative frame NSRect: {{8, 336}, {100, 101}}. | ||
list has relative frame NSRect: {{8, 456}, {754, 37}}. | ||
listitem has relative frame NSRect: {{48, 456}, {714, 19}}. | ||
|
||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
Hello, world. | ||
|
||
|
||
List item 1 | ||
List item 2 |
60 changes: 60 additions & 0 deletions
60
LayoutTests/accessibility/mac/initial-relative-frame-cached.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="../../resources/accessibility-helper.js"></script> | ||
<script src="../../resources/js-test.js"></script> | ||
</head> | ||
<body style="height: 1000px; width=1000px"> | ||
|
||
<div style="height: 500px; overflow: auto;" id="scrollarea"> | ||
<div style="margin-top: 600px;" id="hidden-content"> | ||
<h1 id="heading1">Hello, world.</h1> | ||
|
||
<img id="image" height=100 width=100 src="../resources/cake.png" alt="Cake in front of a glass door"> | ||
|
||
<ul id="list"> | ||
<li id="listitem">List item 1</li> | ||
<li>List item 2</li> | ||
</ul> | ||
</div> | ||
</div> | ||
|
||
<script> | ||
let output = "This test verifies that when initial rough frame caching is enabled, frames are eventually correct.\n\n"; | ||
|
||
if (window.accessibilityController) { | ||
accessibilityController.setForceInitialFrameCaching(true); | ||
window.jsTestIsAsync = true; | ||
|
||
setTimeout(async function() { | ||
// Scroll all content onscreen | ||
let container = document.getElementById("scrollarea"); | ||
container.scrollTop = container.scrollHeight; | ||
|
||
// Enable accessibility & trigger paint | ||
accessibilityController.rootElement; | ||
|
||
// Wait for the objects to be painted | ||
await sleep(1000); | ||
|
||
output += frameDebugString("heading1"); | ||
output += frameDebugString("image"); | ||
output += frameDebugString("list"); | ||
output += frameDebugString("listitem"); | ||
|
||
accessibilityController.setForceInitialFrameCaching(false); | ||
|
||
debug(output); | ||
finishJSTest(); | ||
}, 0); | ||
} | ||
|
||
|
||
function frameDebugString(id) { | ||
let element = accessibilityController.accessibleElementById(id); | ||
return `${id} has relative frame ${element.stringDescriptionOfAttributeValue('AXRelativeFrame')}.\n`; | ||
} | ||
|
||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters