Title: [200508] trunk
- Revision
- 200508
- Author
- n_w...@apple.com
- Date
- 2016-05-06 00:27:22 -0700 (Fri, 06 May 2016)
Log Message
AX: String for document range is empty if end visible position anchors to a ignored replaced node
https://bugs.webkit.org/show_bug.cgi?id=157403
Reviewed by Chris Fleizach.
Source/WebCore:
The CharacterOffset that is converted from VisiblePositon is wrong when the VisiblePostion anchors
to an ignored replaced node. Fixed it by adjusting the offset of the CharacterOffset correctly in
such case.
Test: accessibility/mac/text-marker-string-for-document-end-replaced-node.html
* accessibility/AXObjectCache.cpp:
(WebCore::characterOffsetsInOrder):
(WebCore::AXObjectCache::characterOffsetFromVisiblePosition):
(WebCore::AXObjectCache::accessibilityObjectForTextMarkerData):
LayoutTests:
* accessibility/mac/text-marker-string-for-document-end-replaced-node-expected.txt: Added.
* accessibility/mac/text-marker-string-for-document-end-replaced-node.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (200507 => 200508)
--- trunk/LayoutTests/ChangeLog 2016-05-06 06:25:30 UTC (rev 200507)
+++ trunk/LayoutTests/ChangeLog 2016-05-06 07:27:22 UTC (rev 200508)
@@ -1,3 +1,13 @@
+2016-05-06 Nan Wang <n_w...@apple.com>
+
+ AX: String for document range is empty if end visible position anchors to a ignored replaced node
+ https://bugs.webkit.org/show_bug.cgi?id=157403
+
+ Reviewed by Chris Fleizach.
+
+ * accessibility/mac/text-marker-string-for-document-end-replaced-node-expected.txt: Added.
+ * accessibility/mac/text-marker-string-for-document-end-replaced-node.html: Added.
+
2016-05-05 Dean Jackson <d...@apple.com>
4 and 8 digit color attributes should use the crazypants algorithm, not the CSS one.
Added: trunk/LayoutTests/accessibility/mac/text-marker-string-for-document-end-replaced-node-expected.txt (0 => 200508)
--- trunk/LayoutTests/accessibility/mac/text-marker-string-for-document-end-replaced-node-expected.txt (rev 0)
+++ trunk/LayoutTests/accessibility/mac/text-marker-string-for-document-end-replaced-node-expected.txt 2016-05-06 07:27:22 UTC (rev 200508)
@@ -0,0 +1,25 @@
+ Some text
+
+Message content.
+
+Some other text.
+
+This tests that we are getting the correct string for document range if the end visible position anchors an ignored replaced node.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+String:
+ Some text
+
+Message content.
+
+Some other text.
+
+This tests that we are getting the correct string for document range if the end visible position anchors an ignored replaced node.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/accessibility/mac/text-marker-string-for-document-end-replaced-node.html (0 => 200508)
--- trunk/LayoutTests/accessibility/mac/text-marker-string-for-document-end-replaced-node.html (rev 0)
+++ trunk/LayoutTests/accessibility/mac/text-marker-string-for-document-end-replaced-node.html 2016-05-06 07:27:22 UTC (rev 200508)
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<body>
+<div id="wrapper">
+<h1>
+ <img src="" alt="Apple">
+ <span> Some text </span>
+</h1>
+<div id="message">
+Message content.<br><br>
+Some other text.<br>
+</div>
+<img alt="" style="bottom: -20px; right: -30px; width: 135px; height: 100px;" src=""
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+</body>
+
+<script>
+
+ description("This tests that we are getting the correct string for document range if the end visible position anchors an ignored replaced node.");
+
+ if (window.accessibilityController) {
+
+ var body = accessibilityController.rootElement.childAtIndex(0);
+ var startMarker = body.startTextMarker;
+ var endMarker = body.endTextMarker;
+ var textMarkerRange = body.textMarkerRangeForMarkers(startMarker, endMarker);
+ debug("String: \n" + body.stringForTextMarkerRange(textMarkerRange));
+ }
+
+</script>
+
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (200507 => 200508)
--- trunk/Source/WebCore/ChangeLog 2016-05-06 06:25:30 UTC (rev 200507)
+++ trunk/Source/WebCore/ChangeLog 2016-05-06 07:27:22 UTC (rev 200508)
@@ -1,3 +1,21 @@
+2016-05-06 Nan Wang <n_w...@apple.com>
+
+ AX: String for document range is empty if end visible position anchors to a ignored replaced node
+ https://bugs.webkit.org/show_bug.cgi?id=157403
+
+ Reviewed by Chris Fleizach.
+
+ The CharacterOffset that is converted from VisiblePositon is wrong when the VisiblePostion anchors
+ to an ignored replaced node. Fixed it by adjusting the offset of the CharacterOffset correctly in
+ such case.
+
+ Test: accessibility/mac/text-marker-string-for-document-end-replaced-node.html
+
+ * accessibility/AXObjectCache.cpp:
+ (WebCore::characterOffsetsInOrder):
+ (WebCore::AXObjectCache::characterOffsetFromVisiblePosition):
+ (WebCore::AXObjectCache::accessibilityObjectForTextMarkerData):
+
2016-05-05 David Kilzer <ddkil...@apple.com>
[iOS] WebCore does not need to link to CoreAudio, GraphicsServices, SystemConfiguration frameworks
Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (200507 => 200508)
--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp 2016-05-06 06:25:30 UTC (rev 200507)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp 2016-05-06 07:27:22 UTC (rev 200508)
@@ -1655,9 +1655,9 @@
Node* node1 = characterOffset1.node;
Node* node2 = characterOffset2.node;
- if (!node1->offsetInCharacters() && !isReplacedNodeOrBR(node1))
+ if (!node1->offsetInCharacters() && !isReplacedNodeOrBR(node1) && node1->hasChildNodes())
node1 = node1->traverseToChildAt(characterOffset1.offset);
- if (!node2->offsetInCharacters() && !isReplacedNodeOrBR(node2))
+ if (!node2->offsetInCharacters() && !isReplacedNodeOrBR(node2) && node2->hasChildNodes())
node2 = node2->traverseToChildAt(characterOffset2.offset);
if (!node1 || !node2)
@@ -1997,7 +1997,11 @@
}
}
- return traverseToOffsetInRange(rangeForNodeContents(obj->node()), characterOffset);
+ // Sometimes when the node is a replaced node and is ignored in accessibility, we get a wrong CharacterOffset from it.
+ CharacterOffset result = traverseToOffsetInRange(rangeForNodeContents(obj->node()), characterOffset);
+ if (result.remainingOffset > 0 && !result.isNull() && isRendererReplacedElement(result.node->renderer()))
+ result.offset += result.remainingOffset;
+ return result;
}
AccessibilityObject* AXObjectCache::accessibilityObjectForTextMarkerData(TextMarkerData& textMarkerData)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes