<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[203562] branches/safari-602-branch</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/203562">203562</a></dd>
<dt>Author</dt> <dd>bshafiei@apple.com</dd>
<dt>Date</dt> <dd>2016-07-22 02:25:21 -0700 (Fri, 22 Jul 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/203412">r203412</a>. rdar://problem/26898984</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari602branchLayoutTestsChangeLog">branches/safari-602-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari602branchSourceWebCoreChangeLog">branches/safari-602-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari602branchSourceWebCoreaccessibilityAXObjectCachecpp">branches/safari-602-branch/Source/WebCore/accessibility/AXObjectCache.cpp</a></li>
<li><a href="#branchessafari602branchSourceWebCoreaccessibilityAXObjectCacheh">branches/safari-602-branch/Source/WebCore/accessibility/AXObjectCache.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari602branchLayoutTestsaccessibilitymactextmarkerwordnavcollapsedwhitespaceexpectedtxt">branches/safari-602-branch/LayoutTests/accessibility/mac/text-marker-word-nav-collapsed-whitespace-expected.txt</a></li>
<li><a href="#branchessafari602branchLayoutTestsaccessibilitymactextmarkerwordnavcollapsedwhitespacehtml">branches/safari-602-branch/LayoutTests/accessibility/mac/text-marker-word-nav-collapsed-whitespace.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari602branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/LayoutTests/ChangeLog (203561 => 203562)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/LayoutTests/ChangeLog        2016-07-22 09:25:18 UTC (rev 203561)
+++ branches/safari-602-branch/LayoutTests/ChangeLog        2016-07-22 09:25:21 UTC (rev 203562)
</span><span class="lines">@@ -1,5 +1,19 @@
</span><span class="cx"> 2016-07-22 Babak Shafiei <bshafiei@apple.com>
</span><span class="cx">
</span><ins>+ Merge r203412. rdar://problem/26898984
+
+ 2016-07-19 Nan Wang <n_wang@apple.com>
+
+ AX: Incorrect behavior for word related text marker functions when there's collapsed whitespace
+ https://bugs.webkit.org/show_bug.cgi?id=159910
+
+ Reviewed by Chris Fleizach.
+
+ * accessibility/mac/text-marker-word-nav-collapsed-whitespace-expected.txt: Added.
+ * accessibility/mac/text-marker-word-nav-collapsed-whitespace.html: Added.
+
+2016-07-22 Babak Shafiei <bshafiei@apple.com>
+
</ins><span class="cx"> Merge r203409. rdar://problem/27182267
</span><span class="cx">
</span><span class="cx"> 2016-07-19 Simon Fraser <simon.fraser@apple.com>
</span></span></pre></div>
<a id="branchessafari602branchLayoutTestsaccessibilitymactextmarkerwordnavcollapsedwhitespaceexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-602-branch/LayoutTests/accessibility/mac/text-marker-word-nav-collapsed-whitespace-expected.txt (0 => 203562)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/LayoutTests/accessibility/mac/text-marker-word-nav-collapsed-whitespace-expected.txt         (rev 0)
+++ branches/safari-602-branch/LayoutTests/accessibility/mac/text-marker-word-nav-collapsed-whitespace-expected.txt        2016-07-22 09:25:21 UTC (rev 203562)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+Test1 Test2 Test3
+This tests that word navigation is working correctly with collapsed whitespaces.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Current character is: 1
+Left word is: Test1
+Right word is:
+Pre word start to next word end: Test1
+
+Current character is:
+Left word is:
+Right word is: Test2
+Pre word start to next word end: Test2
+
+Current character is: 2
+Left word is: Test2
+Right word is:
+Pre word start to next word end: Test2
+
+Current character is:
+Left word is:
+Right word is: Test3
+Pre word start to next word end: Test3
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="branchessafari602branchLayoutTestsaccessibilitymactextmarkerwordnavcollapsedwhitespacehtml"></a>
<div class="addfile"><h4>Added: branches/safari-602-branch/LayoutTests/accessibility/mac/text-marker-word-nav-collapsed-whitespace.html (0 => 203562)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/LayoutTests/accessibility/mac/text-marker-word-nav-collapsed-whitespace.html         (rev 0)
+++ branches/safari-602-branch/LayoutTests/accessibility/mac/text-marker-word-nav-collapsed-whitespace.html        2016-07-22 09:25:21 UTC (rev 203562)
</span><span class="lines">@@ -0,0 +1,81 @@
</span><ins>+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<div id="text">
+Test1
+
+
+
+Test2 Test3
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+ description("This tests that word navigation is working correctly with collapsed whitespaces.");
+
+ if (window.accessibilityController) {
+
+ var text = accessibilityController.accessibleElementById("text");
+ // Get the actual text node.
+ text = text.childAtIndex(0);
+
+ // Check that we can get the second word "Test2"
+ var textMarkerRange = text.textMarkerRangeForElement(text);
+ var startMarker = text.startTextMarkerForTextMarkerRange(textMarkerRange);
+ var currentMarker = advanceAndVerify(startMarker, 5, text);
+ currentMarker = advanceAndVerify(currentMarker, 1, text);
+
+ // Check that we can get the third word "Test3"
+ currentMarker = advanceAndVerify(currentMarker, 5, text);
+ currentMarker = advanceAndVerify(currentMarker, 1, text);
+
+ function advanceAndVerify(currentMarker, offset, obj) {
+ var previousMarker = currentMarker;
+ for (var i = 0; i < offset; i++) {
+ previousMarker = currentMarker;
+ currentMarker = obj.nextTextMarker(previousMarker);
+ }
+ verifyWordRangeForTextMarker(previousMarker, currentMarker, obj);
+ return currentMarker;
+ }
+
+ function replaceAttachmentInString(str) {
+ var newline = '\n';
+ str = str.replace(String.fromCharCode(65532), "[ATTACHMENT]");
+ str = str.replace(newline, "'line break'");
+ return str;
+ }
+
+ function verifyWordRangeForTextMarker(preMarker, textMarker, obj) {
+ var markerRange = obj.textMarkerRangeForMarkers(preMarker, textMarker);
+ var currentCharacter = obj.stringForTextMarkerRange(markerRange);
+ debug("Current character is: " + currentCharacter);
+
+ var previousWordRange = obj.leftWordTextMarkerRangeForTextMarker(textMarker);
+ var nextWordRange = obj.rightWordTextMarkerRangeForTextMarker(textMarker);
+ var preWord = obj.stringForTextMarkerRange(previousWordRange);
+ var nextWord = obj.stringForTextMarkerRange(nextWordRange);
+ debug("Left word is: " + preWord);
+ debug("Right word is: " + nextWord);
+
+ var preWordStart = obj.previousWordStartTextMarkerForTextMarker(textMarker);
+ var nextWordEnd = obj.nextWordEndTextMarkerForTextMarker(textMarker);
+ var preAndNextWordRange = obj.textMarkerRangeForMarkers(preWordStart, nextWordEnd);
+ var preAndNextWord = obj.stringForTextMarkerRange(preAndNextWordRange);
+ debug("Pre word start to next word end: " + preAndNextWord + "\n");
+ }
+ }
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/ChangeLog (203561 => 203562)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/ChangeLog        2016-07-22 09:25:18 UTC (rev 203561)
+++ branches/safari-602-branch/Source/WebCore/ChangeLog        2016-07-22 09:25:21 UTC (rev 203562)
</span><span class="lines">@@ -1,5 +1,32 @@
</span><span class="cx"> 2016-07-22 Babak Shafiei <bshafiei@apple.com>
</span><span class="cx">
</span><ins>+ Merge r203412. rdar://problem/26898984
+
+ 2016-07-19 Nan Wang <n_wang@apple.com>
+
+ AX: Incorrect behavior for word related text marker functions when there's collapsed whitespace
+ https://bugs.webkit.org/show_bug.cgi?id=159910
+
+ Reviewed by Chris Fleizach.
+
+ We are getting a bad CharacterOffset when there's collapsed whitespace. Added a TraverseOptionValidateOffset
+ option to make sure we are getting the correct CharacterOffset based on the corresponding Range offset. And
+ fixed a word navigation issue based on that.
+
+ Test: accessibility/mac/text-marker-word-nav-collapsed-whitespace.html
+
+ * accessibility/AXObjectCache.cpp:
+ (WebCore::AXObjectCache::traverseToOffsetInRange):
+ (WebCore::AXObjectCache::rangeForNodeContents):
+ (WebCore::AXObjectCache::startOrEndCharacterOffsetForRange):
+ (WebCore::AXObjectCache::characterOffsetFromVisiblePosition):
+ (WebCore::AXObjectCache::rightWordRange):
+ (WebCore::AXObjectCache::previousBoundary):
+ * accessibility/AXObjectCache.h:
+ (WebCore::AXObjectCache::isNodeInUse):
+
+2016-07-22 Babak Shafiei <bshafiei@apple.com>
+
</ins><span class="cx"> Merge r203409. rdar://problem/27182267
</span><span class="cx">
</span><span class="cx"> 2016-07-19 Simon Fraser <simon.fraser@apple.com>
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCoreaccessibilityAXObjectCachecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/accessibility/AXObjectCache.cpp (203561 => 203562)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/accessibility/AXObjectCache.cpp        2016-07-22 09:25:18 UTC (rev 203561)
+++ branches/safari-602-branch/Source/WebCore/accessibility/AXObjectCache.cpp        2016-07-22 09:25:21 UTC (rev 203562)
</span><span class="lines">@@ -1503,6 +1503,7 @@
</span><span class="cx"> return CharacterOffset();
</span><span class="cx">
</span><span class="cx"> bool toNodeEnd = option & TraverseOptionToNodeEnd;
</span><ins>+ bool validateOffset = option & TraverseOptionValidateOffset;
</ins><span class="cx">
</span><span class="cx"> int offsetInCharacter = 0;
</span><span class="cx"> int cumulativeOffset = 0;
</span><span class="lines">@@ -1536,9 +1537,6 @@
</span><span class="cx"> // Sometimes text contents in a node are splitted into several iterations, so that iterator.range()->startOffset()
</span><span class="cx"> // might not be the correct character count. Here we use a previousNode object to keep track of that.
</span><span class="cx"> Node* previousNode = nullptr;
</span><del>- // When text node has collapsed whitespaces, we need to treat it differently since text iterator
- // will omit the collapsed spaces and make the offset inaccurate.
- Node* collapsedWhitespaceNode = nullptr;
</del><span class="cx"> for (; !iterator.atEnd(); iterator.advance()) {
</span><span class="cx"> int currentLength = iterator.text().length();
</span><span class="cx"> bool hasReplacedNodeOrBR = false;
</span><span class="lines">@@ -1546,10 +1544,6 @@
</span><span class="cx"> Node& node = iterator.range()->startContainer();
</span><span class="cx"> currentNode = &node;
</span><span class="cx">
</span><del>- // The offset of node with collapsed whitespaces has been calcualted in the first iteration.
- if (currentNode == collapsedWhitespaceNode)
- continue;
-
</del><span class="cx"> // When currentLength == 0, we check if there's any replaced node.
</span><span class="cx"> // If not, we skip the node with no length.
</span><span class="cx"> if (!currentLength) {
</span><span class="lines">@@ -1579,34 +1573,14 @@
</span><span class="cx"> continue;
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- } else if (currentNode->isTextNode() && currentNode->renderer()) {
- // When there's collapsed whitespace, the text iterator will only count those spaces as one single space.
- // Here we use the RenderText to get the actual length.
- RenderText* renderedText = downcast<RenderText>(currentNode->renderer());
- int currentStartOffset = iterator.range()->startOffset();
- if (renderedText->style().isCollapsibleWhiteSpace(iterator.text()[currentLength - 1]) && currentLength + currentStartOffset != renderedText->caretMaxOffset()) {
- int appendLength = (&range->endContainer() == currentNode ? range->endOffset() : (int)renderedText->text()->length()) - currentStartOffset;
- lastStartOffset = currentStartOffset;
- cumulativeOffset += appendLength;
- lastLength = appendLength;
-
- // Break early if we have advanced enough characters.
- if (!toNodeEnd && cumulativeOffset >= offset) {
- offsetInCharacter = offset - (cumulativeOffset - lastLength);
- finished = true;
- break;
- }
-
- collapsedWhitespaceNode = currentNode;
- continue;
- }
-
</del><span class="cx"> }
</span><span class="cx"> cumulativeOffset += currentLength;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (currentNode == previousNode)
</del><ins>+ if (currentNode == previousNode) {
</ins><span class="cx"> lastLength += currentLength;
</span><ins>+ lastStartOffset = iterator.range()->endOffset() - lastLength;
+ }
</ins><span class="cx"> else {
</span><span class="cx"> lastLength = currentLength;
</span><span class="cx"> lastStartOffset = hasReplacedNodeOrBR ? 0 : iterator.range()->startOffset();
</span><span class="lines">@@ -1613,8 +1587,9 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Break early if we have advanced enough characters.
</span><del>- if (!toNodeEnd && cumulativeOffset >= offset) {
- offsetInCharacter = offset - (cumulativeOffset - lastLength);
</del><ins>+ bool offsetLimitReached = validateOffset ? cumulativeOffset + lastStartOffset >= offset : cumulativeOffset >= offset;
+ if (!toNodeEnd && offsetLimitReached) {
+ offsetInCharacter = validateOffset ? std::max(offset - lastStartOffset, 0) : offset - (cumulativeOffset - lastLength);
</ins><span class="cx"> finished = true;
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="lines">@@ -1667,7 +1642,11 @@
</span><span class="cx"> return nullptr;
</span><span class="cx"> RefPtr<Range> range = Range::create(*document);
</span><span class="cx"> ExceptionCode ec = 0;
</span><del>- range->selectNodeContents(*node, ec);
</del><ins>+ // For replaced node without children, we should incluce itself in the range.
+ if (AccessibilityObject::replacedNodeNeedsCharacter(node))
+ range->selectNode(*node, ec);
+ else
+ range->selectNodeContents(*node, ec);
</ins><span class="cx"> return ec ? nullptr : range;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1811,15 +1790,20 @@
</span><span class="cx"> // If it's end text marker, we want to go to the end of the range, and stay within the range.
</span><span class="cx"> bool stayWithinRange = !isStart;
</span><span class="cx">
</span><ins>+ Node& endNode = range->endContainer();
+ if (endNode.offsetInCharacters() && !isStart)
+ return traverseToOffsetInRange(rangeForNodeContents(&endNode), range->endOffset(), TraverseOptionValidateOffset);
+
</ins><span class="cx"> Ref<Range> copyRange = *range;
</span><span class="cx"> // Change the start of the range, so the character offset starts from node beginning.
</span><span class="cx"> int offset = 0;
</span><span class="cx"> Node& node = copyRange->startContainer();
</span><span class="cx"> if (node.offsetInCharacters()) {
</span><del>- copyRange = Range::create(range->ownerDocument(), &range->startContainer(), range->startOffset(), &range->endContainer(), range->endOffset());
- CharacterOffset nodeStartOffset = traverseToOffsetInRange(rangeForNodeContents(&node), 0);
- offset = std::max(copyRange->startOffset() - nodeStartOffset.startIndex, 0);
- copyRange->setStart(node, nodeStartOffset.startIndex);
</del><ins>+ CharacterOffset nodeStartOffset = traverseToOffsetInRange(rangeForNodeContents(&node), range->startOffset(), TraverseOptionValidateOffset);
+ if (isStart)
+ return nodeStartOffset;
+ copyRange = Range::create(range->ownerDocument(), &range->startContainer(), 0, &range->endContainer(), range->endOffset());
+ offset += nodeStartOffset.offset;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return traverseToOffsetInRange(WTFMove(copyRange), offset, isStart ? TraverseOptionDefault : TraverseOptionToNodeEnd, stayWithinRange);
</span><span class="lines">@@ -1984,7 +1968,7 @@
</span><span class="cx"> ASSERT(domNode);
</span><span class="cx">
</span><span class="cx"> if (domNode->offsetInCharacters())
</span><del>- return CharacterOffset(domNode, 0, deepPos.deprecatedEditingOffset(), 0);
</del><ins>+ return traverseToOffsetInRange(rangeForNodeContents(domNode), deepPos.deprecatedEditingOffset(), TraverseOptionValidateOffset);
</ins><span class="cx">
</span><span class="cx"> RefPtr<AccessibilityObject> obj = this->getOrCreate(domNode);
</span><span class="cx"> if (!obj)
</span><span class="lines">@@ -2186,7 +2170,7 @@
</span><span class="cx">
</span><span class="cx"> RefPtr<Range> AXObjectCache::rightWordRange(const CharacterOffset& characterOffset)
</span><span class="cx"> {
</span><del>- CharacterOffset start = startCharacterOffsetOfWord(characterOffset);
</del><ins>+ CharacterOffset start = startCharacterOffsetOfWord(characterOffset, RightWordIfOnBoundary);
</ins><span class="cx"> CharacterOffset end = endCharacterOffsetOfWord(start);
</span><span class="cx"> return rangeForUnorderedCharacterOffsets(start, end);
</span><span class="cx"> }
</span><span class="lines">@@ -2319,10 +2303,18 @@
</span><span class="cx"> return it.atEnd() ? start : characterOffset;
</span><span class="cx">
</span><span class="cx"> Node& node = it.atEnd() ? searchRange->startContainer() : it.range()->startContainer();
</span><ins>+
+ // SimplifiedBackwardsTextIterator ignores replaced elements.
+ if (AccessibilityObject::replacedNodeNeedsCharacter(characterOffset.node))
+ return characterOffsetForNodeAndOffset(*characterOffset.node, 0);
+ Node* nextSibling = node.nextSibling();
+ if (&node != characterOffset.node && AccessibilityObject::replacedNodeNeedsCharacter(nextSibling))
+ return startOrEndCharacterOffsetForRange(rangeForNodeContents(nextSibling), false);
+
</ins><span class="cx"> if ((node.isTextNode() && static_cast<int>(next) <= node.maxCharacterOffset()) || (node.renderer() && node.renderer()->isBR() && !next)) {
</span><span class="cx"> // The next variable contains a usable index into a text node
</span><del>- if (&node == characterOffset.node)
- next -= characterOffset.startIndex;
</del><ins>+ if (node.isTextNode())
+ return traverseToOffsetInRange(rangeForNodeContents(&node), next, TraverseOptionValidateOffset);
</ins><span class="cx"> return characterOffsetForNodeAndOffset(node, next, TraverseOptionIncludeStart);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari602branchSourceWebCoreaccessibilityAXObjectCacheh"></a>
<div class="modfile"><h4>Modified: branches/safari-602-branch/Source/WebCore/accessibility/AXObjectCache.h (203561 => 203562)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602-branch/Source/WebCore/accessibility/AXObjectCache.h        2016-07-22 09:25:18 UTC (rev 203561)
+++ branches/safari-602-branch/Source/WebCore/accessibility/AXObjectCache.h        2016-07-22 09:25:21 UTC (rev 203562)
</span><span class="lines">@@ -348,7 +348,7 @@
</span><span class="cx"> bool isNodeInUse(Node* n) { return m_textMarkerNodes.contains(n); }
</span><span class="cx">
</span><span class="cx"> // CharacterOffset functions.
</span><del>- enum TraverseOption { TraverseOptionDefault = 1 << 0, TraverseOptionToNodeEnd = 1 << 1, TraverseOptionIncludeStart = 1 << 2 };
</del><ins>+ enum TraverseOption { TraverseOptionDefault = 1 << 0, TraverseOptionToNodeEnd = 1 << 1, TraverseOptionIncludeStart = 1 << 2, TraverseOptionValidateOffset = 1 << 3 };
</ins><span class="cx"> Node* nextNode(Node*) const;
</span><span class="cx"> Node* previousNode(Node*) const;
</span><span class="cx"> CharacterOffset traverseToOffsetInRange(RefPtr<Range>, int, TraverseOption = TraverseOptionDefault, bool stayWithinRange = false);
</span></span></pre>
</div>
</div>
</body>
</html>