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/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;