<!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>[192170] 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/192170">192170</a></dd>
<dt>Author</dt> <dd>jiewen_tan@apple.com</dd>
<dt>Date</dt> <dd>2015-11-09 12:11:30 -0800 (Mon, 09 Nov 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Null dereference loading Blink layout test editing/inserting/insert-html-crash-01.html
https://bugs.webkit.org/show_bug.cgi?id=149298
&lt;rdar://problem/22746918&gt;

Reviewed by Ryosuke Niwa.

Source/WebCore:

The test crashes in the method WebCore::CompositeEditCommand::moveParagraphs() because
the other method WebCore::CompositeEditCommand::cleanupAfterDeletion() accidentally
deletes the destination node. In WebCore::CompositeEditCommand::cleanupAfterDeletion(),
it fails to determine that caretAfterDelete equals to destination as Position::operator==,
which is called in VisiblePosition::operator==, only checks the equality of tuple
&lt;Anchor Node, Anchor Type, Offset&gt;. It is insufficient as a single position can be
represented by multiple tuples. Therefore, this change adds Position::equals() to fortify
the equal checking of two positions by considering combinations of different tuple
representations.

Furthermore, it adds VisiblePosition::equals() which considers affinity and call
Position::equals() while comparing two visible positions.

Test: editing/inserting/insert-html-crash-01.html

* dom/Position.cpp:
(WebCore::Position::equals):
* dom/Position.h:
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::cleanupAfterDeletion):
Replace operator== with VisiblePosition::equals() to tackle the test case.
* editing/VisiblePosition.cpp:
(WebCore::VisiblePosition::equals):
* editing/VisiblePosition.h:

LayoutTests:

This test case is from Blink <a href="http://trac.webkit.org/projects/webkit/changeset/153982">r153982</a>:
https://codereview.chromium.org/16053005

* editing/inserting/insert-html-crash-01-expected.txt: Added.
* editing/inserting/insert-html-crash-01.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="#trunkSourceWebCoredomPositioncpp">trunk/Source/WebCore/dom/Position.cpp</a></li>
<li><a href="#trunkSourceWebCoredomPositionh">trunk/Source/WebCore/dom/Position.h</a></li>
<li><a href="#trunkSourceWebCoreeditingCompositeEditCommandcpp">trunk/Source/WebCore/editing/CompositeEditCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingVisiblePositioncpp">trunk/Source/WebCore/editing/VisiblePosition.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingVisiblePositionh">trunk/Source/WebCore/editing/VisiblePosition.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestseditinginsertinginserthtmlcrash01expectedtxt">trunk/LayoutTests/editing/inserting/insert-html-crash-01-expected.txt</a></li>
<li><a href="#trunkLayoutTestseditinginsertinginserthtmlcrash01html">trunk/LayoutTests/editing/inserting/insert-html-crash-01.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (192169 => 192170)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-11-09 19:40:39 UTC (rev 192169)
+++ trunk/LayoutTests/ChangeLog        2015-11-09 20:11:30 UTC (rev 192170)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2015-11-09  Jiewen Tan  &lt;jiewen_tan@apple.com&gt;
+
+        Null dereference loading Blink layout test editing/inserting/insert-html-crash-01.html
+        https://bugs.webkit.org/show_bug.cgi?id=149298
+        &lt;rdar://problem/22746918&gt;
+
+        Reviewed by Ryosuke Niwa.
+
+        This test case is from Blink r153982:
+        https://codereview.chromium.org/16053005
+
+        * editing/inserting/insert-html-crash-01-expected.txt: Added.
+        * editing/inserting/insert-html-crash-01.html: Added.
+
</ins><span class="cx"> 2015-11-09  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Some style changes cause tatechuyoko to be drawn off center
</span></span></pre></div>
<a id="trunkLayoutTestseditinginsertinginserthtmlcrash01expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/inserting/insert-html-crash-01-expected.txt (0 => 192170)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/inserting/insert-html-crash-01-expected.txt                                (rev 0)
+++ trunk/LayoutTests/editing/inserting/insert-html-crash-01-expected.txt        2015-11-09 20:11:30 UTC (rev 192170)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV &gt; BODY &gt; HTML &gt; #document to 3 of DIV &gt; BODY &gt; HTML &gt; #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV &gt; BODY &gt; HTML &gt; #document to 0 of DIV &gt; BODY &gt; HTML &gt; #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV &gt; BODY &gt; HTML &gt; #document to 0 of DIV &gt; BODY &gt; HTML &gt; #document toDOMRange:range from 1 of #text &gt; DIV &gt; BODY &gt; HTML &gt; #document to 1 of DIV &gt; DIV &gt; BODY &gt; HTML &gt; #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV &gt; BODY &gt; HTML &gt; #document to 2 of DIV &gt; DIV &gt; BODY &gt; HTML &gt; #document toDOMRange:range from 9 of #text &gt; DIV &gt; DIV &gt; BODY &gt; HTML &gt; #document to 9 of #text &gt; DIV &gt; DIV &gt; BODY &gt; HTML &gt; #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 9 of #text &gt; DIV &gt; DIV &gt; BODY &gt; HTML &gt; #document to 9 of #text &gt; DIV &gt; DIV &gt; BODY &gt; HTML &gt; #document toDOMRange:range from 0 of #text &gt; DIV &gt; DIV &gt; BODY &gt; HTML &gt; #document to 2 of DIV &gt; DIV &gt; BODY &gt; HTML &gt; #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidEndEditing:WebViewDidEndEditingNotification
+PASS. WebKit didn't crash.
</ins></span></pre></div>
<a id="trunkLayoutTestseditinginsertinginserthtmlcrash01html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/inserting/insert-html-crash-01.html (0 => 192170)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/inserting/insert-html-crash-01.html                                (rev 0)
+++ trunk/LayoutTests/editing/inserting/insert-html-crash-01.html        2015-11-09 20:11:30 UTC (rev 192170)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../editing.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+function editingTest() {
+    var editable = document.getElementById('editable');
+    editable.focus();
+    document.execCommand('SelectAll');
+    document.execCommand('InsertText', false, 'SUCCEEDED');
+    document.execCommand('SelectAll');
+    document.write(&quot;PASS. WebKit didn't crash.&quot;);
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=runEditingTest()&gt;
+&lt;div id=&quot;editable&quot; contenteditable=&quot;true&quot;&gt;
+Foo
+    &lt;div style=&quot;overflow:scroll;&quot;&gt;
+        &lt;div style=&quot;display:table&quot;&gt;&lt;/div&gt;
+    &lt;/div&gt;
+&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (192169 => 192170)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-11-09 19:40:39 UTC (rev 192169)
+++ trunk/Source/WebCore/ChangeLog        2015-11-09 20:11:30 UTC (rev 192170)
</span><span class="lines">@@ -1,3 +1,36 @@
</span><ins>+2015-11-09  Jiewen Tan  &lt;jiewen_tan@apple.com&gt;
+
+        Null dereference loading Blink layout test editing/inserting/insert-html-crash-01.html
+        https://bugs.webkit.org/show_bug.cgi?id=149298
+        &lt;rdar://problem/22746918&gt;
+
+        Reviewed by Ryosuke Niwa.
+
+        The test crashes in the method WebCore::CompositeEditCommand::moveParagraphs() because
+        the other method WebCore::CompositeEditCommand::cleanupAfterDeletion() accidentally
+        deletes the destination node. In WebCore::CompositeEditCommand::cleanupAfterDeletion(),
+        it fails to determine that caretAfterDelete equals to destination as Position::operator==,
+        which is called in VisiblePosition::operator==, only checks the equality of tuple
+        &lt;Anchor Node, Anchor Type, Offset&gt;. It is insufficient as a single position can be
+        represented by multiple tuples. Therefore, this change adds Position::equals() to fortify
+        the equal checking of two positions by considering combinations of different tuple
+        representations.
+
+        Furthermore, it adds VisiblePosition::equals() which considers affinity and call
+        Position::equals() while comparing two visible positions.
+
+        Test: editing/inserting/insert-html-crash-01.html
+
+        * dom/Position.cpp:
+        (WebCore::Position::equals):
+        * dom/Position.h:
+        * editing/CompositeEditCommand.cpp:
+        (WebCore::CompositeEditCommand::cleanupAfterDeletion):
+        Replace operator== with VisiblePosition::equals() to tackle the test case.
+        * editing/VisiblePosition.cpp:
+        (WebCore::VisiblePosition::equals):
+        * editing/VisiblePosition.h:
+
</ins><span class="cx"> 2015-11-09  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Some style changes cause tatechuyoko to be drawn off center
</span></span></pre></div>
<a id="trunkSourceWebCoredomPositioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Position.cpp (192169 => 192170)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Position.cpp        2015-11-09 19:40:39 UTC (rev 192169)
+++ trunk/Source/WebCore/dom/Position.cpp        2015-11-09 20:11:30 UTC (rev 192170)
</span><span class="lines">@@ -1453,6 +1453,102 @@
</span><span class="cx"> 
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+bool Position::equals(const Position&amp; other) const
+{
+    if (!m_anchorNode)
+        return !m_anchorNode == !other.m_anchorNode;
+    if (!other.m_anchorNode)
+        return false;
+
+    switch (anchorType()) {
+    case PositionIsBeforeChildren:
+        ASSERT(!m_anchorNode-&gt;isTextNode());
+        switch (other.anchorType()) {
+        case PositionIsBeforeChildren:
+            ASSERT(!other.m_anchorNode-&gt;isTextNode());
+            return m_anchorNode == other.m_anchorNode;
+        case PositionIsAfterChildren:
+            ASSERT(!other.m_anchorNode-&gt;isTextNode());
+            return m_anchorNode == other.m_anchorNode &amp;&amp; !m_anchorNode-&gt;hasChildNodes();
+        case PositionIsOffsetInAnchor:
+            return m_anchorNode == other.m_anchorNode &amp;&amp; !other.m_offset;
+        case PositionIsBeforeAnchor:
+            return m_anchorNode-&gt;firstChild() == other.m_anchorNode;
+        case PositionIsAfterAnchor:
+            return false;
+        }
+        break;
+    case PositionIsAfterChildren:
+        ASSERT(!m_anchorNode-&gt;isTextNode());
+        switch (other.anchorType()) {
+        case PositionIsBeforeChildren:
+            ASSERT(!other.m_anchorNode-&gt;isTextNode());
+            return m_anchorNode == other.m_anchorNode &amp;&amp; !m_anchorNode-&gt;hasChildNodes();
+        case PositionIsAfterChildren:
+            ASSERT(!other.m_anchorNode-&gt;isTextNode());
+            return m_anchorNode == other.m_anchorNode;
+        case PositionIsOffsetInAnchor:
+            return m_anchorNode == other.m_anchorNode &amp;&amp; m_anchorNode-&gt;countChildNodes() == static_cast&lt;unsigned&gt;(m_offset);
+        case PositionIsBeforeAnchor:
+            return false;
+        case PositionIsAfterAnchor:
+            return m_anchorNode-&gt;lastChild() == other.m_anchorNode;
+        }
+        break;
+    case PositionIsOffsetInAnchor:
+        switch (other.anchorType()) {
+        case PositionIsBeforeChildren:
+            ASSERT(!other.m_anchorNode-&gt;isTextNode());
+            return m_anchorNode == other.m_anchorNode &amp;&amp; !m_offset;
+        case PositionIsAfterChildren:
+            ASSERT(!other.m_anchorNode-&gt;isTextNode());
+            return m_anchorNode == other.m_anchorNode &amp;&amp; m_offset == static_cast&lt;int&gt;(other.m_anchorNode-&gt;countChildNodes());
+        case PositionIsOffsetInAnchor:
+            return m_anchorNode == other.m_anchorNode &amp;&amp; m_offset == other.m_offset;
+        case PositionIsBeforeAnchor:
+            return m_anchorNode-&gt;traverseToChildAt(m_offset) == other.m_anchorNode;
+        case PositionIsAfterAnchor:
+            return m_offset &amp;&amp; m_anchorNode-&gt;traverseToChildAt(m_offset - 1) == other.m_anchorNode;
+        }
+        break;
+    case PositionIsBeforeAnchor:
+        switch (other.anchorType()) {
+        case PositionIsBeforeChildren:
+            ASSERT(!other.m_anchorNode-&gt;isTextNode());
+            return m_anchorNode == other.m_anchorNode-&gt;firstChild();
+        case PositionIsAfterChildren:
+            ASSERT(!other.m_anchorNode-&gt;isTextNode());
+            return false;
+        case PositionIsOffsetInAnchor:
+            return m_anchorNode == other.m_anchorNode-&gt;traverseToChildAt(other.m_offset);
+        case PositionIsBeforeAnchor:
+            return m_anchorNode == other.m_anchorNode;
+        case PositionIsAfterAnchor:
+            return m_anchorNode-&gt;previousSibling() == other.m_anchorNode;
+        }
+        break;
+    case PositionIsAfterAnchor:
+        switch (other.anchorType()) {
+        case PositionIsBeforeChildren:
+            ASSERT(!other.m_anchorNode-&gt;isTextNode());
+            return false;
+        case PositionIsAfterChildren:
+            ASSERT(!other.m_anchorNode-&gt;isTextNode());
+            return m_anchorNode == other.m_anchorNode-&gt;lastChild();
+        case PositionIsOffsetInAnchor:
+            return other.m_offset &amp;&amp; m_anchorNode == other.m_anchorNode-&gt;traverseToChildAt(other.m_offset - 1);
+        case PositionIsBeforeAnchor:
+            return m_anchorNode-&gt;nextSibling() == other.m_anchorNode;
+        case PositionIsAfterAnchor:
+            return m_anchorNode == other.m_anchorNode;
+        }
+        break;
+    }
+
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(TREE_DEBUGGING)
</span></span></pre></div>
<a id="trunkSourceWebCoredomPositionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Position.h (192169 => 192170)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Position.h        2015-11-09 19:40:39 UTC (rev 192169)
+++ trunk/Source/WebCore/dom/Position.h        2015-11-09 20:11:30 UTC (rev 192170)
</span><span class="lines">@@ -207,7 +207,10 @@
</span><span class="cx">     void showAnchorTypeAndOffset() const;
</span><span class="cx">     void showTreeForThis() const;
</span><span class="cx"> #endif
</span><del>-    
</del><ins>+
+    // This is a tentative enhancement of operator== to account for different position types.
+    // FIXME: Combine this function with operator==
+    bool equals(const Position&amp;) const;
</ins><span class="cx"> private:
</span><span class="cx">     WEBCORE_EXPORT int offsetForPositionAfterAnchor() const;
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingCompositeEditCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/CompositeEditCommand.cpp (192169 => 192170)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/CompositeEditCommand.cpp        2015-11-09 19:40:39 UTC (rev 192169)
+++ trunk/Source/WebCore/editing/CompositeEditCommand.cpp        2015-11-09 20:11:30 UTC (rev 192170)
</span><span class="lines">@@ -1120,7 +1120,7 @@
</span><span class="cx"> void CompositeEditCommand::cleanupAfterDeletion(VisiblePosition destination)
</span><span class="cx"> {
</span><span class="cx">     VisiblePosition caretAfterDelete = endingSelection().visibleStart();
</span><del>-    if (caretAfterDelete != destination &amp;&amp; isStartOfParagraph(caretAfterDelete) &amp;&amp; isEndOfParagraph(caretAfterDelete)) {
</del><ins>+    if (!caretAfterDelete.equals(destination) &amp;&amp; isStartOfParagraph(caretAfterDelete) &amp;&amp; isEndOfParagraph(caretAfterDelete)) {
</ins><span class="cx">         // Note: We want the rightmost candidate.
</span><span class="cx">         Position position = caretAfterDelete.deepEquivalent().downstream();
</span><span class="cx">         Node* node = position.deprecatedNode();
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingVisiblePositioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/VisiblePosition.cpp (192169 => 192170)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/VisiblePosition.cpp        2015-11-09 19:40:39 UTC (rev 192169)
+++ trunk/Source/WebCore/editing/VisiblePosition.cpp        2015-11-09 20:11:30 UTC (rev 192170)
</span><span class="lines">@@ -743,6 +743,11 @@
</span><span class="cx">     return next.isNull() || !next.deepEquivalent().deprecatedNode()-&gt;isDescendantOf(node);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool VisiblePosition::equals(const VisiblePosition&amp; other) const
+{
+    return m_affinity == other.m_affinity &amp;&amp; m_deepPosition.equals(other.m_deepPosition);
+}
+
</ins><span class="cx"> }  // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(TREE_DEBUGGING)
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingVisiblePositionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/VisiblePosition.h (192169 => 192170)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/VisiblePosition.h        2015-11-09 19:40:39 UTC (rev 192169)
+++ trunk/Source/WebCore/editing/VisiblePosition.h        2015-11-09 20:11:30 UTC (rev 192170)
</span><span class="lines">@@ -100,6 +100,10 @@
</span><span class="cx">     // FIXME: navigation with transforms should be smarter.
</span><span class="cx">     WEBCORE_EXPORT int lineDirectionPointForBlockDirectionNavigation() const;
</span><span class="cx"> 
</span><ins>+    // This is a tentative enhancement of operator== to account for affinity.
+    // FIXME: Combine this function with operator==
+    bool equals(const VisiblePosition&amp;) const;
+
</ins><span class="cx"> #if ENABLE(TREE_DEBUGGING)
</span><span class="cx">     void debugPosition(const char* msg = &quot;&quot;) const;
</span><span class="cx">     void formatForDebugger(char* buffer, unsigned length) const;
</span></span></pre>
</div>
</div>

</body>
</html>