<!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>[186256] 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/186256">186256</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-07-02 20:34:36 -0700 (Thu, 02 Jul 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>AX: Selection change as a result of focusing an element should include that
information in the intent
https://bugs.webkit.org/show_bug.cgi?id=146533

Patch by Doug Russell &lt;d_russell@apple.com&gt; on 2015-07-02
Reviewed by Chris Fleizach.

Added focusChange flag to AXTextStateChangeIntent.
Added intent support to selection logic called by Element::updateFocusAppearance().
Added NSAccessibilityTextSelectionChangedFocus to mac notifications.

Source/WebCore:

Test: platform/mac/accessibility/selection-notification-focus-change.html

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::postTextStateChangeNotification):
* accessibility/AXTextStateChangeIntent.h:
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::setTextSelectionIntent):
(WebCore::AccessibilityRenderObject::setFocused):
* accessibility/mac/AXObjectCacheMac.mm:
(WebCore::AXObjectCache::postTextStateChangePlatformNotification):
* dom/Element.cpp:
(WebCore::Element::updateFocusAppearance):
* dom/Element.h:
(WebCore::Element::defaultFocusTextStateChangeIntent):
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::moveWithoutValidationTo):
(WebCore::FrameSelection::setSelectionByMouseIfDifferent):
(WebCore::FrameSelection::selectAll):
* editing/FrameSelection.h:
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::updateFocusAppearance):
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::updateFocusAppearance):
* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::select):
(WebCore::HTMLTextFormControlElement::setSelectionRange):
(WebCore::HTMLTextFormControlElement::restoreCachedSelection):
* html/HTMLTextFormControlElement.h:
* page/EventHandler.cpp:
(WebCore::setInitialKeyboardSelection):
* page/FocusController.cpp:
(WebCore::FocusController::advanceFocusInDocumentOrder):

LayoutTests:

* platform/mac/accessibility/selection-notification-focus-change-expected.txt: Added.
* platform/mac/accessibility/selection-notification-focus-change.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAXObjectCachecpp">trunk/Source/WebCore/accessibility/AXObjectCache.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAXTextStateChangeIntenth">trunk/Source/WebCore/accessibility/AXTextStateChangeIntent.h</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityRenderObjectcpp">trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilitymacAXObjectCacheMacmm">trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm</a></li>
<li><a href="#trunkSourceWebCoredomElementcpp">trunk/Source/WebCore/dom/Element.cpp</a></li>
<li><a href="#trunkSourceWebCoredomElementh">trunk/Source/WebCore/dom/Element.h</a></li>
<li><a href="#trunkSourceWebCoreeditingFrameSelectioncpp">trunk/Source/WebCore/editing/FrameSelection.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingFrameSelectionh">trunk/Source/WebCore/editing/FrameSelection.h</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLInputElementcpp">trunk/Source/WebCore/html/HTMLInputElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLTextAreaElementcpp">trunk/Source/WebCore/html/HTMLTextAreaElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLTextFormControlElementcpp">trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLTextFormControlElementh">trunk/Source/WebCore/html/HTMLTextFormControlElement.h</a></li>
<li><a href="#trunkSourceWebCorepageEventHandlercpp">trunk/Source/WebCore/page/EventHandler.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFocusControllercpp">trunk/Source/WebCore/page/FocusController.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityselectionnotificationfocuschangeexpectedtxt">trunk/LayoutTests/platform/mac/accessibility/selection-notification-focus-change-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityselectionnotificationfocuschangehtml">trunk/LayoutTests/platform/mac/accessibility/selection-notification-focus-change.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (186255 => 186256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/LayoutTests/ChangeLog        2015-07-03 03:34:36 UTC (rev 186256)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-07-02  Doug Russell  &lt;d_russell@apple.com&gt;
+
+        AX: Selection change as a result of focusing an element should include that 
+        information in the intent
+        https://bugs.webkit.org/show_bug.cgi?id=146533
+
+        Reviewed by Chris Fleizach.
+
+        Added focusChange flag to AXTextStateChangeIntent.
+        Added intent support to selection logic called by Element::updateFocusAppearance().
+        Added NSAccessibilityTextSelectionChangedFocus to mac notifications.
+
+        * platform/mac/accessibility/selection-notification-focus-change-expected.txt: Added.
+        * platform/mac/accessibility/selection-notification-focus-change.html: Added.
+
</ins><span class="cx"> 2015-07-02  Saam barati  &lt;saambarati1@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Rename &quot;Deconstruction&quot; to &quot;Destructuring&quot; throughout JSC
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityselectionnotificationfocuschangeexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/selection-notification-focus-change-expected.txt (0 => 186256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/selection-notification-focus-change-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/selection-notification-focus-change-expected.txt        2015-07-03 03:34:36 UTC (rev 186256)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+
+ 1
+ 2
+This tests that selection changes as a result of advancing focus include AXTextSelectionChangedFocus flag.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS addedNotification is true
+PASS axTextFocusChangeOne is true
+PASS axTextFocusChangeTwo is true
+PASS accessibilityController.accessibleElementById(&quot;1&quot;).isFocusable is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS axTextFocusChangeThree is true
+PASS axTextFocusChangeFour is true
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityselectionnotificationfocuschangehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/selection-notification-focus-change.html (0 => 186256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/selection-notification-focus-change.html                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/selection-notification-focus-change.html        2015-07-03 03:34:36 UTC (rev 186256)
</span><span class="lines">@@ -0,0 +1,82 @@
</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;/head&gt;
+    &lt;body id=&quot;body&quot;&gt;
+        &lt;fieldset&gt;
+            &lt;div&gt;
+                &lt;input id=&quot;1&quot;&gt;
+                    &lt;label for=&quot;1&quot;&gt;1&lt;/label&gt;
+                    &lt;/div&gt;
+            &lt;div&gt;
+                &lt;input id=&quot;2&quot;&gt;
+                    &lt;label for=&quot;2&quot;&gt;2&lt;/label&gt;
+                    &lt;/div&gt;
+        &lt;/fieldset&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 that selection changes as a result of advancing focus include AXTextSelectionChangedFocus flag.&quot;);
+
+            var webArea = 0;
+            var axTextFocusChangeOne = 0;
+            var axTextFocusChangeTwo = 0;
+            var axTextFocusChangeThree = 0;
+            var axTextFocusChangeFour = 0;
+            var selectCount = 0;
+            var focusCount = 0;
+            // Notification ordering:
+            // The first tab will result in 2 selection change notifications and a focus notification          selectCount=2, focusCount=1
+            // takeFocus() will result in a focus notification                                                 selectCount=2, focusCount=2
+            // The second tab will result in another 2 selection change notifications and a focus notification selectCount=1, focusCount=3
+            // (The 2 selection change notifications per tab is caused by caret browsing being enabled)
+            function notificationCallback(notification, userInfo) {
+                if (notification == &quot;AXSelectedTextChanged&quot;) {
+                    selectCount++;
+                    if (selectCount == 1) {
+                        axTextFocusChangeOne = userInfo[&quot;AXTextSelectionChangedFocus&quot;];
+                        shouldBe(&quot;axTextFocusChangeOne&quot;, &quot;true&quot;);
+                    } else if (selectCount == 2) {
+                        axTextFocusChangeTwo = userInfo[&quot;AXTextSelectionChangedFocus&quot;];
+                        shouldBe(&quot;axTextFocusChangeTwo&quot;, &quot;true&quot;);
+
+                        shouldBe(&quot;accessibilityController.accessibleElementById(\&quot;1\&quot;).isFocusable&quot;, &quot;true&quot;);
+                        accessibilityController.accessibleElementById(&quot;1&quot;).takeFocus();
+                    } else if (selectCount == 3) {
+                        axTextFocusChangeThree = userInfo[&quot;AXTextSelectionChangedFocus&quot;];
+                        shouldBe(&quot;axTextFocusChangeThree&quot;, &quot;true&quot;);
+                    } else if (selectCount == 4) {
+                        axTextFocusChangeFour = userInfo[&quot;AXTextSelectionChangedFocus&quot;];
+                        shouldBe(&quot;axTextFocusChangeFour&quot;, &quot;true&quot;);
+                    }
+                } else if (notification == &quot;AXFocusChanged&quot;) {
+                    focusCount++;
+                    if (focusCount == 2) {
+                        eventSender.scheduleAsynchronousKeyDown(&quot;\t&quot;);
+                    }
+                }
+                if (selectCount == 4 &amp;&amp; focusCount == 3) {
+                    webArea.removeNotificationListener();
+                    testRunner.notifyDone();
+                }
+            }
+
+            if (window.accessibilityController) {
+                testRunner.waitUntilDone();
+                testRunner.overridePreference(&quot;WebKitTabToLinksPreferenceKey&quot;, 1);
+
+                accessibilityController.enableEnhancedAccessibility(true);
+                webArea = accessibilityController.rootElement.childAtIndex(0);
+                webArea.setBoolAttributeValue(&quot;AXCaretBrowsingEnabled&quot;, true)
+
+                var addedNotification = webArea.addNotificationListener(notificationCallback);
+                shouldBe(&quot;addedNotification&quot;, &quot;true&quot;);
+
+                eventSender.keyDown(&quot;\t&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="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (186255 => 186256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/ChangeLog        2015-07-03 03:34:36 UTC (rev 186256)
</span><span class="lines">@@ -1,3 +1,48 @@
</span><ins>+2015-07-02  Doug Russell  &lt;d_russell@apple.com&gt;
+
+        AX: Selection change as a result of focusing an element should include that 
+        information in the intent
+        https://bugs.webkit.org/show_bug.cgi?id=146533
+
+        Reviewed by Chris Fleizach.
+
+        Added focusChange flag to AXTextStateChangeIntent.
+        Added intent support to selection logic called by Element::updateFocusAppearance().
+        Added NSAccessibilityTextSelectionChangedFocus to mac notifications.
+
+        Test: platform/mac/accessibility/selection-notification-focus-change.html
+
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::AXObjectCache::postTextStateChangeNotification):
+        * accessibility/AXTextStateChangeIntent.h:
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::setTextSelectionIntent):
+        (WebCore::AccessibilityRenderObject::setFocused):
+        * accessibility/mac/AXObjectCacheMac.mm:
+        (WebCore::AXObjectCache::postTextStateChangePlatformNotification):
+        * dom/Element.cpp:
+        (WebCore::Element::updateFocusAppearance):
+        * dom/Element.h:
+        (WebCore::Element::defaultFocusTextStateChangeIntent):
+        * editing/FrameSelection.cpp:
+        (WebCore::FrameSelection::moveWithoutValidationTo):
+        (WebCore::FrameSelection::setSelectionByMouseIfDifferent):
+        (WebCore::FrameSelection::selectAll):
+        * editing/FrameSelection.h:
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::updateFocusAppearance):
+        * html/HTMLTextAreaElement.cpp:
+        (WebCore::HTMLTextAreaElement::updateFocusAppearance):
+        * html/HTMLTextFormControlElement.cpp:
+        (WebCore::HTMLTextFormControlElement::select):
+        (WebCore::HTMLTextFormControlElement::setSelectionRange):
+        (WebCore::HTMLTextFormControlElement::restoreCachedSelection):
+        * html/HTMLTextFormControlElement.h:
+        * page/EventHandler.cpp:
+        (WebCore::setInitialKeyboardSelection):
+        * page/FocusController.cpp:
+        (WebCore::FocusController::advanceFocusInDocumentOrder):
+
</ins><span class="cx"> 2015-07-02  Przemek Piorkowski  &lt;piorkowskiprzemyslaw@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [EFL] test_ewk2_application_cache_manager has been failed since r185527
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAXObjectCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (186255 => 186256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp        2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp        2015-07-03 03:34:36 UTC (rev 186256)
</span><span class="lines">@@ -1053,7 +1053,8 @@
</span><span class="cx">             object = observableObject;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    postTextStateChangePlatformNotification(object, (intent.type == AXTextStateChangeTypeUnknown || m_isSynchronizingSelection) ? m_textSelectionIntent : intent, selection);
</del><ins>+    const AXTextStateChangeIntent&amp; newIntent = (intent.type == AXTextStateChangeTypeUnknown || (m_isSynchronizingSelection &amp;&amp; m_textSelectionIntent.type != AXTextStateChangeTypeUnknown)) ? m_textSelectionIntent : intent;
+    postTextStateChangePlatformNotification(object, newIntent, selection);
</ins><span class="cx"> #else
</span><span class="cx">     UNUSED_PARAM(object);
</span><span class="cx">     UNUSED_PARAM(intent);
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAXTextStateChangeIntenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AXTextStateChangeIntent.h (186255 => 186256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AXTextStateChangeIntent.h        2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/accessibility/AXTextStateChangeIntent.h        2015-07-03 03:34:36 UTC (rev 186256)
</span><span class="lines">@@ -70,6 +70,7 @@
</span><span class="cx"> struct AXTextSelection {
</span><span class="cx">     AXTextSelectionDirection direction;
</span><span class="cx">     AXTextSelectionGranularity granularity;
</span><ins>+    bool focusChange;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> struct AXTextStateChangeIntent {
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityRenderObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (186255 => 186256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp        2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp        2015-07-03 03:34:36 UTC (rev 186256)
</span><span class="lines">@@ -1502,7 +1502,7 @@
</span><span class="cx"> {
</span><span class="cx">     if (!cache)
</span><span class="cx">         return;
</span><del>-    AXTextStateChangeIntent intent(type, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown });
</del><ins>+    AXTextStateChangeIntent intent(type, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown, false });
</ins><span class="cx">     cache-&gt;setTextSelectionIntent(intent);
</span><span class="cx">     cache-&gt;setIsSynchronizingSelection(true);
</span><span class="cx"> }
</span><span class="lines">@@ -1683,9 +1683,9 @@
</span><span class="cx">     if (document-&gt;focusedElement() == node)
</span><span class="cx">         document-&gt;setFocusedElement(nullptr);
</span><span class="cx"> 
</span><del>-    setTextSelectionIntent(axObjectCache(), AXTextStateChangeTypeSelectionMove);
</del><ins>+    axObjectCache()-&gt;setIsSynchronizingSelection(true);
</ins><span class="cx">     downcast&lt;Element&gt;(*node).focus();
</span><del>-    clearTextSelectionIntent(axObjectCache());
</del><ins>+    axObjectCache()-&gt;setIsSynchronizingSelection(false);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void AccessibilityRenderObject::setSelectedRows(AccessibilityChildrenVector&amp; selectedRows)
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilitymacAXObjectCacheMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm (186255 => 186256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm        2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm        2015-07-03 03:34:36 UTC (rev 186256)
</span><span class="lines">@@ -60,6 +60,10 @@
</span><span class="cx"> #define NSAccessibilityTextSelectionGranularity @&quot;AXTextSelectionGranularity&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#ifndef NSAccessibilityTextSelectionChangedFocus
+#define NSAccessibilityTextSelectionChangedFocus @&quot;AXTextSelectionChangedFocus&quot;
+#endif
+
</ins><span class="cx"> #ifndef NSAccessibilityTextEditType
</span><span class="cx"> #define NSAccessibilityTextEditType @&quot;AXTextEditType&quot;
</span><span class="cx"> #endif
</span><span class="lines">@@ -249,6 +253,8 @@
</span><span class="cx">         case AXTextStateChangeTypeEdit:
</span><span class="cx">             break;
</span><span class="cx">         }
</span><ins>+        if (intent.selection.focusChange)
+            [userInfo setObject:[NSNumber numberWithBool:intent.selection.focusChange] forKey:NSAccessibilityTextSelectionChangedFocus];
</ins><span class="cx">     }
</span><span class="cx">     if (!selection.isNone()) {
</span><span class="cx">         if (id textMarkerRange = [object-&gt;wrapper() textMarkerRangeFromVisiblePositions:selection.visibleStart() endPosition:selection.visibleEnd()])
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.cpp (186255 => 186256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.cpp        2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/dom/Element.cpp        2015-07-03 03:34:36 UTC (rev 186256)
</span><span class="lines">@@ -2199,7 +2199,7 @@
</span><span class="cx">         VisibleSelection newSelection = VisibleSelection(firstPositionInOrBeforeNode(this), DOWNSTREAM);
</span><span class="cx">         
</span><span class="cx">         if (frame-&gt;selection().shouldChangeSelection(newSelection)) {
</span><del>-            frame-&gt;selection().setSelection(newSelection);
</del><ins>+            frame-&gt;selection().setSelection(newSelection, FrameSelection::defaultSetSelectionOptions(), Element::defaultFocusTextStateChangeIntent());
</ins><span class="cx">             frame-&gt;selection().revealSelection();
</span><span class="cx">         }
</span><span class="cx">     } else if (renderer() &amp;&amp; !renderer()-&gt;isWidget())
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.h (186255 => 186256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.h        2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/dom/Element.h        2015-07-03 03:34:36 UTC (rev 186256)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx"> #ifndef Element_h
</span><span class="cx"> #define Element_h
</span><span class="cx"> 
</span><ins>+#include &quot;AXTextStateChangeIntent.h&quot;
</ins><span class="cx"> #include &quot;Document.h&quot;
</span><span class="cx"> #include &quot;ElementData.h&quot;
</span><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="lines">@@ -321,6 +322,7 @@
</span><span class="cx">     virtual const AtomicString&amp; imageSourceURL() const;
</span><span class="cx">     virtual String target() const { return String(); }
</span><span class="cx"> 
</span><ins>+    static AXTextStateChangeIntent defaultFocusTextStateChangeIntent() { return AXTextStateChangeIntent(AXTextStateChangeTypeSelectionMove, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown, true }); }
</ins><span class="cx">     void updateFocusAppearanceAfterAttachIfNeeded();
</span><span class="cx">     virtual void focus(bool restorePreviousSelection = true, FocusDirection = FocusDirectionNone);
</span><span class="cx">     virtual void updateFocusAppearance(bool restorePreviousSelection);
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingFrameSelectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (186255 => 186256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/FrameSelection.cpp        2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp        2015-07-03 03:34:36 UTC (rev 186256)
</span><span class="lines">@@ -166,13 +166,13 @@
</span><span class="cx">     setSelection(VisibleSelection(base, extent, affinity, selectionHasDirection), defaultSetSelectionOptions(userTriggered));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void FrameSelection::moveWithoutValidationTo(const Position&amp; base, const Position&amp; extent, bool selectionHasDirection, bool shouldSetFocus)
</del><ins>+void FrameSelection::moveWithoutValidationTo(const Position&amp; base, const Position&amp; extent, bool selectionHasDirection, bool shouldSetFocus, const AXTextStateChangeIntent&amp; intent)
</ins><span class="cx"> {
</span><span class="cx">     VisibleSelection newSelection;
</span><span class="cx">     newSelection.setWithoutValidation(base, extent);
</span><span class="cx">     newSelection.setIsDirectional(selectionHasDirection);
</span><del>-    AXTextStateChangeIntent intent(AXTextStateChangeTypeSelectionMove, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown });
-    setSelection(newSelection, defaultSetSelectionOptions() | (shouldSetFocus ? 0 : DoNotSetFocus), intent);
</del><ins>+    AXTextStateChangeIntent newIntent = intent.type == AXTextStateChangeTypeUnknown ? AXTextStateChangeIntent(AXTextStateChangeTypeSelectionMove, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown, false }) : intent;
+    setSelection(newSelection, defaultSetSelectionOptions() | (shouldSetFocus ? 0 : DoNotSetFocus), newIntent);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void DragCaretController::setCaretPosition(const VisiblePosition&amp; position)
</span><span class="lines">@@ -259,7 +259,7 @@
</span><span class="cx">     
</span><span class="cx">     AXTextStateChangeIntent intent;
</span><span class="cx">     if (AXObjectCache::accessibilityEnabled() &amp;&amp; newSelection.isCaret())
</span><del>-        intent = AXTextStateChangeIntent(AXTextStateChangeTypeSelectionMove, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown });
</del><ins>+        intent = AXTextStateChangeIntent(AXTextStateChangeTypeSelectionMove, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown, false });
</ins><span class="cx">     else
</span><span class="cx">         intent = AXTextStateChangeIntent();
</span><span class="cx">     setSelection(newSelection, defaultSetSelectionOptions() | FireSelectEvent, intent, AlignCursorOnScrollIfNeeded, granularity);
</span><span class="lines">@@ -1792,7 +1792,7 @@
</span><span class="cx">     VisibleSelection newSelection(VisibleSelection::selectionFromContentsOfNode(root.get()));
</span><span class="cx"> 
</span><span class="cx">     if (shouldChangeSelection(newSelection)) {
</span><del>-        AXTextStateChangeIntent intent(AXTextStateChangeTypeSelectionExtend, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityAll });
</del><ins>+        AXTextStateChangeIntent intent(AXTextStateChangeTypeSelectionExtend, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityAll, false });
</ins><span class="cx">         setSelection(newSelection, defaultSetSelectionOptions() | FireSelectEvent, intent);
</span><span class="cx">     }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingFrameSelectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/FrameSelection.h (186255 => 186256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/FrameSelection.h        2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/editing/FrameSelection.h        2015-07-03 03:34:36 UTC (rev 186256)
</span><span class="lines">@@ -142,7 +142,7 @@
</span><span class="cx">     WEBCORE_EXPORT void moveTo(const VisiblePosition&amp;, const VisiblePosition&amp;, EUserTriggered = NotUserTriggered);
</span><span class="cx">     void moveTo(const Position&amp;, EAffinity, EUserTriggered = NotUserTriggered);
</span><span class="cx">     void moveTo(const Position&amp;, const Position&amp;, EAffinity, EUserTriggered = NotUserTriggered);
</span><del>-    void moveWithoutValidationTo(const Position&amp;, const Position&amp;, bool selectionHasDirection, bool shouldSetFocus);
</del><ins>+    void moveWithoutValidationTo(const Position&amp;, const Position&amp;, bool selectionHasDirection, bool shouldSetFocus, const AXTextStateChangeIntent&amp; = AXTextStateChangeIntent());
</ins><span class="cx"> 
</span><span class="cx">     const VisibleSelection&amp; selection() const { return m_selection; }
</span><span class="cx">     WEBCORE_EXPORT void setSelection(const VisibleSelection&amp;, SetSelectionOptions = defaultSetSelectionOptions(), AXTextStateChangeIntent = AXTextStateChangeIntent(), CursorAlignOnScroll = AlignCursorOnScrollIfNeeded, TextGranularity = CharacterGranularity);
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLInputElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (186255 => 186256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLInputElement.cpp        2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp        2015-07-03 03:34:36 UTC (rev 186256)
</span><span class="lines">@@ -407,7 +407,7 @@
</span><span class="cx"> {
</span><span class="cx">     if (isTextField()) {
</span><span class="cx">         if (!restorePreviousSelection || !hasCachedSelection())
</span><del>-            select();
</del><ins>+            select(Element::defaultFocusTextStateChangeIntent());
</ins><span class="cx">         else
</span><span class="cx">             restoreCachedSelection();
</span><span class="cx">         if (document().frame())
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTextAreaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTextAreaElement.cpp (186255 => 186256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTextAreaElement.cpp        2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/html/HTMLTextAreaElement.cpp        2015-07-03 03:34:36 UTC (rev 186256)
</span><span class="lines">@@ -257,9 +257,9 @@
</span><span class="cx">         // If this is the first focus, set a caret at the beginning of the text.  
</span><span class="cx">         // This matches some browsers' behavior; see bug 11746 Comment #15.
</span><span class="cx">         // http://bugs.webkit.org/show_bug.cgi?id=11746#c15
</span><del>-        setSelectionRange(0, 0);
</del><ins>+        setSelectionRange(0, 0, SelectionHasNoDirection, Element::defaultFocusTextStateChangeIntent());
</ins><span class="cx">     } else
</span><del>-        restoreCachedSelection();
</del><ins>+        restoreCachedSelection(Element::defaultFocusTextStateChangeIntent());
</ins><span class="cx"> 
</span><span class="cx">     if (document().frame())
</span><span class="cx">         document().frame()-&gt;selection().revealSelection();
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTextFormControlElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp (186255 => 186256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp        2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp        2015-07-03 03:34:36 UTC (rev 186256)
</span><span class="lines">@@ -185,15 +185,15 @@
</span><span class="cx">     setSelectionRange(selectionStart(), selectionEnd(), direction);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void HTMLTextFormControlElement::select()
</del><ins>+void HTMLTextFormControlElement::select(const AXTextStateChangeIntent&amp; intent)
</ins><span class="cx"> {
</span><span class="cx">     // FIXME: We should abstract the selection behavior into an EditingBehavior function instead
</span><span class="cx">     // of hardcoding the behavior using a macro define.
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     // We don't want to select all the text on iOS. Instead use the standard textfield behavior of going to the end of the line.
</span><del>-    setSelectionRange(std::numeric_limits&lt;int&gt;::max(), std::numeric_limits&lt;int&gt;::max(), SelectionHasForwardDirection);
</del><ins>+    setSelectionRange(std::numeric_limits&lt;int&gt;::max(), std::numeric_limits&lt;int&gt;::max(), SelectionHasForwardDirection, intent);
</ins><span class="cx"> #else
</span><del>-    setSelectionRange(0, std::numeric_limits&lt;int&gt;::max(), SelectionHasNoDirection);
</del><ins>+    setSelectionRange(0, std::numeric_limits&lt;int&gt;::max(), SelectionHasNoDirection, intent);
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -272,7 +272,7 @@
</span><span class="cx">     setSelectionRange(newSelectionStart, newSelectionEnd, SelectionHasNoDirection);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void HTMLTextFormControlElement::setSelectionRange(int start, int end, const String&amp; directionString)
</del><ins>+void HTMLTextFormControlElement::setSelectionRange(int start, int end, const String&amp; directionString, const AXTextStateChangeIntent&amp; intent)
</ins><span class="cx"> {
</span><span class="cx">     TextFieldSelectionDirection direction = SelectionHasNoDirection;
</span><span class="cx">     if (directionString == &quot;forward&quot;)
</span><span class="lines">@@ -280,10 +280,10 @@
</span><span class="cx">     else if (directionString == &quot;backward&quot;)
</span><span class="cx">         direction = SelectionHasBackwardDirection;
</span><span class="cx"> 
</span><del>-    return setSelectionRange(start, end, direction);
</del><ins>+    return setSelectionRange(start, end, direction, intent);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void HTMLTextFormControlElement::setSelectionRange(int start, int end, TextFieldSelectionDirection direction)
</del><ins>+void HTMLTextFormControlElement::setSelectionRange(int start, int end, TextFieldSelectionDirection direction, const AXTextStateChangeIntent&amp; intent)
</ins><span class="cx"> {
</span><span class="cx">     if (!isTextFormControl())
</span><span class="cx">         return;
</span><span class="lines">@@ -317,7 +317,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (Frame* frame = document().frame())
</span><del>-        frame-&gt;selection().moveWithoutValidationTo(startPosition, endPosition, direction != SelectionHasNoDirection, !hasFocus);
</del><ins>+        frame-&gt;selection().moveWithoutValidationTo(startPosition, endPosition, direction != SelectionHasNoDirection, !hasFocus, intent);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> int HTMLTextFormControlElement::indexForVisiblePosition(const VisiblePosition&amp; position) const
</span><span class="lines">@@ -468,9 +468,9 @@
</span><span class="cx">     return Range::create(document(), startNode, start, endNode, end);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void HTMLTextFormControlElement::restoreCachedSelection()
</del><ins>+void HTMLTextFormControlElement::restoreCachedSelection(const AXTextStateChangeIntent&amp; intent)
</ins><span class="cx"> {
</span><del>-    setSelectionRange(m_cachedSelectionStart, m_cachedSelectionEnd, cachedSelectionDirection());
</del><ins>+    setSelectionRange(m_cachedSelectionStart, m_cachedSelectionEnd, cachedSelectionDirection(), intent);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLTextFormControlElement::selectionChanged(bool shouldFireSelectEvent)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTextFormControlElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTextFormControlElement.h (186255 => 186256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTextFormControlElement.h        2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/html/HTMLTextFormControlElement.h        2015-07-03 03:34:36 UTC (rev 186256)
</span><span class="lines">@@ -64,11 +64,11 @@
</span><span class="cx">     void setSelectionStart(int);
</span><span class="cx">     void setSelectionEnd(int);
</span><span class="cx">     void setSelectionDirection(const String&amp;);
</span><del>-    void select();
</del><ins>+    void select(const AXTextStateChangeIntent&amp; = AXTextStateChangeIntent());
</ins><span class="cx">     virtual void setRangeText(const String&amp; replacement, ExceptionCode&amp;);
</span><span class="cx">     virtual void setRangeText(const String&amp; replacement, unsigned start, unsigned end, const String&amp; selectionMode, ExceptionCode&amp;);
</span><del>-    void setSelectionRange(int start, int end, const String&amp; direction);
-    void setSelectionRange(int start, int end, TextFieldSelectionDirection = SelectionHasNoDirection);
</del><ins>+    void setSelectionRange(int start, int end, const String&amp; direction, const AXTextStateChangeIntent&amp; = AXTextStateChangeIntent());
+    void setSelectionRange(int start, int end, TextFieldSelectionDirection = SelectionHasNoDirection, const AXTextStateChangeIntent&amp; = AXTextStateChangeIntent());
</ins><span class="cx">     PassRefPtr&lt;Range&gt; selection() const;
</span><span class="cx">     String selectedText() const;
</span><span class="cx"> 
</span><span class="lines">@@ -110,7 +110,7 @@
</span><span class="cx">         m_cachedSelectionDirection = direction;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void restoreCachedSelection();
</del><ins>+    void restoreCachedSelection(const AXTextStateChangeIntent&amp; = AXTextStateChangeIntent());
</ins><span class="cx">     bool hasCachedSelection() const { return m_cachedSelectionStart &gt;= 0; }
</span><span class="cx"> 
</span><span class="cx">     virtual void subtreeHasChanged() = 0;
</span></span></pre></div>
<a id="trunkSourceWebCorepageEventHandlercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/EventHandler.cpp (186255 => 186256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/EventHandler.cpp        2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/page/EventHandler.cpp        2015-07-03 03:34:36 UTC (rev 186256)
</span><span class="lines">@@ -3238,7 +3238,7 @@
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    AXTextStateChangeIntent intent(AXTextStateChangeTypeSelectionMove, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown });
</del><ins>+    AXTextStateChangeIntent intent(AXTextStateChangeTypeSelectionMove, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown, false });
</ins><span class="cx">     selection.setSelection(visiblePosition, FrameSelection::defaultSetSelectionOptions(UserTriggered), intent);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepageFocusControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FocusController.cpp (186255 => 186256)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FocusController.cpp        2015-07-03 03:08:44 UTC (rev 186255)
+++ trunk/Source/WebCore/page/FocusController.cpp        2015-07-03 03:34:36 UTC (rev 186256)
</span><span class="lines">@@ -341,7 +341,7 @@
</span><span class="cx">         Position position = firstPositionInOrBeforeNode(element.get());
</span><span class="cx">         VisibleSelection newSelection(position, position, DOWNSTREAM);
</span><span class="cx">         if (frame.selection().shouldChangeSelection(newSelection)) {
</span><del>-            AXTextStateChangeIntent intent(AXTextStateChangeTypeSelectionMove, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown });
</del><ins>+            AXTextStateChangeIntent intent(AXTextStateChangeTypeSelectionMove, AXTextSelection { AXTextSelectionDirectionDiscontiguous, AXTextSelectionGranularityUnknown, true });
</ins><span class="cx">             frame.selection().setSelection(newSelection, FrameSelection::defaultSetSelectionOptions(UserTriggered), intent);
</span><span class="cx">         }
</span><span class="cx">     }
</span></span></pre>
</div>
</div>

</body>
</html>