Title: [199809] trunk
Revision
199809
Author
[email protected]
Date
2016-04-21 01:41:14 -0700 (Thu, 21 Apr 2016)

Log Message

AX: stringForTextMarkerRange returning empty string for document range
https://bugs.webkit.org/show_bug.cgi?id=156819

Reviewed by Chris Fleizach.

Source/WebCore:

Set text marker data with CharacterOffset when VisiblePosition is having PositionIsAfterAnchor
or PositionIsAfterChildren anchor type, so that the character offset corresponds to the anchored
node.

Test: accessibility/mac/text-marker-string-for-document-range.html

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::textMarkerDataForVisiblePosition):

LayoutTests:

* accessibility/mac/text-marker-string-for-document-range-expected.txt: Added.
* accessibility/mac/text-marker-string-for-document-range.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (199808 => 199809)


--- trunk/LayoutTests/ChangeLog	2016-04-21 05:04:47 UTC (rev 199808)
+++ trunk/LayoutTests/ChangeLog	2016-04-21 08:41:14 UTC (rev 199809)
@@ -1,3 +1,13 @@
+2016-04-21  Nan Wang  <[email protected]>
+
+        AX: stringForTextMarkerRange returning empty string for document range
+        https://bugs.webkit.org/show_bug.cgi?id=156819
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/mac/text-marker-string-for-document-range-expected.txt: Added.
+        * accessibility/mac/text-marker-string-for-document-range.html: Added.
+
 2016-04-20  Ryan Haddad  <[email protected]>
 
         Adding ios-simulator-wk1 specific baselines for compositing and css3 LayoutTests due to contentsOpaque difference

Added: trunk/LayoutTests/accessibility/mac/text-marker-string-for-document-range-expected.txt (0 => 199809)


--- trunk/LayoutTests/accessibility/mac/text-marker-string-for-document-range-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/text-marker-string-for-document-range-expected.txt	2016-04-21 08:41:14 UTC (rev 199809)
@@ -0,0 +1,18 @@
+text
+This tests that we are getting the correct string for document range if the end visible position has after anchor type.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+String: 
+text
+This tests that we are getting the correct string for document range if the end visible position has after anchor type.
+
+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-range.html (0 => 199809)


--- trunk/LayoutTests/accessibility/mac/text-marker-string-for-document-range.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/mac/text-marker-string-for-document-range.html	2016-04-21 08:41:14 UTC (rev 199809)
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<table>
+<tbody>
+<tr>
+<td>
+<table><tbody><tr><td>text</td></tr></tbody></table>
+<table><tbody><tr><td><p id="description"></p><div id="console"></div></td></tr></tbody></table>
+</td>
+</tr>
+</tbody>
+</table>
+
+<script>
+
+    description("This tests that we are getting the correct string for document range if the end visible position has after anchor type.");
+
+    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 (199808 => 199809)


--- trunk/Source/WebCore/ChangeLog	2016-04-21 05:04:47 UTC (rev 199808)
+++ trunk/Source/WebCore/ChangeLog	2016-04-21 08:41:14 UTC (rev 199809)
@@ -1,3 +1,19 @@
+2016-04-21  Nan Wang  <[email protected]>
+
+        AX: stringForTextMarkerRange returning empty string for document range
+        https://bugs.webkit.org/show_bug.cgi?id=156819
+
+        Reviewed by Chris Fleizach.
+
+        Set text marker data with CharacterOffset when VisiblePosition is having PositionIsAfterAnchor
+        or PositionIsAfterChildren anchor type, so that the character offset corresponds to the anchored
+        node.
+
+        Test: accessibility/mac/text-marker-string-for-document-range.html
+
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::AXObjectCache::textMarkerDataForVisiblePosition):
+
 2016-04-20  Chris Dumez  <[email protected]>
 
         Crash under WebCore::TextIterator::subrange()

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (199808 => 199809)


--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2016-04-21 05:04:47 UTC (rev 199808)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2016-04-21 08:41:14 UTC (rev 199809)
@@ -1971,6 +1971,14 @@
     if (is<HTMLInputElement>(*domNode) && downcast<HTMLInputElement>(*domNode).isPasswordField())
         return;
     
+    // If the visible position has an anchor type referring to a node other than the anchored node, we should
+    // set the text marker data with CharacterOffset so that the offset will correspond to the node.
+    CharacterOffset characterOffset = characterOffsetFromVisiblePosition(visiblePos);
+    if (deepPos.anchorType() == Position::PositionIsAfterAnchor || deepPos.anchorType() == Position::PositionIsAfterChildren) {
+        textMarkerDataForCharacterOffset(textMarkerData, characterOffset);
+        return;
+    }
+    
     // find or create an accessibility object for this node
     AXObjectCache* cache = domNode->document().axObjectCache();
     RefPtr<AccessibilityObject> obj = cache->getOrCreate(domNode);
@@ -1980,8 +1988,6 @@
     textMarkerData.offset = deepPos.deprecatedEditingOffset();
     textMarkerData.affinity = visiblePos.affinity();
     
-    // convert to character offset
-    CharacterOffset characterOffset = characterOffsetFromVisiblePosition(visiblePos);
     textMarkerData.characterOffset = characterOffset.offset;
     textMarkerData.characterStartIndex = characterOffset.startIndex;
     
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to