Title: [292019] trunk
Revision
292019
Author
[email protected]
Date
2022-03-28 18:20:34 -0700 (Mon, 28 Mar 2022)

Log Message

[AT-SPI] accessibility/native-text-control-attributed-string.html is failing
https://bugs.webkit.org/show_bug.cgi?id=237821

Reviewed by Carlos Garcia Campos.

Tools:

* WebKitTestRunner/InjectedBundle/atspi/AccessibilityUIElementAtspi.cpp:
(WTR::AccessibilityUIElement::attributedStringForRange): Check the
validity of the passed range.

LayoutTests:

* platform/gtk/TestExpectations:
* platform/gtk/accessibility/native-text-control-attributed-string-expected.txt: Added.
* platform/wpe/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (292018 => 292019)


--- trunk/LayoutTests/ChangeLog	2022-03-29 01:16:31 UTC (rev 292018)
+++ trunk/LayoutTests/ChangeLog	2022-03-29 01:20:34 UTC (rev 292019)
@@ -1,3 +1,14 @@
+2022-03-28  Lauro Moura  <[email protected]>
+
+        [AT-SPI] accessibility/native-text-control-attributed-string.html is failing
+        https://bugs.webkit.org/show_bug.cgi?id=237821
+
+        Reviewed by Carlos Garcia Campos.
+
+        * platform/gtk/TestExpectations:
+        * platform/gtk/accessibility/native-text-control-attributed-string-expected.txt: Added.
+        * platform/wpe/TestExpectations:
+
 2022-03-28  Matteo Flores  <[email protected]>
 
         [ iPadOS ] 3 svg/filters/* tests are constant image failures

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (292018 => 292019)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2022-03-29 01:16:31 UTC (rev 292018)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2022-03-29 01:20:34 UTC (rev 292019)
@@ -1864,7 +1864,6 @@
 #////////////////////////////////////////////////////////////////////////////////////////
 
 accessibility/dialog-properties.html [ Skip ]
-accessibility/native-text-control-attributed-string.html [ Skip ]
 
 # These tests require platform support.
 media/media-allowed-codecs.html

Added: trunk/LayoutTests/platform/gtk/accessibility/native-text-control-attributed-string-expected.txt (0 => 292019)


--- trunk/LayoutTests/platform/gtk/accessibility/native-text-control-attributed-string-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/gtk/accessibility/native-text-control-attributed-string-expected.txt	2022-03-29 01:20:34 UTC (rev 292019)
@@ -0,0 +1,135 @@
+Tests that attributedStringForRange works properly for native text and password fields, including for ranges out of bound.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Attributed string for range (0, 9):
+	Default text attributes:
+		indent:0
+		family-name:Liberation Sans
+		bg-color:255,255,255
+		editable:true
+		strikethrough:false
+		style:normal
+		fg-color:0,0,0
+		size:12pt
+		weight:400
+		invisible:false
+		underline:none
+		direction:ltr
+	Range attributes for 'some word':
+Attributed string for range (0, 3):
+	Default text attributes:
+		indent:0
+		family-name:Liberation Sans
+		bg-color:255,255,255
+		editable:true
+		strikethrough:false
+		style:normal
+		fg-color:0,0,0
+		size:12pt
+		weight:400
+		invisible:false
+		underline:none
+		direction:ltr
+	Range attributes for 'som':
+Attributed string for range (5, 4):
+	Default text attributes:
+		indent:0
+		family-name:Liberation Sans
+		bg-color:255,255,255
+		editable:true
+		strikethrough:false
+		style:normal
+		fg-color:0,0,0
+		size:12pt
+		weight:400
+		invisible:false
+		underline:none
+		direction:ltr
+	Range attributes for 'word':
+Attributed string for range (5, 10):
+Attributed string for range (10, 1):
+Attributed string for range (-1, 1):
+	Default text attributes:
+		indent:0
+		family-name:Liberation Sans
+		bg-color:255,255,255
+		editable:true
+		strikethrough:false
+		style:normal
+		fg-color:0,0,0
+		size:12pt
+		weight:400
+		invisible:false
+		underline:none
+		direction:ltr
+	Range attributes for 's':
+
+Attributed string for range (0, 3):
+	Default text attributes:
+		indent:0
+		family-name:Liberation Sans
+		bg-color:255,255,255
+		editable:true
+		strikethrough:false
+		style:normal
+		fg-color:0,0,0
+		size:12pt
+		weight:400
+		invisible:false
+		underline:none
+		direction:ltr
+	Range attributes for '•••':
+Attributed string for range (0, 2):
+	Default text attributes:
+		indent:0
+		family-name:Liberation Sans
+		bg-color:255,255,255
+		editable:true
+		strikethrough:false
+		style:normal
+		fg-color:0,0,0
+		size:12pt
+		weight:400
+		invisible:false
+		underline:none
+		direction:ltr
+	Range attributes for '••':
+Attributed string for range (1, 2):
+	Default text attributes:
+		indent:0
+		family-name:Liberation Sans
+		bg-color:255,255,255
+		editable:true
+		strikethrough:false
+		style:normal
+		fg-color:0,0,0
+		size:12pt
+		weight:400
+		invisible:false
+		underline:none
+		direction:ltr
+	Range attributes for '••':
+Attributed string for range (1, 10):
+Attributed string for range (10, 1):
+Attributed string for range (-1, 1):
+	Default text attributes:
+		indent:0
+		family-name:Liberation Sans
+		bg-color:255,255,255
+		editable:true
+		strikethrough:false
+		style:normal
+		fg-color:0,0,0
+		size:12pt
+		weight:400
+		invisible:false
+		underline:none
+		direction:ltr
+	Range attributes for '•':
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Modified: trunk/LayoutTests/platform/wpe/TestExpectations (292018 => 292019)


--- trunk/LayoutTests/platform/wpe/TestExpectations	2022-03-29 01:16:31 UTC (rev 292018)
+++ trunk/LayoutTests/platform/wpe/TestExpectations	2022-03-29 01:20:34 UTC (rev 292019)
@@ -163,6 +163,7 @@
 # Accessibility
 webkit.org/b/225479 accessibility/aria-modal.html [ Timeout ]
 webkit.org/b/225479 accessibility/dialog-showModal.html [ Timeout ]
+webkit.org/b/237820 accessibility/native-text-control-attributed-string.html [ Timeout ]
 
 # Animations
 webkit.org/b/232745 fast/animation/request-animation-frame-throttling-lowPowerMode.html [ Timeout ]

Modified: trunk/Tools/ChangeLog (292018 => 292019)


--- trunk/Tools/ChangeLog	2022-03-29 01:16:31 UTC (rev 292018)
+++ trunk/Tools/ChangeLog	2022-03-29 01:20:34 UTC (rev 292019)
@@ -1,3 +1,14 @@
+2022-03-28  Lauro Moura  <[email protected]>
+
+        [AT-SPI] accessibility/native-text-control-attributed-string.html is failing
+        https://bugs.webkit.org/show_bug.cgi?id=237821
+
+        Reviewed by Carlos Garcia Campos.
+
+        * WebKitTestRunner/InjectedBundle/atspi/AccessibilityUIElementAtspi.cpp:
+        (WTR::AccessibilityUIElement::attributedStringForRange): Check the
+        validity of the passed range.
+
 2022-03-28  Devin Rousso  <[email protected]>
 
         [macOS] Add `WKWebView` API to control CSS "small viewport" `sv*` and "large viewport" `lv*` units

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/atspi/AccessibilityUIElementAtspi.cpp (292018 => 292019)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/atspi/AccessibilityUIElementAtspi.cpp	2022-03-29 01:16:31 UTC (rev 292018)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/atspi/AccessibilityUIElementAtspi.cpp	2022-03-29 01:20:34 UTC (rev 292019)
@@ -1166,6 +1166,13 @@
     if (!m_element->interfaces().contains(WebCore::AccessibilityObjectAtspi::Interface::Text))
         return JSStringCreateWithCharacters(nullptr, 0);
 
+    m_element->updateBackingStore();
+    auto text = m_element->text();
+    auto limit = location + length;
+
+    if (limit > text.length())
+        return JSStringCreateWithCharacters(nullptr, 0);
+
     StringBuilder builder;
 
     auto buildAttributes = [&](const WebCore::AccessibilityObjectAtspi::TextAttributes& attributes) {
@@ -1179,12 +1186,11 @@
     builder.append("\n\tDefault text attributes:");
     buildAttributes(m_element->textAttributes());
 
-    auto text = m_element->text();
     int endOffset = 0;
-    for (unsigned i = location; i < location + length; i = endOffset) {
+    for (unsigned i = location; i < limit; i = endOffset) {
         auto attributes = m_element->textAttributes(i);
         auto rangeStart = std::max<int>(location, attributes.startOffset);
-        auto rangeEnd = std::min<int>(location + length, attributes.endOffset);
+        auto rangeEnd = std::min<int>(limit, attributes.endOffset);
         builder.append("\n\tRange attributes for '", text.substring(rangeStart, rangeEnd - rangeStart).replace("\n", "<\\n>").replace(objectReplacementCharacter, "<obj>"), "':");
         buildAttributes(attributes);
         endOffset = attributes.endOffset;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to