Title: [293236] branches/safari-613.2.7.1-branch
Revision
293236
Author
[email protected]
Date
2022-04-22 12:02:35 -0700 (Fri, 22 Apr 2022)

Log Message

Cherry-pick r291724. rdar://problem/91975589

    Expose the AX tree of PDFs loaded via iframes on the Mac
    https://bugs.webkit.org/show_bug.cgi?id=238168

    Reviewed by Chris Fleizach.

    Source/WebKit:

    Given this markup:

    <iframe src=""

    An accessibility tree is built for paystub.pdf, but we don't expose it
    to AX clients, making the PDF entirely inaccessible.

    This happens because we were setting the AX parent to be the webpage
    for full-frame PDF plugins (which an iframe with this markup is).
    This behavior is correct only for main-frame (i.e. not iframe)
    full-frame plugins, so this patch adds an extra condition to that logic.

    Test: accessibility/mac/iframe-pdf.html

    * WebProcess/Plugins/PDF/PDFPlugin.mm:
    (WebKit::PDFPlugin::PDFPlugin):

    LayoutTests:

    * accessibility/mac/iframe-pdf-expected.txt: Added.
    * accessibility/mac/iframe-pdf.html: Added.
    * platform/mac-wk1/TestExpectations:
    Skip new test as it always times out in WK1 (similar to
    accessibility/mac/basic-embed-pdf-accessibility.html)

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291724 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-613.2.7.1-branch/LayoutTests/ChangeLog (293235 => 293236)


--- branches/safari-613.2.7.1-branch/LayoutTests/ChangeLog	2022-04-22 18:46:08 UTC (rev 293235)
+++ branches/safari-613.2.7.1-branch/LayoutTests/ChangeLog	2022-04-22 19:02:35 UTC (rev 293236)
@@ -1,3 +1,55 @@
+2022-04-22  Russell Epstein  <[email protected]>
+
+        Cherry-pick r291724. rdar://problem/91975589
+
+    Expose the AX tree of PDFs loaded via iframes on the Mac
+    https://bugs.webkit.org/show_bug.cgi?id=238168
+    
+    Reviewed by Chris Fleizach.
+    
+    Source/WebKit:
+    
+    Given this markup:
+    
+    <iframe src=""
+    
+    An accessibility tree is built for paystub.pdf, but we don't expose it
+    to AX clients, making the PDF entirely inaccessible.
+    
+    This happens because we were setting the AX parent to be the webpage
+    for full-frame PDF plugins (which an iframe with this markup is).
+    This behavior is correct only for main-frame (i.e. not iframe)
+    full-frame plugins, so this patch adds an extra condition to that logic.
+    
+    Test: accessibility/mac/iframe-pdf.html
+    
+    * WebProcess/Plugins/PDF/PDFPlugin.mm:
+    (WebKit::PDFPlugin::PDFPlugin):
+    
+    LayoutTests:
+    
+    * accessibility/mac/iframe-pdf-expected.txt: Added.
+    * accessibility/mac/iframe-pdf.html: Added.
+    * platform/mac-wk1/TestExpectations:
+    Skip new test as it always times out in WK1 (similar to
+    accessibility/mac/basic-embed-pdf-accessibility.html)
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291724 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-03-22  Tyler Wilcock  <[email protected]>
+
+            Expose the AX tree of PDFs loaded via iframes on the Mac
+            https://bugs.webkit.org/show_bug.cgi?id=238168
+
+            Reviewed by Chris Fleizach.
+
+            * accessibility/mac/iframe-pdf-expected.txt: Added.
+            * accessibility/mac/iframe-pdf.html: Added.
+            * platform/mac-wk1/TestExpectations:
+            Skip new test as it always times out in WK1 (similar to
+            accessibility/mac/basic-embed-pdf-accessibility.html)
+
 2022-04-19  Alan Coon  <[email protected]>
 
         Cherry-pick r292079. rdar://problem/88512506

Added: branches/safari-613.2.7.1-branch/LayoutTests/accessibility/mac/iframe-pdf-expected.txt (0 => 293236)


--- branches/safari-613.2.7.1-branch/LayoutTests/accessibility/mac/iframe-pdf-expected.txt	                        (rev 0)
+++ branches/safari-613.2.7.1-branch/LayoutTests/accessibility/mac/iframe-pdf-expected.txt	2022-04-22 19:02:35 UTC (rev 293236)
@@ -0,0 +1,26 @@
+This test ensures PDFs loaded in iframes are exposed in the accessibility tree.
+
+Traversal path to text node inside PDF:
+
+At index 0, got AXRole: AXScrollArea
+At index 0, got AXRole: AXWebArea
+At index 0, got AXRole: AXGroup
+At index 0, got AXRole: AXGroup
+At index 0, got AXRole: AXGroup
+At index 0, got AXRole: AXGroup
+At index 0, got AXRole: AXPage
+At index 0, got AXRole: AXGroup
+At index 0, got AXRole: AXGroup
+At index 0, got AXRole: AXGroup
+At index 1, got AXRole: AXGroup
+At index 0, got AXRole: AXGroup
+At index 0, got AXRole: AXStaticText
+
+Found object:
+AXRole: AXStaticText
+AXValue: Welcome to the website for the WebKit Open Source Project!
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: branches/safari-613.2.7.1-branch/LayoutTests/accessibility/mac/iframe-pdf.html (0 => 293236)


--- branches/safari-613.2.7.1-branch/LayoutTests/accessibility/mac/iframe-pdf.html	                        (rev 0)
+++ branches/safari-613.2.7.1-branch/LayoutTests/accessibility/mac/iframe-pdf.html	2022-04-22 19:02:35 UTC (rev 293236)
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+    if (window.accessibilityController)
+        window.jsTestIsAsync = true;
+</script>
+</head>
+<body>
+
+<script>
+    var testOutput = "This test ensures PDFs loaded in iframes are exposed in the accessibility tree.\n\n";
+
+    function traverseChildrenWithPath(startObject, traversalPath) {
+        if (!startObject)
+            return [];
+
+        let traversalString = "";
+        let currentObject = startObject;
+        for (let index of traversalPath) {
+            currentObject = currentObject.childAtIndex(index);
+            if (!currentObject)
+                return [];
+            traversalString += `At index ${index}, got ${currentObject.role}\n`;
+        }
+        return [traversalString, currentObject];
+    }
+
+    if (window.accessibilityController) {
+        var textNode, traversalString;
+        setTimeout(async function() {
+            // This test is async because we may need to try the traversal a few times before the iframe
+            // and the PDF inside the iframe are fully loaded.
+            await waitFor(() => {
+                let container = accessibilityController.accessibleElementById("container");
+                [traversalString, textNode] = traverseChildrenWithPath(container, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0]);
+                return textNode;
+            });
+            testOutput += "Traversal path to text node inside PDF:\n\n";
+            testOutput += traversalString;
+
+            testOutput += "\nFound object:\n";
+            testOutput += `${textNode.role}\n`;
+            testOutput += `${textNode.stringValue}\n`;
+
+            debug(testOutput);
+            finishJSTest();
+        }, 0)
+    }
+</script>
+
+<div id="container" role="group">
+    <iframe src=""
+</div>
+
+</body>
+</html>
+

Modified: branches/safari-613.2.7.1-branch/LayoutTests/platform/mac-wk1/TestExpectations (293235 => 293236)


--- branches/safari-613.2.7.1-branch/LayoutTests/platform/mac-wk1/TestExpectations	2022-04-22 18:46:08 UTC (rev 293235)
+++ branches/safari-613.2.7.1-branch/LayoutTests/platform/mac-wk1/TestExpectations	2022-04-22 19:02:35 UTC (rev 293236)
@@ -616,6 +616,7 @@
 
 # Skip because the embedded plugin never resolves in WK1, resulting in a timeout.
 accessibility/mac/basic-embed-pdf-accessibility.html [ Skip ]
+accessibility/mac/iframe-pdf.html [ Skip ]
 
 # rdar://problem/26478296
 svg/hixie/text/003.html [ Failure ]

Modified: branches/safari-613.2.7.1-branch/Source/WebKit/ChangeLog (293235 => 293236)


--- branches/safari-613.2.7.1-branch/Source/WebKit/ChangeLog	2022-04-22 18:46:08 UTC (rev 293235)
+++ branches/safari-613.2.7.1-branch/Source/WebKit/ChangeLog	2022-04-22 19:02:35 UTC (rev 293236)
@@ -1,3 +1,66 @@
+2022-04-22  Russell Epstein  <[email protected]>
+
+        Cherry-pick r291724. rdar://problem/91975589
+
+    Expose the AX tree of PDFs loaded via iframes on the Mac
+    https://bugs.webkit.org/show_bug.cgi?id=238168
+    
+    Reviewed by Chris Fleizach.
+    
+    Source/WebKit:
+    
+    Given this markup:
+    
+    <iframe src=""
+    
+    An accessibility tree is built for paystub.pdf, but we don't expose it
+    to AX clients, making the PDF entirely inaccessible.
+    
+    This happens because we were setting the AX parent to be the webpage
+    for full-frame PDF plugins (which an iframe with this markup is).
+    This behavior is correct only for main-frame (i.e. not iframe)
+    full-frame plugins, so this patch adds an extra condition to that logic.
+    
+    Test: accessibility/mac/iframe-pdf.html
+    
+    * WebProcess/Plugins/PDF/PDFPlugin.mm:
+    (WebKit::PDFPlugin::PDFPlugin):
+    
+    LayoutTests:
+    
+    * accessibility/mac/iframe-pdf-expected.txt: Added.
+    * accessibility/mac/iframe-pdf.html: Added.
+    * platform/mac-wk1/TestExpectations:
+    Skip new test as it always times out in WK1 (similar to
+    accessibility/mac/basic-embed-pdf-accessibility.html)
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291724 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-03-22  Tyler Wilcock  <[email protected]>
+
+            Expose the AX tree of PDFs loaded via iframes on the Mac
+            https://bugs.webkit.org/show_bug.cgi?id=238168
+
+            Reviewed by Chris Fleizach.
+
+            Given this markup:
+
+            <iframe src=""
+
+            An accessibility tree is built for paystub.pdf, but we don't expose it
+            to AX clients, making the PDF entirely inaccessible.
+
+            This happens because we were setting the AX parent to be the webpage
+            for full-frame PDF plugins (which an iframe with this markup is).
+            This behavior is correct only for main-frame (i.e. not iframe)
+            full-frame plugins, so this patch adds an extra condition to that logic.
+
+            Test: accessibility/mac/iframe-pdf.html
+
+            * WebProcess/Plugins/PDF/PDFPlugin.mm:
+            (WebKit::PDFPlugin::PDFPlugin):
+
 2022-04-20  Alan Coon  <[email protected]>
 
         Cherry-pick r289100. rdar://problem/79950080

Modified: branches/safari-613.2.7.1-branch/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm (293235 => 293236)


--- branches/safari-613.2.7.1-branch/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm	2022-04-22 18:46:08 UTC (rev 293235)
+++ branches/safari-613.2.7.1-branch/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm	2022-04-22 19:02:35 UTC (rev 293236)
@@ -673,9 +673,9 @@
 
     m_accessibilityObject = adoptNS([[WKPDFPluginAccessibilityObject alloc] initWithPDFPlugin:this andElement:pluginElement]);
     [m_accessibilityObject setPdfLayerController:m_pdfLayerController.get()];
-    if (isFullFrame)
+    if (isFullFrame && frame.isMainFrame())
         [m_accessibilityObject setParent:frame.page()->accessibilityRemoteObject()];
-    // If the plugin is not full-frame, we'll need to set the parent later after the AXObjectCache for the document has been initialized.
+    // If this is not a main-frame (e.g. it originated from an iframe) full-frame plugin, we'll need to set the parent later after the AXObjectCache has been initialized.
 
     [m_containerLayer addSublayer:m_contentLayer.get()];
     [m_containerLayer addSublayer:m_scrollCornerLayer.get()];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to