Title: [265495] trunk
Revision
265495
Author
[email protected]
Date
2020-08-11 05:11:24 -0700 (Tue, 11 Aug 2020)

Log Message

Update the isolated tree on element language changes.
https://bugs.webkit.org/show_bug.cgi?id=215354
<rdar://problem/65583698>

Reviewed by Chris Fleizach.

Source/WebCore:

Test: accessibility/language-attribute-change.html

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::handleAttributeChange): Added handling of
AXLanguageChanged notifications.
(WebCore::AXObjectCache::updateIsolatedTree): Update the isolated tree
for ASLanguage notifications.
* accessibility/AXObjectCache.h:

LayoutTests:

* accessibility/language-attribute-change-expected.txt: Added.
* accessibility/language-attribute-change.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (265494 => 265495)


--- trunk/LayoutTests/ChangeLog	2020-08-11 11:41:11 UTC (rev 265494)
+++ trunk/LayoutTests/ChangeLog	2020-08-11 12:11:24 UTC (rev 265495)
@@ -1,3 +1,14 @@
+2020-08-11  Andres Gonzalez  <[email protected]>
+
+        Update the isolated tree on element language changes.
+        https://bugs.webkit.org/show_bug.cgi?id=215354
+        <rdar://problem/65583698>
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/language-attribute-change-expected.txt: Added.
+        * accessibility/language-attribute-change.html: Added.
+
 2020-08-10  Myles C. Maxfield  <[email protected]>
 
         [BigSur] 5 fast/text/international/system-language/navigator-language/navigator-language tests are constant failures

Added: trunk/LayoutTests/accessibility/language-attribute-change-expected.txt (0 => 265495)


--- trunk/LayoutTests/accessibility/language-attribute-change-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/language-attribute-change-expected.txt	2020-08-11 12:11:24 UTC (rev 265495)
@@ -0,0 +1,7 @@
+Hola Mundo!
+PASS accessibleContent.language is 'AXLanguage: en'
+PASS accessibleContent.language is 'AXLanguage: es'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/accessibility/language-attribute-change.html (0 => 265495)


--- trunk/LayoutTests/accessibility/language-attribute-change.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/language-attribute-change.html	2020-08-11 12:11:24 UTC (rev 265495)
@@ -0,0 +1,34 @@
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+
+<div id="content" lang="en">Hello World!</div>
+
+<div id="console"></div>
+
+<script>
+    if (window.accessibilityController) {
+        window.jsTestIsAsync = true;
+
+        var content = document.getElementById("content");
+        var accessibleContent = accessibilityController.accessibleElementById("content");
+        shouldBe("accessibleContent.language", "'AXLanguage: en'");
+
+        content.innerText = "Hola Mundo!";
+        content.setAttribute("lang", "es");
+        setTimeout(async function() {
+            await waitFor(() => {
+                return accessibleContent.language == "AXLanguage: es";
+            });
+            shouldBe("accessibleContent.language", "'AXLanguage: es'");
+
+            finishJSTest();
+        }, 0);
+    }
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (265494 => 265495)


--- trunk/Source/WebCore/ChangeLog	2020-08-11 11:41:11 UTC (rev 265494)
+++ trunk/Source/WebCore/ChangeLog	2020-08-11 12:11:24 UTC (rev 265495)
@@ -1,3 +1,20 @@
+2020-08-11  Andres Gonzalez  <[email protected]>
+
+        Update the isolated tree on element language changes.
+        https://bugs.webkit.org/show_bug.cgi?id=215354
+        <rdar://problem/65583698>
+
+        Reviewed by Chris Fleizach.
+
+        Test: accessibility/language-attribute-change.html
+
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::AXObjectCache::handleAttributeChange): Added handling of
+        AXLanguageChanged notifications.
+        (WebCore::AXObjectCache::updateIsolatedTree): Update the isolated tree
+        for ASLanguage notifications.
+        * accessibility/AXObjectCache.h:
+
 2020-08-11  Alicia Boya GarcĂ­a  <[email protected]>
 
         [MSE][GStreamer] Remove m_sourceBufferPrivateClient checks in SourceBufferPrivateGStreamer

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (265494 => 265495)


--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2020-08-11 11:41:11 UTC (rev 265494)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2020-08-11 12:11:24 UTC (rev 265495)
@@ -1685,7 +1685,7 @@
 {
     if (!shouldProcessAttributeChange(attrName, element))
         return;
-    
+
     if (attrName == roleAttr)
         handleAriaRoleChanged(element);
     else if (attrName == altAttr || attrName == titleAttr)
@@ -1694,6 +1694,8 @@
         labelChanged(element);
     else if (attrName == tabindexAttr)
         childrenChanged(element->parentNode(), element);
+    else if (attrName == langAttr)
+        postNotification(element, AXObjectCache::AXLanguageChanged);
 
     if (!attrName.localName().string().startsWith("aria-"))
         return;
@@ -3170,6 +3172,7 @@
         tree->updateNode(object);
         break;
     case AXChildrenChanged:
+    case AXLanguageChanged:
         tree->updateChildren(object);
         break;
     default:
@@ -3230,7 +3233,8 @@
                 tree->updateNode(*notification.first);
             break;
         }
-        case AXChildrenChanged: {
+        case AXChildrenChanged:
+        case AXLanguageChanged: {
             bool needsUpdate = appendIfNotContainsMatching(filteredNotifications, notification, [&notification] (const std::pair<RefPtr<AXCoreObject>, AXNotification>& note) {
                 return note.second == notification.second && note.first.get() == notification.first.get();
             });

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.h (265494 => 265495)


--- trunk/Source/WebCore/accessibility/AXObjectCache.h	2020-08-11 11:41:11 UTC (rev 265494)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.h	2020-08-11 12:11:24 UTC (rev 265495)
@@ -278,6 +278,7 @@
         AXCurrentChanged,
         AXDisabledStateChanged,
         AXFocusedUIElementChanged,
+        AXLanguageChanged,
         AXLayoutComplete,
         AXLoadComplete,
         AXNewDocumentLoadComplete,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to