| Differences between
and this patch
- a/Source/WebCore/accessibility/AccessibilityNodeObject.cpp -1 / +1 lines
Lines 2356-2362 String AccessibilityNodeObject::textUnderElement(AccessibilityTextUnderElementMo a/Source/WebCore/accessibility/AccessibilityNodeObject.cpp_sec1
2356
        if (node) {
2356
        if (node) {
2357
            auto* childParentElement = child->node() ? child->node()->parentElement() : nullptr;
2357
            auto* childParentElement = child->node() ? child->node()->parentElement() : nullptr;
2358
            // Do not take the textUnderElement for a different element (determined by child's element parent not being us). Otherwise we may doubly-expose the same text.
2358
            // Do not take the textUnderElement for a different element (determined by child's element parent not being us). Otherwise we may doubly-expose the same text.
2359
            if (childParentElement && childParentElement != node && childParentElement->shadowHost() != node)
2359
            if (childParentElement && childParentElement != node && childParentElement->shadowHost() != node && node->isInShadowTree() == childParentElement->isInShadowTree())
2360
                continue;
2360
                continue;
2361
        }
2361
        }
2362
2362
- a/LayoutTests/accessibility/custom-elements/shadow-element-text-expected.txt +15 lines
Line 0 a/LayoutTests/accessibility/custom-elements/shadow-element-text-expected.txt_sec1
1
This test ensures that shadow dom elements return the right text.
2
3
Button1 text: 	AXTitle: Button One
4
	AXDescription:
5
	AXHelp:
6
Button2 text: 	AXTitle: Nested Button Two
7
	AXDescription:
8
	AXHelp:
9
10
PASS successfullyParsed is true
11
12
TEST COMPLETE
13
Button One
14
Nested Button Two
15
- a/LayoutTests/accessibility/custom-elements/shadow-element-text.html +34 lines
Line 0 a/LayoutTests/accessibility/custom-elements/shadow-element-text.html_sec1
1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2
<html>
3
<head>
4
<script src="../resources/accessibility-helper.js"></script>
5
<script src="../resources/js-test.js"></script>
6
</head>
7
<body>
8
9
<my-button id="button1">Button One</my-button>
10
<my-button id="button2"><div>Nested Button Two</div></my-button>
11
12
<script>
13
    class MyButton extends HTMLElement {
14
        constructor() {
15
            super();
16
            const root = this.attachShadow({ mode: 'open' });
17
            root.innerHTML = `<button id=${this.id}><slot></slot></button>`;
18
        }
19
    }
20
    customElements.define('my-button', MyButton);
21
22
    let output = "This test ensures that shadow dom elements return the right text.\n\n";
23
24
    if (window.accessibilityController) {
25
        var button1 = accessibilityController.accessibleElementById("button1");
26
        output += `Button1 text: ${platformTextAlternatives(button1)}\n`;
27
        
28
        var button2 = accessibilityController.accessibleElementById("button2");
29
        output += `Button2 text: ${platformTextAlternatives(button2)}\n`;
30
        debug(output); 
31
    }
32
</script>
33
</body>
34
</html>

Return to Bug 264410