Title: [234307] branches/safari-606-branch
- Revision
- 234307
- Author
- [email protected]
- Date
- 2018-07-26 23:02:25 -0700 (Thu, 26 Jul 2018)
Log Message
Cherry-pick r234275. rdar://problem/42650440
AX: nothing returned for various previous text marker APIs from one div/p node to another
https://bugs.webkit.org/show_bug.cgi?id=188071
Reviewed by Chris Fleizach.
Source/WebCore:
TextIterator is emitting an extra '\n' at the end of the <p> node and there's no
corresponding text node in the DOM tree, so we are not able to handle that for
text markers. Fixed it by ignoring the extra '\n' and anchor the text marker to
the previous child text node.
Test: accessibility/mac/text-marker-p-tags.html
* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::traverseToOffsetInRange):
LayoutTests:
* accessibility/mac/text-marker-p-tags-expected.txt: Added.
* accessibility/mac/text-marker-p-tags.html: Added.
* accessibility/mac/text-marker-string-for-document-range-expected.txt:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234275 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Added Paths
Diff
Modified: branches/safari-606-branch/LayoutTests/ChangeLog (234306 => 234307)
--- branches/safari-606-branch/LayoutTests/ChangeLog 2018-07-27 06:02:22 UTC (rev 234306)
+++ branches/safari-606-branch/LayoutTests/ChangeLog 2018-07-27 06:02:25 UTC (rev 234307)
@@ -1,5 +1,46 @@
2018-07-26 Babak Shafiei <[email protected]>
+ Cherry-pick r234275. rdar://problem/42650440
+
+ AX: nothing returned for various previous text marker APIs from one div/p node to another
+ https://bugs.webkit.org/show_bug.cgi?id=188071
+
+ Reviewed by Chris Fleizach.
+
+ Source/WebCore:
+
+ TextIterator is emitting an extra '\n' at the end of the <p> node and there's no
+ corresponding text node in the DOM tree, so we are not able to handle that for
+ text markers. Fixed it by ignoring the extra '\n' and anchor the text marker to
+ the previous child text node.
+
+ Test: accessibility/mac/text-marker-p-tags.html
+
+ * accessibility/AXObjectCache.cpp:
+ (WebCore::AXObjectCache::traverseToOffsetInRange):
+
+ LayoutTests:
+
+ * accessibility/mac/text-marker-p-tags-expected.txt: Added.
+ * accessibility/mac/text-marker-p-tags.html: Added.
+ * accessibility/mac/text-marker-string-for-document-range-expected.txt:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234275 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2018-07-26 Nan Wang <[email protected]>
+
+ AX: nothing returned for various previous text marker APIs from one div/p node to another
+ https://bugs.webkit.org/show_bug.cgi?id=188071
+
+ Reviewed by Chris Fleizach.
+
+ * accessibility/mac/text-marker-p-tags-expected.txt: Added.
+ * accessibility/mac/text-marker-p-tags.html: Added.
+ * accessibility/mac/text-marker-string-for-document-range-expected.txt:
+
+2018-07-26 Babak Shafiei <[email protected]>
+
Cherry-pick r233926. rdar://problem/42354941
PiP from Element Fullscreen should match AVKit's behavior
Added: branches/safari-606-branch/LayoutTests/accessibility/mac/text-marker-p-tags-expected.txt (0 => 234307)
--- branches/safari-606-branch/LayoutTests/accessibility/mac/text-marker-p-tags-expected.txt (rev 0)
+++ branches/safari-606-branch/LayoutTests/accessibility/mac/text-marker-p-tags-expected.txt 2018-07-27 06:02:25 UTC (rev 234307)
@@ -0,0 +1,21 @@
+This tests that previous sentence/word/paragraph text marker calls work with p tag elements
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS selectedString is 'Where'
+Previous sentence: Test sentence two
+
+
+Previous word: two
+
+
+Previous paragraph: Test sentence one. Test sentence two
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Test sentence one. Test sentence two
+
+Where
Added: branches/safari-606-branch/LayoutTests/accessibility/mac/text-marker-p-tags.html (0 => 234307)
--- branches/safari-606-branch/LayoutTests/accessibility/mac/text-marker-p-tags.html (rev 0)
+++ branches/safari-606-branch/LayoutTests/accessibility/mac/text-marker-p-tags.html 2018-07-27 06:02:25 UTC (rev 234307)
@@ -0,0 +1,67 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<div>
+<p id="p1">Test sentence one. Test sentence two</p>
+</div>
+<div>
+<p id="p2">Where</p>
+</div>
+
+<script>
+
+ description("This tests that previous sentence\/word\/paragraph text marker calls work with p tag elements");
+
+ if (window.accessibilityController) {
+
+ // select text
+ selectText('p2');
+ var p2 = accessibilityController.accessibleElementById("p2");
+ var selectedRange = p2.selectedTextMarkerRange();
+ var selectedString = p2.stringForTextMarkerRange(selectedRange);
+ shouldBe("selectedString", "'Where'");
+
+ var startTextMarker = p2.startTextMarkerForTextMarkerRange(selectedRange);
+ var preSentenceStart = p2.previousSentenceStartTextMarkerForTextMarker(startTextMarker);
+ var sentenceRange = p2.textMarkerRangeForMarkers(preSentenceStart, startTextMarker);
+ var sentenceString = p2.stringForTextMarkerRange(sentenceRange);
+ debug("Previous sentence: " + sentenceString);
+
+ var preWordStart = p2.previousWordStartTextMarkerForTextMarker(startTextMarker);
+ var wordRange = p2.textMarkerRangeForMarkers(preWordStart, startTextMarker);
+ var wordString = p2.stringForTextMarkerRange(wordRange);
+ debug("Previous word: " + wordString);
+
+ var preParagraphStart = p2.previousParagraphStartTextMarkerForTextMarker(startTextMarker);
+ var paragraphRange = p2.textMarkerRangeForMarkers(preParagraphStart, startTextMarker);
+ var paragraphString = p2.stringForTextMarkerRange(paragraphRange);
+ debug("Previous paragraph: " + paragraphString);
+ }
+
+ function selectText(node) {
+ node = document.getElementById(node);
+
+ if (document.body.createTextRange) {
+ const range = document.body.createTextRange();
+ range.moveToElementText(node);
+ range.select();
+ } else if (window.getSelection) {
+ const selection = window.getSelection();
+ const range = document.createRange();
+ range.selectNodeContents(node);
+ selection.removeAllRanges();
+ selection.addRange(range);
+ } else {
+ console.warn("Could not select text in node: Unsupported browser.");
+ }
+ }
+
+</script>
+
+<script src=""
+</body>
+</html>
Modified: branches/safari-606-branch/LayoutTests/accessibility/mac/text-marker-string-for-document-range-expected.txt (234306 => 234307)
--- branches/safari-606-branch/LayoutTests/accessibility/mac/text-marker-string-for-document-range-expected.txt 2018-07-27 06:02:22 UTC (rev 234306)
+++ branches/safari-606-branch/LayoutTests/accessibility/mac/text-marker-string-for-document-range-expected.txt 2018-07-27 06:02:25 UTC (rev 234307)
@@ -9,9 +9,6 @@
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
Modified: branches/safari-606-branch/Source/WebCore/ChangeLog (234306 => 234307)
--- branches/safari-606-branch/Source/WebCore/ChangeLog 2018-07-27 06:02:22 UTC (rev 234306)
+++ branches/safari-606-branch/Source/WebCore/ChangeLog 2018-07-27 06:02:25 UTC (rev 234307)
@@ -1,5 +1,52 @@
2018-07-26 Babak Shafiei <[email protected]>
+ Cherry-pick r234275. rdar://problem/42650440
+
+ AX: nothing returned for various previous text marker APIs from one div/p node to another
+ https://bugs.webkit.org/show_bug.cgi?id=188071
+
+ Reviewed by Chris Fleizach.
+
+ Source/WebCore:
+
+ TextIterator is emitting an extra '\n' at the end of the <p> node and there's no
+ corresponding text node in the DOM tree, so we are not able to handle that for
+ text markers. Fixed it by ignoring the extra '\n' and anchor the text marker to
+ the previous child text node.
+
+ Test: accessibility/mac/text-marker-p-tags.html
+
+ * accessibility/AXObjectCache.cpp:
+ (WebCore::AXObjectCache::traverseToOffsetInRange):
+
+ LayoutTests:
+
+ * accessibility/mac/text-marker-p-tags-expected.txt: Added.
+ * accessibility/mac/text-marker-p-tags.html: Added.
+ * accessibility/mac/text-marker-string-for-document-range-expected.txt:
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234275 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2018-07-26 Nan Wang <[email protected]>
+
+ AX: nothing returned for various previous text marker APIs from one div/p node to another
+ https://bugs.webkit.org/show_bug.cgi?id=188071
+
+ Reviewed by Chris Fleizach.
+
+ TextIterator is emitting an extra '\n' at the end of the <p> node and there's no
+ corresponding text node in the DOM tree, so we are not able to handle that for
+ text markers. Fixed it by ignoring the extra '\n' and anchor the text marker to
+ the previous child text node.
+
+ Test: accessibility/mac/text-marker-p-tags.html
+
+ * accessibility/AXObjectCache.cpp:
+ (WebCore::AXObjectCache::traverseToOffsetInRange):
+
+2018-07-26 Babak Shafiei <[email protected]>
+
Cherry-pick r234264. rdar://problem/42650373
Switching tabs should not close PiP window
Modified: branches/safari-606-branch/Source/WebCore/accessibility/AXObjectCache.cpp (234306 => 234307)
--- branches/safari-606-branch/Source/WebCore/accessibility/AXObjectCache.cpp 2018-07-27 06:02:22 UTC (rev 234306)
+++ branches/safari-606-branch/Source/WebCore/accessibility/AXObjectCache.cpp 2018-07-27 06:02:25 UTC (rev 234307)
@@ -1694,6 +1694,11 @@
currentNode = shadowHost;
continue;
}
+ } else if (previousNode && previousNode->isTextNode() && previousNode->isDescendantOf(currentNode) && currentNode->hasTagName(pTag)) {
+ // TextIterator is emitting an extra newline after the <p> element. We should
+ // ignore that since the extra text node is not in the DOM tree.
+ currentNode = previousNode;
+ continue;
} else if (currentNode != previousNode) {
// We should set the start offset and length for the current node in case this is the last iteration.
lastStartOffset = 1;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes