Title: [219949] trunk
- Revision
- 219949
- Author
- [email protected]
- Date
- 2017-07-26 09:53:09 -0700 (Wed, 26 Jul 2017)
Log Message
AX: Incorrect range from index and length in contenteditable with <p> tags
https://bugs.webkit.org/show_bug.cgi?id=174856
Reviewed by Chris Fleizach.
Source/WebCore:
When asking for the string inside a text control with a given range, we sometimes get
a wrong string at the line boundary due to a bad plain range to text marker conversion.
To fix this, we should use the exsisting method on text controls to avoid this issue.
Updated the test to test the problematic case.
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
LayoutTests:
* accessibility/mac/range-for-contenteditable-newline-expected.txt:
* accessibility/mac/range-for-contenteditable-newline.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (219948 => 219949)
--- trunk/LayoutTests/ChangeLog 2017-07-26 15:29:29 UTC (rev 219948)
+++ trunk/LayoutTests/ChangeLog 2017-07-26 16:53:09 UTC (rev 219949)
@@ -1,3 +1,13 @@
+2017-07-26 Nan Wang <[email protected]>
+
+ AX: Incorrect range from index and length in contenteditable with <p> tags
+ https://bugs.webkit.org/show_bug.cgi?id=174856
+
+ Reviewed by Chris Fleizach.
+
+ * accessibility/mac/range-for-contenteditable-newline-expected.txt:
+ * accessibility/mac/range-for-contenteditable-newline.html:
+
2017-07-26 Ms2ger <[email protected]>
Remove obsolete failure annotation for bad-charset-alias.html.
Modified: trunk/LayoutTests/accessibility/mac/range-for-contenteditable-newline-expected.txt (219948 => 219949)
--- trunk/LayoutTests/accessibility/mac/range-for-contenteditable-newline-expected.txt 2017-07-26 15:29:29 UTC (rev 219948)
+++ trunk/LayoutTests/accessibility/mac/range-for-contenteditable-newline-expected.txt 2017-07-26 16:53:09 UTC (rev 219949)
@@ -7,9 +7,9 @@
def
-The quick brown fox
+ab
-jumped over the lazy dog
+cd ef
Text in a pre element
is displayed in a fixed-width
@@ -26,14 +26,11 @@
PASS textareaTextHello is 'hello'
PASS textareaTextWorld is 'world'
PASS textDEF is 'def'
-PASS rangeForLine is '{21, 25}'
-PASS textLine is 'jumped over the lazy dog'
-PASS firstLine is 0
-PASS secondLine is 1
+PASS rangeValue is '[newline][newline]cd'
PASS rangeForLine is '{22, 30}'
PASS textLine is 'is displayed in a fixed-width\n'
PASS firstLine is 0
-FAIL secondLine should be 1. Was 2.
+PASS secondLine is 1
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/accessibility/mac/range-for-contenteditable-newline.html (219948 => 219949)
--- trunk/LayoutTests/accessibility/mac/range-for-contenteditable-newline.html 2017-07-26 15:29:29 UTC (rev 219948)
+++ trunk/LayoutTests/accessibility/mac/range-for-contenteditable-newline.html 2017-07-26 16:53:09 UTC (rev 219949)
@@ -13,8 +13,8 @@
<div id="textcontrol2" contenteditable="true">abc<div><br></div<div><br></div><div><br></div><div>def</div></div>
<div id="textcontrol3" contenteditable="true">
-<p>The quick brown fox</p>
-<p>jumped over the lazy dog</p>
+<p>ab</p>
+<p>cd ef</p>
</div>
<div id="textcontrol4" contenteditable="true">
@@ -59,14 +59,10 @@
// Test line ranges in contenteditable
var textControl3 = accessibilityController.accessibleElementById("textcontrol3");
- var rangeForLine = textControl3.rangeForLine(1);
- shouldBe("rangeForLine", "'{21, 25}'");
- var textLine = textControl3.stringForRange(21, 25);
- shouldBe("textLine", "'jumped over the lazy dog'");
- var firstLine = textControl3.lineForIndex(20);
- var secondLine = textControl3.lineForIndex(46);
- shouldBe("firstLine", "0");
- shouldBe("secondLine", "1");
+ var rangeValue = textControl3.stringForRange(2, 4);
+ // Replace the newline characters, and make sure it has two of them
+ rangeValue = rangeValue.replace(/(?:\r\n|\r|\n)/g, '[newline]');
+ shouldBe("rangeValue", "'[newline][newline]cd'");
// pre tag in contenteditable
var textControl4 = accessibilityController.accessibleElementById("textcontrol4");
@@ -75,7 +71,7 @@
textLine = textControl4.stringForRange(22, 30);
shouldBe("textLine", "'is displayed in a fixed-width\\n'");
firstLine = textControl4.lineForIndex(21);
- secondLine = textControl4.lineForIndex(52);
+ secondLine = textControl4.lineForIndex(51);
shouldBe("firstLine", "0");
shouldBe("secondLine", "1");
Modified: trunk/Source/WebCore/ChangeLog (219948 => 219949)
--- trunk/Source/WebCore/ChangeLog 2017-07-26 15:29:29 UTC (rev 219948)
+++ trunk/Source/WebCore/ChangeLog 2017-07-26 16:53:09 UTC (rev 219949)
@@ -1,3 +1,19 @@
+2017-07-26 Nan Wang <[email protected]>
+
+ AX: Incorrect range from index and length in contenteditable with <p> tags
+ https://bugs.webkit.org/show_bug.cgi?id=174856
+
+ Reviewed by Chris Fleizach.
+
+ When asking for the string inside a text control with a given range, we sometimes get
+ a wrong string at the line boundary due to a bad plain range to text marker conversion.
+ To fix this, we should use the exsisting method on text controls to avoid this issue.
+
+ Updated the test to test the problematic case.
+
+ * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+ (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
+
2017-07-26 Daewoong Jang <[email protected]>
[Curl] Bug fix after r219606
Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (219948 => 219949)
--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm 2017-07-26 15:29:29 UTC (rev 219948)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm 2017-07-26 16:53:09 UTC (rev 219949)
@@ -3960,6 +3960,11 @@
}
if ([attribute isEqualToString:NSAccessibilityStringForRangeParameterizedAttribute]) {
+ if (m_object->isTextControl()) {
+ PlainTextRange plainTextRange = PlainTextRange(range.location, range.length);
+ return m_object->doAXStringForRange(plainTextRange);
+ }
+
CharacterOffset start = cache->characterOffsetForIndex(range.location, m_object);
CharacterOffset end = cache->characterOffsetForIndex(range.location + range.length, m_object);
if (start.isNull() || end.isNull())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes