<!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>[163721] trunk/Source/WebCore</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/163721">163721</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2014-02-08 13:40:32 -0800 (Sat, 08 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Split UserTriggered into FireSelectEvent and RevealSelection for selection options
https://bugs.webkit.org/show_bug.cgi?id=128441

Reviewed by Darin Adler.

Split UserTriggered by FireSelectEvent and RevealSelection for selection options.

Also added defaultSetSelectionOptions() to abstract away the default options.

* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::respondToUnappliedSpellCorrection):
* editing/Editor.cpp:
(WebCore::Editor::unappliedEditing):
(WebCore::Editor::reappliedEditing):
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::moveTo):
(WebCore::FrameSelection::setSelectionByMouseIfDifferent): UserTriggered | DoNotRevealSelection
is replaced by FireSelectEvent.
(WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance): Check options &amp; FireSelectEvent
instead of options &amp; UserTriggered.
(WebCore::FrameSelection::setSelection): Check options &amp; RevealSelection instead of
options &amp; UserTriggered &amp;&amp; !(options &amp; DoNotRevealSelection).
(WebCore::FrameSelection::prepareForDestruction):
(WebCore::FrameSelection::setBase):
(WebCore::FrameSelection::setExtent):
(WebCore::FrameSelection::selectAll):
(WebCore::FrameSelection::wordSelectionContainingCaretSelection):
* editing/FrameSelection.h:
(WebCore::FrameSelection::defaultSetSelectionOptions): Added.
* editing/SpellingCorrectionCommand.cpp:
(WebCore::SpellingCorrectionCommand::doApply):
* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::selectionChanged): Renamed the argument.
* html/HTMLTextFormControlElement.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreeditingAlternativeTextControllercpp">trunk/Source/WebCore/editing/AlternativeTextController.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingEditorcpp">trunk/Source/WebCore/editing/Editor.cpp</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="#trunkSourceWebCoreeditingSpellingCorrectionCommandcpp">trunk/Source/WebCore/editing/SpellingCorrectionCommand.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>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (163720 => 163721)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-08 20:58:54 UTC (rev 163720)
+++ trunk/Source/WebCore/ChangeLog        2014-02-08 21:40:32 UTC (rev 163721)
</span><span class="lines">@@ -1,3 +1,40 @@
</span><ins>+2014-02-08  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
+
+        Split UserTriggered into FireSelectEvent and RevealSelection for selection options
+        https://bugs.webkit.org/show_bug.cgi?id=128441
+
+        Reviewed by Darin Adler.
+
+        Split UserTriggered by FireSelectEvent and RevealSelection for selection options.
+
+        Also added defaultSetSelectionOptions() to abstract away the default options.
+
+        * editing/AlternativeTextController.cpp:
+        (WebCore::AlternativeTextController::respondToUnappliedSpellCorrection):
+        * editing/Editor.cpp:
+        (WebCore::Editor::unappliedEditing):
+        (WebCore::Editor::reappliedEditing):
+        * editing/FrameSelection.cpp:
+        (WebCore::FrameSelection::moveTo):
+        (WebCore::FrameSelection::setSelectionByMouseIfDifferent): UserTriggered | DoNotRevealSelection
+        is replaced by FireSelectEvent.
+        (WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance): Check options &amp; FireSelectEvent
+        instead of options &amp; UserTriggered.
+        (WebCore::FrameSelection::setSelection): Check options &amp; RevealSelection instead of
+        options &amp; UserTriggered &amp;&amp; !(options &amp; DoNotRevealSelection).
+        (WebCore::FrameSelection::prepareForDestruction):
+        (WebCore::FrameSelection::setBase):
+        (WebCore::FrameSelection::setExtent):
+        (WebCore::FrameSelection::selectAll):
+        (WebCore::FrameSelection::wordSelectionContainingCaretSelection):
+        * editing/FrameSelection.h:
+        (WebCore::FrameSelection::defaultSetSelectionOptions): Added.
+        * editing/SpellingCorrectionCommand.cpp:
+        (WebCore::SpellingCorrectionCommand::doApply):
+        * html/HTMLTextFormControlElement.cpp:
+        (WebCore::HTMLTextFormControlElement::selectionChanged): Renamed the argument.
+        * html/HTMLTextFormControlElement.h:
+
</ins><span class="cx"> 2014-02-08  Zan Dobersek  &lt;zdobersek@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Move TreeScope, IdTargetObserverRegistry to std::unique_ptr
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingAlternativeTextControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/AlternativeTextController.cpp (163720 => 163721)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/AlternativeTextController.cpp        2014-02-08 20:58:54 UTC (rev 163720)
+++ trunk/Source/WebCore/editing/AlternativeTextController.cpp        2014-02-08 21:40:32 UTC (rev 163721)
</span><span class="lines">@@ -314,7 +314,7 @@
</span><span class="cx">     if (AlternativeTextClient* client = alternativeTextClient())
</span><span class="cx">         client-&gt;recordAutocorrectionResponse(AutocorrectionReverted, corrected, correction);
</span><span class="cx">     m_frame.document()-&gt;updateLayout();
</span><del>-    m_frame.selection().setSelection(selectionOfCorrected, FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle | FrameSelection::SpellCorrectionTriggered);
</del><ins>+    m_frame.selection().setSelection(selectionOfCorrected, FrameSelection::defaultSetSelectionOptions() | FrameSelection::SpellCorrectionTriggered);
</ins><span class="cx">     RefPtr&lt;Range&gt; range = Range::create(*m_frame.document(), m_frame.selection().selection().start(), m_frame.selection().selection().end());
</span><span class="cx"> 
</span><span class="cx">     DocumentMarkerController&amp; markers = m_frame.document()-&gt;markers();
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/Editor.cpp (163720 => 163721)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/Editor.cpp        2014-02-08 20:58:54 UTC (rev 163720)
+++ trunk/Source/WebCore/editing/Editor.cpp        2014-02-08 21:40:32 UTC (rev 163721)
</span><span class="lines">@@ -1102,7 +1102,7 @@
</span><span class="cx">     document().updateLayout();
</span><span class="cx"> 
</span><span class="cx">     VisibleSelection newSelection(cmd-&gt;startingSelection());
</span><del>-    changeSelectionAfterCommand(newSelection, FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle);
</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">     m_alternativeTextController-&gt;respondToUnappliedEditing(cmd.get());
</span><span class="lines">@@ -1118,7 +1118,7 @@
</span><span class="cx">     document().updateLayout();
</span><span class="cx"> 
</span><span class="cx">     VisibleSelection newSelection(cmd-&gt;endingSelection());
</span><del>-    changeSelectionAfterCommand(newSelection, FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle);
</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">     m_lastEditCommand = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingFrameSelectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (163720 => 163721)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/FrameSelection.cpp        2014-02-08 20:58:54 UTC (rev 163720)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp        2014-02-08 21:40:32 UTC (rev 163721)
</span><span class="lines">@@ -135,35 +135,31 @@
</span><span class="cx"> 
</span><span class="cx"> void FrameSelection::moveTo(const VisiblePosition &amp;pos, EUserTriggered userTriggered, CursorAlignOnScroll align)
</span><span class="cx"> {
</span><del>-    SetSelectionOptions options = CloseTyping | ClearTypingStyle | userTriggered;
-    setSelection(VisibleSelection(pos.deepEquivalent(), pos.deepEquivalent(), pos.affinity(), m_selection.isDirectional()), options, align);
</del><ins>+    setSelection(VisibleSelection(pos.deepEquivalent(), pos.deepEquivalent(), pos.affinity(), m_selection.isDirectional()),
+        defaultSetSelectionOptions(userTriggered), align);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FrameSelection::moveTo(const VisiblePosition &amp;base, const VisiblePosition &amp;extent, EUserTriggered userTriggered)
</span><span class="cx"> {
</span><span class="cx">     const bool selectionHasDirection = true;
</span><del>-    SetSelectionOptions options = CloseTyping | ClearTypingStyle | userTriggered;
-    setSelection(VisibleSelection(base.deepEquivalent(), extent.deepEquivalent(), base.affinity(), selectionHasDirection), options);
</del><ins>+    setSelection(VisibleSelection(base.deepEquivalent(), extent.deepEquivalent(), base.affinity(), selectionHasDirection), defaultSetSelectionOptions(userTriggered));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FrameSelection::moveTo(const Position &amp;pos, EAffinity affinity, EUserTriggered userTriggered)
</span><span class="cx"> {
</span><del>-    SetSelectionOptions options = CloseTyping | ClearTypingStyle | userTriggered;
-    setSelection(VisibleSelection(pos, affinity, m_selection.isDirectional()), options);
</del><ins>+    setSelection(VisibleSelection(pos, affinity, m_selection.isDirectional()), defaultSetSelectionOptions(userTriggered));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FrameSelection::moveTo(const Range *r, EAffinity affinity, EUserTriggered userTriggered)
</span><span class="cx"> {
</span><del>-    SetSelectionOptions options = CloseTyping | ClearTypingStyle | userTriggered;
</del><span class="cx">     VisibleSelection selection = r ? VisibleSelection(r-&gt;startPosition(), r-&gt;endPosition(), affinity) : VisibleSelection(Position(), Position(), affinity);
</span><del>-    setSelection(selection, options);
</del><ins>+    setSelection(selection, defaultSetSelectionOptions(userTriggered));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FrameSelection::moveTo(const Position &amp;base, const Position &amp;extent, EAffinity affinity, EUserTriggered userTriggered)
</span><span class="cx"> {
</span><span class="cx">     const bool selectionHasDirection = true;
</span><del>-    SetSelectionOptions options = CloseTyping | ClearTypingStyle | userTriggered;
-    setSelection(VisibleSelection(base, extent, affinity, selectionHasDirection), options);
</del><ins>+    setSelection(VisibleSelection(base, extent, affinity, selectionHasDirection), defaultSetSelectionOptions(userTriggered));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void DragCaretController::setCaretPosition(const VisiblePosition&amp; position)
</span><span class="lines">@@ -247,10 +243,10 @@
</span><span class="cx">     if (m_selection == newSelection || !shouldChangeSelection(newSelection))
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    setSelection(newSelection, UserTriggered | DoNotRevealSelection | CloseTyping | ClearTypingStyle, AlignCursorOnScrollIfNeeded, granularity);
</del><ins>+    setSelection(newSelection, defaultSetSelectionOptions() | FireSelectEvent, AlignCursorOnScrollIfNeeded, granularity);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool FrameSelection::setSelectionWithoutUpdatingAppearance(const VisibleSelection&amp; newSelectionPossiblyWithoutDirection, SetSelectionOptions options, CursorAlignOnScroll align, TextGranularity granularity, EUserTriggered userTriggered)
</del><ins>+bool FrameSelection::setSelectionWithoutUpdatingAppearance(const VisibleSelection&amp; newSelectionPossiblyWithoutDirection, SetSelectionOptions options, CursorAlignOnScroll align, TextGranularity granularity)
</ins><span class="cx"> {
</span><span class="cx">     bool closeTyping = options &amp; CloseTyping;
</span><span class="cx">     bool shouldClearTypingStyle = options &amp; ClearTypingStyle;
</span><span class="lines">@@ -297,7 +293,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Selection offsets should increase when LF is inserted before the caret in InsertLineBreakCommand. See &lt;https://webkit.org/b/56061&gt;.
</span><span class="cx">     if (HTMLTextFormControlElement* textControl = enclosingTextFormControl(newSelection.start()))
</span><del>-        textControl-&gt;selectionChanged(userTriggered == UserTriggered);
</del><ins>+        textControl-&gt;selectionChanged(options &amp; FireSelectEvent);
</ins><span class="cx"> 
</span><span class="cx">     if (oldSelection == newSelection)
</span><span class="cx">         return false;
</span><span class="lines">@@ -319,8 +315,7 @@
</span><span class="cx"> 
</span><span class="cx"> void FrameSelection::setSelection(const VisibleSelection&amp; selection, SetSelectionOptions options, CursorAlignOnScroll align, TextGranularity granularity)
</span><span class="cx"> {
</span><del>-    EUserTriggered userTriggered = selectionOptionsToUserTriggered(options);
-    if (!setSelectionWithoutUpdatingAppearance(selection, options, align, granularity, userTriggered))
</del><ins>+    if (!setSelectionWithoutUpdatingAppearance(selection, options, align, granularity))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(TEXT_CARET)
</span><span class="lines">@@ -330,7 +325,7 @@
</span><span class="cx"> #endif
</span><span class="cx">     updateAppearance();
</span><span class="cx"> 
</span><del>-    if (userTriggered == UserTriggered &amp;&amp; !(options &amp; DoNotRevealSelection)) {
</del><ins>+    if (options &amp; RevealSelection) {
</ins><span class="cx">         ScrollAlignment alignment;
</span><span class="cx"> 
</span><span class="cx">         if (m_frame-&gt;editor().behavior().shouldCenterAlignWhenSelectionIsRevealed())
</span><span class="lines">@@ -1243,8 +1238,7 @@
</span><span class="cx">     if (view)
</span><span class="cx">         view-&gt;clearSelection();
</span><span class="cx"> 
</span><del>-    setSelectionWithoutUpdatingAppearance(VisibleSelection(), CloseTyping | ClearTypingStyle,
-        AlignCursorOnScrollIfNeeded, CharacterGranularity, NotUserTriggered);
</del><ins>+    setSelectionWithoutUpdatingAppearance(VisibleSelection(), defaultSetSelectionOptions(), AlignCursorOnScrollIfNeeded, CharacterGranularity);
</ins><span class="cx">     m_previousCaretNode.clear();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1267,25 +1261,25 @@
</span><span class="cx"> void FrameSelection::setBase(const VisiblePosition &amp;pos, EUserTriggered userTriggered)
</span><span class="cx"> {
</span><span class="cx">     const bool selectionHasDirection = true;
</span><del>-    setSelection(VisibleSelection(pos.deepEquivalent(), m_selection.extent(), pos.affinity(), selectionHasDirection), CloseTyping | ClearTypingStyle | userTriggered);
</del><ins>+    setSelection(VisibleSelection(pos.deepEquivalent(), m_selection.extent(), pos.affinity(), selectionHasDirection), defaultSetSelectionOptions(userTriggered));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FrameSelection::setExtent(const VisiblePosition &amp;pos, EUserTriggered userTriggered)
</span><span class="cx"> {
</span><span class="cx">     const bool selectionHasDirection = true;
</span><del>-    setSelection(VisibleSelection(m_selection.base(), pos.deepEquivalent(), pos.affinity(), selectionHasDirection), CloseTyping | ClearTypingStyle | userTriggered);
</del><ins>+    setSelection(VisibleSelection(m_selection.base(), pos.deepEquivalent(), pos.affinity(), selectionHasDirection), defaultSetSelectionOptions(userTriggered));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FrameSelection::setBase(const Position &amp;pos, EAffinity affinity, EUserTriggered userTriggered)
</span><span class="cx"> {
</span><span class="cx">     const bool selectionHasDirection = true;
</span><del>-    setSelection(VisibleSelection(pos, m_selection.extent(), affinity, selectionHasDirection), CloseTyping | ClearTypingStyle | userTriggered);
</del><ins>+    setSelection(VisibleSelection(pos, m_selection.extent(), affinity, selectionHasDirection), defaultSetSelectionOptions(userTriggered));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FrameSelection::setExtent(const Position &amp;pos, EAffinity affinity, EUserTriggered userTriggered)
</span><span class="cx"> {
</span><span class="cx">     const bool selectionHasDirection = true;
</span><del>-    setSelection(VisibleSelection(m_selection.base(), pos, affinity, selectionHasDirection), CloseTyping | ClearTypingStyle | userTriggered);
</del><ins>+    setSelection(VisibleSelection(m_selection.base(), pos, affinity, selectionHasDirection), defaultSetSelectionOptions(userTriggered));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void CaretBase::clearCaretRect()
</span><span class="lines">@@ -1706,7 +1700,7 @@
</span><span class="cx">     VisibleSelection newSelection(VisibleSelection::selectionFromContentsOfNode(root.get()));
</span><span class="cx"> 
</span><span class="cx">     if (shouldChangeSelection(newSelection))
</span><del>-        setSelection(newSelection, UserTriggered | CloseTyping | ClearTypingStyle | DoNotRevealSelection);
</del><ins>+        setSelection(newSelection, defaultSetSelectionOptions() | FireSelectEvent);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool FrameSelection::setSelectedRange(Range* range, EAffinity affinity, bool closeTyping)
</span><span class="lines">@@ -2422,7 +2416,7 @@
</span><span class="cx"> 
</span><span class="cx">     VisibleSelection newSelection = frameSelection.selection();
</span><span class="cx">     newSelection.expandUsingGranularity(WordGranularity);
</span><del>-    frameSelection.setSelection(newSelection, CloseTyping | ClearTypingStyle, AlignCursorOnScrollIfNeeded, frameSelection.granularity());
</del><ins>+    frameSelection.setSelection(newSelection, defaultSetSelectionOptions(), AlignCursorOnScrollIfNeeded, frameSelection.granularity());
</ins><span class="cx"> 
</span><span class="cx">     Position startPos(frameSelection.selection().start());
</span><span class="cx">     Position endPos(frameSelection.selection().end());
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingFrameSelectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/FrameSelection.h (163720 => 163721)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/FrameSelection.h        2014-02-08 20:58:54 UTC (rev 163720)
+++ trunk/Source/WebCore/editing/FrameSelection.h        2014-02-08 21:40:32 UTC (rev 163721)
</span><span class="lines">@@ -118,18 +118,18 @@
</span><span class="cx">     enum CursorAlignOnScroll { AlignCursorOnScrollIfNeeded,
</span><span class="cx">                                AlignCursorOnScrollAlways };
</span><span class="cx">     enum SetSelectionOption {
</span><del>-        // 1 &lt;&lt; 0 is reserved for EUserTriggered
</del><ins>+        FireSelectEvent = 1 &lt;&lt; 0,
</ins><span class="cx">         CloseTyping = 1 &lt;&lt; 1,
</span><span class="cx">         ClearTypingStyle = 1 &lt;&lt; 2,
</span><span class="cx">         SpellCorrectionTriggered = 1 &lt;&lt; 3,
</span><span class="cx">         DoNotSetFocus = 1 &lt;&lt; 4,
</span><span class="cx">         DictationTriggered = 1 &lt;&lt; 5,
</span><del>-        DoNotRevealSelection = 1 &lt;&lt; 6,
</del><ins>+        RevealSelection = 1 &lt;&lt; 6,
</ins><span class="cx">     };
</span><span class="cx">     typedef unsigned SetSelectionOptions; // Union of values in SetSelectionOption and EUserTriggered
</span><del>-    static inline EUserTriggered selectionOptionsToUserTriggered(SetSelectionOptions options)
</del><ins>+    static inline SetSelectionOptions defaultSetSelectionOptions(EUserTriggered userTriggered = NotUserTriggered)
</ins><span class="cx">     {
</span><del>-        return static_cast&lt;EUserTriggered&gt;(options &amp; UserTriggered);
</del><ins>+        return CloseTyping | ClearTypingStyle | (userTriggered ? (RevealSelection | FireSelectEvent) : 0);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     explicit FrameSelection(Frame* = 0);
</span><span class="lines">@@ -143,7 +143,7 @@
</span><span class="cx">     void moveTo(const Position&amp;, const Position&amp;, EAffinity, EUserTriggered = NotUserTriggered);
</span><span class="cx"> 
</span><span class="cx">     const VisibleSelection&amp; selection() const { return m_selection; }
</span><del>-    void setSelection(const VisibleSelection&amp;, SetSelectionOptions = CloseTyping | ClearTypingStyle, CursorAlignOnScroll = AlignCursorOnScrollIfNeeded, TextGranularity = CharacterGranularity);
</del><ins>+    void setSelection(const VisibleSelection&amp;, SetSelectionOptions = defaultSetSelectionOptions(), CursorAlignOnScroll = AlignCursorOnScrollIfNeeded, TextGranularity = CharacterGranularity);
</ins><span class="cx">     bool setSelectedRange(Range*, EAffinity, bool closeTyping);
</span><span class="cx">     void selectAll();
</span><span class="cx">     void clear();
</span><span class="lines">@@ -279,7 +279,7 @@
</span><span class="cx"> private:
</span><span class="cx">     enum EPositionType { START, END, BASE, EXTENT };
</span><span class="cx"> 
</span><del>-    bool setSelectionWithoutUpdatingAppearance(const VisibleSelection&amp;, SetSelectionOptions, CursorAlignOnScroll, TextGranularity, EUserTriggered);
</del><ins>+    bool setSelectionWithoutUpdatingAppearance(const VisibleSelection&amp;, SetSelectionOptions, CursorAlignOnScroll, TextGranularity);
</ins><span class="cx"> 
</span><span class="cx">     void respondToNodeModification(Node*, bool baseRemoved, bool extentRemoved, bool startRemoved, bool endRemoved);
</span><span class="cx">     TextDirection directionOfEnclosingBlock();
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingSpellingCorrectionCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/SpellingCorrectionCommand.cpp (163720 => 163721)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/SpellingCorrectionCommand.cpp        2014-02-08 20:58:54 UTC (rev 163720)
+++ trunk/Source/WebCore/editing/SpellingCorrectionCommand.cpp        2014-02-08 21:40:32 UTC (rev 163721)
</span><span class="lines">@@ -104,7 +104,7 @@
</span><span class="cx">     if (!fragment)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    applyCommandToComposite(SetSelectionCommand::create(m_selectionToBeCorrected, FrameSelection::SpellCorrectionTriggered | FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle));
</del><ins>+    applyCommandToComposite(SetSelectionCommand::create(m_selectionToBeCorrected, FrameSelection::defaultSetSelectionOptions() | FrameSelection::SpellCorrectionTriggered));
</ins><span class="cx"> #if USE(AUTOCORRECTION_PANEL)
</span><span class="cx">     applyCommandToComposite(SpellingCorrectionRecordUndoCommand::create(document(), m_corrected, m_correction));
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTextFormControlElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp (163720 => 163721)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp        2014-02-08 20:58:54 UTC (rev 163720)
+++ trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp        2014-02-08 21:40:32 UTC (rev 163721)
</span><span class="lines">@@ -475,7 +475,7 @@
</span><span class="cx">     setSelectionRange(m_cachedSelectionStart, m_cachedSelectionEnd, m_cachedSelectionDirection);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void HTMLTextFormControlElement::selectionChanged(bool userTriggered)
</del><ins>+void HTMLTextFormControlElement::selectionChanged(bool shouldFireSelectEvent)
</ins><span class="cx"> {
</span><span class="cx">     if (!isTextFormControl())
</span><span class="cx">         return;
</span><span class="lines">@@ -483,9 +483,12 @@
</span><span class="cx">     // FIXME: Don't re-compute selection start and end if this function was called inside setSelectionRange.
</span><span class="cx">     // selectionStart() or selectionEnd() will return cached selection when this node doesn't have focus
</span><span class="cx">     cacheSelection(computeSelectionStart(), computeSelectionEnd(), computeSelectionDirection());
</span><ins>+    
+    if (!shouldFireSelectEvent)
+        return;
</ins><span class="cx"> 
</span><span class="cx">     if (Frame* frame = document().frame()) {
</span><del>-        if (frame-&gt;selection().isRange() &amp;&amp; userTriggered)
</del><ins>+        if (frame-&gt;selection().isRange())
</ins><span class="cx">             dispatchEvent(Event::create(eventNames().selectEvent, true, false));
</span><span class="cx">     }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLTextFormControlElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLTextFormControlElement.h (163720 => 163721)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLTextFormControlElement.h        2014-02-08 20:58:54 UTC (rev 163720)
+++ trunk/Source/WebCore/html/HTMLTextFormControlElement.h        2014-02-08 21:40:32 UTC (rev 163721)
</span><span class="lines">@@ -78,7 +78,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual TextControlInnerTextElement* innerTextElement() const = 0;
</span><span class="cx"> 
</span><del>-    void selectionChanged(bool userTriggered);
</del><ins>+    void selectionChanged(bool shouldFireSelectEvent);
</ins><span class="cx">     bool lastChangeWasUserEdit() const;
</span><span class="cx">     void setInnerTextValue(const String&amp;);
</span><span class="cx">     String innerTextValue() const;
</span></span></pre>
</div>
</div>

</body>
</html>