<!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>[180726] 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/180726">180726</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2015-02-26 21:51:31 -0800 (Thu, 26 Feb 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>isEditablePosition and related functions shouldn't move position out of table
https://bugs.webkit.org/show_bug.cgi?id=129200

Reviewed by Darin Adler.

Source/WebCore:

This patch removes the legacy editing position for elements display: table in its computed style.
Previously, we used (table, 0) and (table, !0) to denote positions immediately before and after
such an element for historical reasons. This forced us to update the style tree before computing
the editability of a position because we have to check the editability of the position outside
the element with display: table if the position was using such a legacy editing position.
e.g. if a table was not editable (contenteditable=false), the position before the table (table, 0)
should still be considered editable if the parent node of the table was editable.

This patch replaces such a legacy editing position by using modern position types:
PositionIsBeforeAnchor and PositionIsAfterAnchor.

No new tests since there should be no change in the user perceived editing operations.

* dom/Position.cpp:
(WebCore::Position::previous): Setup the node and the offset correctly when the original position's
type is PositionIsBeforeAnchor. Also return a position before or after node when the node we found
is &quot;atomic&quot; (e.g. input, img, br, etc...) or it's a table. This avoids creating a legacy editing
position inside a table.
(WebCore::Position::next): Ditto.
(WebCore::Position::atStartOfTree): Use atFirstEditingPositionForNode, which takes care of all types
of positions.
(WebCore::Position::atEndOfTree): Ditto.
(WebCore::Position::downstream): Return a position before a node instead of a legacy editing position
for an atomic element or a table element as done in the equivalent code in Position::upstream.
(WebCore::Position::isCandidate): Don't treat a position inside a table to be a candidate. e.g.
(table, 1) when there are more than two children of the table.

* dom/PositionIterator.cpp:
(WebCore::PositionIterator::operator Position): PositionIterator internally uses legacy editing
positions. So convert it to a modern position by returning a position before or after a table here.
* editing/ApplyBlockElementCommand.cpp:
(WebCore::ApplyBlockElementCommand::formatSelection): Check that the unsplittable element we found
is actually empty before executing the simple code path for an empty unsplittable element. Without
this check, block formatting a table element will fail.

* editing/htmlediting.cpp:
(WebCore::isEditablePosition): Use containerNode instead of deprecatedNode because the editability
of a position before or after an element is determined by its parent, not the element itself.
(WebCore::isAtUnsplittableElement): Ditto.
(WebCore::isRichlyEditablePosition): Ditto. Removed the code that moved the starting node out of
an element with display: table. This is the code removal for which this patch was made.
(WebCore::editableRootForPosition): Ditto.

LayoutTests:

Rebaselined a test. There is no visual difference.

* platform/mac/editing/inserting/5058163-1-expected.txt:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmaceditinginserting50581631expectedtxt">trunk/LayoutTests/platform/mac/editing/inserting/5058163-1-expected.txt</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="#trunkSourceWebCoredomPositionIteratorcpp">trunk/Source/WebCore/dom/PositionIterator.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingApplyBlockElementCommandcpp">trunk/Source/WebCore/editing/ApplyBlockElementCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditinghtmleditingcpp">trunk/Source/WebCore/editing/htmlediting.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditinghtmleditingh">trunk/Source/WebCore/editing/htmlediting.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (180725 => 180726)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-02-27 05:32:07 UTC (rev 180725)
+++ trunk/LayoutTests/ChangeLog        2015-02-27 05:51:31 UTC (rev 180726)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2015-02-26  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
+
+        isEditablePosition and related functions shouldn't move position out of table
+        https://bugs.webkit.org/show_bug.cgi?id=129200
+
+        Reviewed by Darin Adler.
+
+        Rebaselined a test. There is no visual difference.
+
+        * platform/mac/editing/inserting/5058163-1-expected.txt:
+
</ins><span class="cx"> 2015-02-26  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Win] More test expectation updates.
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmaceditinginserting50581631expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/editing/inserting/5058163-1-expected.txt (180725 => 180726)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/editing/inserting/5058163-1-expected.txt        2015-02-27 05:32:07 UTC (rev 180725)
+++ trunk/LayoutTests/platform/mac/editing/inserting/5058163-1-expected.txt        2015-02-27 05:51:31 UTC (rev 180726)
</span><span class="lines">@@ -13,9 +13,10 @@
</span><span class="cx">               RenderTableCell {TD} at (2,2) size 478x20 [r=0 c=0 rs=1 cs=1]
</span><span class="cx">                 RenderText {#text} at (1,1) size 476x18
</span><span class="cx">                   text run at (1,1) width 476: &quot;There should be two empty paragraphs after this table and before the next.&quot;
</span><del>-        RenderBlock (anonymous) at (0,26) size 784x36
</del><ins>+        RenderBlock {DIV} at (0,26) size 784x18
</ins><span class="cx">           RenderBR {BR} at (0,0) size 0x18
</span><del>-          RenderBR {BR} at (0,18) size 0x18
</del><ins>+        RenderBlock (anonymous) at (0,44) size 784x18
+          RenderBR {BR} at (0,0) size 0x18
</ins><span class="cx">         RenderTable {TABLE} at (0,62) size 280x26 [border: (1px solid #AAAAAA)]
</span><span class="cx">           RenderTableSection {TBODY} at (1,1) size 278x24
</span><span class="cx">             RenderTableRow {TR} at (0,2) size 278x20
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (180725 => 180726)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-02-27 05:32:07 UTC (rev 180725)
+++ trunk/Source/WebCore/ChangeLog        2015-02-27 05:51:31 UTC (rev 180726)
</span><span class="lines">@@ -1,3 +1,53 @@
</span><ins>+2015-02-26  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
+
+        isEditablePosition and related functions shouldn't move position out of table
+        https://bugs.webkit.org/show_bug.cgi?id=129200
+
+        Reviewed by Darin Adler.
+
+        This patch removes the legacy editing position for elements display: table in its computed style.
+        Previously, we used (table, 0) and (table, !0) to denote positions immediately before and after
+        such an element for historical reasons. This forced us to update the style tree before computing
+        the editability of a position because we have to check the editability of the position outside
+        the element with display: table if the position was using such a legacy editing position.
+        e.g. if a table was not editable (contenteditable=false), the position before the table (table, 0)
+        should still be considered editable if the parent node of the table was editable.
+
+        This patch replaces such a legacy editing position by using modern position types:
+        PositionIsBeforeAnchor and PositionIsAfterAnchor.
+
+        No new tests since there should be no change in the user perceived editing operations.
+
+        * dom/Position.cpp:
+        (WebCore::Position::previous): Setup the node and the offset correctly when the original position's
+        type is PositionIsBeforeAnchor. Also return a position before or after node when the node we found
+        is &quot;atomic&quot; (e.g. input, img, br, etc...) or it's a table. This avoids creating a legacy editing
+        position inside a table.
+        (WebCore::Position::next): Ditto.
+        (WebCore::Position::atStartOfTree): Use atFirstEditingPositionForNode, which takes care of all types
+        of positions.
+        (WebCore::Position::atEndOfTree): Ditto.
+        (WebCore::Position::downstream): Return a position before a node instead of a legacy editing position
+        for an atomic element or a table element as done in the equivalent code in Position::upstream.
+        (WebCore::Position::isCandidate): Don't treat a position inside a table to be a candidate. e.g.
+        (table, 1) when there are more than two children of the table.
+
+        * dom/PositionIterator.cpp:
+        (WebCore::PositionIterator::operator Position): PositionIterator internally uses legacy editing
+        positions. So convert it to a modern position by returning a position before or after a table here.
+        * editing/ApplyBlockElementCommand.cpp:
+        (WebCore::ApplyBlockElementCommand::formatSelection): Check that the unsplittable element we found
+        is actually empty before executing the simple code path for an empty unsplittable element. Without
+        this check, block formatting a table element will fail.
+
+        * editing/htmlediting.cpp:
+        (WebCore::isEditablePosition): Use containerNode instead of deprecatedNode because the editability
+        of a position before or after an element is determined by its parent, not the element itself.
+        (WebCore::isAtUnsplittableElement): Ditto.
+        (WebCore::isRichlyEditablePosition): Ditto. Removed the code that moved the starting node out of
+        an element with display: table. This is the code removal for which this patch was made.
+        (WebCore::editableRootForPosition): Ditto.
+
</ins><span class="cx"> 2015-02-26  Timothy Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Implement &lt;attachment&gt; element appearance on Mac
</span></span></pre></div>
<a id="trunkSourceWebCoredomPositioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Position.cpp (180725 => 180726)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Position.cpp        2015-02-27 05:32:07 UTC (rev 180725)
+++ trunk/Source/WebCore/dom/Position.cpp        2015-02-27 05:51:31 UTC (rev 180726)
</span><span class="lines">@@ -308,6 +308,11 @@
</span><span class="cx">     // FIXME: Negative offsets shouldn't be allowed. We should catch this earlier.
</span><span class="cx">     ASSERT(offset &gt;= 0);
</span><span class="cx"> 
</span><ins>+    if (anchorType() == PositionIsBeforeAnchor) {
+        node = containerNode();
+        offset = computeOffsetInContainerNode();
+    }
+
</ins><span class="cx">     if (offset &gt; 0) {
</span><span class="cx">         if (Node* child = node-&gt;traverseToChildAt(offset - 1))
</span><span class="cx">             return lastPositionInOrAfterNode(child);
</span><span class="lines">@@ -331,6 +336,13 @@
</span><span class="cx">     if (!parent)
</span><span class="cx">         return *this;
</span><span class="cx"> 
</span><ins>+    if (positionBeforeOrAfterNodeIsCandidate(node))
+        return positionBeforeNode(node);
+
+    Node* previousSibling = node-&gt;previousSibling();
+    if (previousSibling &amp;&amp; positionBeforeOrAfterNodeIsCandidate(previousSibling))
+        return positionAfterNode(previousSibling);
+
</ins><span class="cx">     return createLegacyEditingPosition(parent, node-&gt;computeNodeIndex());
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -346,6 +358,11 @@
</span><span class="cx">     // FIXME: Negative offsets shouldn't be allowed. We should catch this earlier.
</span><span class="cx">     ASSERT(offset &gt;= 0);
</span><span class="cx"> 
</span><ins>+    if (anchorType() == PositionIsAfterAnchor) {
+        node = containerNode();
+        offset = computeOffsetInContainerNode();
+    }
+
</ins><span class="cx">     Node* child = node-&gt;traverseToChildAt(offset);
</span><span class="cx">     if (child || (!node-&gt;hasChildNodes() &amp;&amp; offset &lt; lastOffsetForEditing(node))) {
</span><span class="cx">         if (child)
</span><span class="lines">@@ -363,6 +380,13 @@
</span><span class="cx">     if (!parent)
</span><span class="cx">         return *this;
</span><span class="cx"> 
</span><ins>+    if (isRenderedTable(node) || editingIgnoresContent(node))
+        return positionAfterNode(node);
+
+    Node* nextSibling = node-&gt;nextSibling();
+    if (nextSibling &amp;&amp; positionBeforeOrAfterNodeIsCandidate(nextSibling))
+        return positionBeforeNode(nextSibling);
+
</ins><span class="cx">     return createLegacyEditingPosition(parent, node-&gt;computeNodeIndex() + 1);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -452,14 +476,14 @@
</span><span class="cx"> {
</span><span class="cx">     if (isNull())
</span><span class="cx">         return true;
</span><del>-    return !findParent(deprecatedNode()) &amp;&amp; m_offset &lt;= 0;
</del><ins>+    return !findParent(containerNode()) &amp;&amp; atFirstEditingPositionForNode();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool Position::atEndOfTree() const
</span><span class="cx"> {
</span><span class="cx">     if (isNull())
</span><span class="cx">         return true;
</span><del>-    return !findParent(deprecatedNode()) &amp;&amp; m_offset &gt;= lastOffsetForEditing(deprecatedNode());
</del><ins>+    return !findParent(containerNode()) &amp;&amp; atLastEditingPositionForNode();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // return first preceding DOM position rendered at a different location, or &quot;this&quot;
</span><span class="lines">@@ -754,7 +778,7 @@
</span><span class="cx">         // Return position before tables and nodes which have content that can be ignored.
</span><span class="cx">         if (editingIgnoresContent(currentNode) || isRenderedTable(currentNode)) {
</span><span class="cx">             if (currentPos.offsetInLeafNode() &lt;= renderer-&gt;caretMinOffset())
</span><del>-                return createLegacyEditingPosition(currentNode, renderer-&gt;caretMinOffset());
</del><ins>+                return positionBeforeNode(currentNode);
</ins><span class="cx">             continue;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -931,8 +955,11 @@
</span><span class="cx">     if (is&lt;RenderText&gt;(*renderer))
</span><span class="cx">         return !nodeIsUserSelectNone(deprecatedNode()) &amp;&amp; downcast&lt;RenderText&gt;(*renderer).containsCaretOffset(m_offset);
</span><span class="cx"> 
</span><del>-    if (isRenderedTable(deprecatedNode()) || editingIgnoresContent(deprecatedNode()))
-        return (atFirstEditingPositionForNode() || atLastEditingPositionForNode()) &amp;&amp; !nodeIsUserSelectNone(deprecatedNode()-&gt;parentNode());
</del><ins>+    if (positionBeforeOrAfterNodeIsCandidate(deprecatedNode())) {
+        return ((atFirstEditingPositionForNode() &amp;&amp; m_anchorType == PositionIsBeforeAnchor)
+            || (atLastEditingPositionForNode() &amp;&amp; m_anchorType == PositionIsAfterAnchor))
+            &amp;&amp; !nodeIsUserSelectNone(deprecatedNode()-&gt;parentNode());
+    }
</ins><span class="cx"> 
</span><span class="cx">     if (m_anchorNode-&gt;hasTagName(htmlTag))
</span><span class="cx">         return false;
</span></span></pre></div>
<a id="trunkSourceWebCoredomPositionIteratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/PositionIterator.cpp (180725 => 180726)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/PositionIterator.cpp        2015-02-27 05:32:07 UTC (rev 180725)
+++ trunk/Source/WebCore/dom/PositionIterator.cpp        2015-02-27 05:51:31 UTC (rev 180726)
</span><span class="lines">@@ -43,10 +43,12 @@
</span><span class="cx">     if (m_nodeAfterPositionInAnchor) {
</span><span class="cx">         ASSERT(m_nodeAfterPositionInAnchor-&gt;parentNode() == m_anchorNode);
</span><span class="cx">         // FIXME: This check is inadaquete because any ancestor could be ignored by editing
</span><del>-        if (editingIgnoresContent(m_nodeAfterPositionInAnchor-&gt;parentNode()))
</del><ins>+        if (positionBeforeOrAfterNodeIsCandidate(m_anchorNode))
</ins><span class="cx">             return positionBeforeNode(m_anchorNode);
</span><span class="cx">         return positionInParentBeforeNode(m_nodeAfterPositionInAnchor);
</span><span class="cx">     }
</span><ins>+    if (positionBeforeOrAfterNodeIsCandidate(m_anchorNode))
+        return atStartOfNode() ? positionBeforeNode(m_anchorNode) : positionAfterNode(m_anchorNode);
</ins><span class="cx">     if (m_anchorNode-&gt;hasChildNodes())
</span><span class="cx">         return lastPositionInOrAfterNode(m_anchorNode);
</span><span class="cx">     return createLegacyEditingPosition(m_anchorNode, m_offsetInAnchor);
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingApplyBlockElementCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/ApplyBlockElementCommand.cpp (180725 => 180726)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/ApplyBlockElementCommand.cpp        2015-02-27 05:32:07 UTC (rev 180725)
+++ trunk/Source/WebCore/editing/ApplyBlockElementCommand.cpp        2015-02-27 05:51:31 UTC (rev 180726)
</span><span class="lines">@@ -103,7 +103,7 @@
</span><span class="cx">     // Special case empty unsplittable elements because there's nothing to split
</span><span class="cx">     // and there's nothing to move.
</span><span class="cx">     Position start = startOfSelection.deepEquivalent().downstream();
</span><del>-    if (isAtUnsplittableElement(start)) {
</del><ins>+    if (isAtUnsplittableElement(start) &amp;&amp; startOfParagraph(start) == endOfParagraph(endOfSelection)) {
</ins><span class="cx">         RefPtr&lt;Element&gt; blockquote = createBlockElement();
</span><span class="cx">         insertNodeAt(blockquote, start);
</span><span class="cx">         RefPtr&lt;Element&gt; placeholder = createBreakElement(document());
</span></span></pre></div>
<a id="trunkSourceWebCoreeditinghtmleditingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/htmlediting.cpp (180725 => 180726)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/htmlediting.cpp        2015-02-27 05:32:07 UTC (rev 180725)
+++ trunk/Source/WebCore/editing/htmlediting.cpp        2015-02-27 05:51:31 UTC (rev 180726)
</span><span class="lines">@@ -143,7 +143,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool isEditablePosition(const Position&amp; p, EditableType editableType, EUpdateStyle updateStyle)
</span><span class="cx"> {
</span><del>-    Node* node = p.deprecatedNode();
</del><ins>+    Node* node = p.containerNode();
</ins><span class="cx">     if (!node)
</span><span class="cx">         return false;
</span><span class="cx">     if (updateStyle == UpdateStyle)
</span><span class="lines">@@ -151,28 +151,22 @@
</span><span class="cx">     else
</span><span class="cx">         ASSERT(updateStyle == DoNotUpdateStyle);
</span><span class="cx"> 
</span><del>-    if (node-&gt;renderer() &amp;&amp; node-&gt;renderer()-&gt;isTable())
-        node = node-&gt;parentNode();
-
</del><span class="cx">     return node-&gt;hasEditableStyle(editableType);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool isAtUnsplittableElement(const Position&amp; pos)
</span><span class="cx"> {
</span><del>-    Node* node = pos.deprecatedNode();
</del><ins>+    Node* node = pos.containerNode();
</ins><span class="cx">     return (node == editableRootForPosition(pos) || node == enclosingNodeOfType(pos, &amp;isTableCell));
</span><span class="cx"> }
</span><span class="cx">     
</span><span class="cx">     
</span><span class="cx"> bool isRichlyEditablePosition(const Position&amp; p, EditableType editableType)
</span><span class="cx"> {
</span><del>-    Node* node = p.deprecatedNode();
</del><ins>+    Node* node = p.containerNode();
</ins><span class="cx">     if (!node)
</span><span class="cx">         return false;
</span><del>-        
-    if (node-&gt;renderer() &amp;&amp; node-&gt;renderer()-&gt;isTable())
-        node = node-&gt;parentNode();
-    
</del><ins>+
</ins><span class="cx">     return node-&gt;hasRichlyEditableStyle(editableType);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -181,10 +175,7 @@
</span><span class="cx">     Node* node = p.containerNode();
</span><span class="cx">     if (!node)
</span><span class="cx">         return 0;
</span><del>-        
-    if (node-&gt;renderer() &amp;&amp; node-&gt;renderer()-&gt;isTable())
-        node = node-&gt;parentNode();
-    
</del><ins>+
</ins><span class="cx">     return node-&gt;rootEditableElement(editableType);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreeditinghtmleditingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/htmlediting.h (180725 => 180726)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/htmlediting.h        2015-02-27 05:32:07 UTC (rev 180725)
+++ trunk/Source/WebCore/editing/htmlediting.h        2015-02-27 05:51:31 UTC (rev 180726)
</span><span class="lines">@@ -120,6 +120,11 @@
</span><span class="cx"> bool areIdenticalElements(const Node*, const Node*);
</span><span class="cx"> bool isNonTableCellHTMLBlockElement(const Node*);
</span><span class="cx"> 
</span><ins>+inline bool positionBeforeOrAfterNodeIsCandidate(Node* node)
+{
+    return isRenderedTable(node) || editingIgnoresContent(node);
+}
+
</ins><span class="cx"> WEBCORE_EXPORT TextDirection directionOfEnclosingBlock(const Position&amp;);
</span><span class="cx"> 
</span><span class="cx"> // -------------------------------------------------------------------------
</span></span></pre>
</div>
</div>

</body>
</html>