Title: [198426] trunk
- Revision
- 198426
- Author
- n_w...@apple.com
- Date
- 2016-03-18 10:44:00 -0700 (Fri, 18 Mar 2016)
Log Message
AX: Typing broken on form input field while using VoiceOver
https://bugs.webkit.org/show_bug.cgi?id=155613
Reviewed by Chris Fleizach.
Source/WebCore:
The div element inside the INPUT element gives a collapsed TextMarkerRange which then creates
a collapsed Range. Fixed it by using the parent node to create the Range when the div node has
no children.
Test: accessibility/mac/text-marker-range-for-node-without-children.html
* accessibility/AXObjectCache.cpp:
(WebCore::setRangeStartOrEndWithCharacterOffset):
LayoutTests:
* accessibility/mac/text-marker-range-for-node-without-children-expected.txt: Added.
* accessibility/mac/text-marker-range-for-node-without-children.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (198425 => 198426)
--- trunk/LayoutTests/ChangeLog 2016-03-18 16:57:38 UTC (rev 198425)
+++ trunk/LayoutTests/ChangeLog 2016-03-18 17:44:00 UTC (rev 198426)
@@ -1,3 +1,13 @@
+2016-03-18 Nan Wang <n_w...@apple.com>
+
+ AX: Typing broken on form input field while using VoiceOver
+ https://bugs.webkit.org/show_bug.cgi?id=155613
+
+ Reviewed by Chris Fleizach.
+
+ * accessibility/mac/text-marker-range-for-node-without-children-expected.txt: Added.
+ * accessibility/mac/text-marker-range-for-node-without-children.html: Added.
+
2016-03-18 Youenn Fablet <youenn.fab...@crf.canon.fr>
crossorigin element resource loading should check HTTP redirection
Added: trunk/LayoutTests/accessibility/mac/text-marker-range-for-node-without-children-expected.txt (0 => 198426)
--- trunk/LayoutTests/accessibility/mac/text-marker-range-for-node-without-children-expected.txt (rev 0)
+++ trunk/LayoutTests/accessibility/mac/text-marker-range-for-node-without-children-expected.txt 2016-03-18 17:44:00 UTC (rev 198426)
@@ -0,0 +1,14 @@
+a
+b
+This tests that creating TextMarkerRange from nodes that have no children won't collapse to one side.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS textbox.textMarkerRangeLength(textboxRange) == 1 is true
+PASS textbox.accessibilityElementForTextMarker(startMarker).description is 'AXDescription: parent level'
+PASS textbox.accessibilityElementForTextMarker(endMarker).description is 'AXDescription: parent level'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/accessibility/mac/text-marker-range-for-node-without-children.html (0 => 198426)
--- trunk/LayoutTests/accessibility/mac/text-marker-range-for-node-without-children.html (rev 0)
+++ trunk/LayoutTests/accessibility/mac/text-marker-range-for-node-without-children.html 2016-03-18 17:44:00 UTC (rev 198426)
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+
+<div id="container" aria-label="parent level">
+a <div id="textbox" aria-label="child level" contenteditable="true"></div> b
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+ description("This tests that creating TextMarkerRange from nodes that have no children won't collapse to one side.");
+
+ if (window.accessibilityController) {
+ var textbox = accessibilityController.accessibleElementById("textbox");
+ var textboxRange = textbox.textMarkerRangeForElement(textbox);
+ // The range should include the div element.
+ shouldBeTrue("textbox.textMarkerRangeLength(textboxRange) == 1");
+
+ // Make sure the node that associates with the text marker is the parent div element.
+ var startMarker = textbox.startTextMarkerForTextMarkerRange(textboxRange);
+ var endMarker = textbox.endTextMarkerForTextMarkerRange(textboxRange);
+ shouldBe("textbox.accessibilityElementForTextMarker(startMarker).description", "'AXDescription: parent level'");
+ shouldBe("textbox.accessibilityElementForTextMarker(endMarker).description", "'AXDescription: parent level'");
+ }
+</script>
+
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (198425 => 198426)
--- trunk/Source/WebCore/ChangeLog 2016-03-18 16:57:38 UTC (rev 198425)
+++ trunk/Source/WebCore/ChangeLog 2016-03-18 17:44:00 UTC (rev 198426)
@@ -1,3 +1,19 @@
+2016-03-18 Nan Wang <n_w...@apple.com>
+
+ AX: Typing broken on form input field while using VoiceOver
+ https://bugs.webkit.org/show_bug.cgi?id=155613
+
+ Reviewed by Chris Fleizach.
+
+ The div element inside the INPUT element gives a collapsed TextMarkerRange which then creates
+ a collapsed Range. Fixed it by using the parent node to create the Range when the div node has
+ no children.
+
+ Test: accessibility/mac/text-marker-range-for-node-without-children.html
+
+ * accessibility/AXObjectCache.cpp:
+ (WebCore::setRangeStartOrEndWithCharacterOffset):
+
2016-03-18 Chris Fleizach <cfleiz...@apple.com>
AX: Implement AutoFill Available attribute for a text field
Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (198425 => 198426)
--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp 2016-03-18 16:57:38 UTC (rev 198425)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp 2016-03-18 17:44:00 UTC (rev 198426)
@@ -1630,9 +1630,16 @@
int offset = characterOffset.startIndex + characterOffset.offset;
Node* node = characterOffset.node;
- if (isReplacedNodeOrBR(node))
- node = resetNodeAndOffsetForReplacedNode(node, offset, characterOffset.offset);
+ bool replacedNodeOrBR = isReplacedNodeOrBR(node);
+ // For the non text node that has no children, we should create the range with its parent, otherwise the range would be collapsed.
+ // Example: <div contenteditable="true"></div>, we want the range to include the div element.
+ bool noChildren = !replacedNodeOrBR && !node->isTextNode() && !node->hasChildNodes();
+ int characterCount = noChildren ? (isStart ? 0 : 1) : characterOffset.offset;
+
+ if (replacedNodeOrBR || noChildren)
+ node = resetNodeAndOffsetForReplacedNode(node, offset, characterCount);
+
if (isStart)
range->setStart(node, offset, ec);
else
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes