<!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>[199030] trunk</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/199030">199030</a></dd>
<dt>Author</dt> <dd>d_russell@apple.com</dd>
<dt>Date</dt> <dd>2016-04-04 16:17:59 -0700 (Mon, 04 Apr 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>AX: new lines in content editable elements don't notify accessibility
https://bugs.webkit.org/show_bug.cgi?id=153361

Reviewed by Ryosuke Niwa.

Relocate accessibility edit notification logic into higher level logic.
Typing notifications relocated into TypingCommand.
Cut &amp; Paste notifications relocated into Editor.
Undo relocated into EditCommandComposition.

Tests: accessibility/mac/value-change/value-change-user-info-contenteditable.html
       accessibility/mac/value-change/value-change-user-info-textarea.html
       accessibility/mac/value-change/value-change-user-info-textfield.html

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* accessibility/AXObjectCache.cpp:
(WebCore::AccessibilityReplacedText::AccessibilityReplacedText):
(WebCore::AccessibilityReplacedText::postTextStateChangeNotification):
(WebCore::AXObjectCache::postTextStateChangeNotification):
(WebCore::AXObjectCache::postTextReplacementNotification):
* accessibility/AXObjectCache.h:
(WebCore::VisiblePositionIndexRange::isNull):
(WebCore::AccessibilityReplacedText::AccessibilityReplacedText):
(WebCore::AccessibilityReplacedText::replacedRange):
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::listMarkerTextForNodeAndPosition):
(WebCore::AccessibilityObject::stringForVisiblePositionRange):
* accessibility/AccessibilityObject.h:
(WebCore::VisiblePositionRange::VisiblePositionRange):
* accessibility/mac/AXObjectCacheMac.mm:
(WebCore::AXObjectCache::postTextStateChangePlatformNotification):
(WebCore::AXObjectCache::postTextReplacementPlatformNotification):
* editing/AppendNodeCommand.cpp:
(WebCore::AppendNodeCommand::doApply): Deleted.
(WebCore::AppendNodeCommand::doUnapply): Deleted.
* editing/CompositeEditCommand.cpp:
(WebCore::AccessibilityUndoReplacedText::indexForVisiblePosition):
(WebCore::AccessibilityUndoReplacedText::confgureTextToBeDeletedByUnapplyIndexesWithEditCommandEndingSelection):
(WebCore::AccessibilityUndoReplacedText::confgureTextToBeDeletedByUnapplyStartIndexWithEditCommandStartingSelection):
(WebCore::AccessibilityUndoReplacedText::setTextInsertedByUnapplyRange):
(WebCore::AccessibilityUndoReplacedText::captureTextToBeDeletedByUnapply):
(WebCore::AccessibilityUndoReplacedText::captureTextToBeDeletedByReapply):
(WebCore::stringForVisiblePositionIndexRange):
(WebCore::AccessibilityUndoReplacedText::textInsertedByUnapply):
(WebCore::AccessibilityUndoReplacedText::textInsertedByReapply):
(WebCore::postTextStateChangeNotification):
(WebCore::AccessibilityUndoReplacedText::postTextStateChangeNotificationForUnapply):
(WebCore::AccessibilityUndoReplacedText::postTextStateChangeNotificationForReapply):
(WebCore::EditCommandComposition::EditCommandComposition):
(WebCore::EditCommandComposition::unapply):
(WebCore::EditCommandComposition::reapply):
(WebCore::EditCommandComposition::setStartingSelection):
(WebCore::EditCommandComposition::setEndingSelection):
(WebCore::EditCommandComposition::setTextInsertedByUnapplyRange):
(WebCore::CompositeEditCommand::removeNode):
(WebCore::CompositeEditCommand::replaceTextInNode):
(WebCore::deleteSelectionEditingActionForEditingAction):
(WebCore::CompositeEditCommand::deleteSelection):
(WebCore::CompositeEditCommand::applyStyle): Deleted.
(WebCore::CompositeEditCommand::updatePositionForNodeRemovalPreservingChildren): Deleted.
(WebCore::CompositeEditCommand::inputText): Deleted.
* editing/CompositeEditCommand.h:
(WebCore::AccessibilityUndoReplacedText::AccessibilityUndoReplacedText):
* editing/DeleteFromTextNodeCommand.cpp:
(WebCore::DeleteFromTextNodeCommand::doApply): Deleted.
(WebCore::DeleteFromTextNodeCommand::getNodesInCommand): Deleted.
* editing/DeleteFromTextNodeCommand.h:
* editing/DictationCommand.cpp:
(WebCore::DictationCommand::doApply):
* editing/EditCommand.cpp:
(WebCore::EditCommand::postTextStateChangeNotification):
(WebCore::SimpleEditCommand::SimpleEditCommand): Deleted.
(WebCore::SimpleEditCommand::doReapply): Deleted.
(WebCore::SimpleEditCommand::addNodeAndDescendants): Deleted.
* editing/EditCommand.h:
* editing/EditingAllInOne.cpp:
* editing/Editor.cpp:
(WebCore::Editor::replaceSelectionWithFragment):
(WebCore::Editor::appliedEditing):
(WebCore::Editor::unappliedEditing):
(WebCore::Editor::postTextStateChangeNotificationForCut):
(WebCore::Editor::performCutOrCopy):
(WebCore::Editor::changeSelectionAfterCommand):
(WebCore::dispatchEditableContentChangedEvents): Deleted.
(WebCore::Editor::addTextToKillRing): Deleted.
* editing/Editor.h:
* editing/InsertIntoTextNodeCommand.cpp:
(WebCore::InsertIntoTextNodeCommand::doApply): Deleted.
(WebCore::InsertIntoTextNodeCommand::getNodesInCommand): Deleted.
* editing/InsertNodeBeforeCommand.cpp:
(WebCore::InsertNodeBeforeCommand::doApply): Deleted.
(WebCore::InsertNodeBeforeCommand::doUnapply): Deleted.
(WebCore::InsertNodeBeforeCommand::getNodesInCommand): Deleted.
* editing/RemoveNodeCommand.cpp:
(WebCore::RemoveNodeCommand::RemoveNodeCommand):
* editing/RemoveNodeCommand.h:
(WebCore::RemoveNodeCommand::create):
* editing/ReplaceDeleteFromTextNodeCommand.cpp: Removed.
* editing/ReplaceDeleteFromTextNodeCommand.h: Removed.
* editing/ReplaceInsertIntoTextNodeCommand.cpp: Removed.
* editing/ReplaceInsertIntoTextNodeCommand.h: Removed.
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::doApply):
(WebCore::ReplaceSelectionCommand::completeHTMLReplacement):
(WebCore::ReplaceSelectionCommand::performTrivialReplace):
* editing/ReplaceSelectionCommand.h:
(WebCore::ReplaceSelectionCommand::visibleSelectionForInsertedText):
* editing/TextInsertionBaseCommand.cpp:
(WebCore::TextInsertionBaseCommand::TextInsertionBaseCommand):
* editing/TextInsertionBaseCommand.h:
* editing/TypingCommand.cpp:
(WebCore::TypingCommand::TypingCommand):
(WebCore::TypingCommand::insertText):
(WebCore::TypingCommand::insertLineBreak):
(WebCore::TypingCommand::insertParagraphSeparatorInQuotedContent):
(WebCore::TypingCommand::insertParagraphSeparator):
(WebCore::TypingCommand::postTextStateChangeNotificationForDeletion):
(WebCore::TypingCommand::doApply):
(WebCore::TypingCommand::insertTextAndNotifyAccessibility):
(WebCore::TypingCommand::insertLineBreakAndNotifyAccessibility):
(WebCore::TypingCommand::insertParagraphSeparatorAndNotifyAccessibility):
(WebCore::TypingCommand::insertParagraphSeparatorInQuotedContentAndNotifyAccessibility):
(WebCore::TypingCommand::deleteKeyPressed):
(WebCore::TypingCommand::forwardDeleteKeyPressed):
* editing/TypingCommand.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsaccessibilitymacselectionvaluechangesforariatextboxexpectedtxt">trunk/LayoutTests/accessibility/mac/selection-value-changes-for-aria-textbox-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAXObjectCachecpp">trunk/Source/WebCore/accessibility/AXObjectCache.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAXObjectCacheh">trunk/Source/WebCore/accessibility/AXObjectCache.h</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityObjectcpp">trunk/Source/WebCore/accessibility/AccessibilityObject.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityObjecth">trunk/Source/WebCore/accessibility/AccessibilityObject.h</a></li>
<li><a href="#trunkSourceWebCoreaccessibilitymacAXObjectCacheMacmm">trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm</a></li>
<li><a href="#trunkSourceWebCoreeditingAppendNodeCommandcpp">trunk/Source/WebCore/editing/AppendNodeCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingCompositeEditCommandcpp">trunk/Source/WebCore/editing/CompositeEditCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingCompositeEditCommandh">trunk/Source/WebCore/editing/CompositeEditCommand.h</a></li>
<li><a href="#trunkSourceWebCoreeditingDeleteFromTextNodeCommandcpp">trunk/Source/WebCore/editing/DeleteFromTextNodeCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingDeleteFromTextNodeCommandh">trunk/Source/WebCore/editing/DeleteFromTextNodeCommand.h</a></li>
<li><a href="#trunkSourceWebCoreeditingDictationCommandcpp">trunk/Source/WebCore/editing/DictationCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingEditCommandcpp">trunk/Source/WebCore/editing/EditCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingEditCommandh">trunk/Source/WebCore/editing/EditCommand.h</a></li>
<li><a href="#trunkSourceWebCoreeditingEditingAllInOnecpp">trunk/Source/WebCore/editing/EditingAllInOne.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingEditorcpp">trunk/Source/WebCore/editing/Editor.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingEditorh">trunk/Source/WebCore/editing/Editor.h</a></li>
<li><a href="#trunkSourceWebCoreeditingInsertIntoTextNodeCommandcpp">trunk/Source/WebCore/editing/InsertIntoTextNodeCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingInsertNodeBeforeCommandcpp">trunk/Source/WebCore/editing/InsertNodeBeforeCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingRemoveNodeCommandcpp">trunk/Source/WebCore/editing/RemoveNodeCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingRemoveNodeCommandh">trunk/Source/WebCore/editing/RemoveNodeCommand.h</a></li>
<li><a href="#trunkSourceWebCoreeditingReplaceSelectionCommandcpp">trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingReplaceSelectionCommandh">trunk/Source/WebCore/editing/ReplaceSelectionCommand.h</a></li>
<li><a href="#trunkSourceWebCoreeditingTextInsertionBaseCommandcpp">trunk/Source/WebCore/editing/TextInsertionBaseCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingTextInsertionBaseCommandh">trunk/Source/WebCore/editing/TextInsertionBaseCommand.h</a></li>
<li><a href="#trunkSourceWebCoreeditingTypingCommandcpp">trunk/Source/WebCore/editing/TypingCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingTypingCommandh">trunk/Source/WebCore/editing/TypingCommand.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/accessibility/mac/value-change/</li>
<li><a href="#trunkLayoutTestsaccessibilitymacvaluechangevaluechangehelpersjs">trunk/LayoutTests/accessibility/mac/value-change/value-change-helpers.js</a></li>
<li><a href="#trunkLayoutTestsaccessibilitymacvaluechangevaluechangeuserinfocontenteditableexpectedtxt">trunk/LayoutTests/accessibility/mac/value-change/value-change-user-info-contenteditable-expected.txt</a></li>
<li><a href="#trunkLayoutTestsaccessibilitymacvaluechangevaluechangeuserinfocontenteditablehtml">trunk/LayoutTests/accessibility/mac/value-change/value-change-user-info-contenteditable.html</a></li>
<li><a href="#trunkLayoutTestsaccessibilitymacvaluechangevaluechangeuserinfotextareaexpectedtxt">trunk/LayoutTests/accessibility/mac/value-change/value-change-user-info-textarea-expected.txt</a></li>
<li><a href="#trunkLayoutTestsaccessibilitymacvaluechangevaluechangeuserinfotextareahtml">trunk/LayoutTests/accessibility/mac/value-change/value-change-user-info-textarea.html</a></li>
<li><a href="#trunkLayoutTestsaccessibilitymacvaluechangevaluechangeuserinfotextfieldexpectedtxt">trunk/LayoutTests/accessibility/mac/value-change/value-change-user-info-textfield-expected.txt</a></li>
<li><a href="#trunkLayoutTestsaccessibilitymacvaluechangevaluechangeuserinfotextfieldhtml">trunk/LayoutTests/accessibility/mac/value-change/value-change-user-info-textfield.html</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsaccessibilitymacvaluechangeuserinfoexpectedtxt">trunk/LayoutTests/accessibility/mac/value-change-userinfo-expected.txt</a></li>
<li><a href="#trunkLayoutTestsaccessibilitymacvaluechangeuserinfohtml">trunk/LayoutTests/accessibility/mac/value-change-userinfo.html</a></li>
<li><a href="#trunkSourceWebCoreeditingReplaceDeleteFromTextNodeCommandcpp">trunk/Source/WebCore/editing/ReplaceDeleteFromTextNodeCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingReplaceDeleteFromTextNodeCommandh">trunk/Source/WebCore/editing/ReplaceDeleteFromTextNodeCommand.h</a></li>
<li><a href="#trunkSourceWebCoreeditingReplaceInsertIntoTextNodeCommandcpp">trunk/Source/WebCore/editing/ReplaceInsertIntoTextNodeCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingReplaceInsertIntoTextNodeCommandh">trunk/Source/WebCore/editing/ReplaceInsertIntoTextNodeCommand.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/LayoutTests/ChangeLog        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2016-04-04  Doug Russell  &lt;d_russell@apple.com&gt;
+
+        AX: new lines in content editable elements don't notify accessibility
+        https://bugs.webkit.org/show_bug.cgi?id=153361
+
+        Reviewed by Ryosuke Niwa.
+
+        Relocate accessibility edit notification logic into higher level logic.
+        Typing notifications relocated into TypingCommand.
+        Cut &amp; Paste notifications relocated into Editor.
+        Undo relocated into EditCommandComposition.
+
+        * accessibility/mac/selection-value-changes-for-aria-textbox-expected.txt:
+        * accessibility/mac/value-change-userinfo-expected.txt: Removed.
+        * accessibility/mac/value-change-userinfo.html: Removed.
+        * accessibility/mac/value-change/value-change-helpers.js: Added.
+        (stringForEditType):
+        (bump):
+        (shouldBeInsert):
+        (shouldBeTyping):
+        (shouldBeDelete):
+        (shouldBeCut):
+        (shouldBePaste):
+        (shouldBeReplace):
+        (shouldBePasteReplace):
+        (shouldBeTypingReplace):
+        (shouldBeInsertReplace):
+        * accessibility/mac/value-change/value-change-user-info-contenteditable-expected.txt: Added.
+        * accessibility/mac/value-change/value-change-user-info-contenteditable.html: Added.
+        * accessibility/mac/value-change/value-change-user-info-textarea-expected.txt: Added.
+        * accessibility/mac/value-change/value-change-user-info-textarea.html: Added.
+        * accessibility/mac/value-change/value-change-user-info-textfield-expected.txt: Added.
+        * accessibility/mac/value-change/value-change-user-info-textfield.html: Added.
+
</ins><span class="cx"> 2016-04-04  Dean Jackson  &lt;dino@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add color-gamut media query support
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymacselectionvaluechangesforariatextboxexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/accessibility/mac/selection-value-changes-for-aria-textbox-expected.txt (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/selection-value-changes-for-aria-textbox-expected.txt        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/LayoutTests/accessibility/mac/selection-value-changes-for-aria-textbox-expected.txt        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -11,5 +11,6 @@
</span><span class="cx"> Successfully received AXSelectedTextChanged
</span><span class="cx"> Successfully received AXSelectedTextChanged
</span><span class="cx"> Successfully received AXSelectedTextChanged
</span><ins>+Successfully received AXSelectedTextChanged
</ins><span class="cx"> Successfully received AXValueChanged
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymacvaluechangevaluechangehelpersjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/mac/value-change/value-change-helpers.js (0 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/value-change/value-change-helpers.js                                (rev 0)
+++ trunk/LayoutTests/accessibility/mac/value-change/value-change-helpers.js        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -0,0 +1,88 @@
</span><ins>+var AXTextStateChangeTypeEdit = 1;
+
+var AXTextEditTypeDelete = 1;
+var AXTextEditTypeInsert = AXTextEditTypeDelete + 1;
+var AXTextEditTypeTyping = AXTextEditTypeInsert + 1;
+var AXTextEditTypeDictation = AXTextEditTypeTyping + 1;
+var AXTextEditTypeCut = AXTextEditTypeDictation + 1
+var AXTextEditTypePaste = AXTextEditTypeCut + 1;
+
+function stringForEditType(editType) {
+    if (editType == AXTextEditTypeDelete) {
+        return &quot;Delete&quot;;
+    } else if (editType == AXTextEditTypeInsert) {
+        return &quot;Insert&quot;;
+    } else if (editType == AXTextEditTypeTyping) {
+        return &quot;Typing&quot;;
+    } else if (editType == AXTextEditTypeDictation) {
+        return &quot;Dictation&quot;;
+    } else if (editType == AXTextEditTypeCut) {
+        return &quot;Cut&quot;;
+    } else if (editType == AXTextEditTypePaste) {
+        return &quot;Paste&quot;;
+    }
+    return &quot;Unknown&quot;;
+}
+
+function bump(value) {
+    resultIndex++;
+    expectedValues[resultIndex] = value
+}
+
+function shouldBeInsert(value) {
+    bump(value);
+    shouldBe(&quot;actualChangeTypes[resultIndex]&quot;, &quot;AXTextStateChangeTypeEdit&quot;);
+    shouldBe(&quot;actualChangeValues[resultIndex]&quot;, &quot;expectedValues[resultIndex]&quot;);
+    shouldBe(&quot;actualEditTypes[resultIndex]&quot;, &quot;\&quot;Insert\&quot;&quot;);
+}
+
+function shouldBeTyping(value) {
+    bump(value);
+    shouldBe(&quot;actualChangeTypes[resultIndex]&quot;, &quot;AXTextStateChangeTypeEdit&quot;);
+    shouldBe(&quot;actualChangeValues[resultIndex]&quot;, &quot;expectedValues[resultIndex]&quot;);
+    shouldBe(&quot;actualEditTypes[resultIndex]&quot;, &quot;\&quot;Typing\&quot;&quot;);
+}
+
+function shouldBeDelete(value) {
+    bump(value);
+    shouldBe(&quot;actualChangeTypes[resultIndex]&quot;, &quot;AXTextStateChangeTypeEdit&quot;);
+    shouldBe(&quot;actualChangeValues[resultIndex]&quot;, &quot;expectedValues[resultIndex]&quot;);
+    shouldBe(&quot;actualEditTypes[resultIndex]&quot;, &quot;\&quot;Delete\&quot;&quot;);
+}
+
+function shouldBeCut(value) {
+    bump(value);
+    shouldBe(&quot;actualChangeTypes[resultIndex]&quot;, &quot;AXTextStateChangeTypeEdit&quot;);
+    shouldBe(&quot;actualChangeValues[resultIndex]&quot;, &quot;expectedValues[resultIndex]&quot;);
+    shouldBe(&quot;actualEditTypes[resultIndex]&quot;, &quot;\&quot;Cut\&quot;&quot;);
+}
+
+function shouldBePaste(value) {
+    bump(value);
+    shouldBe(&quot;actualChangeTypes[resultIndex]&quot;, &quot;AXTextStateChangeTypeEdit&quot;);
+    shouldBe(&quot;actualChangeValues[resultIndex]&quot;, &quot;expectedValues[resultIndex]&quot;);
+    shouldBe(&quot;actualEditTypes[resultIndex]&quot;, &quot;\&quot;Paste\&quot;&quot;);
+}
+
+function shouldBeReplace(deletedValue, insertedValue) {
+    bump([deletedValue, insertedValue]);
+    shouldBe(&quot;actualChangeTypes[resultIndex]&quot;, &quot;AXTextStateChangeTypeEdit&quot;);
+    shouldBe(&quot;actualChangeValues[resultIndex][0]&quot;, &quot;expectedValues[resultIndex][0]&quot;);
+    shouldBe(&quot;actualEditTypes[resultIndex][0]&quot;, &quot;\&quot;Delete\&quot;&quot;);
+    shouldBe(&quot;actualChangeValues[resultIndex][1]&quot;, &quot;expectedValues[resultIndex][1]&quot;);
+}
+
+function shouldBePasteReplace(deletedValue, insertedValue) {
+    shouldBeReplace(deletedValue, insertedValue);
+    shouldBe(&quot;actualEditTypes[resultIndex][1]&quot;, &quot;\&quot;Paste\&quot;&quot;);
+}
+
+function shouldBeTypingReplace(deletedValue, insertedValue) {
+    shouldBeReplace(deletedValue, insertedValue);
+    shouldBe(&quot;actualEditTypes[resultIndex][1]&quot;, &quot;\&quot;Typing\&quot;&quot;);
+}
+
+function shouldBeInsertReplace(deletedValue, insertedValue) {
+    shouldBeReplace(deletedValue, insertedValue);
+    shouldBe(&quot;actualEditTypes[resultIndex][1]&quot;, &quot;\&quot;Insert\&quot;&quot;);
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymacvaluechangevaluechangeuserinfocontenteditableexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/mac/value-change/value-change-user-info-contenteditable-expected.txt (0 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/value-change/value-change-user-info-contenteditable-expected.txt                                (rev 0)
+++ trunk/LayoutTests/accessibility/mac/value-change/value-change-user-info-contenteditable-expected.txt        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+223
+This tests value change notifications user info data.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS addedNotification is true
+PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
+PASS actualChangeValues[resultIndex] is expectedValues[resultIndex]
+PASS actualEditTypes[resultIndex] is &quot;Typing&quot;
+PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
+PASS actualChangeValues[resultIndex] is expectedValues[resultIndex]
+PASS actualEditTypes[resultIndex] is &quot;Delete&quot;
+PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
+PASS actualChangeValues[resultIndex] is expectedValues[resultIndex]
+PASS actualEditTypes[resultIndex] is &quot;Typing&quot;
+PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
+PASS actualChangeValues[resultIndex] is expectedValues[resultIndex]
+PASS actualEditTypes[resultIndex] is &quot;Delete&quot;
+PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
+PASS actualChangeValues[resultIndex][0] is expectedValues[resultIndex][0]
+PASS actualEditTypes[resultIndex][0] is &quot;Delete&quot;
+PASS actualChangeValues[resultIndex][1] is expectedValues[resultIndex][1]
+PASS actualEditTypes[resultIndex][1] is &quot;Typing&quot;
+PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
+PASS actualChangeValues[resultIndex] is expectedValues[resultIndex]
+PASS actualEditTypes[resultIndex] is &quot;Cut&quot;
+PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
+PASS actualChangeValues[resultIndex] is expectedValues[resultIndex]
+PASS actualEditTypes[resultIndex] is &quot;Paste&quot;
+PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
+PASS actualChangeValues[resultIndex][0] is expectedValues[resultIndex][0]
+PASS actualEditTypes[resultIndex][0] is &quot;Delete&quot;
+PASS actualChangeValues[resultIndex][1] is expectedValues[resultIndex][1]
+PASS actualEditTypes[resultIndex][1] is &quot;Paste&quot;
+PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
+PASS actualChangeValues[resultIndex][0] is expectedValues[resultIndex][0]
+PASS actualEditTypes[resultIndex][0] is &quot;Delete&quot;
+PASS actualChangeValues[resultIndex][1] is expectedValues[resultIndex][1]
+PASS actualEditTypes[resultIndex][1] is &quot;Typing&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymacvaluechangevaluechangeuserinfocontenteditablehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/mac/value-change/value-change-user-info-contenteditable.html (0 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/value-change/value-change-user-info-contenteditable.html                                (rev 0)
+++ trunk/LayoutTests/accessibility/mac/value-change/value-change-user-info-contenteditable.html        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -0,0 +1,102 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+    &lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+    &lt;script src=&quot;../../../editing/editing.js&quot;&gt;&lt;/script&gt;
+    &lt;script src=&quot;value-change-helpers.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body id=&quot;body&quot;&gt;
+
+    &lt;div role=&quot;textbox&quot; id=&quot;textbox&quot; contenteditable=true&gt;123&lt;/div&gt;
+
+    &lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+    &lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+    &lt;div id=&quot;notifications&quot;&gt;&lt;/div&gt;
+
+    &lt;script&gt;
+
+        description(&quot;This tests value change notifications user info data.&quot;);
+
+        var webArea = 0;
+        var count = 0;
+
+        var resultIndex = -1;
+
+        var actualChangeTypes = [];
+        var actualChangeValues = [];
+        var actualEditTypes = [];
+
+        var expectedValues = [];
+
+        function notificationCallback(notification, userInfo) {
+            if (notification == &quot;AXValueChanged&quot;) {
+
+                actualChangeTypes[count] = userInfo[&quot;AXTextStateChangeType&quot;];
+                var changes = userInfo[&quot;AXTextChangeValues&quot;];
+                if (changes &amp;&amp; changes.length == 1) {
+                    var change = changes[0];
+                    actualChangeValues[count] = change[&quot;AXTextChangeValue&quot;];
+                    actualEditTypes[count] = stringForEditType(change[&quot;AXTextEditType&quot;])
+                } else if (changes &amp;&amp; changes.length == 2) {
+                    var change1 = changes[0];
+                    var change2 = changes[1];
+                    actualChangeValues[count] = [change1[&quot;AXTextChangeValue&quot;], change2[&quot;AXTextChangeValue&quot;]];
+                    actualEditTypes[count] = [stringForEditType(change1[&quot;AXTextEditType&quot;]), stringForEditType(change2[&quot;AXTextEditType&quot;])];
+                }
+
+                count++;
+                if (count == 9) {
+
+                    shouldBeTyping(&quot;1&quot;);
+                    shouldBeDelete(&quot;1&quot;);
+                    shouldBeTyping(&quot;\n&quot;);
+                    shouldBeDelete(&quot;\n&quot;);
+                    shouldBeTypingReplace(&quot;1&quot;, &quot;2&quot;);
+                    shouldBeCut(&quot;2&quot;);
+                    shouldBePaste(&quot;2&quot;);
+                    shouldBePasteReplace(&quot;3&quot;, &quot;2&quot;);
+                    shouldBeTypingReplace(&quot;2&quot;, &quot;3&quot;);
+
+                    webArea.removeNotificationListener();
+                    window.testRunner.notifyDone();
+                }
+            }
+        }
+
+        if (window.accessibilityController) {
+             window.testRunner.waitUntilDone();
+
+            accessibilityController.enableEnhancedAccessibility(true);
+
+            webArea = accessibilityController.rootElement.childAtIndex(0);
+            var addedNotification = webArea.addNotificationListener(notificationCallback);
+            shouldBe(&quot;addedNotification&quot;, &quot;true&quot;);
+
+            var textbox = document.getElementById(&quot;textbox&quot;);
+            textbox.focus();
+
+            eventSender.keyDown(&quot;1&quot;);
+            deleteCommand();
+
+            eventSender.keyDown(&quot;\n&quot;);
+            deleteCommand();
+
+            execExtendSelectionRightByCharacterCommand();
+            eventSender.keyDown(&quot;2&quot;);
+
+            execExtendSelectionRightByCharacterCommand();
+            cutCommand();
+
+            pasteCommand();
+
+            execExtendSelectionRightByCharacterCommand();
+            pasteCommand();
+
+            execExtendSelectionLeftByCharacterCommand();
+            eventSender.keyDown(&quot;3&quot;);
+        }
+    &lt;/script&gt;
+
+    &lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymacvaluechangevaluechangeuserinfotextareaexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/mac/value-change/value-change-user-info-textarea-expected.txt (0 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/value-change/value-change-user-info-textarea-expected.txt                                (rev 0)
+++ trunk/LayoutTests/accessibility/mac/value-change/value-change-user-info-textarea-expected.txt        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+
+This tests value change notifications user info data.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS addedNotification is true
+PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
+PASS actualChangeValues[resultIndex] is expectedValues[resultIndex]
+PASS actualEditTypes[resultIndex] is &quot;Typing&quot;
+PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
+PASS actualChangeValues[resultIndex] is expectedValues[resultIndex]
+PASS actualEditTypes[resultIndex] is &quot;Delete&quot;
+PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
+PASS actualChangeValues[resultIndex] is expectedValues[resultIndex]
+PASS actualEditTypes[resultIndex] is &quot;Typing&quot;
+PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
+PASS actualChangeValues[resultIndex] is expectedValues[resultIndex]
+PASS actualEditTypes[resultIndex] is &quot;Delete&quot;
+PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
+PASS actualChangeValues[resultIndex][0] is expectedValues[resultIndex][0]
+PASS actualEditTypes[resultIndex][0] is &quot;Delete&quot;
+PASS actualChangeValues[resultIndex][1] is expectedValues[resultIndex][1]
+PASS actualEditTypes[resultIndex][1] is &quot;Typing&quot;
+PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
+PASS actualChangeValues[resultIndex] is expectedValues[resultIndex]
+PASS actualEditTypes[resultIndex] is &quot;Cut&quot;
+PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
+PASS actualChangeValues[resultIndex] is expectedValues[resultIndex]
+PASS actualEditTypes[resultIndex] is &quot;Paste&quot;
+PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
+PASS actualChangeValues[resultIndex][0] is expectedValues[resultIndex][0]
+PASS actualEditTypes[resultIndex][0] is &quot;Delete&quot;
+PASS actualChangeValues[resultIndex][1] is expectedValues[resultIndex][1]
+PASS actualEditTypes[resultIndex][1] is &quot;Paste&quot;
+PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
+PASS actualChangeValues[resultIndex][0] is expectedValues[resultIndex][0]
+PASS actualEditTypes[resultIndex][0] is &quot;Delete&quot;
+PASS actualChangeValues[resultIndex][1] is expectedValues[resultIndex][1]
+PASS actualEditTypes[resultIndex][1] is &quot;Typing&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymacvaluechangevaluechangeuserinfotextareahtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/mac/value-change/value-change-user-info-textarea.html (0 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/value-change/value-change-user-info-textarea.html                                (rev 0)
+++ trunk/LayoutTests/accessibility/mac/value-change/value-change-user-info-textarea.html        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -0,0 +1,104 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+    &lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+    &lt;script src=&quot;../../../editing/editing.js&quot;&gt;&lt;/script&gt;
+    &lt;script src=&quot;value-change-helpers.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body id=&quot;body&quot;&gt;
+
+    &lt;textarea id=&quot;textbox&quot;&gt;456&lt;/textarea&gt;
+
+    &lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+    &lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+    &lt;div id=&quot;notifications&quot;&gt;&lt;/div&gt;
+
+    &lt;script&gt;
+
+        description(&quot;This tests value change notifications user info data.&quot;);
+
+        var webArea = 0;
+        var count = 0;
+
+        var resultIndex = -1;
+
+        var actualChangeTypes = [];
+        var actualChangeValues = [];
+        var actualEditTypes = [];
+
+        var expectedValues = [];
+
+        function notificationCallback(notification, userInfo) {
+            if (notification == &quot;AXValueChanged&quot;) {
+
+                actualChangeTypes[count] = userInfo[&quot;AXTextStateChangeType&quot;];
+                var changes = userInfo[&quot;AXTextChangeValues&quot;];
+                if (changes &amp;&amp; changes.length == 1) {
+                    var change = changes[0];
+                    actualChangeValues[count] = change[&quot;AXTextChangeValue&quot;];
+                    actualEditTypes[count] = stringForEditType(change[&quot;AXTextEditType&quot;])
+                } else if (changes &amp;&amp; changes.length == 2) {
+                    var change1 = changes[0];
+                    var change2 = changes[1];
+                    actualChangeValues[count] = [change1[&quot;AXTextChangeValue&quot;], change2[&quot;AXTextChangeValue&quot;]];
+                    actualEditTypes[count] = [stringForEditType(change1[&quot;AXTextEditType&quot;]), stringForEditType(change2[&quot;AXTextEditType&quot;])];
+                }
+
+                count++;
+
+                var expectedCount = 9;
+                if (count == expectedCount) {
+
+                    shouldBeTyping(&quot;3&quot;);
+                    shouldBeDelete(&quot;3&quot;);
+                    shouldBeTyping(&quot;\n&quot;);
+                    shouldBeDelete(&quot;\n&quot;);
+                    shouldBeTypingReplace(&quot;4&quot;, &quot;5&quot;);
+                    shouldBeCut(&quot;5&quot;);
+                    shouldBePaste(&quot;5&quot;);
+                    shouldBePasteReplace(&quot;6&quot;, &quot;5&quot;);
+                    shouldBeTypingReplace(&quot;5&quot;, &quot;6&quot;);
+
+                    webArea.removeNotificationListener();
+                    window.testRunner.notifyDone();
+                }
+            }
+        }
+
+        if (window.accessibilityController) {
+             window.testRunner.waitUntilDone();
+
+            accessibilityController.enableEnhancedAccessibility(true);
+
+            webArea = accessibilityController.rootElement.childAtIndex(0);
+            var addedNotification = webArea.addNotificationListener(notificationCallback);
+            shouldBe(&quot;addedNotification&quot;, &quot;true&quot;);
+
+            var textbox = document.getElementById(&quot;textbox&quot;);
+            textbox.focus();
+
+            eventSender.keyDown(&quot;3&quot;);
+            deleteCommand();
+
+            eventSender.keyDown(&quot;\n&quot;);
+            deleteCommand();
+
+            execExtendSelectionRightByCharacterCommand();
+            eventSender.keyDown(&quot;5&quot;);
+
+            execExtendSelectionRightByCharacterCommand();
+            cutCommand();
+
+            pasteCommand();
+
+            execExtendSelectionRightByCharacterCommand();
+            pasteCommand();
+
+            execExtendSelectionLeftByCharacterCommand();
+            eventSender.keyDown(&quot;6&quot;);
+        }
+    &lt;/script&gt;
+
+    &lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymacvaluechangevaluechangeuserinfotextfieldexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/mac/value-change/value-change-user-info-textfield-expected.txt (0 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/value-change/value-change-user-info-textfield-expected.txt                                (rev 0)
+++ trunk/LayoutTests/accessibility/mac/value-change/value-change-user-info-textfield-expected.txt        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+
+This tests value change notifications user info data.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS addedNotification is true
+PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
+PASS actualChangeValues[resultIndex] is expectedValues[resultIndex]
+PASS actualEditTypes[resultIndex] is &quot;Typing&quot;
+PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
+PASS actualChangeValues[resultIndex] is expectedValues[resultIndex]
+PASS actualEditTypes[resultIndex] is &quot;Delete&quot;
+PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
+PASS actualChangeValues[resultIndex][0] is expectedValues[resultIndex][0]
+PASS actualEditTypes[resultIndex][0] is &quot;Delete&quot;
+PASS actualChangeValues[resultIndex][1] is expectedValues[resultIndex][1]
+PASS actualEditTypes[resultIndex][1] is &quot;Typing&quot;
+PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
+PASS actualChangeValues[resultIndex] is expectedValues[resultIndex]
+PASS actualEditTypes[resultIndex] is &quot;Cut&quot;
+PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
+PASS actualChangeValues[resultIndex] is expectedValues[resultIndex]
+PASS actualEditTypes[resultIndex] is &quot;Paste&quot;
+PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
+PASS actualChangeValues[resultIndex][0] is expectedValues[resultIndex][0]
+PASS actualEditTypes[resultIndex][0] is &quot;Delete&quot;
+PASS actualChangeValues[resultIndex][1] is expectedValues[resultIndex][1]
+PASS actualEditTypes[resultIndex][1] is &quot;Paste&quot;
+PASS actualChangeTypes[resultIndex] is AXTextStateChangeTypeEdit
+PASS actualChangeValues[resultIndex][0] is expectedValues[resultIndex][0]
+PASS actualEditTypes[resultIndex][0] is &quot;Delete&quot;
+PASS actualChangeValues[resultIndex][1] is expectedValues[resultIndex][1]
+PASS actualEditTypes[resultIndex][1] is &quot;Typing&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymacvaluechangevaluechangeuserinfotextfieldhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/mac/value-change/value-change-user-info-textfield.html (0 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/value-change/value-change-user-info-textfield.html                                (rev 0)
+++ trunk/LayoutTests/accessibility/mac/value-change/value-change-user-info-textfield.html        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -0,0 +1,100 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+    &lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+    &lt;script src=&quot;../../../editing/editing.js&quot;&gt;&lt;/script&gt;
+    &lt;script src=&quot;value-change-helpers.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body id=&quot;body&quot;&gt;
+
+    &lt;input type=&quot;text&quot; id=&quot;textbox&quot; value=&quot;789&quot;&gt;&lt;/input&gt;
+
+    &lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+    &lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+    &lt;div id=&quot;notifications&quot;&gt;&lt;/div&gt;
+
+    &lt;script&gt;
+
+        description(&quot;This tests value change notifications user info data.&quot;);
+
+        var webArea = 0;
+        var count = 0;
+
+        var resultIndex = -1;
+
+        var actualChangeTypes = [];
+        var actualChangeValues = [];
+        var actualEditTypes = [];
+
+        var expectedValues = [];
+
+        function notificationCallback(notification, userInfo) {
+            if (notification == &quot;AXValueChanged&quot;) {
+
+                actualChangeTypes[count] = userInfo[&quot;AXTextStateChangeType&quot;];
+                var changes = userInfo[&quot;AXTextChangeValues&quot;];
+                if (changes &amp;&amp; changes.length == 1) {
+                    var change = changes[0];
+                    actualChangeValues[count] = change[&quot;AXTextChangeValue&quot;];
+                    actualEditTypes[count] = stringForEditType(change[&quot;AXTextEditType&quot;])
+                } else if (changes &amp;&amp; changes.length == 2) {
+                    var change1 = changes[0];
+                    var change2 = changes[1];
+                    actualChangeValues[count] = [change1[&quot;AXTextChangeValue&quot;], change2[&quot;AXTextChangeValue&quot;]];
+                    actualEditTypes[count] = [stringForEditType(change1[&quot;AXTextEditType&quot;]), stringForEditType(change2[&quot;AXTextEditType&quot;])];
+                }
+
+                count++;
+
+                var expectedCount = 7;
+                if (count == expectedCount) {
+
+                    shouldBeTyping(&quot;6&quot;);
+                    shouldBeDelete(&quot;6&quot;);
+                    shouldBeTypingReplace(&quot;7&quot;, &quot;8&quot;);
+                    shouldBeCut(&quot;8&quot;);
+                    shouldBePaste(&quot;8&quot;);
+                    shouldBePasteReplace(&quot;9&quot;, &quot;8&quot;);
+                    shouldBeTypingReplace(&quot;8&quot;, &quot;9&quot;);
+
+                    webArea.removeNotificationListener();
+                    window.testRunner.notifyDone();
+                }
+            }
+        }
+
+        if (window.accessibilityController) {
+             window.testRunner.waitUntilDone();
+
+            accessibilityController.enableEnhancedAccessibility(true);
+
+            webArea = accessibilityController.rootElement.childAtIndex(0);
+            var addedNotification = webArea.addNotificationListener(notificationCallback);
+            shouldBe(&quot;addedNotification&quot;, &quot;true&quot;);
+
+            var textbox = document.getElementById(&quot;textbox&quot;);
+            textbox.focus();
+            execMoveSelectionLeftByCharacterCommand();
+
+            eventSender.keyDown(&quot;6&quot;);
+            deleteCommand();
+
+            execExtendSelectionRightByCharacterCommand();
+            eventSender.keyDown(&quot;8&quot;);
+
+            execExtendSelectionRightByCharacterCommand();
+            cutCommand();
+
+            pasteCommand();
+
+            execExtendSelectionRightByCharacterCommand();
+            pasteCommand();
+
+            execExtendSelectionLeftByCharacterCommand();
+            eventSender.keyDown(&quot;9&quot;);
+        }
+    &lt;/script&gt;
+
+    &lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymacvaluechangeuserinfoexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/accessibility/mac/value-change-userinfo-expected.txt (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/value-change-userinfo-expected.txt        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/LayoutTests/accessibility/mac/value-change-userinfo-expected.txt        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -1,29 +0,0 @@
</span><del>-0234567890
-This tests value change notifications user info data.
-
-On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
-
-
-PASS addedNotification is true
-PASS results[resultIndex][&quot;AXTextStateChangeType&quot;] is AXTextStateChangeTypeEdit
-PASS results[resultIndex][&quot;AXTextChangeValues&quot;][0][&quot;AXTextChangeValue&quot;] is &quot;0&quot;
-PASS results[resultIndex][&quot;AXTextChangeValues&quot;][0][&quot;AXTextEditType&quot;] is AXTextEditTypeCut
-PASS results[resultIndex][&quot;AXTextStateChangeType&quot;] is AXTextStateChangeTypeEdit
-PASS results[resultIndex][&quot;AXTextChangeValues&quot;][0][&quot;AXTextChangeValue&quot;] is &quot;1&quot;
-PASS results[resultIndex][&quot;AXTextChangeValues&quot;][0][&quot;AXTextEditType&quot;] is AXTextEditTypeDelete
-PASS results[resultIndex][&quot;AXTextStateChangeType&quot;] is AXTextStateChangeTypeEdit
-PASS results[resultIndex][&quot;AXTextChangeValues&quot;][0][&quot;AXTextChangeValue&quot;] is &quot;0&quot;
-PASS results[resultIndex][&quot;AXTextChangeValues&quot;][0][&quot;AXTextEditType&quot;] is AXTextEditTypePaste
-PASS results[resultIndex][&quot;AXTextStateChangeType&quot;] is AXTextStateChangeTypeEdit
-PASS results[resultIndex][&quot;AXTextChangeValues&quot;][0][&quot;AXTextChangeValue&quot;] is &quot;234567890&quot;
-PASS results[resultIndex][&quot;AXTextChangeValues&quot;][0][&quot;AXTextEditType&quot;] is AXTextEditTypePaste
-PASS results[resultIndex][&quot;AXTextStateChangeType&quot;] is AXTextStateChangeTypeEdit
-PASS results[resultIndex][&quot;AXTextChangeValues&quot;][0][&quot;AXTextChangeValue&quot;] is &quot;1&quot;
-PASS results[resultIndex][&quot;AXTextChangeValues&quot;][0][&quot;AXTextEditType&quot;] is AXTextEditTypeTyping
-PASS results[resultIndex][&quot;AXTextStateChangeType&quot;] is AXTextStateChangeTypeEdit
-PASS results[resultIndex][&quot;AXTextChangeValues&quot;][0][&quot;AXTextChangeValue&quot;] is &quot;1&quot;
-PASS results[resultIndex][&quot;AXTextChangeValues&quot;][0][&quot;AXTextEditType&quot;] is AXTextEditTypeDelete
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
</del></span></pre></div>
<a id="trunkLayoutTestsaccessibilitymacvaluechangeuserinfohtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/accessibility/mac/value-change-userinfo.html (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/mac/value-change-userinfo.html        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/LayoutTests/accessibility/mac/value-change-userinfo.html        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -1,97 +0,0 @@
</span><del>-&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
-&lt;html&gt;
-&lt;head&gt;
-    &lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
-    &lt;script src=&quot;../../editing/editing.js&quot;&gt;&lt;/script&gt;
-&lt;/head&gt;
-&lt;body id=&quot;body&quot;&gt;
-
-    &lt;div role=&quot;textbox&quot; tabindex=0 id=&quot;textbox&quot; contenteditable=true&gt;01234567890&lt;/div&gt;
-
-    &lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
-    &lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
-    &lt;div id=&quot;notifications&quot;&gt;&lt;/div&gt;
-
-    &lt;script&gt;
-
-        description(&quot;This tests value change notifications user info data.&quot;);
-
-        var AXTextStateChangeTypeEdit = 1;
-
-        var AXTextEditTypeDelete = 1;
-        var AXTextEditTypeInsert = AXTextEditTypeDelete + 1;
-        var AXTextEditTypeTyping = AXTextEditTypeInsert + 1;
-        var AXTextEditTypeDictation = AXTextEditTypeTyping + 1;
-        var AXTextEditTypeCut = AXTextEditTypeDictation + 1
-        var AXTextEditTypePaste = AXTextEditTypeCut + 1;
-
-        var webArea = 0;
-        var count = 0;
-        var results = [];
-        var resultIndex = 0;
-        function notificationCallback(notification, userInfo) {
-            if (notification == &quot;AXValueChanged&quot;) {
-                count++;
-                results.push(userInfo);
-                if (count == 6) {
-
-                    shouldBe(&quot;results[resultIndex][\&quot;AXTextStateChangeType\&quot;]&quot;, &quot;AXTextStateChangeTypeEdit&quot;);
-                    shouldBe(&quot;results[resultIndex][\&quot;AXTextChangeValues\&quot;][0][\&quot;AXTextChangeValue\&quot;]&quot;, &quot;\&quot;0\&quot;&quot;);
-                    shouldBe(&quot;results[resultIndex][\&quot;AXTextChangeValues\&quot;][0][\&quot;AXTextEditType\&quot;]&quot;, &quot;AXTextEditTypeCut&quot;);
-
-                    resultIndex++;
-                    shouldBe(&quot;results[resultIndex][\&quot;AXTextStateChangeType\&quot;]&quot;, &quot;AXTextStateChangeTypeEdit&quot;);
-                    shouldBe(&quot;results[resultIndex][\&quot;AXTextChangeValues\&quot;][0][\&quot;AXTextChangeValue\&quot;]&quot;, &quot;\&quot;1\&quot;&quot;);
-                    shouldBe(&quot;results[resultIndex][\&quot;AXTextChangeValues\&quot;][0][\&quot;AXTextEditType\&quot;]&quot;, &quot;AXTextEditTypeDelete&quot;);
-
-                    resultIndex++;
-                    shouldBe(&quot;results[resultIndex][\&quot;AXTextStateChangeType\&quot;]&quot;, &quot;AXTextStateChangeTypeEdit&quot;);
-                    shouldBe(&quot;results[resultIndex][\&quot;AXTextChangeValues\&quot;][0][\&quot;AXTextChangeValue\&quot;]&quot;, &quot;\&quot;0\&quot;&quot;);
-                    shouldBe(&quot;results[resultIndex][\&quot;AXTextChangeValues\&quot;][0][\&quot;AXTextEditType\&quot;]&quot;, &quot;AXTextEditTypePaste&quot;);
-
-                    resultIndex++;
-                    shouldBe(&quot;results[resultIndex][\&quot;AXTextStateChangeType\&quot;]&quot;, &quot;AXTextStateChangeTypeEdit&quot;);
-                    shouldBe(&quot;results[resultIndex][\&quot;AXTextChangeValues\&quot;][0][\&quot;AXTextChangeValue\&quot;]&quot;, &quot;\&quot;234567890\&quot;&quot;);
-                    shouldBe(&quot;results[resultIndex][\&quot;AXTextChangeValues\&quot;][0][\&quot;AXTextEditType\&quot;]&quot;, &quot;AXTextEditTypePaste&quot;);
-
-                    resultIndex++;
-                    shouldBe(&quot;results[resultIndex][\&quot;AXTextStateChangeType\&quot;]&quot;, &quot;AXTextStateChangeTypeEdit&quot;);
-                    shouldBe(&quot;results[resultIndex][\&quot;AXTextChangeValues\&quot;][0][\&quot;AXTextChangeValue\&quot;]&quot;, &quot;\&quot;1\&quot;&quot;);
-                    shouldBe(&quot;results[resultIndex][\&quot;AXTextChangeValues\&quot;][0][\&quot;AXTextEditType\&quot;]&quot;, &quot;AXTextEditTypeTyping&quot;);
-
-                    resultIndex++;
-                    shouldBe(&quot;results[resultIndex][\&quot;AXTextStateChangeType\&quot;]&quot;, &quot;AXTextStateChangeTypeEdit&quot;);
-                    shouldBe(&quot;results[resultIndex][\&quot;AXTextChangeValues\&quot;][0][\&quot;AXTextChangeValue\&quot;]&quot;, &quot;\&quot;1\&quot;&quot;);
-                    shouldBe(&quot;results[resultIndex][\&quot;AXTextChangeValues\&quot;][0][\&quot;AXTextEditType\&quot;]&quot;, &quot;AXTextEditTypeDelete&quot;);
-
-                    webArea.removeNotificationListener();
-                    window.testRunner.notifyDone();
-                }
-            }
-        }
-
-        if (window.accessibilityController) {
-             window.testRunner.waitUntilDone();
-
-            accessibilityController.enableEnhancedAccessibility(true);
-
-            webArea = accessibilityController.rootElement.childAtIndex(0);
-            var addedNotification = webArea.addNotificationListener(notificationCallback);
-            shouldBe(&quot;addedNotification&quot;, &quot;true&quot;);
-
-            var textbox = document.getElementById(&quot;textbox&quot;);
-            textbox.focus();
-
-            execSetSelectionCommand(textbox, 0);
-            execExtendSelectionRightByCharacterCommand();
-            cutCommand();
-            execExtendSelectionRightByCharacterCommand();
-            pasteCommand();
-            eventSender.keyDown(&quot;1&quot;);
-            deleteCommand();
-        }
-    &lt;/script&gt;
-
-    &lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
-&lt;/body&gt;
-&lt;/html&gt;
</del></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/CMakeLists.txt        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -1565,8 +1565,6 @@
</span><span class="cx">     editing/RemoveNodeCommand.cpp
</span><span class="cx">     editing/RemoveNodePreservingChildrenCommand.cpp
</span><span class="cx">     editing/RenderedPosition.cpp
</span><del>-    editing/ReplaceDeleteFromTextNodeCommand.cpp
-    editing/ReplaceInsertIntoTextNodeCommand.cpp
</del><span class="cx">     editing/ReplaceNodeWithSpanCommand.cpp
</span><span class="cx">     editing/ReplaceSelectionCommand.cpp
</span><span class="cx">     editing/SetNodeAttributeCommand.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/ChangeLog        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -1,3 +1,132 @@
</span><ins>+2016-04-04  Doug Russell  &lt;d_russell@apple.com&gt;
+
+        AX: new lines in content editable elements don't notify accessibility
+        https://bugs.webkit.org/show_bug.cgi?id=153361
+
+        Reviewed by Ryosuke Niwa.
+
+        Relocate accessibility edit notification logic into higher level logic.
+        Typing notifications relocated into TypingCommand.
+        Cut &amp; Paste notifications relocated into Editor.
+        Undo relocated into EditCommandComposition.
+
+        Tests: accessibility/mac/value-change/value-change-user-info-contenteditable.html
+               accessibility/mac/value-change/value-change-user-info-textarea.html
+               accessibility/mac/value-change/value-change-user-info-textfield.html
+
+        * CMakeLists.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::AccessibilityReplacedText::AccessibilityReplacedText):
+        (WebCore::AccessibilityReplacedText::postTextStateChangeNotification):
+        (WebCore::AXObjectCache::postTextStateChangeNotification):
+        (WebCore::AXObjectCache::postTextReplacementNotification):
+        * accessibility/AXObjectCache.h:
+        (WebCore::VisiblePositionIndexRange::isNull):
+        (WebCore::AccessibilityReplacedText::AccessibilityReplacedText):
+        (WebCore::AccessibilityReplacedText::replacedRange):
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::listMarkerTextForNodeAndPosition):
+        (WebCore::AccessibilityObject::stringForVisiblePositionRange):
+        * accessibility/AccessibilityObject.h:
+        (WebCore::VisiblePositionRange::VisiblePositionRange):
+        * accessibility/mac/AXObjectCacheMac.mm:
+        (WebCore::AXObjectCache::postTextStateChangePlatformNotification):
+        (WebCore::AXObjectCache::postTextReplacementPlatformNotification):
+        * editing/AppendNodeCommand.cpp:
+        (WebCore::AppendNodeCommand::doApply): Deleted.
+        (WebCore::AppendNodeCommand::doUnapply): Deleted.
+        * editing/CompositeEditCommand.cpp:
+        (WebCore::AccessibilityUndoReplacedText::indexForVisiblePosition):
+        (WebCore::AccessibilityUndoReplacedText::confgureTextToBeDeletedByUnapplyIndexesWithEditCommandEndingSelection):
+        (WebCore::AccessibilityUndoReplacedText::confgureTextToBeDeletedByUnapplyStartIndexWithEditCommandStartingSelection):
+        (WebCore::AccessibilityUndoReplacedText::setTextInsertedByUnapplyRange):
+        (WebCore::AccessibilityUndoReplacedText::captureTextToBeDeletedByUnapply):
+        (WebCore::AccessibilityUndoReplacedText::captureTextToBeDeletedByReapply):
+        (WebCore::stringForVisiblePositionIndexRange):
+        (WebCore::AccessibilityUndoReplacedText::textInsertedByUnapply):
+        (WebCore::AccessibilityUndoReplacedText::textInsertedByReapply):
+        (WebCore::postTextStateChangeNotification):
+        (WebCore::AccessibilityUndoReplacedText::postTextStateChangeNotificationForUnapply):
+        (WebCore::AccessibilityUndoReplacedText::postTextStateChangeNotificationForReapply):
+        (WebCore::EditCommandComposition::EditCommandComposition):
+        (WebCore::EditCommandComposition::unapply):
+        (WebCore::EditCommandComposition::reapply):
+        (WebCore::EditCommandComposition::setStartingSelection):
+        (WebCore::EditCommandComposition::setEndingSelection):
+        (WebCore::EditCommandComposition::setTextInsertedByUnapplyRange):
+        (WebCore::CompositeEditCommand::removeNode):
+        (WebCore::CompositeEditCommand::replaceTextInNode):
+        (WebCore::deleteSelectionEditingActionForEditingAction):
+        (WebCore::CompositeEditCommand::deleteSelection):
+        (WebCore::CompositeEditCommand::applyStyle): Deleted.
+        (WebCore::CompositeEditCommand::updatePositionForNodeRemovalPreservingChildren): Deleted.
+        (WebCore::CompositeEditCommand::inputText): Deleted.
+        * editing/CompositeEditCommand.h:
+        (WebCore::AccessibilityUndoReplacedText::AccessibilityUndoReplacedText):
+        * editing/DeleteFromTextNodeCommand.cpp:
+        (WebCore::DeleteFromTextNodeCommand::doApply): Deleted.
+        (WebCore::DeleteFromTextNodeCommand::getNodesInCommand): Deleted.
+        * editing/DeleteFromTextNodeCommand.h:
+        * editing/DictationCommand.cpp:
+        (WebCore::DictationCommand::doApply):
+        * editing/EditCommand.cpp:
+        (WebCore::EditCommand::postTextStateChangeNotification):
+        (WebCore::SimpleEditCommand::SimpleEditCommand): Deleted.
+        (WebCore::SimpleEditCommand::doReapply): Deleted.
+        (WebCore::SimpleEditCommand::addNodeAndDescendants): Deleted.
+        * editing/EditCommand.h:
+        * editing/EditingAllInOne.cpp:
+        * editing/Editor.cpp:
+        (WebCore::Editor::replaceSelectionWithFragment):
+        (WebCore::Editor::appliedEditing):
+        (WebCore::Editor::unappliedEditing):
+        (WebCore::Editor::postTextStateChangeNotificationForCut):
+        (WebCore::Editor::performCutOrCopy):
+        (WebCore::Editor::changeSelectionAfterCommand):
+        (WebCore::dispatchEditableContentChangedEvents): Deleted.
+        (WebCore::Editor::addTextToKillRing): Deleted.
+        * editing/Editor.h:
+        * editing/InsertIntoTextNodeCommand.cpp:
+        (WebCore::InsertIntoTextNodeCommand::doApply): Deleted.
+        (WebCore::InsertIntoTextNodeCommand::getNodesInCommand): Deleted.
+        * editing/InsertNodeBeforeCommand.cpp:
+        (WebCore::InsertNodeBeforeCommand::doApply): Deleted.
+        (WebCore::InsertNodeBeforeCommand::doUnapply): Deleted.
+        (WebCore::InsertNodeBeforeCommand::getNodesInCommand): Deleted.
+        * editing/RemoveNodeCommand.cpp:
+        (WebCore::RemoveNodeCommand::RemoveNodeCommand):
+        * editing/RemoveNodeCommand.h:
+        (WebCore::RemoveNodeCommand::create):
+        * editing/ReplaceDeleteFromTextNodeCommand.cpp: Removed.
+        * editing/ReplaceDeleteFromTextNodeCommand.h: Removed.
+        * editing/ReplaceInsertIntoTextNodeCommand.cpp: Removed.
+        * editing/ReplaceInsertIntoTextNodeCommand.h: Removed.
+        * editing/ReplaceSelectionCommand.cpp:
+        (WebCore::ReplaceSelectionCommand::doApply):
+        (WebCore::ReplaceSelectionCommand::completeHTMLReplacement):
+        (WebCore::ReplaceSelectionCommand::performTrivialReplace):
+        * editing/ReplaceSelectionCommand.h:
+        (WebCore::ReplaceSelectionCommand::visibleSelectionForInsertedText):
+        * editing/TextInsertionBaseCommand.cpp:
+        (WebCore::TextInsertionBaseCommand::TextInsertionBaseCommand):
+        * editing/TextInsertionBaseCommand.h:
+        * editing/TypingCommand.cpp:
+        (WebCore::TypingCommand::TypingCommand):
+        (WebCore::TypingCommand::insertText):
+        (WebCore::TypingCommand::insertLineBreak):
+        (WebCore::TypingCommand::insertParagraphSeparatorInQuotedContent):
+        (WebCore::TypingCommand::insertParagraphSeparator):
+        (WebCore::TypingCommand::postTextStateChangeNotificationForDeletion):
+        (WebCore::TypingCommand::doApply):
+        (WebCore::TypingCommand::insertTextAndNotifyAccessibility):
+        (WebCore::TypingCommand::insertLineBreakAndNotifyAccessibility):
+        (WebCore::TypingCommand::insertParagraphSeparatorAndNotifyAccessibility):
+        (WebCore::TypingCommand::insertParagraphSeparatorInQuotedContentAndNotifyAccessibility):
+        (WebCore::TypingCommand::deleteKeyPressed):
+        (WebCore::TypingCommand::forwardDeleteKeyPressed):
+        * editing/TypingCommand.h:
+
</ins><span class="cx"> 2016-04-04  Dean Jackson  &lt;dino@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add color-gamut media query support
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -6738,10 +6738,6 @@
</span><span class="cx">                 F52AD5E41534245F0059FBE6 /* EmptyClients.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F52AD5E31534245F0059FBE6 /* EmptyClients.cpp */; };
</span><span class="cx">                 F544F78815CFB2A800AF33A8 /* PlatformLocale.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F544F78615CFB2A800AF33A8 /* PlatformLocale.cpp */; };
</span><span class="cx">                 F544F78915CFB2A800AF33A8 /* PlatformLocale.h in Headers */ = {isa = PBXBuildFile; fileRef = F544F78715CFB2A800AF33A8 /* PlatformLocale.h */; };
</span><del>-                F5528DA51AC1033E000EF7AD /* ReplaceDeleteFromTextNodeCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = F5528DA31AC1033E000EF7AD /* ReplaceDeleteFromTextNodeCommand.h */; };
-                F5528DA61AC1033E000EF7AD /* ReplaceDeleteFromTextNodeCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5528DA41AC1033E000EF7AD /* ReplaceDeleteFromTextNodeCommand.cpp */; };
-                F5528DA91AC109DF000EF7AD /* ReplaceInsertIntoTextNodeCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5528DA71AC109DF000EF7AD /* ReplaceInsertIntoTextNodeCommand.cpp */; };
-                F5528DAA1AC109DF000EF7AD /* ReplaceInsertIntoTextNodeCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = F5528DA81AC109DF000EF7AD /* ReplaceInsertIntoTextNodeCommand.h */; };
</del><span class="cx">                 F55B3DAD1251F12D003EF269 /* BaseTextInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D791251F12D003EF269 /* BaseTextInputType.cpp */; };
</span><span class="cx">                 F55B3DAE1251F12D003EF269 /* BaseTextInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D7A1251F12D003EF269 /* BaseTextInputType.h */; };
</span><span class="cx">                 F55B3DAF1251F12D003EF269 /* ButtonInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D7B1251F12D003EF269 /* ButtonInputType.cpp */; };
</span><span class="lines">@@ -14797,10 +14793,6 @@
</span><span class="cx">                 F52AD5E31534245F0059FBE6 /* EmptyClients.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EmptyClients.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 F544F78615CFB2A800AF33A8 /* PlatformLocale.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformLocale.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 F544F78715CFB2A800AF33A8 /* PlatformLocale.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformLocale.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                F5528DA31AC1033E000EF7AD /* ReplaceDeleteFromTextNodeCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReplaceDeleteFromTextNodeCommand.h; sourceTree = &quot;&lt;group&gt;&quot;; };
-                F5528DA41AC1033E000EF7AD /* ReplaceDeleteFromTextNodeCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReplaceDeleteFromTextNodeCommand.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                F5528DA71AC109DF000EF7AD /* ReplaceInsertIntoTextNodeCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReplaceInsertIntoTextNodeCommand.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                F5528DA81AC109DF000EF7AD /* ReplaceInsertIntoTextNodeCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReplaceInsertIntoTextNodeCommand.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 F55B3D791251F12D003EF269 /* BaseTextInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BaseTextInputType.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 F55B3D7A1251F12D003EF269 /* BaseTextInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseTextInputType.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 F55B3D7B1251F12D003EF269 /* ButtonInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ButtonInputType.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -18889,10 +18881,6 @@
</span><span class="cx">                                 93309DB8099E64910056E581 /* RemoveNodePreservingChildrenCommand.h */,
</span><span class="cx">                                 9B32CDA813DF7FA900F34D13 /* RenderedPosition.cpp */,
</span><span class="cx">                                 9B32CDA713DF7FA900F34D13 /* RenderedPosition.h */,
</span><del>-                                F5528DA41AC1033E000EF7AD /* ReplaceDeleteFromTextNodeCommand.cpp */,
-                                F5528DA31AC1033E000EF7AD /* ReplaceDeleteFromTextNodeCommand.h */,
-                                F5528DA71AC109DF000EF7AD /* ReplaceInsertIntoTextNodeCommand.cpp */,
-                                F5528DA81AC109DF000EF7AD /* ReplaceInsertIntoTextNodeCommand.h */,
</del><span class="cx">                                 A89CCC500F44E98100B5DA10 /* ReplaceNodeWithSpanCommand.cpp */,
</span><span class="cx">                                 A89CCC510F44E98100B5DA10 /* ReplaceNodeWithSpanCommand.h */,
</span><span class="cx">                                 93309DBA099E64910056E581 /* ReplaceSelectionCommand.cpp */,
</span><span class="lines">@@ -27658,8 +27646,6 @@
</span><span class="cx">                                 BCEA4868097D93020094C9E4 /* RenderView.h in Headers */,
</span><span class="cx">                                 BE20507E18A458C20080647E /* RenderVTTCue.h in Headers */,
</span><span class="cx">                                 A871DFE40A15376B00B12A68 /* RenderWidget.h in Headers */,
</span><del>-                                F5528DA51AC1033E000EF7AD /* ReplaceDeleteFromTextNodeCommand.h in Headers */,
-                                F5528DAA1AC109DF000EF7AD /* ReplaceInsertIntoTextNodeCommand.h in Headers */,
</del><span class="cx">                                 A89CCC530F44E98100B5DA10 /* ReplaceNodeWithSpanCommand.h in Headers */,
</span><span class="cx">                                 93309E0A099E64920056E581 /* ReplaceSelectionCommand.h in Headers */,
</span><span class="cx">                                 99CC0B5418BE9849006CEBCC /* ReplayController.h in Headers */,
</span><span class="lines">@@ -31282,8 +31268,6 @@
</span><span class="cx">                                 BCEA4867097D93020094C9E4 /* RenderView.cpp in Sources */,
</span><span class="cx">                                 BE20507D18A458BF0080647E /* RenderVTTCue.cpp in Sources */,
</span><span class="cx">                                 A871DFE50A15376B00B12A68 /* RenderWidget.cpp in Sources */,
</span><del>-                                F5528DA61AC1033E000EF7AD /* ReplaceDeleteFromTextNodeCommand.cpp in Sources */,
-                                F5528DA91AC109DF000EF7AD /* ReplaceInsertIntoTextNodeCommand.cpp in Sources */,
</del><span class="cx">                                 A89CCC520F44E98100B5DA10 /* ReplaceNodeWithSpanCommand.cpp in Sources */,
</span><span class="cx">                                 93309E09099E64920056E581 /* ReplaceSelectionCommand.cpp in Sources */,
</span><span class="cx">                                 99CC0B5318BE9849006CEBCC /* ReplayController.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAXObjectCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -119,7 +119,31 @@
</span><span class="cx">         m_idMapping.set(id, attributes);
</span><span class="cx">     }
</span><span class="cx"> }
</span><del>-    
</del><ins>+
+AccessibilityReplacedText::AccessibilityReplacedText(const VisibleSelection&amp; selection)
+{
+    if (AXObjectCache::accessibilityEnabled() &amp;&amp; selection.isRange()) {
+        m_replacedText = AccessibilityObject::stringForVisiblePositionRange(selection);
+        m_replacedRange.startIndex.value = indexForVisiblePosition(selection.start(), m_replacedRange.startIndex.scope);
+        m_replacedRange.endIndex.value = indexForVisiblePosition(selection.end(), m_replacedRange.endIndex.scope);
+    }
+}
+
+void AccessibilityReplacedText::postTextStateChangeNotification(AXObjectCache* cache, AXTextEditType type, const String&amp; text, const VisibleSelection&amp; selection)
+{
+    if (!cache)
+        return;
+    if (!AXObjectCache::accessibilityEnabled())
+        return;
+
+    VisiblePosition position = selection.start();
+    Node* node = highestEditableRoot(position.deepEquivalent(), HasEditableAXRole);
+    if (m_replacedText.length())
+        cache-&gt;postTextReplacementNotification(node, AXTextEditTypeDelete, m_replacedText, type, text, position);
+    else
+        cache-&gt;postTextStateChangeNotification(node, type, text, position);
+}
+
</ins><span class="cx"> bool AXObjectCache::gAccessibilityEnabled = false;
</span><span class="cx"> bool AXObjectCache::gAccessibilityEnhancedUserInterfaceEnabled = false;
</span><span class="cx"> 
</span><span class="lines">@@ -1197,7 +1221,8 @@
</span><span class="cx"> {
</span><span class="cx">     if (!node)
</span><span class="cx">         return;
</span><del>-    ASSERT(type != AXTextEditTypeUnknown);
</del><ins>+    if (type == AXTextEditTypeUnknown)
+        return;
</ins><span class="cx"> 
</span><span class="cx">     stopCachingComputedObjectAttributes();
</span><span class="cx"> 
</span><span class="lines">@@ -1219,8 +1244,10 @@
</span><span class="cx"> {
</span><span class="cx">     if (!node)
</span><span class="cx">         return;
</span><del>-    ASSERT(deletionType == AXTextEditTypeDelete);
-    ASSERT(insertionType == AXTextEditTypeInsert || insertionType == AXTextEditTypeTyping || insertionType == AXTextEditTypeDictation || insertionType == AXTextEditTypePaste);
</del><ins>+    if (deletionType != AXTextEditTypeDelete)
+        return;
+    if (!(insertionType == AXTextEditTypeInsert || insertionType == AXTextEditTypeTyping || insertionType == AXTextEditTypeDictation || insertionType == AXTextEditTypePaste))
+        return;
</ins><span class="cx"> 
</span><span class="cx">     stopCachingComputedObjectAttributes();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAXObjectCacheh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AXObjectCache.h (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AXObjectCache.h        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.h        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -97,6 +97,28 @@
</span><span class="cx">     HashMap&lt;AXID, CachedAXObjectAttributes&gt; m_idMapping;
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+struct VisiblePositionIndex {
+    int value = -1;
+    RefPtr&lt;ContainerNode&gt; scope;
+};
+
+struct VisiblePositionIndexRange {
+    VisiblePositionIndex startIndex;
+    VisiblePositionIndex endIndex;
+    bool isNull() const { return startIndex.value == -1 || endIndex.value == -1; }
+};
+
+class AccessibilityReplacedText {
+public:
+    AccessibilityReplacedText() { }
+    AccessibilityReplacedText(const VisibleSelection&amp;);
+    void postTextStateChangeNotification(AXObjectCache*, AXTextEditType, const String&amp;, const VisibleSelection&amp;);
+    const VisiblePositionIndexRange&amp; replacedRange() { return m_replacedRange; }
+protected:
+    String m_replacedText;
+    VisiblePositionIndexRange m_replacedRange;
+};
+
</ins><span class="cx"> #if !PLATFORM(COCOA)
</span><span class="cx"> enum AXTextChange { AXTextInserted, AXTextDeleted, AXTextAttributesChanged };
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -1258,7 +1258,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Returns the text associated with a list marker if this node is contained within a list item.
</span><del>-String AccessibilityObject::listMarkerTextForNodeAndPosition(Node* node, const VisiblePosition&amp; visiblePositionStart) const
</del><ins>+String AccessibilityObject::listMarkerTextForNodeAndPosition(Node* node, const VisiblePosition&amp; visiblePositionStart)
</ins><span class="cx"> {
</span><span class="cx">     // If the range does not contain the start of the line, the list marker text should not be included.
</span><span class="cx">     if (!isStartOfLine(visiblePositionStart))
</span><span class="lines">@@ -1305,7 +1305,7 @@
</span><span class="cx">     return builder.toString();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-String AccessibilityObject::stringForVisiblePositionRange(const VisiblePositionRange&amp; visiblePositionRange) const
</del><ins>+String AccessibilityObject::stringForVisiblePositionRange(const VisiblePositionRange&amp; visiblePositionRange)
</ins><span class="cx"> {
</span><span class="cx">     if (visiblePositionRange.isNull())
</span><span class="cx">         return String();
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityObject.h        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -394,6 +394,11 @@
</span><span class="cx">         , end(e)
</span><span class="cx">     { }
</span><span class="cx"> 
</span><ins>+    VisiblePositionRange(const VisibleSelection&amp; selection)
+        : start(selection.start())
+        , end(selection.end())
+    { }
+
</ins><span class="cx">     bool isNull() const { return start.isNull() || end.isNull(); }
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -843,7 +848,7 @@
</span><span class="cx">     
</span><span class="cx">     RefPtr&lt;Range&gt; rangeForPlainTextRange(const PlainTextRange&amp;) const;
</span><span class="cx"> 
</span><del>-    String stringForVisiblePositionRange(const VisiblePositionRange&amp;) const;
</del><ins>+    static String stringForVisiblePositionRange(const VisiblePositionRange&amp;);
</ins><span class="cx">     String stringForRange(RefPtr&lt;Range&gt;) const;
</span><span class="cx">     virtual IntRect boundsForVisiblePositionRange(const VisiblePositionRange&amp;) const { return IntRect(); }
</span><span class="cx">     virtual IntRect boundsForRange(const RefPtr&lt;Range&gt;) const { return IntRect(); }
</span><span class="lines">@@ -881,7 +886,7 @@
</span><span class="cx">     virtual String doAXStringForRange(const PlainTextRange&amp;) const { return String(); }
</span><span class="cx">     virtual IntRect doAXBoundsForRange(const PlainTextRange&amp;) const { return IntRect(); }
</span><span class="cx">     virtual IntRect doAXBoundsForRangeUsingCharacterOffset(const PlainTextRange&amp;) const { return IntRect(); }
</span><del>-    String listMarkerTextForNodeAndPosition(Node*, const VisiblePosition&amp;) const;
</del><ins>+    static String listMarkerTextForNodeAndPosition(Node*, const VisiblePosition&amp;);
</ins><span class="cx"> 
</span><span class="cx">     unsigned doAXLineForIndex(unsigned);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilitymacAXObjectCacheMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -398,7 +398,8 @@
</span><span class="cx">         [userInfo setObject:wrapper forKey:NSAccessibilityTextChangeElement];
</span><span class="cx"> 
</span><span class="cx">     AXPostNotificationWithUserInfo(rootWebArea()-&gt;wrapper(), NSAccessibilitySelectedTextChangedNotification, userInfo);
</span><del>-    AXPostNotificationWithUserInfo(object-&gt;wrapper(), NSAccessibilitySelectedTextChangedNotification, userInfo);
</del><ins>+    if (rootWebArea()-&gt;wrapper() != object-&gt;wrapper())
+        AXPostNotificationWithUserInfo(object-&gt;wrapper(), NSAccessibilitySelectedTextChangedNotification, userInfo);
</ins><span class="cx"> 
</span><span class="cx">     [userInfo release];
</span><span class="cx"> }
</span><span class="lines">@@ -455,7 +456,8 @@
</span><span class="cx">         [userInfo setObject:wrapper forKey:NSAccessibilityTextChangeElement];
</span><span class="cx"> 
</span><span class="cx">     AXPostNotificationWithUserInfo(rootWebArea()-&gt;wrapper(), NSAccessibilityValueChangedNotification, userInfo);
</span><del>-    AXPostNotificationWithUserInfo(object-&gt;wrapper(), NSAccessibilityValueChangedNotification, userInfo);
</del><ins>+    if (rootWebArea()-&gt;wrapper() != object-&gt;wrapper())
+        AXPostNotificationWithUserInfo(object-&gt;wrapper(), NSAccessibilityValueChangedNotification, userInfo);
</ins><span class="cx"> 
</span><span class="cx">     [userInfo release];
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingAppendNodeCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/AppendNodeCommand.cpp (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/AppendNodeCommand.cpp        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/editing/AppendNodeCommand.cpp        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -46,31 +46,12 @@
</span><span class="cx">     ASSERT(m_parent-&gt;hasEditableStyle() || !m_parent-&gt;renderer());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void sendAXTextChangedIgnoringLineBreaks(Node* node, AXTextEditType type)
-{
-    if (!node)
-        return;
-
-    String text = node-&gt;nodeValue();
-    // Don't consider linebreaks in this command
-    if (text == &quot;\n&quot;)
-      return;
-
-    if (AXObjectCache* cache = node-&gt;document().existingAXObjectCache()) {
-        Position position = is&lt;Text&gt;(node) ? Position(downcast&lt;Text&gt;(node), 0) : createLegacyEditingPosition(node, 0);
-        cache-&gt;postTextStateChangeNotification(node, type, text, VisiblePosition(position));
-    }
-}
-
</del><span class="cx"> void AppendNodeCommand::doApply()
</span><span class="cx"> {
</span><span class="cx">     if (!m_parent-&gt;hasEditableStyle() &amp;&amp; m_parent-&gt;renderer())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_parent-&gt;appendChild(m_node.copyRef(), IGNORE_EXCEPTION);
</span><del>-
-    if (shouldPostAccessibilityNotification())
-        sendAXTextChangedIgnoringLineBreaks(m_node.ptr(), applyEditType());
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void AppendNodeCommand::doUnapply()
</span><span class="lines">@@ -78,10 +59,6 @@
</span><span class="cx">     if (!m_parent-&gt;hasEditableStyle())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    // Need to notify this before actually deleting the text
-    if (shouldPostAccessibilityNotification())
-        sendAXTextChangedIgnoringLineBreaks(m_node.ptr(), unapplyEditType());
-
</del><span class="cx">     m_node-&gt;remove(IGNORE_EXCEPTION);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingCompositeEditCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/CompositeEditCommand.cpp (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/CompositeEditCommand.cpp        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/editing/CompositeEditCommand.cpp        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;CompositeEditCommand.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;AXObjectCache.h&quot;
</ins><span class="cx"> #include &quot;AppendNodeCommand.h&quot;
</span><span class="cx"> #include &quot;ApplyStyleCommand.h&quot;
</span><span class="cx"> #include &quot;BreakBlockquoteCommand.h&quot;
</span><span class="lines">@@ -59,8 +60,6 @@
</span><span class="cx"> #include &quot;RenderBlockFlow.h&quot;
</span><span class="cx"> #include &quot;RenderText.h&quot;
</span><span class="cx"> #include &quot;RenderedDocumentMarker.h&quot;
</span><del>-#include &quot;ReplaceDeleteFromTextNodeCommand.h&quot;
-#include &quot;ReplaceInsertIntoTextNodeCommand.h&quot;
</del><span class="cx"> #include &quot;ReplaceNodeWithSpanCommand.h&quot;
</span><span class="cx"> #include &quot;ReplaceSelectionCommand.h&quot;
</span><span class="cx"> #include &quot;ScopedEventQueue.h&quot;
</span><span class="lines">@@ -79,6 +78,119 @@
</span><span class="cx"> 
</span><span class="cx"> using namespace HTMLNames;
</span><span class="cx"> 
</span><ins>+int AccessibilityUndoReplacedText::indexForVisiblePosition(const VisiblePosition&amp; position, RefPtr&lt;ContainerNode&gt;&amp; scope) const
+{
+    if (position.deepEquivalent().isNull())
+        return -1;
+    return WebCore::indexForVisiblePosition(position, scope);
+}
+
+void AccessibilityUndoReplacedText::confgureTextToBeDeletedByUnapplyIndexesWithEditCommandEndingSelection(const VisibleSelection&amp; selection)
+{
+    if (!AXObjectCache::accessibilityEnabled())
+        return;
+    if (selection.isRange() &amp;&amp; m_textDeletedByUnapplyRange.startIndex.value == -1)
+        m_textDeletedByUnapplyRange.startIndex.value = indexForVisiblePosition(selection.start(), m_textDeletedByUnapplyRange.startIndex.scope);
+    if (m_textDeletedByUnapplyRange.endIndex.value == -1)
+        m_textDeletedByUnapplyRange.endIndex.value = indexForVisiblePosition(selection.start(), m_textDeletedByUnapplyRange.endIndex.scope);
+}
+
+void AccessibilityUndoReplacedText::confgureTextToBeDeletedByUnapplyStartIndexWithEditCommandStartingSelection(const VisibleSelection&amp; selection)
+{
+    if (!AXObjectCache::accessibilityEnabled())
+        return;
+    if (m_textDeletedByUnapplyRange.startIndex.value == -1)
+        m_textDeletedByUnapplyRange.startIndex.value = indexForVisiblePosition(selection.start(), m_textDeletedByUnapplyRange.startIndex.scope);
+    if (selection.isRange() &amp;&amp; m_textDeletedByUnapplyRange.endIndex.value == -1)
+        m_textDeletedByUnapplyRange.endIndex.value = indexForVisiblePosition(selection.end(), m_textDeletedByUnapplyRange.endIndex.scope);
+}
+
+void AccessibilityUndoReplacedText::setTextInsertedByUnapplyRange(const VisiblePositionIndexRange&amp; range)
+{
+    m_textInsertedByUnapplyRange = range;
+}
+
+void AccessibilityUndoReplacedText::captureTextToBeDeletedByUnapply()
+{
+    if (!AXObjectCache::accessibilityEnabled())
+        return;
+    m_replacedText = textInsertedByReapply();
+}
+
+void AccessibilityUndoReplacedText::captureTextToBeDeletedByReapply()
+{
+    if (!AXObjectCache::accessibilityEnabled())
+        return;
+    m_replacedText = textInsertedByUnapply();
+}
+
+static String stringForVisiblePositionIndexRange(const VisiblePositionIndexRange&amp; range)
+{
+    if (range.isNull())
+        return String();
+    VisiblePosition start = visiblePositionForIndex(range.startIndex.value, range.startIndex.scope.get());
+    VisiblePosition end = visiblePositionForIndex(range.endIndex.value, range.endIndex.scope.get());
+    return AccessibilityObject::stringForVisiblePositionRange(VisiblePositionRange(start, end));
+}
+
+String AccessibilityUndoReplacedText::textInsertedByUnapply()
+{
+    if (!AXObjectCache::accessibilityEnabled())
+        return String();
+    return stringForVisiblePositionIndexRange(m_textInsertedByUnapplyRange);
+}
+
+String AccessibilityUndoReplacedText::textInsertedByReapply()
+{
+    if (!AXObjectCache::accessibilityEnabled())
+        return String();
+    return stringForVisiblePositionIndexRange(m_textDeletedByUnapplyRange);
+}
+
+static void postTextStateChangeNotification(AXObjectCache* cache, const VisiblePosition&amp; position, const String&amp; deletedText, const String&amp; insertedText)
+{
+    ASSERT(cache);
+    Node* node = highestEditableRoot(position.deepEquivalent(), HasEditableAXRole);
+    if (!node)
+        return;
+    if (insertedText.length() &amp;&amp; deletedText.length())
+        cache-&gt;postTextReplacementNotification(node, AXTextEditTypeDelete, insertedText, AXTextEditTypeInsert, deletedText, position);
+    else if (deletedText.length())
+        cache-&gt;postTextStateChangeNotification(node, AXTextEditTypeInsert, deletedText, position);
+    else if (insertedText.length())
+        cache-&gt;postTextStateChangeNotification(node, AXTextEditTypeDelete, insertedText, position);
+}
+
+void AccessibilityUndoReplacedText::postTextStateChangeNotificationForUnapply(AXObjectCache* cache)
+{
+    if (!cache)
+        return;
+    if (!AXObjectCache::accessibilityEnabled())
+        return;
+    if (m_textInsertedByUnapplyRange.isNull())
+        return;
+    VisiblePosition position = visiblePositionForIndex(m_textInsertedByUnapplyRange.endIndex.value, m_textInsertedByUnapplyRange.endIndex.scope.get());
+    if (position.isNull())
+        return;
+    postTextStateChangeNotification(cache, position, textInsertedByUnapply(), m_replacedText);
+    m_replacedText = String();
+}
+
+void AccessibilityUndoReplacedText::postTextStateChangeNotificationForReapply(AXObjectCache* cache)
+{
+    if (!cache)
+        return;
+    if (!AXObjectCache::accessibilityEnabled())
+        return;
+    if (m_textDeletedByUnapplyRange.isNull())
+        return;
+    VisiblePosition position = visiblePositionForIndex(m_textDeletedByUnapplyRange.startIndex.value, m_textDeletedByUnapplyRange.startIndex.scope.get());
+    if (position.isNull())
+        return;
+    postTextStateChangeNotification(cache, position, m_replacedText, textInsertedByReapply());
+    m_replacedText = String();
+}
+
</ins><span class="cx"> Ref&lt;EditCommandComposition&gt; EditCommandComposition::create(Document&amp; document,
</span><span class="cx">     const VisibleSelection&amp; startingSelection, const VisibleSelection&amp; endingSelection, EditAction editAction)
</span><span class="cx"> {
</span><span class="lines">@@ -93,6 +205,7 @@
</span><span class="cx">     , m_endingRootEditableElement(endingSelection.rootEditableElement())
</span><span class="cx">     , m_editAction(editAction)
</span><span class="cx"> {
</span><ins>+    m_replacedText.confgureTextToBeDeletedByUnapplyStartIndexWithEditCommandStartingSelection(startingSelection);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void EditCommandComposition::unapply()
</span><span class="lines">@@ -101,6 +214,8 @@
</span><span class="cx">     RefPtr&lt;Frame&gt; frame = m_document-&gt;frame();
</span><span class="cx">     ASSERT(frame);
</span><span class="cx"> 
</span><ins>+    m_replacedText.captureTextToBeDeletedByUnapply();
+
</ins><span class="cx">     // Changes to the document may have been made since the last editing operation that require a layout, as in &lt;rdar://problem/5658603&gt;.
</span><span class="cx">     // Low level operations, like RemoveNodeCommand, don't require a layout because the high level operations that use them perform one
</span><span class="cx">     // if one is necessary (like for the creation of VisiblePositions).
</span><span class="lines">@@ -119,6 +234,9 @@
</span><span class="cx">         m_commands[i - 1]-&gt;doUnapply();
</span><span class="cx"> 
</span><span class="cx">     frame-&gt;editor().unappliedEditing(this);
</span><ins>+
+    if (AXObjectCache::accessibilityEnabled())
+        m_replacedText.postTextStateChangeNotificationForUnapply(m_document-&gt;existingAXObjectCache());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void EditCommandComposition::reapply()
</span><span class="lines">@@ -127,6 +245,8 @@
</span><span class="cx">     RefPtr&lt;Frame&gt; frame = m_document-&gt;frame();
</span><span class="cx">     ASSERT(frame);
</span><span class="cx"> 
</span><ins>+    m_replacedText.captureTextToBeDeletedByReapply();
+
</ins><span class="cx">     // Changes to the document may have been made since the last editing operation that require a layout, as in &lt;rdar://problem/5658603&gt;.
</span><span class="cx">     // Low level operations, like RemoveNodeCommand, don't require a layout because the high level operations that use them perform one
</span><span class="cx">     // if one is necessary (like for the creation of VisiblePositions).
</span><span class="lines">@@ -136,6 +256,9 @@
</span><span class="cx">         command-&gt;doReapply();
</span><span class="cx"> 
</span><span class="cx">     frame-&gt;editor().reappliedEditing(this);
</span><ins>+
+    if (AXObjectCache::accessibilityEnabled())
+        m_replacedText.postTextStateChangeNotificationForReapply(m_document-&gt;existingAXObjectCache());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void EditCommandComposition::append(SimpleEditCommand* command)
</span><span class="lines">@@ -147,14 +270,21 @@
</span><span class="cx"> {
</span><span class="cx">     m_startingSelection = selection;
</span><span class="cx">     m_startingRootEditableElement = selection.rootEditableElement();
</span><ins>+    m_replacedText.confgureTextToBeDeletedByUnapplyStartIndexWithEditCommandStartingSelection(selection);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void EditCommandComposition::setEndingSelection(const VisibleSelection&amp; selection)
</span><span class="cx"> {
</span><span class="cx">     m_endingSelection = selection;
</span><span class="cx">     m_endingRootEditableElement = selection.rootEditableElement();
</span><ins>+    m_replacedText.confgureTextToBeDeletedByUnapplyIndexesWithEditCommandEndingSelection(selection);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void EditCommandComposition::setTextInsertedByUnapplyRange(const VisiblePositionIndexRange&amp; range)
+{
+    m_replacedText.setTextInsertedByUnapplyRange(range);
+}
+
</ins><span class="cx"> #ifndef NDEBUG
</span><span class="cx"> void EditCommandComposition::getNodesInCommand(HashSet&lt;Node*&gt;&amp; nodes)
</span><span class="cx"> {
</span><span class="lines">@@ -163,24 +293,6 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-AXTextEditType EditCommandComposition::unapplyEditType() const
-{
-    switch (editingAction()) {
-    case EditActionCut:
-    case EditActionDelete:
-        return AXTextEditTypeInsert;
-    case EditActionDictation:
-    case EditActionInsert:
-    case EditActionPaste:
-    case EditActionTyping:
-        return AXTextEditTypeDelete;
-    // Include default case for unhandled EditAction cases.
-    default:
-        break;
-    }
-    return AXTextEditTypeUnknown;
-}
-
</del><span class="cx"> void applyCommand(PassRefPtr&lt;CompositeEditCommand&gt; command)
</span><span class="cx"> {
</span><span class="cx">     command-&gt;apply();
</span><span class="lines">@@ -414,7 +526,7 @@
</span><span class="cx"> {
</span><span class="cx">     if (!node || !node-&gt;nonShadowBoundaryParentNode())
</span><span class="cx">         return;
</span><del>-    applyCommandToComposite(RemoveNodeCommand::create(*node, shouldAssumeContentIsAlwaysEditable));
</del><ins>+    applyCommandToComposite(RemoveNodeCommand::create(*node, shouldAssumeContentIsAlwaysEditable, editingAction()));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void CompositeEditCommand::removeNodePreservingChildren(PassRefPtr&lt;Node&gt; node, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable)
</span><span class="lines">@@ -558,10 +670,9 @@
</span><span class="cx"> void CompositeEditCommand::replaceTextInNode(PassRefPtr&lt;Text&gt; prpNode, unsigned offset, unsigned count, const String&amp; replacementText)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;Text&gt; node(prpNode);
</span><del>-    RefPtr&lt;DeleteFromTextNodeCommand&gt; deleteCommand = ReplaceDeleteFromTextNodeCommand::create(WTFMove(node), offset, count);
-    applyCommandToComposite(deleteCommand);
</del><ins>+    applyCommandToComposite(DeleteFromTextNodeCommand::create(WTFMove(node), offset, count));
</ins><span class="cx">     if (!replacementText.isEmpty())
</span><del>-        applyCommandToComposite(ReplaceInsertIntoTextNodeCommand::create(WTFMove(node), offset, replacementText, deleteCommand-&gt;deletedText(), editingAction()));
</del><ins>+        applyCommandToComposite(InsertIntoTextNodeCommand::create(WTFMove(node), offset, replacementText, editingAction()));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Position CompositeEditCommand::replaceSelectedTextInNode(const String&amp; text)
</span><span class="lines">@@ -638,10 +749,20 @@
</span><span class="cx">     insertNodeAt(node, positionOutsideTabSpan(pos));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static EditAction deleteSelectionEditingActionForEditingAction(EditAction editingAction)
+{
+    switch (editingAction) {
+    case EditActionCut:
+        return EditActionCut;
+    default:
+        return EditActionDelete;
+    }
+}
+
</ins><span class="cx"> void CompositeEditCommand::deleteSelection(bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements, bool sanitizeMarkup)
</span><span class="cx"> {
</span><span class="cx">     if (endingSelection().isRange())
</span><del>-        applyCommandToComposite(DeleteSelectionCommand::create(document(), smartDelete, mergeBlocksAfterDelete, replace, expandForSpecialElements, sanitizeMarkup));
</del><ins>+        applyCommandToComposite(DeleteSelectionCommand::create(document(), smartDelete, mergeBlocksAfterDelete, replace, expandForSpecialElements, sanitizeMarkup, deleteSelectionEditingActionForEditingAction(editingAction())));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void CompositeEditCommand::deleteSelection(const VisibleSelection &amp;selection, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements, bool sanitizeMarkup)
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingCompositeEditCommandh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/CompositeEditCommand.h (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/CompositeEditCommand.h        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/editing/CompositeEditCommand.h        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #ifndef CompositeEditCommand_h
</span><span class="cx"> #define CompositeEditCommand_h
</span><span class="cx"> 
</span><ins>+#include &quot;AXObjectCache.h&quot;
</ins><span class="cx"> #include &quot;EditCommand.h&quot;
</span><span class="cx"> #include &quot;CSSPropertyNames.h&quot;
</span><span class="cx"> #include &quot;UndoStep.h&quot;
</span><span class="lines">@@ -38,9 +39,32 @@
</span><span class="cx"> class StyledElement;
</span><span class="cx"> class Text;
</span><span class="cx"> 
</span><ins>+class AccessibilityUndoReplacedText {
+public:
+    AccessibilityUndoReplacedText() { }
+    void confgureTextToBeDeletedByUnapplyStartIndexWithEditCommandStartingSelection(const VisibleSelection&amp;);
+    void confgureTextToBeDeletedByUnapplyIndexesWithEditCommandEndingSelection(const VisibleSelection&amp;);
+    void setTextInsertedByUnapplyRange(const VisiblePositionIndexRange&amp;);
+
+    void captureTextToBeDeletedByUnapply();
+    void captureTextToBeDeletedByReapply();
+
+    void postTextStateChangeNotificationForUnapply(AXObjectCache*);
+    void postTextStateChangeNotificationForReapply(AXObjectCache*);
+
+private:
+    int indexForVisiblePosition(const VisiblePosition&amp;, RefPtr&lt;ContainerNode&gt;&amp;) const;
+    String textInsertedByUnapply();
+    String textInsertedByReapply();
+
+    String m_replacedText;
+    VisiblePositionIndexRange m_textDeletedByUnapplyRange;
+    VisiblePositionIndexRange m_textInsertedByUnapplyRange;
+};
+
</ins><span class="cx"> class EditCommandComposition : public UndoStep {
</span><span class="cx"> public:
</span><del>-    static Ref&lt;EditCommandComposition&gt; create(Document&amp;, const VisibleSelection&amp;, const VisibleSelection&amp;, EditAction);
</del><ins>+    static Ref&lt;EditCommandComposition&gt; create(Document&amp;, const VisibleSelection&amp; startingSelection, const VisibleSelection&amp; endingSelection, EditAction);
</ins><span class="cx"> 
</span><span class="cx">     void unapply() override;
</span><span class="cx">     void reapply() override;
</span><span class="lines">@@ -54,13 +78,12 @@
</span><span class="cx">     void setEndingSelection(const VisibleSelection&amp;);
</span><span class="cx">     Element* startingRootEditableElement() const { return m_startingRootEditableElement.get(); }
</span><span class="cx">     Element* endingRootEditableElement() const { return m_endingRootEditableElement.get(); }
</span><ins>+    void setTextInsertedByUnapplyRange(const VisiblePositionIndexRange&amp;);
</ins><span class="cx"> 
</span><span class="cx"> #ifndef NDEBUG
</span><span class="cx">     virtual void getNodesInCommand(HashSet&lt;Node*&gt;&amp;);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    AXTextEditType unapplyEditType() const;
-
</del><span class="cx"> private:
</span><span class="cx">     EditCommandComposition(Document&amp;, const VisibleSelection&amp; startingSelection, const VisibleSelection&amp; endingSelection, EditAction);
</span><span class="cx"> 
</span><span class="lines">@@ -70,6 +93,7 @@
</span><span class="cx">     Vector&lt;RefPtr&lt;SimpleEditCommand&gt;&gt; m_commands;
</span><span class="cx">     RefPtr&lt;Element&gt; m_startingRootEditableElement;
</span><span class="cx">     RefPtr&lt;Element&gt; m_endingRootEditableElement;
</span><ins>+    AccessibilityUndoReplacedText m_replacedText;
</ins><span class="cx">     EditAction m_editAction;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingDeleteFromTextNodeCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/DeleteFromTextNodeCommand.cpp (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/DeleteFromTextNodeCommand.cpp        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/editing/DeleteFromTextNodeCommand.cpp        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -55,10 +55,6 @@
</span><span class="cx">     m_text = m_node-&gt;substringData(m_offset, m_count, ec);
</span><span class="cx">     if (ec)
</span><span class="cx">         return;
</span><del>-    
-    // Need to notify this before actually deleting the text
-    if (shouldPostAccessibilityNotification())
-        notifyAccessibilityForTextChange(m_node.get(), applyEditType(), m_text, VisiblePosition(Position(m_node, m_offset)));
</del><span class="cx"> 
</span><span class="cx">     m_node-&gt;deleteData(m_offset, m_count, ec);
</span><span class="cx"> }
</span><span class="lines">@@ -71,9 +67,6 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_node-&gt;insertData(m_offset, m_text, IGNORE_EXCEPTION);
</span><del>-
-    if (shouldPostAccessibilityNotification())
-        notifyAccessibilityForTextChange(m_node.get(), unapplyEditType(), m_text, VisiblePosition(Position(m_node, m_offset)));
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #ifndef NDEBUG
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingDeleteFromTextNodeCommandh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/DeleteFromTextNodeCommand.h (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/DeleteFromTextNodeCommand.h        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/editing/DeleteFromTextNodeCommand.h        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -39,8 +39,6 @@
</span><span class="cx">         return adoptRef(*new DeleteFromTextNodeCommand(WTFMove(node), offset, count, editingAction));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    const String&amp; deletedText();
-
</del><span class="cx"> protected:
</span><span class="cx">     DeleteFromTextNodeCommand(RefPtr&lt;Text&gt;&amp;&amp;, unsigned offset, unsigned count, EditAction);
</span><span class="cx"> 
</span><span class="lines">@@ -58,11 +56,6 @@
</span><span class="cx">     String m_text;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-inline const String&amp; DeleteFromTextNodeCommand::deletedText()
-{
-    return m_text;
-}
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // DeleteFromTextNodeCommand_h
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingDictationCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/DictationCommand.cpp (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/DictationCommand.cpp        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/editing/DictationCommand.cpp        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -108,6 +108,7 @@
</span><span class="cx"> {
</span><span class="cx">     DictationCommandLineOperation operation(this);
</span><span class="cx">     forEachLineInString(m_textToInsert, operation);
</span><ins>+    postTextStateChangeNotification(AXTextEditTypeDictation, m_textToInsert);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void DictationCommand::insertTextRunWithoutNewlines(size_t lineStart, size_t lineLength)
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/EditCommand.cpp (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/EditCommand.cpp        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/editing/EditCommand.cpp        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -112,82 +112,26 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-AXTextEditType EditCommand::applyEditType() const
</del><ins>+void EditCommand::postTextStateChangeNotification(AXTextEditType type, const String&amp; text)
</ins><span class="cx"> {
</span><del>-    switch (editingAction()) {
-    case EditActionCut:
-        return AXTextEditTypeCut;
-    case EditActionDelete:
-        return AXTextEditTypeDelete;
-    case EditActionDictation:
-        return AXTextEditTypeDictation;
-    case EditActionInsert:
-        return AXTextEditTypeInsert;
-    case EditActionPaste:
-        return AXTextEditTypePaste;
-    case EditActionTyping:
-        return AXTextEditTypeTyping;
-    case EditActionSetColor:
-    case EditActionSetBackgroundColor:
-    case EditActionTurnOffKerning:
-    case EditActionTightenKerning:
-    case EditActionLoosenKerning:
-    case EditActionUseStandardKerning:
-    case EditActionTurnOffLigatures:
-    case EditActionUseStandardLigatures:
-    case EditActionUseAllLigatures:
-    case EditActionRaiseBaseline:
-    case EditActionLowerBaseline:
-    case EditActionSetTraditionalCharacterShape:
-    case EditActionSetFont:
-    case EditActionChangeAttributes:
-    case EditActionAlignLeft:
-    case EditActionAlignRight:
-    case EditActionCenter:
-    case EditActionJustify:
-    case EditActionSetWritingDirection:
-    case EditActionSubscript:
-    case EditActionSuperscript:
-    case EditActionUnderline:
-    case EditActionOutline:
-    case EditActionUnscript:
-    case EditActionBold:
-    case EditActionItalics:
-    case EditActionFormatBlock:
-    case EditActionIndent:
-    case EditActionOutdent:
-        return AXTextEditTypeAttributesChange;
-    // Include default case for unhandled EditAction cases.
-    default:
-        break;
-    }
-    return AXTextEditTypeUnknown;
</del><ins>+    if (!AXObjectCache::accessibilityEnabled())
+        return;
+    postTextStateChangeNotification(type, text, frame().selection().selection().start());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-AXTextEditType EditCommand::unapplyEditType() const
</del><ins>+void EditCommand::postTextStateChangeNotification(AXTextEditType type, const String&amp; text, const VisiblePosition&amp; position)
</ins><span class="cx"> {
</span><del>-    switch (applyEditType()) {
-    case AXTextEditTypeUnknown:
-        return AXTextEditTypeUnknown;
-    case AXTextEditTypeDelete:
-    case AXTextEditTypeCut:
-        return AXTextEditTypeInsert;
-    case AXTextEditTypeInsert:
-    case AXTextEditTypeTyping:
-    case AXTextEditTypeDictation:
-    case AXTextEditTypePaste:
-        return AXTextEditTypeDelete;
-    case AXTextEditTypeAttributesChange:
-        return AXTextEditTypeAttributesChange;
-    }
-    return AXTextEditTypeUnknown;
</del><ins>+    if (!AXObjectCache::accessibilityEnabled())
+        return;
+    if (!text.length())
+        return;
+    AXObjectCache* cache = document().existingAXObjectCache();
+    if (!cache)
+        return;
+    Node* node = highestEditableRoot(position.deepEquivalent(), HasEditableAXRole);
+    cache-&gt;postTextStateChangeNotification(node, type, text, position);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool EditCommand::shouldPostAccessibilityNotification() const
-{
-    return AXObjectCache::accessibilityEnabled() &amp;&amp; editingAction() != EditActionUnspecified;
-}
-
</del><span class="cx"> SimpleEditCommand::SimpleEditCommand(Document&amp; document, EditAction editingAction)
</span><span class="cx">     : EditCommand(document, editingAction)
</span><span class="cx"> {
</span><span class="lines">@@ -206,14 +150,4 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-void SimpleEditCommand::notifyAccessibilityForTextChange(Node* node, AXTextEditType type, const String&amp; text, const VisiblePosition&amp; position)
-{
-    if (!AXObjectCache::accessibilityEnabled())
-        return;
-    AXObjectCache* cache = document().existingAXObjectCache();
-    if (!cache)
-        return;
-    cache-&gt;postTextStateChangeNotification(node, type, text, position);
-}
-
</del><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditCommandh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/EditCommand.h (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/EditCommand.h        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/editing/EditCommand.h        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -60,11 +60,6 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void doApply() = 0;
</span><span class="cx"> 
</span><del>-    AXTextEditType applyEditType() const;
-    AXTextEditType unapplyEditType() const;
-
-    bool shouldPostAccessibilityNotification() const;
-
</del><span class="cx"> protected:
</span><span class="cx">     explicit EditCommand(Document&amp;, EditAction = EditActionUnspecified);
</span><span class="cx">     EditCommand(Document&amp;, const VisibleSelection&amp;, const VisibleSelection&amp;);
</span><span class="lines">@@ -75,6 +70,9 @@
</span><span class="cx">     void setStartingSelection(const VisibleSelection&amp;);
</span><span class="cx">     WEBCORE_EXPORT void setEndingSelection(const VisibleSelection&amp;);
</span><span class="cx"> 
</span><ins>+    void postTextStateChangeNotification(AXTextEditType, const String&amp;);
+    void postTextStateChangeNotification(AXTextEditType, const String&amp;, const VisiblePosition&amp;);
+
</ins><span class="cx"> private:
</span><span class="cx">     Ref&lt;Document&gt; m_document;
</span><span class="cx">     VisibleSelection m_startingSelection;
</span><span class="lines">@@ -104,8 +102,6 @@
</span><span class="cx">     void addNodeAndDescendants(Node*, HashSet&lt;Node*&gt;&amp;);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    virtual void notifyAccessibilityForTextChange(Node*, AXTextEditType, const String&amp;, const VisiblePosition&amp;);
-
</del><span class="cx"> private:
</span><span class="cx">     bool isSimpleEditCommand() const override { return true; }
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditingAllInOnecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/EditingAllInOne.cpp (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/EditingAllInOne.cpp        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/editing/EditingAllInOne.cpp        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -59,8 +59,6 @@
</span><span class="cx"> #include &lt;RemoveNodeCommand.cpp&gt;
</span><span class="cx"> #include &lt;RemoveNodePreservingChildrenCommand.cpp&gt;
</span><span class="cx"> #include &lt;RenderedPosition.cpp&gt;
</span><del>-#include &lt;ReplaceDeleteFromTextNodeCommand.cpp&gt;
-#include &lt;ReplaceInsertIntoTextNodeCommand.cpp&gt;
</del><span class="cx"> #include &lt;ReplaceNodeWithSpanCommand.cpp&gt;
</span><span class="cx"> #include &lt;ReplaceSelectionCommand.cpp&gt;
</span><span class="cx"> #include &lt;SetNodeAttributeCommand.cpp&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/Editor.cpp (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/Editor.cpp        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/editing/Editor.cpp        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -525,6 +525,10 @@
</span><span class="cx">     if (selection.isNone() || !selection.isContentEditable() || !fragment)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    AccessibilityReplacedText replacedText;
+    if (AXObjectCache::accessibilityEnabled() &amp;&amp; editingAction == EditActionPaste)
+        replacedText = AccessibilityReplacedText(selection);
+
</ins><span class="cx">     ReplaceSelectionCommand::CommandOptions options = ReplaceSelectionCommand::PreventNesting | ReplaceSelectionCommand::SanitizeFragment;
</span><span class="cx">     if (selectReplacement)
</span><span class="cx">         options |= ReplaceSelectionCommand::SelectReplacement;
</span><span class="lines">@@ -535,12 +539,23 @@
</span><span class="cx">     if (mailBlockquoteHandling == MailBlockquoteHandling::IgnoreBlockquote)
</span><span class="cx">         options |= ReplaceSelectionCommand::IgnoreMailBlockquote;
</span><span class="cx"> 
</span><del>-    applyCommand(ReplaceSelectionCommand::create(document(), fragment, options, editingAction));
</del><ins>+    RefPtr&lt;ReplaceSelectionCommand&gt; command = ReplaceSelectionCommand::create(document(), fragment, options, editingAction);
+    applyCommand(command);
</ins><span class="cx">     revealSelectionAfterEditingOperation();
</span><span class="cx"> 
</span><span class="cx">     selection = m_frame.selection().selection();
</span><del>-    if (selection.isInPasswordField() || !isContinuousSpellCheckingEnabled())
</del><ins>+    if (selection.isInPasswordField())
</ins><span class="cx">         return;
</span><ins>+
+    if (AXObjectCache::accessibilityEnabled() &amp;&amp; editingAction == EditActionPaste) {
+        String text = AccessibilityObject::stringForVisiblePositionRange(command-&gt;visibleSelectionForInsertedText());
+        replacedText.postTextStateChangeNotification(document().existingAXObjectCache(), AXTextEditTypePaste, text, m_frame.selection().selection());
+        command-&gt;composition()-&gt;setTextInsertedByUnapplyRange(replacedText.replacedRange());
+    }
+
+    if (!isContinuousSpellCheckingEnabled())
+        return;
+
</ins><span class="cx">     Node* nodeToCheck = selection.rootEditableElement();
</span><span class="cx">     if (!nodeToCheck)
</span><span class="cx">         return;
</span><span class="lines">@@ -1030,7 +1045,7 @@
</span><span class="cx">     // Don't clear the typing style with this selection change.  We do those things elsewhere if necessary.
</span><span class="cx">     FrameSelection::SetSelectionOptions options = cmd-&gt;isDictationCommand() ? FrameSelection::DictationTriggered : 0;
</span><span class="cx">     
</span><del>-    changeSelectionAfterCommand(newSelection, options, cmd-&gt;applyEditType());
</del><ins>+    changeSelectionAfterCommand(newSelection, options);
</ins><span class="cx">     dispatchEditableContentChangedEvents(composition-&gt;startingRootEditableElement(), composition-&gt;endingRootEditableElement());
</span><span class="cx"> 
</span><span class="cx">     updateEditorUINowIfScheduled();
</span><span class="lines">@@ -1061,7 +1076,7 @@
</span><span class="cx">     notifyTextFromControls(cmd-&gt;startingRootEditableElement(), cmd-&gt;endingRootEditableElement());
</span><span class="cx"> 
</span><span class="cx">     VisibleSelection newSelection(cmd-&gt;startingSelection());
</span><del>-    changeSelectionAfterCommand(newSelection, FrameSelection::defaultSetSelectionOptions(), cmd-&gt;unapplyEditType());
</del><ins>+    changeSelectionAfterCommand(newSelection, FrameSelection::defaultSetSelectionOptions());
</ins><span class="cx">     dispatchEditableContentChangedEvents(cmd-&gt;startingRootEditableElement(), cmd-&gt;endingRootEditableElement());
</span><span class="cx"> 
</span><span class="cx">     updateEditorUINowIfScheduled();
</span><span class="lines">@@ -1266,6 +1281,18 @@
</span><span class="cx">     performCutOrCopy(CopyAction);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Editor::postTextStateChangeNotificationForCut(const String&amp; text, const VisibleSelection&amp; selection)
+{
+    if (!AXObjectCache::accessibilityEnabled())
+        return;
+    if (!text.length())
+        return;
+    AXObjectCache* cache = document().existingAXObjectCache();
+    if (!cache)
+        return;
+    cache-&gt;postTextStateChangeNotification(selection.start().anchorNode(), AXTextEditTypeCut, text, selection.start());
+}
+
</ins><span class="cx"> void Editor::performCutOrCopy(EditorActionSpecifier action)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;Range&gt; selection = selectedRange();
</span><span class="lines">@@ -1301,8 +1328,14 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     didWriteSelectionToPasteboard();
</span><del>-    if (action == CutAction)
</del><ins>+    if (action == CutAction) {
+        String text;
+        if (AXObjectCache::accessibilityEnabled())
+            text = AccessibilityObject::stringForVisiblePositionRange(m_frame.selection().selection());
</ins><span class="cx">         deleteSelectionWithSmartDelete(canSmartCopyOrDelete(), EditActionCut);
</span><ins>+        if (AXObjectCache::accessibilityEnabled())
+            postTextStateChangeNotificationForCut(text, m_frame.selection().selection());
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void Editor::paste()
</span><span class="lines">@@ -2895,7 +2928,7 @@
</span><span class="cx">     m_alternativeTextController-&gt;dismiss(ReasonForDismissingAlternativeTextIgnored);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Editor::changeSelectionAfterCommand(const VisibleSelection&amp; newSelection, FrameSelection::SetSelectionOptions options, AXTextStateChangeIntent intent)
</del><ins>+void Editor::changeSelectionAfterCommand(const VisibleSelection&amp; newSelection, FrameSelection::SetSelectionOptions options)
</ins><span class="cx"> {
</span><span class="cx">     // If the new selection is orphaned, then don't update the selection.
</span><span class="cx">     if (newSelection.start().isOrphan() || newSelection.end().isOrphan())
</span><span class="lines">@@ -2907,7 +2940,7 @@
</span><span class="cx">     // See &lt;rdar://problem/5729315&gt; Some shouldChangeSelectedDOMRange contain Ranges for selections that are no longer valid
</span><span class="cx">     bool selectionDidNotChangeDOMPosition = newSelection == m_frame.selection().selection();
</span><span class="cx">     if (selectionDidNotChangeDOMPosition || m_frame.selection().shouldChangeSelection(newSelection))
</span><del>-        m_frame.selection().setSelection(newSelection, options, intent);
</del><ins>+        m_frame.selection().setSelection(newSelection, options);
</ins><span class="cx"> 
</span><span class="cx">     // Some editing operations change the selection visually without affecting its position within the DOM.
</span><span class="cx">     // For example when you press return in the following (the caret is marked by ^):
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/Editor.h (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/Editor.h        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/editing/Editor.h        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -482,7 +482,7 @@
</span><span class="cx">     enum SetCompositionMode { ConfirmComposition, CancelComposition };
</span><span class="cx">     void setComposition(const String&amp;, SetCompositionMode);
</span><span class="cx"> 
</span><del>-    void changeSelectionAfterCommand(const VisibleSelection&amp; newSelection, FrameSelection::SetSelectionOptions, AXTextStateChangeIntent = AXTextStateChangeIntent());
</del><ins>+    void changeSelectionAfterCommand(const VisibleSelection&amp; newSelection, FrameSelection::SetSelectionOptions);
</ins><span class="cx"> 
</span><span class="cx">     enum EditorActionSpecifier { CutAction, CopyAction };
</span><span class="cx">     void performCutOrCopy(EditorActionSpecifier);
</span><span class="lines">@@ -501,6 +501,8 @@
</span><span class="cx">     void fillInUserVisibleForm(PasteboardURL&amp;);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    void postTextStateChangeNotificationForCut(const String&amp;, const VisibleSelection&amp;);
+
</ins><span class="cx">     Frame&amp; m_frame;
</span><span class="cx">     RefPtr&lt;CompositeEditCommand&gt; m_lastEditCommand;
</span><span class="cx">     RefPtr&lt;Text&gt; m_compositionNode;
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingInsertIntoTextNodeCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/InsertIntoTextNodeCommand.cpp (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/InsertIntoTextNodeCommand.cpp        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/editing/InsertIntoTextNodeCommand.cpp        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -64,9 +64,6 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     m_node-&gt;insertData(m_offset, m_text, IGNORE_EXCEPTION);
</span><del>-
-    if (shouldPostAccessibilityNotification())
-        notifyAccessibilityForTextChange(m_node.get(), applyEditType(), m_text, VisiblePosition(Position(m_node, m_offset)));
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="lines">@@ -81,10 +78,6 @@
</span><span class="cx"> {
</span><span class="cx">     if (!m_node-&gt;hasEditableStyle())
</span><span class="cx">         return;
</span><del>-        
-    // Need to notify this before actually deleting the text
-    if (shouldPostAccessibilityNotification())
-        notifyAccessibilityForTextChange(m_node.get(), unapplyEditType(), m_text, VisiblePosition(Position(m_node, m_offset)));
</del><span class="cx"> 
</span><span class="cx">     m_node-&gt;deleteData(m_offset, m_text.length(), IGNORE_EXCEPTION);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingInsertNodeBeforeCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/InsertNodeBeforeCommand.cpp (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/InsertNodeBeforeCommand.cpp        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/editing/InsertNodeBeforeCommand.cpp        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -56,11 +56,6 @@
</span><span class="cx">     ASSERT(isEditableNode(*parent));
</span><span class="cx"> 
</span><span class="cx">     parent-&gt;insertBefore(*m_insertChild, m_refChild.get(), IGNORE_EXCEPTION);
</span><del>-
-    if (shouldPostAccessibilityNotification()) {
-        Position position = is&lt;Text&gt;(m_insertChild.get()) ? Position(downcast&lt;Text&gt;(m_insertChild.get()), 0) : createLegacyEditingPosition(m_insertChild.get(), 0);
-        notifyAccessibilityForTextChange(m_insertChild.get(), applyEditType(), m_insertChild-&gt;nodeValue(), VisiblePosition(position));
-    }
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InsertNodeBeforeCommand::doUnapply()
</span><span class="lines">@@ -68,12 +63,6 @@
</span><span class="cx">     if (!isEditableNode(*m_insertChild))
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    // Need to notify this before actually deleting the text
-    if (shouldPostAccessibilityNotification()) {
-        Position position = is&lt;Text&gt;(m_insertChild.get()) ? Position(downcast&lt;Text&gt;(m_insertChild.get()), 0) : createLegacyEditingPosition(m_insertChild.get(), 0);
-        notifyAccessibilityForTextChange(m_insertChild.get(), unapplyEditType(), m_insertChild-&gt;nodeValue(), VisiblePosition(position));
-    }
-
</del><span class="cx">     m_insertChild-&gt;remove(IGNORE_EXCEPTION);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingRemoveNodeCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/RemoveNodeCommand.cpp (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/RemoveNodeCommand.cpp        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/editing/RemoveNodeCommand.cpp        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -34,8 +34,8 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-RemoveNodeCommand::RemoveNodeCommand(Ref&lt;Node&gt;&amp;&amp; node, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable)
-    : SimpleEditCommand(node-&gt;document())
</del><ins>+RemoveNodeCommand::RemoveNodeCommand(Ref&lt;Node&gt;&amp;&amp; node, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable, EditAction editingAction)
+    : SimpleEditCommand(node-&gt;document(), editingAction)
</ins><span class="cx">     , m_node(WTFMove(node))
</span><span class="cx">     , m_shouldAssumeContentIsAlwaysEditable(shouldAssumeContentIsAlwaysEditable)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingRemoveNodeCommandh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/RemoveNodeCommand.h (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/RemoveNodeCommand.h        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/editing/RemoveNodeCommand.h        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -32,13 +32,13 @@
</span><span class="cx"> 
</span><span class="cx"> class RemoveNodeCommand : public SimpleEditCommand {
</span><span class="cx"> public:
</span><del>-    static Ref&lt;RemoveNodeCommand&gt; create(Ref&lt;Node&gt;&amp;&amp; node, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable)
</del><ins>+    static Ref&lt;RemoveNodeCommand&gt; create(Ref&lt;Node&gt;&amp;&amp; node, ShouldAssumeContentIsAlwaysEditable shouldAssumeContentIsAlwaysEditable, EditAction editingAction = EditActionUnspecified)
</ins><span class="cx">     {
</span><del>-        return adoptRef(*new RemoveNodeCommand(WTFMove(node), shouldAssumeContentIsAlwaysEditable));
</del><ins>+        return adoptRef(*new RemoveNodeCommand(WTFMove(node), shouldAssumeContentIsAlwaysEditable, editingAction));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    RemoveNodeCommand(Ref&lt;Node&gt;&amp;&amp;, ShouldAssumeContentIsAlwaysEditable);
</del><ins>+    RemoveNodeCommand(Ref&lt;Node&gt;&amp;&amp;, ShouldAssumeContentIsAlwaysEditable, EditAction);
</ins><span class="cx"> 
</span><span class="cx">     void doApply() override;
</span><span class="cx">     void doUnapply() override;
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingReplaceDeleteFromTextNodeCommandcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/editing/ReplaceDeleteFromTextNodeCommand.cpp (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/ReplaceDeleteFromTextNodeCommand.cpp        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/editing/ReplaceDeleteFromTextNodeCommand.cpp        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -1,42 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#include &quot;config.h&quot;
-#include &quot;ReplaceDeleteFromTextNodeCommand.h&quot;
-
-#include &quot;Text.h&quot;
-
-namespace WebCore {
-    
-ReplaceDeleteFromTextNodeCommand::ReplaceDeleteFromTextNodeCommand(RefPtr&lt;Text&gt;&amp;&amp; text, unsigned offset, unsigned count)
-    : DeleteFromTextNodeCommand(WTFMove(text), offset, count, EditActionDelete)
-{
-}
-
-void ReplaceDeleteFromTextNodeCommand::notifyAccessibilityForTextChange(Node*, AXTextEditType, const String&amp;, const VisiblePosition&amp;)
-{
-}
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCoreeditingReplaceDeleteFromTextNodeCommandh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/editing/ReplaceDeleteFromTextNodeCommand.h (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/ReplaceDeleteFromTextNodeCommand.h        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/editing/ReplaceDeleteFromTextNodeCommand.h        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -1,47 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#ifndef ReplaceDeleteFromTextNodeCommand_h
-#define ReplaceDeleteFromTextNodeCommand_h
-
-#include &quot;DeleteFromTextNodeCommand.h&quot;
-
-namespace WebCore {
-
-class ReplaceDeleteFromTextNodeCommand final : public DeleteFromTextNodeCommand {
-public:
-    static Ref&lt;ReplaceDeleteFromTextNodeCommand&gt; create(RefPtr&lt;Text&gt;&amp;&amp; text, unsigned offset, unsigned count)
-    {
-        return adoptRef(*new ReplaceDeleteFromTextNodeCommand(WTFMove(text), offset, count));
-    }
-
-private:
-    ReplaceDeleteFromTextNodeCommand(RefPtr&lt;Text&gt;&amp;&amp;, unsigned, unsigned);
-    void notifyAccessibilityForTextChange(Node*, AXTextEditType, const String&amp;, const VisiblePosition&amp;) override;
-};
-
-} // namespace WebCore
-
-#endif // ReplaceDeleteFromTextNodeCommand_h
</del></span></pre></div>
<a id="trunkSourceWebCoreeditingReplaceInsertIntoTextNodeCommandcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/editing/ReplaceInsertIntoTextNodeCommand.cpp (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/ReplaceInsertIntoTextNodeCommand.cpp        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/editing/ReplaceInsertIntoTextNodeCommand.cpp        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -1,65 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#include &quot;config.h&quot;
-#include &quot;ReplaceInsertIntoTextNodeCommand.h&quot;
-
-#include &quot;AXObjectCache.h&quot;
-#include &quot;Document.h&quot;
-#include &quot;Text.h&quot;
-
-namespace WebCore {
-
-ReplaceInsertIntoTextNodeCommand::ReplaceInsertIntoTextNodeCommand(RefPtr&lt;Text&gt;&amp;&amp; node, unsigned offset, const String&amp; text, const String&amp; deletedText, EditAction editingAction)
-    : InsertIntoTextNodeCommand(WTFMove(node), offset, text, editingAction)
-    , m_deletedText(deletedText)
-{
-}
-
-void ReplaceInsertIntoTextNodeCommand::notifyAccessibilityForTextChange(Node* node, AXTextEditType type, const String&amp; text, const VisiblePosition&amp; position)
-{
-    if (!shouldPostAccessibilityNotification())
-        return;
-    AXObjectCache* cache = document().existingAXObjectCache();
-    if (!cache)
-        return;
-    switch (type) {
-    case AXTextEditTypeAttributesChange:
-    case AXTextEditTypeCut:
-    case AXTextEditTypeUnknown:
-        break;
-    case AXTextEditTypeDelete:
-        cache-&gt;postTextReplacementNotification(node, AXTextEditTypeDelete, text, AXTextEditTypeInsert, m_deletedText, position);
-        break;
-    case AXTextEditTypeDictation:
-    case AXTextEditTypeInsert:
-    case AXTextEditTypePaste:
-    case AXTextEditTypeTyping:
-        cache-&gt;postTextReplacementNotification(node, AXTextEditTypeDelete, m_deletedText, type, text, position);
-        break;
-    }
-}
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCoreeditingReplaceInsertIntoTextNodeCommandh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/editing/ReplaceInsertIntoTextNodeCommand.h (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/ReplaceInsertIntoTextNodeCommand.h        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/editing/ReplaceInsertIntoTextNodeCommand.h        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -1,49 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#ifndef ReplaceInsertIntoTextNodeCommand_h
-#define ReplaceInsertIntoTextNodeCommand_h
-
-#include &quot;InsertIntoTextNodeCommand.h&quot;
-
-namespace WebCore {
-
-class ReplaceInsertIntoTextNodeCommand final : public InsertIntoTextNodeCommand {
-public:
-    static Ref&lt;ReplaceInsertIntoTextNodeCommand&gt; create(RefPtr&lt;Text&gt;&amp;&amp; node, unsigned offset, const String&amp; text, const String&amp; deletedText, EditAction editingAction)
-    {
-        return adoptRef(*new ReplaceInsertIntoTextNodeCommand(WTFMove(node), offset, text, deletedText, editingAction));
-    }
-
-private:
-    ReplaceInsertIntoTextNodeCommand(RefPtr&lt;Text&gt;&amp;&amp;, unsigned, const String&amp;, const String&amp;, EditAction);
-    void notifyAccessibilityForTextChange(Node*, AXTextEditType, const String&amp;, const VisiblePosition&amp;) override;
-
-    String m_deletedText;
-};
-
-} // namespace WebCore
-
-#endif // ReplaceInsertIntoTextNodeCommand_h
</del></span></pre></div>
<a id="trunkSourceWebCoreeditingReplaceSelectionCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;ReplaceSelectionCommand.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;AXObjectCache.h&quot;
</ins><span class="cx"> #include &quot;ApplyStyleCommand.h&quot;
</span><span class="cx"> #include &quot;BeforeTextInsertedEvent.h&quot;
</span><span class="cx"> #include &quot;BreakBlockquoteCommand.h&quot;
</span><span class="lines">@@ -47,8 +48,6 @@
</span><span class="cx"> #include &quot;RenderInline.h&quot;
</span><span class="cx"> #include &quot;RenderObject.h&quot;
</span><span class="cx"> #include &quot;RenderText.h&quot;
</span><del>-#include &quot;ReplaceDeleteFromTextNodeCommand.h&quot;
-#include &quot;ReplaceInsertIntoTextNodeCommand.h&quot;
</del><span class="cx"> #include &quot;SimplifyMarkupCommand.h&quot;
</span><span class="cx"> #include &quot;SmartReplace.h&quot;
</span><span class="cx"> #include &quot;StyleProperties.h&quot;
</span><span class="lines">@@ -960,7 +959,8 @@
</span><span class="cx">         bool mergeBlocksAfterDelete = shouldHandleMailBlockquote || isEndOfParagraph(visibleEnd) || isStartOfBlock(visibleStart);
</span><span class="cx">         // FIXME: We should only expand to include fully selected special elements if we are copying a 
</span><span class="cx">         // selection and pasting it on top of itself.
</span><del>-        deleteSelection(false, mergeBlocksAfterDelete, true, false);
</del><ins>+        // FIXME: capturing the content of this delete would allow a replace accessibility notification instead of a simple insert
+        deleteSelection(false, mergeBlocksAfterDelete, true, false, true);
</ins><span class="cx">         visibleStart = endingSelection().visibleStart();
</span><span class="cx">         if (fragment.hasInterchangeNewlineAtStart()) {
</span><span class="cx">             if (isEndOfParagraph(visibleStart) &amp;&amp; !isStartOfParagraph(visibleStart)) {
</span><span class="lines">@@ -1367,6 +1367,9 @@
</span><span class="cx">     else
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    if (AXObjectCache::accessibilityEnabled() &amp;&amp; editingAction() == EditActionPaste)
+        m_visibleSelectionForInsertedText = VisibleSelection(start, end);
+
</ins><span class="cx">     if (m_selectReplacement)
</span><span class="cx">         setEndingSelection(VisibleSelection(start, end, SEL_DEFAULT_AFFINITY, endingSelection().isDirectional()));
</span><span class="cx">     else
</span><span class="lines">@@ -1512,6 +1515,9 @@
</span><span class="cx"> 
</span><span class="cx">     VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, end);
</span><span class="cx"> 
</span><ins>+    if (AXObjectCache::accessibilityEnabled() &amp;&amp; editingAction() == EditActionPaste)
+        m_visibleSelectionForInsertedText = VisibleSelection(start, end);
+
</ins><span class="cx">     setEndingSelection(selectionAfterReplace);
</span><span class="cx"> 
</span><span class="cx">     return true;
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingReplaceSelectionCommandh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/ReplaceSelectionCommand.h (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/ReplaceSelectionCommand.h        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/editing/ReplaceSelectionCommand.h        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -53,6 +53,8 @@
</span><span class="cx">         return adoptRef(*new ReplaceSelectionCommand(document, WTFMove(fragment), options, editingAction));
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    VisibleSelection visibleSelectionForInsertedText() const { return m_visibleSelectionForInsertedText; }
+
</ins><span class="cx"> private:
</span><span class="cx">     ReplaceSelectionCommand(Document&amp;, RefPtr&lt;DocumentFragment&gt;&amp;&amp;, CommandOptions, EditAction);
</span><span class="cx"> 
</span><span class="lines">@@ -110,6 +112,7 @@
</span><span class="cx"> 
</span><span class="cx">     bool performTrivialReplace(const ReplacementFragment&amp;);
</span><span class="cx"> 
</span><ins>+    VisibleSelection m_visibleSelectionForInsertedText;
</ins><span class="cx">     Position m_startOfInsertedContent;
</span><span class="cx">     Position m_endOfInsertedContent;
</span><span class="cx">     RefPtr&lt;EditingStyle&gt; m_insertionStyle;
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingTextInsertionBaseCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/TextInsertionBaseCommand.cpp (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/TextInsertionBaseCommand.cpp        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/editing/TextInsertionBaseCommand.cpp        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -35,8 +35,8 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-TextInsertionBaseCommand::TextInsertionBaseCommand(Document&amp; document)
-    : CompositeEditCommand(document)
</del><ins>+TextInsertionBaseCommand::TextInsertionBaseCommand(Document&amp; document, EditAction editingAction)
+    : CompositeEditCommand(document, editingAction)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingTextInsertionBaseCommandh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/TextInsertionBaseCommand.h (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/TextInsertionBaseCommand.h        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/editing/TextInsertionBaseCommand.h        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx">     virtual ~TextInsertionBaseCommand() { };
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><del>-    explicit TextInsertionBaseCommand(Document&amp;);
</del><ins>+    explicit TextInsertionBaseCommand(Document&amp;, EditAction = EditActionUnspecified);
</ins><span class="cx">     static void applyTextInsertionCommand(Frame*, TextInsertionBaseCommand&amp;, const VisibleSelection&amp; selectionForInsertion, const VisibleSelection&amp; endingSelection);
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingTypingCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/TypingCommand.cpp (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/TypingCommand.cpp        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/editing/TypingCommand.cpp        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;TypingCommand.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;AXObjectCache.h&quot;
</ins><span class="cx"> #include &quot;BreakBlockquoteCommand.h&quot;
</span><span class="cx"> #include &quot;DeleteSelectionCommand.h&quot;
</span><span class="cx"> #include &quot;Document.h&quot;
</span><span class="lines">@@ -75,7 +76,7 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> TypingCommand::TypingCommand(Document&amp; document, ETypingCommand commandType, const String &amp;textToInsert, Options options, TextGranularity granularity, TextCompositionType compositionType)
</span><del>-    : TextInsertionBaseCommand(document)
</del><ins>+    : TextInsertionBaseCommand(document, EditActionTyping)
</ins><span class="cx">     , m_commandType(commandType)
</span><span class="cx">     , m_textToInsert(textToInsert)
</span><span class="cx">     , m_openForMoreTyping(true)
</span><span class="lines">@@ -182,7 +183,7 @@
</span><span class="cx">         lastTypingCommand-&gt;setCompositionType(compositionType);
</span><span class="cx">         lastTypingCommand-&gt;setShouldRetainAutocorrectionIndicator(options &amp; RetainAutocorrectionIndicator);
</span><span class="cx">         lastTypingCommand-&gt;setShouldPreventSpellChecking(options &amp; PreventSpellChecking);
</span><del>-        lastTypingCommand-&gt;insertText(newText, options &amp; SelectInsertedText);
</del><ins>+        lastTypingCommand-&gt;insertTextAndNotifyAccessibility(newText, options &amp; SelectInsertedText);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -194,7 +195,7 @@
</span><span class="cx"> {
</span><span class="cx">     if (RefPtr&lt;TypingCommand&gt; lastTypingCommand = lastTypingCommandIfStillOpenForTyping(*document.frame())) {
</span><span class="cx">         lastTypingCommand-&gt;setShouldRetainAutocorrectionIndicator(options &amp; RetainAutocorrectionIndicator);
</span><del>-        lastTypingCommand-&gt;insertLineBreak();
</del><ins>+        lastTypingCommand-&gt;insertLineBreakAndNotifyAccessibility();
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -204,7 +205,7 @@
</span><span class="cx"> void TypingCommand::insertParagraphSeparatorInQuotedContent(Document&amp; document)
</span><span class="cx"> {
</span><span class="cx">     if (RefPtr&lt;TypingCommand&gt; lastTypingCommand = lastTypingCommandIfStillOpenForTyping(*document.frame())) {
</span><del>-        lastTypingCommand-&gt;insertParagraphSeparatorInQuotedContent();
</del><ins>+        lastTypingCommand-&gt;insertParagraphSeparatorInQuotedContentAndNotifyAccessibility();
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -215,7 +216,7 @@
</span><span class="cx"> {
</span><span class="cx">     if (RefPtr&lt;TypingCommand&gt; lastTypingCommand = lastTypingCommandIfStillOpenForTyping(*document.frame())) {
</span><span class="cx">         lastTypingCommand-&gt;setShouldRetainAutocorrectionIndicator(options &amp; RetainAutocorrectionIndicator);
</span><del>-        lastTypingCommand-&gt;insertParagraphSeparator();
</del><ins>+        lastTypingCommand-&gt;insertParagraphSeparatorAndNotifyAccessibility();
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -247,6 +248,17 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+void TypingCommand::postTextStateChangeNotificationForDeletion(const VisibleSelection&amp; selection)
+{
+    if (!AXObjectCache::accessibilityEnabled())
+        return;
+    postTextStateChangeNotification(AXTextEditTypeDelete, AccessibilityObject::stringForVisiblePositionRange(selection), selection.start());
+    VisiblePositionIndexRange range;
+    range.startIndex.value = indexForVisiblePosition(selection.start(), range.startIndex.scope);
+    range.endIndex.value = indexForVisiblePosition(selection.end(), range.endIndex.scope);
+    composition()-&gt;setTextInsertedByUnapplyRange(range);
+}
+
</ins><span class="cx"> void TypingCommand::doApply()
</span><span class="cx"> {
</span><span class="cx">     if (!endingSelection().isNonOrphanedCaretOrRange())
</span><span class="lines">@@ -267,27 +279,22 @@
</span><span class="cx">         forwardDeleteKeyPressed(m_granularity, m_shouldAddToKillRing);
</span><span class="cx">         return;
</span><span class="cx">     case InsertLineBreak:
</span><del>-        insertLineBreak();
</del><ins>+        insertLineBreakAndNotifyAccessibility();
</ins><span class="cx">         return;
</span><span class="cx">     case InsertParagraphSeparator:
</span><del>-        insertParagraphSeparator();
</del><ins>+        insertParagraphSeparatorAndNotifyAccessibility();
</ins><span class="cx">         return;
</span><span class="cx">     case InsertParagraphSeparatorInQuotedContent:
</span><del>-        insertParagraphSeparatorInQuotedContent();
</del><ins>+        insertParagraphSeparatorInQuotedContentAndNotifyAccessibility();
</ins><span class="cx">         return;
</span><span class="cx">     case InsertText:
</span><del>-        insertText(m_textToInsert, m_selectInsertedText);
</del><ins>+        insertTextAndNotifyAccessibility(m_textToInsert, m_selectInsertedText);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     ASSERT_NOT_REACHED();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-EditAction TypingCommand::editingAction() const
-{
-    return EditActionTyping;
-}
-
</del><span class="cx"> void TypingCommand::markMisspellingsAfterTyping(ETypingCommand commandType)
</span><span class="cx"> {
</span><span class="cx">     Frame&amp; frame = this-&gt;frame();
</span><span class="lines">@@ -371,6 +378,14 @@
</span><span class="cx">     forEachLineInString(text, operation);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void TypingCommand::insertTextAndNotifyAccessibility(const String &amp;text, bool selectInsertedText)
+{
+    AccessibilityReplacedText replacedText(frame().selection().selection());
+    insertText(text, selectInsertedText);
+    replacedText.postTextStateChangeNotification(document().existingAXObjectCache(), AXTextEditTypeTyping, text, frame().selection().selection());
+    composition()-&gt;setTextInsertedByUnapplyRange(replacedText.replacedRange());
+}
+
</ins><span class="cx"> void TypingCommand::insertTextRunWithoutNewlines(const String &amp;text, bool selectInsertedText)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;InsertTextCommand&gt; command = InsertTextCommand::create(document(), text, selectInsertedText,
</span><span class="lines">@@ -390,6 +405,14 @@
</span><span class="cx">     typingAddedToOpenCommand(InsertLineBreak);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void TypingCommand::insertLineBreakAndNotifyAccessibility()
+{
+    AccessibilityReplacedText replacedText(frame().selection().selection());
+    insertLineBreak();
+    replacedText.postTextStateChangeNotification(document().existingAXObjectCache(), AXTextEditTypeTyping, &quot;\n&quot;, frame().selection().selection());
+    composition()-&gt;setTextInsertedByUnapplyRange(replacedText.replacedRange());
+}
+
</ins><span class="cx"> void TypingCommand::insertParagraphSeparator()
</span><span class="cx"> {
</span><span class="cx">     if (!canAppendNewLineFeedToSelection(endingSelection()))
</span><span class="lines">@@ -399,6 +422,14 @@
</span><span class="cx">     typingAddedToOpenCommand(InsertParagraphSeparator);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void TypingCommand::insertParagraphSeparatorAndNotifyAccessibility()
+{
+    AccessibilityReplacedText replacedText(frame().selection().selection());
+    insertParagraphSeparator();
+    replacedText.postTextStateChangeNotification(document().existingAXObjectCache(), AXTextEditTypeTyping, &quot;\n&quot;, frame().selection().selection());
+    composition()-&gt;setTextInsertedByUnapplyRange(replacedText.replacedRange());
+}
+
</ins><span class="cx"> void TypingCommand::insertParagraphSeparatorInQuotedContent()
</span><span class="cx"> {
</span><span class="cx">     // If the selection starts inside a table, just insert the paragraph separator normally
</span><span class="lines">@@ -412,6 +443,14 @@
</span><span class="cx">     typingAddedToOpenCommand(InsertParagraphSeparatorInQuotedContent);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void TypingCommand::insertParagraphSeparatorInQuotedContentAndNotifyAccessibility()
+{
+    AccessibilityReplacedText replacedText(frame().selection().selection());
+    insertParagraphSeparatorInQuotedContent();
+    replacedText.postTextStateChangeNotification(document().existingAXObjectCache(), AXTextEditTypeTyping, &quot;\n&quot;, frame().selection().selection());
+    composition()-&gt;setTextInsertedByUnapplyRange(replacedText.replacedRange());
+}
+
</ins><span class="cx"> bool TypingCommand::makeEditableRootEmpty()
</span><span class="cx"> {
</span><span class="cx">     Element* root = endingSelection().rootEditableElement();
</span><span class="lines">@@ -532,6 +571,10 @@
</span><span class="cx">     
</span><span class="cx">     if (shouldAddToKillRing)
</span><span class="cx">         frame.editor().addRangeToKillRing(*selectionToDelete.toNormalizedRange().get(), Editor::KillRingInsertionMode::PrependText);
</span><ins>+
+    // Post the accessibility notification before actually deleting the content while selectionToDelete is still valid
+    postTextStateChangeNotificationForDeletion(selectionToDelete);
+
</ins><span class="cx">     // Make undo select everything that has been deleted, unless an undo will undo more than just this deletion.
</span><span class="cx">     // FIXME: This behaves like TextEdit except for the case where you open with text insertion and then delete
</span><span class="cx">     // more text than you insert.  In that case all of the text that was around originally should be selected.
</span><span class="lines">@@ -628,6 +671,9 @@
</span><span class="cx">     if (selectionToDelete.isCaret() || !frame.selection().shouldDeleteSelection(selectionToDelete))
</span><span class="cx">         return;
</span><span class="cx">         
</span><ins>+    // Post the accessibility notification before actually deleting the content while selectionToDelete is still valid
+    postTextStateChangeNotificationForDeletion(selectionToDelete);
+
</ins><span class="cx">     if (shouldAddToKillRing)
</span><span class="cx">         frame.editor().addRangeToKillRing(*selectionToDelete.toNormalizedRange().get(), Editor::KillRingInsertionMode::AppendText);
</span><span class="cx">     // make undo select what was deleted
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingTypingCommandh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/TypingCommand.h (199029 => 199030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/TypingCommand.h        2016-04-04 22:54:31 UTC (rev 199029)
+++ trunk/Source/WebCore/editing/TypingCommand.h        2016-04-04 23:17:59 UTC (rev 199030)
</span><span class="lines">@@ -105,7 +105,6 @@
</span><span class="cx">     static RefPtr&lt;TypingCommand&gt; lastTypingCommandIfStillOpenForTyping(Frame&amp;);
</span><span class="cx"> 
</span><span class="cx">     virtual void doApply();
</span><del>-    virtual EditAction editingAction() const;
</del><span class="cx">     virtual bool isTypingCommand() const;
</span><span class="cx">     virtual bool preservesTypingStyle() const { return m_preservesTypingStyle; }
</span><span class="cx">     virtual bool shouldRetainAutocorrectionIndicator() const
</span><span class="lines">@@ -124,6 +123,12 @@
</span><span class="cx">     void typingAddedToOpenCommand(ETypingCommand);
</span><span class="cx">     bool makeEditableRootEmpty();
</span><span class="cx"> 
</span><ins>+    void postTextStateChangeNotificationForDeletion(const VisibleSelection&amp;);
+    void insertTextAndNotifyAccessibility(const String &amp;text, bool selectInsertedText);
+    void insertLineBreakAndNotifyAccessibility();
+    void insertParagraphSeparatorInQuotedContentAndNotifyAccessibility();
+    void insertParagraphSeparatorAndNotifyAccessibility();
+
</ins><span class="cx">     ETypingCommand m_commandType;
</span><span class="cx">     String m_textToInsert;
</span><span class="cx">     bool m_openForMoreTyping;
</span></span></pre>
</div>
</div>

</body>
</html>