<!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>[200931] trunk/Source</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/200931">200931</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2016-05-15 15:08:52 -0700 (Sun, 15 May 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>More CTTE and other cleanups for HTML editing header
https://bugs.webkit.org/show_bug.cgi?id=157722
Reviewed by Chris Dumez.
Source/WebCore:
These changes are mostly things Chris asked for in his review of my last patch
or other related style and small efficiency improvements.
- using nullptr instead of 0
- using is<Text> instead of isTextNode and is<> instead of hasTagName
- changing argument type of functions like editingIgnoresContent to a reference
- using { } instead of constructor calls for classes like Position
- using words like position intead of abbreviations like pos
- using auto rather than explicit types
- rename functions that return true for HTMLElement to express that in the function names
* dom/Position.cpp:
(WebCore::nextRenderedEditable): nullptr
(WebCore::previousRenderedEditable): nullptr
(WebCore::Position::Position): is<>, reference
(WebCore::Position::moveToPosition): reference
(WebCore::Position::offsetForPositionAfterAnchor): Added a null assertion and
null check that replaces the one that used to be in lastOffsetForEditing.
(WebCore::Position::parentAnchoredEquivalent): { }, reference
(WebCore::Position::computeNodeBeforePosition): nullptr
(WebCore::Position::computeNodeAfterPosition): nullptr
(WebCore::Position::anchorTypeForLegacyEditingPosition): reference
(WebCore::Position::previous): reference
(WebCore::Position::next): reference
(WebCore::Position::parentEditingBoundary): nullptr
(WebCore::Position::previousCharacterPosition): { }, pos -> position
(WebCore::Position::nextCharacterPosition): { }, pos -> position
(WebCore::endsOfNodeAreVisuallyDistinctPositions): reference
(WebCore::Position::upstream): { }, pos -> position
(WebCore::Position::downstream): { }, pos -> position
(WebCore::Position::rootUserSelectAllForNode): nullptr
(WebCore::Position::isCandidate): auto, reference, is<>
(WebCore::Position::rendersInDifferentPosition): pos -> position, auto, is<>
(WebCore::Position::leadingWhitespacePosition): { }, is<>
(WebCore::Position::trailingWhitespacePosition): { }
(WebCore::Position::getInlineBoxAndOffset): reference
(WebCore::Position::equals): reference, is<>
* dom/PositionIterator.cpp:
(WebCore::PositionIterator::operator Position): reference
(WebCore::PositionIterator::isCandidate): reference
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyRelativeFontStyleChange): is<>
(WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange): is<>, reference
(WebCore::ApplyStyleCommand::removeConflictingInlineStyleFromRun): reference
(WebCore::ApplyStyleCommand::removeInlineStyle): auto, is<>, reference
(WebCore::ApplyStyleCommand::nodeFullySelected): is<>
(WebCore::ApplyStyleCommand::nodeFullyUnselected): is<>
(WebCore::ApplyStyleCommand::splitTextAtStart): is<>
(WebCore::ApplyStyleCommand::splitTextElementAtStart): is<>
(WebCore::ApplyStyleCommand::splitTextElementAtEnd): is<>
(WebCore::ApplyStyleCommand::isValidCaretPositionInTextNode): is<>
(WebCore::ApplyStyleCommand::surroundNodeRangeWithElement): Removed unneeded
is<Element> calls before calling areIdenticalElements.
(WebCore::ApplyStyleCommand::positionToComputeInlineStyleChange): Tightened
up logic for the loop to avoid redundant checks.
(WebCore::ApplyStyleCommand::applyInlineStyleChange): auto
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::insertNodeAt): reference
(WebCore::CompositeEditCommand::appendNode): reference
(WebCore::CompositeEditCommand::moveParagraphs): isListHTMLElement
* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::handleGeneralDelete): reference
* editing/FormatBlockCommand.cpp: Fixed order of includes.
(WebCore::enclosingBlockToSplitTreeTo): isListHTMLElement
* editing/InsertParagraphSeparatorCommand.cpp:
(WebCore::InsertParagraphSeparatorCommand::doApply): reference
* editing/ModifySelectionListLevel.cpp:
(WebCore::getStartEndListChildren): isListHTMLElement
(WebCore::IncreaseSelectionListLevelCommand::doApply):isListHTMLElement
(WebCore::canDecreaseListLevel):isListHTMLElement
* editing/RemoveNodeCommand.cpp: Removed unneeded include.
* editing/ReplaceNodeWithSpanCommand.cpp:
(WebCore::ReplaceNodeWithSpanCommand::doApply): Use HTMLSpanElement::create.
* editing/ReplaceSelectionCommand.cpp:
(WebCore::isInterchangeNewlineNode): is<>, downcast<>
(WebCore::isInterchangeConvertedSpaceSpan): is<>, downcast<>
(WebCore::positionAvoidingPrecedingNodes): pos -> position, reference
(WebCore::ReplaceSelectionCommand::doApply): isListHTMLElement
(WebCore::ReplaceSelectionCommand::insertAsListItems): isListHTMLElement
* editing/SpellChecker.cpp: Removed unneeded include.
* editing/TextIterator.cpp:
(WebCore::SimplifiedBackwardsTextIterator::advance): reference
* editing/VisibleSelection.cpp:
(WebCore::VisibleSelection::selectionFromContentsOfNode): reference
* editing/VisibleUnits.cpp:
(WebCore::previousLinePosition): reference
(WebCore::nextLinePosition): reference
(WebCore::findStartOfParagraph): reference
(WebCore::findEndOfParagraph): reference
* editing/htmlediting.cpp:
(WebCore::canHaveChildrenForEditing): Moved here from header file so we don't
have to include "Text.h". Not critical to inline this.
(WebCore::isAtomicNode): reference
(WebCore::lastOffsetForEditing): reference
(WebCore::stringWithRebalancedWhitespace): Changed to use StringBuilder instead
of Vector<UChar> so this won't turn 8-bit strings into 16-bit strings. Changed
to not use the StringBuilder at all until we encounter a character that needs
to be changed.
(WebCore::isSpecialHTMLElement): Renamed to make it clear that it only can return
true for a Node that is an HTMLElement.
(WebCore::firstInSpecialElement): isSpecialHTMLElement
(WebCore::lastInSpecialElement): isSpecialHTMLElement
(WebCore::isListHTMLElement): Renamed to make it clear that it can only return
true for a Node that is an HTMLElement.
(WebCore::isListItem): isListHTMLElement, is<>
(WebCore::enclosingNodeOfType): p -> position, nullptr
(WebCore::highestEnclosingNodeOfType): p -> position
(WebCore::enclosingListChild): isListHTMLElement, is<>
(WebCore::embeddedSublist): isListHTMLElement
(WebCore::appendedSublist):isListHTMLElement
(WebCore::caretMaxOffset): is<>
(WebCore::caretRendersInsideNode): changed to take a reference
(WebCore::rendererForCaretPainting): reference
* editing/htmlediting.h: Updated for name changes and type changes above.
* editing/markup.cpp:
(WebCore::StyledMarkupAccumulator::traverseNodesForSerialization): reference
(WebCore::highestAncestorToWrapMarkup): auto, reference, isListHTMLElement
* html/HTMLSpanElement.cpp:
(WebCore::HTMLSpanElement::create): Added overload that does not require a tag name.
* html/HTMLSpanElement.h: Ditto.
* page/DOMSelection.cpp: Removed unneeded includes.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::localCaretRect): reference
Source/WebKit/ios:
* WebCoreSupport/WebFrameIOS.mm:
(-[WebFrame previousUnperturbedDictationResultBoundaryFromPosition:]): auto
(-[WebFrame nextUnperturbedDictationResultBoundaryFromPosition:]): auto</pre>
<h3>Modified Paths</h3>
<ul>
<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="#trunkSourceWebCoreeditingApplyStyleCommandcpp">trunk/Source/WebCore/editing/ApplyStyleCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingApplyStyleCommandh">trunk/Source/WebCore/editing/ApplyStyleCommand.h</a></li>
<li><a href="#trunkSourceWebCoreeditingCompositeEditCommandcpp">trunk/Source/WebCore/editing/CompositeEditCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingDeleteSelectionCommandcpp">trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingFormatBlockCommandcpp">trunk/Source/WebCore/editing/FormatBlockCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingInsertParagraphSeparatorCommandcpp">trunk/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingModifySelectionListLevelcpp">trunk/Source/WebCore/editing/ModifySelectionListLevel.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingRemoveNodeCommandcpp">trunk/Source/WebCore/editing/RemoveNodeCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingReplaceNodeWithSpanCommandcpp">trunk/Source/WebCore/editing/ReplaceNodeWithSpanCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingReplaceSelectionCommandcpp">trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingSpellCheckercpp">trunk/Source/WebCore/editing/SpellChecker.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingTextIteratorcpp">trunk/Source/WebCore/editing/TextIterator.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingVisibleSelectioncpp">trunk/Source/WebCore/editing/VisibleSelection.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingVisibleUnitscpp">trunk/Source/WebCore/editing/VisibleUnits.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>
<li><a href="#trunkSourceWebCoreeditingmarkupcpp">trunk/Source/WebCore/editing/markup.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLSpanElementcpp">trunk/Source/WebCore/html/HTMLSpanElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLSpanElementh">trunk/Source/WebCore/html/HTMLSpanElement.h</a></li>
<li><a href="#trunkSourceWebCorepageDOMSelectioncpp">trunk/Source/WebCore/page/DOMSelection.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxcpp">trunk/Source/WebCore/rendering/RenderBox.cpp</a></li>
<li><a href="#trunkSourceWebKitiosChangeLog">trunk/Source/WebKit/ios/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitiosWebCoreSupportWebFrameIOSmm">trunk/Source/WebKit/ios/WebCoreSupport/WebFrameIOS.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (200930 => 200931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-05-15 22:05:56 UTC (rev 200930)
+++ trunk/Source/WebCore/ChangeLog        2016-05-15 22:08:52 UTC (rev 200931)
</span><span class="lines">@@ -1,3 +1,154 @@
</span><ins>+2016-05-15 Darin Adler <darin@apple.com>
+
+ More CTTE and other cleanups for HTML editing header
+ https://bugs.webkit.org/show_bug.cgi?id=157722
+
+ Reviewed by Chris Dumez.
+
+ These changes are mostly things Chris asked for in his review of my last patch
+ or other related style and small efficiency improvements.
+
+ - using nullptr instead of 0
+ - using is<Text> instead of isTextNode and is<> instead of hasTagName
+ - changing argument type of functions like editingIgnoresContent to a reference
+ - using { } instead of constructor calls for classes like Position
+ - using words like position intead of abbreviations like pos
+ - using auto rather than explicit types
+ - rename functions that return true for HTMLElement to express that in the function names
+
+ * dom/Position.cpp:
+ (WebCore::nextRenderedEditable): nullptr
+ (WebCore::previousRenderedEditable): nullptr
+ (WebCore::Position::Position): is<>, reference
+ (WebCore::Position::moveToPosition): reference
+ (WebCore::Position::offsetForPositionAfterAnchor): Added a null assertion and
+ null check that replaces the one that used to be in lastOffsetForEditing.
+ (WebCore::Position::parentAnchoredEquivalent): { }, reference
+ (WebCore::Position::computeNodeBeforePosition): nullptr
+ (WebCore::Position::computeNodeAfterPosition): nullptr
+ (WebCore::Position::anchorTypeForLegacyEditingPosition): reference
+ (WebCore::Position::previous): reference
+ (WebCore::Position::next): reference
+ (WebCore::Position::parentEditingBoundary): nullptr
+ (WebCore::Position::previousCharacterPosition): { }, pos -> position
+ (WebCore::Position::nextCharacterPosition): { }, pos -> position
+ (WebCore::endsOfNodeAreVisuallyDistinctPositions): reference
+ (WebCore::Position::upstream): { }, pos -> position
+ (WebCore::Position::downstream): { }, pos -> position
+ (WebCore::Position::rootUserSelectAllForNode): nullptr
+ (WebCore::Position::isCandidate): auto, reference, is<>
+ (WebCore::Position::rendersInDifferentPosition): pos -> position, auto, is<>
+ (WebCore::Position::leadingWhitespacePosition): { }, is<>
+ (WebCore::Position::trailingWhitespacePosition): { }
+ (WebCore::Position::getInlineBoxAndOffset): reference
+ (WebCore::Position::equals): reference, is<>
+
+ * dom/PositionIterator.cpp:
+ (WebCore::PositionIterator::operator Position): reference
+ (WebCore::PositionIterator::isCandidate): reference
+
+ * editing/ApplyStyleCommand.cpp:
+ (WebCore::ApplyStyleCommand::applyRelativeFontStyleChange): is<>
+ (WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange): is<>, reference
+ (WebCore::ApplyStyleCommand::removeConflictingInlineStyleFromRun): reference
+ (WebCore::ApplyStyleCommand::removeInlineStyle): auto, is<>, reference
+ (WebCore::ApplyStyleCommand::nodeFullySelected): is<>
+ (WebCore::ApplyStyleCommand::nodeFullyUnselected): is<>
+ (WebCore::ApplyStyleCommand::splitTextAtStart): is<>
+ (WebCore::ApplyStyleCommand::splitTextElementAtStart): is<>
+ (WebCore::ApplyStyleCommand::splitTextElementAtEnd): is<>
+ (WebCore::ApplyStyleCommand::isValidCaretPositionInTextNode): is<>
+ (WebCore::ApplyStyleCommand::surroundNodeRangeWithElement): Removed unneeded
+ is<Element> calls before calling areIdenticalElements.
+ (WebCore::ApplyStyleCommand::positionToComputeInlineStyleChange): Tightened
+ up logic for the loop to avoid redundant checks.
+ (WebCore::ApplyStyleCommand::applyInlineStyleChange): auto
+
+ * editing/CompositeEditCommand.cpp:
+ (WebCore::CompositeEditCommand::insertNodeAt): reference
+ (WebCore::CompositeEditCommand::appendNode): reference
+ (WebCore::CompositeEditCommand::moveParagraphs): isListHTMLElement
+
+ * editing/DeleteSelectionCommand.cpp:
+ (WebCore::DeleteSelectionCommand::handleGeneralDelete): reference
+
+ * editing/FormatBlockCommand.cpp: Fixed order of includes.
+ (WebCore::enclosingBlockToSplitTreeTo): isListHTMLElement
+
+ * editing/InsertParagraphSeparatorCommand.cpp:
+ (WebCore::InsertParagraphSeparatorCommand::doApply): reference
+
+ * editing/ModifySelectionListLevel.cpp:
+ (WebCore::getStartEndListChildren): isListHTMLElement
+ (WebCore::IncreaseSelectionListLevelCommand::doApply):isListHTMLElement
+ (WebCore::canDecreaseListLevel):isListHTMLElement
+
+ * editing/RemoveNodeCommand.cpp: Removed unneeded include.
+
+ * editing/ReplaceNodeWithSpanCommand.cpp:
+ (WebCore::ReplaceNodeWithSpanCommand::doApply): Use HTMLSpanElement::create.
+
+ * editing/ReplaceSelectionCommand.cpp:
+ (WebCore::isInterchangeNewlineNode): is<>, downcast<>
+ (WebCore::isInterchangeConvertedSpaceSpan): is<>, downcast<>
+ (WebCore::positionAvoidingPrecedingNodes): pos -> position, reference
+ (WebCore::ReplaceSelectionCommand::doApply): isListHTMLElement
+ (WebCore::ReplaceSelectionCommand::insertAsListItems): isListHTMLElement
+
+ * editing/SpellChecker.cpp: Removed unneeded include.
+
+ * editing/TextIterator.cpp:
+ (WebCore::SimplifiedBackwardsTextIterator::advance): reference
+
+ * editing/VisibleSelection.cpp:
+ (WebCore::VisibleSelection::selectionFromContentsOfNode): reference
+
+ * editing/VisibleUnits.cpp:
+ (WebCore::previousLinePosition): reference
+ (WebCore::nextLinePosition): reference
+ (WebCore::findStartOfParagraph): reference
+ (WebCore::findEndOfParagraph): reference
+
+ * editing/htmlediting.cpp:
+ (WebCore::canHaveChildrenForEditing): Moved here from header file so we don't
+ have to include "Text.h". Not critical to inline this.
+ (WebCore::isAtomicNode): reference
+ (WebCore::lastOffsetForEditing): reference
+ (WebCore::stringWithRebalancedWhitespace): Changed to use StringBuilder instead
+ of Vector<UChar> so this won't turn 8-bit strings into 16-bit strings. Changed
+ to not use the StringBuilder at all until we encounter a character that needs
+ to be changed.
+ (WebCore::isSpecialHTMLElement): Renamed to make it clear that it only can return
+ true for a Node that is an HTMLElement.
+ (WebCore::firstInSpecialElement): isSpecialHTMLElement
+ (WebCore::lastInSpecialElement): isSpecialHTMLElement
+ (WebCore::isListHTMLElement): Renamed to make it clear that it can only return
+ true for a Node that is an HTMLElement.
+ (WebCore::isListItem): isListHTMLElement, is<>
+ (WebCore::enclosingNodeOfType): p -> position, nullptr
+ (WebCore::highestEnclosingNodeOfType): p -> position
+ (WebCore::enclosingListChild): isListHTMLElement, is<>
+ (WebCore::embeddedSublist): isListHTMLElement
+ (WebCore::appendedSublist):isListHTMLElement
+ (WebCore::caretMaxOffset): is<>
+ (WebCore::caretRendersInsideNode): changed to take a reference
+ (WebCore::rendererForCaretPainting): reference
+
+ * editing/htmlediting.h: Updated for name changes and type changes above.
+
+ * editing/markup.cpp:
+ (WebCore::StyledMarkupAccumulator::traverseNodesForSerialization): reference
+ (WebCore::highestAncestorToWrapMarkup): auto, reference, isListHTMLElement
+
+ * html/HTMLSpanElement.cpp:
+ (WebCore::HTMLSpanElement::create): Added overload that does not require a tag name.
+ * html/HTMLSpanElement.h: Ditto.
+
+ * page/DOMSelection.cpp: Removed unneeded includes.
+
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::localCaretRect): reference
+
</ins><span class="cx"> 2016-05-15 Commit Queue <commit-queue@webkit.org>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rolling out r200925.
</span></span></pre></div>
<a id="trunkSourceWebCoredomPositioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Position.cpp (200930 => 200931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Position.cpp        2016-05-15 22:05:56 UTC (rev 200930)
+++ trunk/Source/WebCore/dom/Position.cpp        2016-05-15 22:08:52 UTC (rev 200931)
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx"> #include <stdio.h>
</span><span class="cx"> #include <wtf/text/CString.h>
</span><span class="cx"> #include <wtf/unicode/CharacterNames.h>
</span><ins>+
</ins><span class="cx"> #if ENABLE(TREE_DEBUGGING)
</span><span class="cx"> #include <wtf/text/StringBuilder.h>
</span><span class="cx"> #endif
</span><span class="lines">@@ -79,7 +80,7 @@
</span><span class="cx"> if (hasInlineBoxWrapper(*renderer))
</span><span class="cx"> return node;
</span><span class="cx"> }
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static Node* previousRenderedEditable(Node* node)
</span><span class="lines">@@ -91,7 +92,7 @@
</span><span class="cx"> if (hasInlineBoxWrapper(*renderer))
</span><span class="cx"> return node;
</span><span class="cx"> }
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Position::Position(PassRefPtr<Node> anchorNode, LegacyEditingOffset offset)
</span><span class="lines">@@ -114,7 +115,7 @@
</span><span class="cx"> ASSERT(!m_anchorNode || !m_anchorNode->isPseudoElement());
</span><span class="cx"> ASSERT(anchorType != PositionIsOffsetInAnchor);
</span><span class="cx"> ASSERT(!((anchorType == PositionIsBeforeChildren || anchorType == PositionIsAfterChildren)
</span><del>- && (m_anchorNode->isTextNode() || editingIgnoresContent(m_anchorNode.get()))));
</del><ins>+ && (is<Text>(*m_anchorNode) || editingIgnoresContent(*m_anchorNode))));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Position::Position(PassRefPtr<Node> anchorNode, int offset, AnchorType anchorType)
</span><span class="lines">@@ -123,7 +124,7 @@
</span><span class="cx"> , m_anchorType(anchorType)
</span><span class="cx"> , m_isLegacyEditingPosition(false)
</span><span class="cx"> {
</span><del>- ASSERT(!m_anchorNode || !editingIgnoresContent(m_anchorNode.get()) || !m_anchorNode->isShadowRoot());
</del><ins>+ ASSERT(!m_anchorNode || !editingIgnoresContent(*m_anchorNode) || !m_anchorNode->isShadowRoot());
</ins><span class="cx"> ASSERT(!m_anchorNode || !m_anchorNode->isPseudoElement());
</span><span class="cx"> ASSERT(anchorType == PositionIsOffsetInAnchor);
</span><span class="cx"> }
</span><span class="lines">@@ -139,7 +140,7 @@
</span><span class="cx">
</span><span class="cx"> void Position::moveToPosition(PassRefPtr<Node> node, int offset)
</span><span class="cx"> {
</span><del>- ASSERT(!editingIgnoresContent(node.get()));
</del><ins>+ ASSERT(!editingIgnoresContent(*node));
</ins><span class="cx"> ASSERT(anchorType() == PositionIsOffsetInAnchor || m_isLegacyEditingPosition);
</span><span class="cx"> m_anchorNode = node;
</span><span class="cx"> m_offset = offset;
</span><span class="lines">@@ -214,7 +215,8 @@
</span><span class="cx"> {
</span><span class="cx"> ASSERT(m_anchorType == PositionIsAfterAnchor || m_anchorType == PositionIsAfterChildren);
</span><span class="cx"> ASSERT(!m_isLegacyEditingPosition);
</span><del>- return lastOffsetForEditing(*m_anchorNode);
</del><ins>+ ASSERT(m_anchorNode);
+ return m_anchorNode ? lastOffsetForEditing(*m_anchorNode) : 0;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Neighbor-anchored positions are invalid DOM positions, so they need to be
</span><span class="lines">@@ -222,33 +224,33 @@
</span><span class="cx"> Position Position::parentAnchoredEquivalent() const
</span><span class="cx"> {
</span><span class="cx"> if (!m_anchorNode)
</span><del>- return Position();
</del><ins>+ return { };
</ins><span class="cx">
</span><span class="cx"> // FIXME: This should only be necessary for legacy positions, but is also needed for positions before and after Tables
</span><span class="cx"> if (m_offset <= 0 && (m_anchorType != PositionIsAfterAnchor && m_anchorType != PositionIsAfterChildren)) {
</span><del>- if (findParent(*m_anchorNode) && (editingIgnoresContent(m_anchorNode.get()) || isRenderedTable(m_anchorNode.get())))
</del><ins>+ if (findParent(*m_anchorNode) && (editingIgnoresContent(*m_anchorNode) || isRenderedTable(m_anchorNode.get())))
</ins><span class="cx"> return positionInParentBeforeNode(m_anchorNode.get());
</span><span class="cx"> return Position(m_anchorNode.get(), 0, PositionIsOffsetInAnchor);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (!m_anchorNode->offsetInCharacters()
</span><span class="cx"> && (m_anchorType == PositionIsAfterAnchor || m_anchorType == PositionIsAfterChildren || static_cast<unsigned>(m_offset) == m_anchorNode->countChildNodes())
</span><del>- && (editingIgnoresContent(m_anchorNode.get()) || isRenderedTable(m_anchorNode.get()))
</del><ins>+ && (editingIgnoresContent(*m_anchorNode) || isRenderedTable(m_anchorNode.get()))
</ins><span class="cx"> && containerNode()) {
</span><span class="cx"> return positionInParentAfterNode(m_anchorNode.get());
</span><span class="cx"> }
</span><span class="cx">
</span><del>- return Position(containerNode(), computeOffsetInContainerNode(), PositionIsOffsetInAnchor);
</del><ins>+ return { containerNode(), computeOffsetInContainerNode(), PositionIsOffsetInAnchor };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Node* Position::computeNodeBeforePosition() const
</span><span class="cx"> {
</span><span class="cx"> if (!m_anchorNode)
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx">
</span><span class="cx"> switch (anchorType()) {
</span><span class="cx"> case PositionIsBeforeChildren:
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx"> case PositionIsAfterChildren:
</span><span class="cx"> return m_anchorNode->lastChild();
</span><span class="cx"> case PositionIsOffsetInAnchor:
</span><span class="lines">@@ -259,19 +261,19 @@
</span><span class="cx"> return m_anchorNode.get();
</span><span class="cx"> }
</span><span class="cx"> ASSERT_NOT_REACHED();
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Node* Position::computeNodeAfterPosition() const
</span><span class="cx"> {
</span><span class="cx"> if (!m_anchorNode)
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx">
</span><span class="cx"> switch (anchorType()) {
</span><span class="cx"> case PositionIsBeforeChildren:
</span><span class="cx"> return m_anchorNode->firstChild();
</span><span class="cx"> case PositionIsAfterChildren:
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx"> case PositionIsOffsetInAnchor:
</span><span class="cx"> return m_anchorNode->traverseToChildAt(m_offset);
</span><span class="cx"> case PositionIsBeforeAnchor:
</span><span class="lines">@@ -280,12 +282,12 @@
</span><span class="cx"> return m_anchorNode->nextSibling();
</span><span class="cx"> }
</span><span class="cx"> ASSERT_NOT_REACHED();
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Position::AnchorType Position::anchorTypeForLegacyEditingPosition(Node* anchorNode, int offset)
</span><span class="cx"> {
</span><del>- if (anchorNode && editingIgnoresContent(anchorNode)) {
</del><ins>+ if (anchorNode && editingIgnoresContent(*anchorNode)) {
</ins><span class="cx"> if (offset == 0)
</span><span class="cx"> return Position::PositionIsBeforeAnchor;
</span><span class="cx"> return Position::PositionIsAfterAnchor;
</span><span class="lines">@@ -343,11 +345,11 @@
</span><span class="cx"> if (!parent)
</span><span class="cx"> return *this;
</span><span class="cx">
</span><del>- if (positionBeforeOrAfterNodeIsCandidate(node))
</del><ins>+ if (positionBeforeOrAfterNodeIsCandidate(*node))
</ins><span class="cx"> return positionBeforeNode(node);
</span><span class="cx">
</span><span class="cx"> Node* previousSibling = node->previousSibling();
</span><del>- if (previousSibling && positionBeforeOrAfterNodeIsCandidate(previousSibling))
</del><ins>+ if (previousSibling && positionBeforeOrAfterNodeIsCandidate(*previousSibling))
</ins><span class="cx"> return positionAfterNode(previousSibling);
</span><span class="cx">
</span><span class="cx"> return createLegacyEditingPosition(parent, node->computeNodeIndex());
</span><span class="lines">@@ -390,11 +392,11 @@
</span><span class="cx"> if (!parent)
</span><span class="cx"> return *this;
</span><span class="cx">
</span><del>- if (isRenderedTable(node) || editingIgnoresContent(node))
</del><ins>+ if (isRenderedTable(node) || editingIgnoresContent(*node))
</ins><span class="cx"> return positionAfterNode(node);
</span><span class="cx">
</span><span class="cx"> Node* nextSibling = node->nextSibling();
</span><del>- if (nextSibling && positionBeforeOrAfterNodeIsCandidate(nextSibling))
</del><ins>+ if (nextSibling && positionBeforeOrAfterNodeIsCandidate(*nextSibling))
</ins><span class="cx"> return positionBeforeNode(nextSibling);
</span><span class="cx">
</span><span class="cx"> return createLegacyEditingPosition(parent, node->computeNodeIndex() + 1);
</span><span class="lines">@@ -468,11 +470,11 @@
</span><span class="cx"> Node* Position::parentEditingBoundary() const
</span><span class="cx"> {
</span><span class="cx"> if (!m_anchorNode)
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx">
</span><span class="cx"> Node* documentElement = m_anchorNode->document().documentElement();
</span><span class="cx"> if (!documentElement)
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx">
</span><span class="cx"> Node* boundary = m_anchorNode.get();
</span><span class="cx"> while (boundary != documentElement && boundary->nonShadowBoundaryParentNode() && m_anchorNode->hasEditableStyle() == boundary->parentNode()->hasEditableStyle())
</span><span class="lines">@@ -536,25 +538,25 @@
</span><span class="cx"> Position Position::previousCharacterPosition(EAffinity affinity) const
</span><span class="cx"> {
</span><span class="cx"> if (isNull())
</span><del>- return Position();
</del><ins>+ return { };
</ins><span class="cx">
</span><span class="cx"> Node* fromRootEditableElement = deprecatedNode()->rootEditableElement();
</span><span class="cx">
</span><span class="cx"> bool atStartOfLine = isStartOfLine(VisiblePosition(*this, affinity));
</span><span class="cx"> bool rendered = isCandidate();
</span><span class="cx">
</span><del>- Position currentPos = *this;
- while (!currentPos.atStartOfTree()) {
- currentPos = currentPos.previous();
</del><ins>+ Position currentPosition = *this;
+ while (!currentPosition.atStartOfTree()) {
+ currentPosition = currentPosition.previous();
</ins><span class="cx">
</span><del>- if (currentPos.deprecatedNode()->rootEditableElement() != fromRootEditableElement)
</del><ins>+ if (currentPosition.deprecatedNode()->rootEditableElement() != fromRootEditableElement)
</ins><span class="cx"> return *this;
</span><span class="cx">
</span><span class="cx"> if (atStartOfLine || !rendered) {
</span><del>- if (currentPos.isCandidate())
- return currentPos;
- } else if (rendersInDifferentPosition(currentPos))
- return currentPos;
</del><ins>+ if (currentPosition.isCandidate())
+ return currentPosition;
+ } else if (rendersInDifferentPosition(currentPosition))
+ return currentPosition;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return *this;
</span><span class="lines">@@ -564,25 +566,25 @@
</span><span class="cx"> Position Position::nextCharacterPosition(EAffinity affinity) const
</span><span class="cx"> {
</span><span class="cx"> if (isNull())
</span><del>- return Position();
</del><ins>+ return { };
</ins><span class="cx">
</span><span class="cx"> Node* fromRootEditableElement = deprecatedNode()->rootEditableElement();
</span><span class="cx">
</span><del>- bool atEndOfLine = isEndOfLine(VisiblePosition(*this, affinity));
</del><ins>+ bool atEndOfLine = isEndOfLine({ *this, affinity });
</ins><span class="cx"> bool rendered = isCandidate();
</span><span class="cx">
</span><del>- Position currentPos = *this;
- while (!currentPos.atEndOfTree()) {
- currentPos = currentPos.next();
</del><ins>+ Position currentPosition = *this;
+ while (!currentPosition.atEndOfTree()) {
+ currentPosition = currentPosition.next();
</ins><span class="cx">
</span><del>- if (currentPos.deprecatedNode()->rootEditableElement() != fromRootEditableElement)
</del><ins>+ if (currentPosition.deprecatedNode()->rootEditableElement() != fromRootEditableElement)
</ins><span class="cx"> return *this;
</span><span class="cx">
</span><span class="cx"> if (atEndOfLine || !rendered) {
</span><del>- if (currentPos.isCandidate())
- return currentPos;
- } else if (rendersInDifferentPosition(currentPos))
- return currentPos;
</del><ins>+ if (currentPosition.isCandidate())
+ return currentPosition;
+ } else if (rendersInDifferentPosition(currentPosition))
+ return currentPosition;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return *this;
</span><span class="lines">@@ -605,7 +607,7 @@
</span><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> // There is a VisiblePosition inside an empty inline-block container.
</span><del>- return node->renderer()->isReplaced() && canHaveChildrenForEditing(node) && downcast<RenderBox>(*node->renderer()).height() && !node->firstChild();
</del><ins>+ return node->renderer()->isReplaced() && canHaveChildrenForEditing(*node) && downcast<RenderBox>(*node->renderer()).height() && !node->firstChild();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static Node* enclosingVisualBoundary(Node* node)
</span><span class="lines">@@ -639,60 +641,60 @@
</span><span class="cx"> {
</span><span class="cx"> Node* startNode = deprecatedNode();
</span><span class="cx"> if (!startNode)
</span><del>- return Position();
</del><ins>+ return { };
</ins><span class="cx">
</span><span class="cx"> // iterate backward from there, looking for a qualified position
</span><span class="cx"> Node* boundary = enclosingVisualBoundary(startNode);
</span><span class="cx"> // FIXME: PositionIterator should respect Before and After positions.
</span><span class="cx"> PositionIterator lastVisible = m_anchorType == PositionIsAfterAnchor ? createLegacyEditingPosition(m_anchorNode.get(), caretMaxOffset(*m_anchorNode)) : *this;
</span><del>- PositionIterator currentPos = lastVisible;
</del><ins>+ PositionIterator currentPosition = lastVisible;
</ins><span class="cx"> bool startEditable = startNode->hasEditableStyle();
</span><span class="cx"> Node* lastNode = startNode;
</span><span class="cx"> bool boundaryCrossed = false;
</span><del>- for (; !currentPos.atStart(); currentPos.decrement()) {
- Node* currentNode = currentPos.node();
</del><ins>+ for (; !currentPosition.atStart(); currentPosition.decrement()) {
+ auto& currentNode = *currentPosition.node();
</ins><span class="cx">
</span><span class="cx"> // Don't check for an editability change if we haven't moved to a different node,
</span><span class="cx"> // to avoid the expense of computing hasEditableStyle().
</span><del>- if (currentNode != lastNode) {
</del><ins>+ if (&currentNode != lastNode) {
</ins><span class="cx"> // Don't change editability.
</span><del>- bool currentEditable = currentNode->hasEditableStyle();
</del><ins>+ bool currentEditable = currentNode.hasEditableStyle();
</ins><span class="cx"> if (startEditable != currentEditable) {
</span><span class="cx"> if (rule == CannotCrossEditingBoundary)
</span><span class="cx"> break;
</span><span class="cx"> boundaryCrossed = true;
</span><span class="cx"> }
</span><del>- lastNode = currentNode;
</del><ins>+ lastNode = &currentNode;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // If we've moved to a position that is visually distinct, return the last saved position. There
</span><span class="cx"> // is code below that terminates early if we're *about* to move to a visually distinct position.
</span><del>- if (endsOfNodeAreVisuallyDistinctPositions(currentNode) && currentNode != boundary)
</del><ins>+ if (endsOfNodeAreVisuallyDistinctPositions(&currentNode) && &currentNode != boundary)
</ins><span class="cx"> return lastVisible;
</span><span class="cx">
</span><span class="cx"> // skip position in unrendered or invisible node
</span><del>- RenderObject* renderer = currentNode->renderer();
</del><ins>+ RenderObject* renderer = currentNode.renderer();
</ins><span class="cx"> if (!renderer || renderer->style().visibility() != VISIBLE)
</span><span class="cx"> continue;
</span><span class="cx">
</span><span class="cx"> if (rule == CanCrossEditingBoundary && boundaryCrossed) {
</span><del>- lastVisible = currentPos;
</del><ins>+ lastVisible = currentPosition;
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // track last visible streamer position
</span><del>- if (isStreamer(currentPos))
- lastVisible = currentPos;
</del><ins>+ if (isStreamer(currentPosition))
+ lastVisible = currentPosition;
</ins><span class="cx">
</span><span class="cx"> // Don't move past a position that is visually distinct. We could rely on code above to terminate and
</span><span class="cx"> // return lastVisible on the next iteration, but we terminate early to avoid doing a computeNodeIndex() call.
</span><del>- if (endsOfNodeAreVisuallyDistinctPositions(currentNode) && currentPos.atStartOfNode())
</del><ins>+ if (endsOfNodeAreVisuallyDistinctPositions(&currentNode) && currentPosition.atStartOfNode())
</ins><span class="cx"> return lastVisible;
</span><span class="cx">
</span><span class="cx"> // Return position after tables and nodes which have content that can be ignored.
</span><del>- if (editingIgnoresContent(currentNode) || isRenderedTable(currentNode)) {
- if (currentPos.atEndOfNode())
- return positionAfterNode(currentNode);
</del><ins>+ if (editingIgnoresContent(currentNode) || isRenderedTable(&currentNode)) {
+ if (currentPosition.atEndOfNode())
+ return positionAfterNode(&currentNode);
</ins><span class="cx"> continue;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -703,21 +705,21 @@
</span><span class="cx">
</span><span class="cx"> if (!textRenderer.firstTextBox())
</span><span class="cx"> continue;
</span><del>- if (currentNode != startNode) {
</del><ins>+ if (&currentNode != startNode) {
</ins><span class="cx"> // This assertion fires in layout tests in the case-transform.html test because
</span><span class="cx"> // of a mix-up between offsets in the text in the DOM tree with text in the
</span><span class="cx"> // render tree which can have a different length due to case transformation.
</span><span class="cx"> // Until we resolve that, disable this so we can run the layout tests!
</span><span class="cx"> //ASSERT(currentOffset >= renderer->caretMaxOffset());
</span><del>- return createLegacyEditingPosition(currentNode, renderer->caretMaxOffset());
</del><ins>+ return createLegacyEditingPosition(&currentNode, renderer->caretMaxOffset());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- unsigned textOffset = currentPos.offsetInLeafNode();
</del><ins>+ unsigned textOffset = currentPosition.offsetInLeafNode();
</ins><span class="cx"> auto lastTextBox = textRenderer.lastTextBox();
</span><span class="cx"> for (auto* box = textRenderer.firstTextBox(); box; box = box->nextTextBox()) {
</span><span class="cx"> if (textOffset <= box->start() + box->len()) {
</span><span class="cx"> if (textOffset > box->start())
</span><del>- return currentPos;
</del><ins>+ return currentPosition;
</ins><span class="cx"> continue;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -747,7 +749,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (continuesOnNextLine)
</span><del>- return currentPos;
</del><ins>+ return currentPosition;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -766,65 +768,65 @@
</span><span class="cx"> {
</span><span class="cx"> Node* startNode = deprecatedNode();
</span><span class="cx"> if (!startNode)
</span><del>- return Position();
</del><ins>+ return { };
</ins><span class="cx">
</span><span class="cx"> // iterate forward from there, looking for a qualified position
</span><span class="cx"> Node* boundary = enclosingVisualBoundary(startNode);
</span><span class="cx"> // FIXME: PositionIterator should respect Before and After positions.
</span><span class="cx"> PositionIterator lastVisible = m_anchorType == PositionIsAfterAnchor ? createLegacyEditingPosition(m_anchorNode.get(), caretMaxOffset(*m_anchorNode)) : *this;
</span><del>- PositionIterator currentPos = lastVisible;
</del><ins>+ PositionIterator currentPosition = lastVisible;
</ins><span class="cx"> bool startEditable = startNode->hasEditableStyle();
</span><span class="cx"> Node* lastNode = startNode;
</span><span class="cx"> bool boundaryCrossed = false;
</span><del>- for (; !currentPos.atEnd(); currentPos.increment()) {
- Node* currentNode = currentPos.node();
</del><ins>+ for (; !currentPosition.atEnd(); currentPosition.increment()) {
+ auto& currentNode = *currentPosition.node();
</ins><span class="cx">
</span><span class="cx"> // Don't check for an editability change if we haven't moved to a different node,
</span><span class="cx"> // to avoid the expense of computing hasEditableStyle().
</span><del>- if (currentNode != lastNode) {
</del><ins>+ if (&currentNode != lastNode) {
</ins><span class="cx"> // Don't change editability.
</span><del>- bool currentEditable = currentNode->hasEditableStyle();
</del><ins>+ bool currentEditable = currentNode.hasEditableStyle();
</ins><span class="cx"> if (startEditable != currentEditable) {
</span><span class="cx"> if (rule == CannotCrossEditingBoundary)
</span><span class="cx"> break;
</span><span class="cx"> boundaryCrossed = true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- lastNode = currentNode;
</del><ins>+ lastNode = &currentNode;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // stop before going above the body, up into the head
</span><span class="cx"> // return the last visible streamer position
</span><del>- if (currentNode->hasTagName(bodyTag) && currentPos.atEndOfNode())
</del><ins>+ if (is<HTMLBodyElement>(currentNode) && currentPosition.atEndOfNode())
</ins><span class="cx"> break;
</span><del>-
</del><ins>+
</ins><span class="cx"> // Do not move to a visually distinct position.
</span><del>- if (endsOfNodeAreVisuallyDistinctPositions(currentNode) && currentNode != boundary)
</del><ins>+ if (endsOfNodeAreVisuallyDistinctPositions(&currentNode) && &currentNode != boundary)
</ins><span class="cx"> return lastVisible;
</span><span class="cx"> // Do not move past a visually disinct position.
</span><span class="cx"> // Note: The first position after the last in a node whose ends are visually distinct
</span><span class="cx"> // positions will be [boundary->parentNode(), originalBlock->computeNodeIndex() + 1].
</span><del>- if (boundary && boundary->parentNode() == currentNode)
</del><ins>+ if (boundary && boundary->parentNode() == &currentNode)
</ins><span class="cx"> return lastVisible;
</span><span class="cx">
</span><span class="cx"> // skip position in unrendered or invisible node
</span><del>- RenderObject* renderer = currentNode->renderer();
</del><ins>+ auto* renderer = currentNode.renderer();
</ins><span class="cx"> if (!renderer || renderer->style().visibility() != VISIBLE)
</span><span class="cx"> continue;
</span><span class="cx">
</span><span class="cx"> if (rule == CanCrossEditingBoundary && boundaryCrossed) {
</span><del>- lastVisible = currentPos;
</del><ins>+ lastVisible = currentPosition;
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // track last visible streamer position
</span><del>- if (isStreamer(currentPos))
- lastVisible = currentPos;
</del><ins>+ if (isStreamer(currentPosition))
+ lastVisible = currentPosition;
</ins><span class="cx">
</span><span class="cx"> // Return position before tables and nodes which have content that can be ignored.
</span><del>- if (editingIgnoresContent(currentNode) || isRenderedTable(currentNode)) {
- if (currentPos.atStartOfNode())
- return positionBeforeNode(currentNode);
</del><ins>+ if (editingIgnoresContent(currentNode) || isRenderedTable(&currentNode)) {
+ if (currentPosition.atStartOfNode())
+ return positionBeforeNode(&currentNode);
</ins><span class="cx"> continue;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -835,17 +837,17 @@
</span><span class="cx">
</span><span class="cx"> if (!textRenderer.firstTextBox())
</span><span class="cx"> continue;
</span><del>- if (currentNode != startNode) {
- ASSERT(currentPos.atStartOfNode());
- return createLegacyEditingPosition(currentNode, renderer->caretMinOffset());
</del><ins>+ if (&currentNode != startNode) {
+ ASSERT(currentPosition.atStartOfNode());
+ return createLegacyEditingPosition(&currentNode, renderer->caretMinOffset());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- unsigned textOffset = currentPos.offsetInLeafNode();
</del><ins>+ unsigned textOffset = currentPosition.offsetInLeafNode();
</ins><span class="cx"> auto lastTextBox = textRenderer.lastTextBox();
</span><span class="cx"> for (auto* box = textRenderer.firstTextBox(); box; box = box->nextTextBox()) {
</span><span class="cx"> if (textOffset <= box->end()) {
</span><span class="cx"> if (textOffset >= box->start())
</span><del>- return currentPos;
</del><ins>+ return currentPosition;
</ins><span class="cx"> continue;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -875,7 +877,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (continuesOnNextLine)
</span><del>- return currentPos;
</del><ins>+ return currentPosition;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -962,7 +964,7 @@
</span><span class="cx"> Node* Position::rootUserSelectAllForNode(Node* node)
</span><span class="cx"> {
</span><span class="cx"> if (!node || !nodeIsUserSelectAll(node))
</span><del>- return 0;
</del><ins>+ return nullptr;
</ins><span class="cx"> Node* parent = node->parentNode();
</span><span class="cx"> if (!parent)
</span><span class="cx"> return node;
</span><span class="lines">@@ -987,27 +989,28 @@
</span><span class="cx"> if (isNull())
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- RenderObject* renderer = deprecatedNode()->renderer();
</del><ins>+ auto* renderer = deprecatedNode()->renderer();
</ins><span class="cx"> if (!renderer)
</span><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> if (renderer->style().visibility() != VISIBLE)
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (renderer->isBR())
</del><ins>+ if (renderer->isBR()) {
</ins><span class="cx"> // FIXME: The condition should be m_anchorType == PositionIsBeforeAnchor, but for now we still need to support legacy positions.
</span><span class="cx"> return !m_offset && m_anchorType != PositionIsAfterAnchor && !nodeIsUserSelectNone(deprecatedNode()->parentNode());
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx"> if (is<RenderText>(*renderer))
</span><span class="cx"> return !nodeIsUserSelectNone(deprecatedNode()) && downcast<RenderText>(*renderer).containsCaretOffset(m_offset);
</span><span class="cx">
</span><del>- if (positionBeforeOrAfterNodeIsCandidate(deprecatedNode())) {
</del><ins>+ if (positionBeforeOrAfterNodeIsCandidate(*deprecatedNode())) {
</ins><span class="cx"> return ((atFirstEditingPositionForNode() && m_anchorType == PositionIsBeforeAnchor)
</span><span class="cx"> || (atLastEditingPositionForNode() && m_anchorType == PositionIsAfterAnchor))
</span><span class="cx"> && !nodeIsUserSelectNone(deprecatedNode()->parentNode());
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (m_anchorNode->hasTagName(htmlTag))
</del><ins>+ if (is<HTMLHtmlElement>(*m_anchorNode))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> if (is<RenderBlockFlow>(*renderer)
</span><span class="lines">@@ -1016,7 +1019,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> || is<RenderFlexibleBox>(*renderer)) {
</span><span class="cx"> RenderBlock& block = downcast<RenderBlock>(*renderer);
</span><del>- if (block.logicalHeight() || m_anchorNode->hasTagName(bodyTag)) {
</del><ins>+ if (block.logicalHeight() || is<HTMLBodyElement>(*m_anchorNode)) {
</ins><span class="cx"> if (!Position::hasRenderedNonAnonymousDescendantsWithHeight(block))
</span><span class="cx"> return atFirstEditingPositionForNode() && !Position::nodeIsUserSelectNone(deprecatedNode());
</span><span class="cx"> return m_anchorNode->hasEditableStyle() && !Position::nodeIsUserSelectNone(deprecatedNode()) && atEditingBoundary();
</span><span class="lines">@@ -1044,69 +1047,68 @@
</span><span class="cx"> return a && b && deprecatedEnclosingBlockFlowElement(a) == deprecatedEnclosingBlockFlowElement(b);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool Position::rendersInDifferentPosition(const Position &pos) const
</del><ins>+bool Position::rendersInDifferentPosition(const Position& position) const
</ins><span class="cx"> {
</span><del>- if (isNull() || pos.isNull())
</del><ins>+ if (isNull() || position.isNull())
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- RenderObject* renderer = deprecatedNode()->renderer();
</del><ins>+ auto* renderer = deprecatedNode()->renderer();
</ins><span class="cx"> if (!renderer)
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- RenderObject* posRenderer = pos.deprecatedNode()->renderer();
- if (!posRenderer)
</del><ins>+ auto* positionRenderer = position.deprecatedNode()->renderer();
+ if (!positionRenderer)
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (renderer->style().visibility() != VISIBLE ||
- posRenderer->style().visibility() != VISIBLE)
</del><ins>+ if (renderer->style().visibility() != VISIBLE || positionRenderer->style().visibility() != VISIBLE)
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (deprecatedNode() == pos.deprecatedNode()) {
- if (deprecatedNode()->hasTagName(brTag))
</del><ins>+ if (deprecatedNode() == position.deprecatedNode()) {
+ if (is<HTMLBRElement>(*deprecatedNode()))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (m_offset == pos.deprecatedEditingOffset())
</del><ins>+ if (m_offset == position.deprecatedEditingOffset())
</ins><span class="cx"> return false;
</span><del>-
- if (!deprecatedNode()->isTextNode() && !pos.deprecatedNode()->isTextNode()) {
- if (m_offset != pos.deprecatedEditingOffset())
</del><ins>+
+ if (!is<Text>(*deprecatedNode()) && !is<Text>(*position.deprecatedNode())) {
+ if (m_offset != position.deprecatedEditingOffset())
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>-
- if (deprecatedNode()->hasTagName(brTag) && pos.isCandidate())
</del><ins>+
+ if (is<HTMLBRElement>(*deprecatedNode()) && position.isCandidate())
</ins><span class="cx"> return true;
</span><del>-
- if (pos.deprecatedNode()->hasTagName(brTag) && isCandidate())
</del><ins>+
+ if (is<HTMLBRElement>(*position.deprecatedNode()) && isCandidate())
</ins><span class="cx"> return true;
</span><del>-
- if (!inSameEnclosingBlockFlowElement(deprecatedNode(), pos.deprecatedNode()))
</del><ins>+
+ if (!inSameEnclosingBlockFlowElement(deprecatedNode(), position.deprecatedNode()))
</ins><span class="cx"> return true;
</span><span class="cx">
</span><span class="cx"> if (is<RenderText>(*renderer) && !downcast<RenderText>(*renderer).containsCaretOffset(m_offset))
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (is<RenderText>(*posRenderer) && !downcast<RenderText>(*posRenderer).containsCaretOffset(pos.m_offset))
</del><ins>+ if (is<RenderText>(*positionRenderer) && !downcast<RenderText>(*positionRenderer).containsCaretOffset(position.m_offset))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> int thisRenderedOffset = is<RenderText>(*renderer) ? downcast<RenderText>(*renderer).countRenderedCharacterOffsetsUntil(m_offset) : m_offset;
</span><del>- int posRenderedOffset = is<RenderText>(*posRenderer) ? downcast<RenderText>(*posRenderer).countRenderedCharacterOffsetsUntil(pos.m_offset) : pos.m_offset;
</del><ins>+ int positionRenderedOffset = is<RenderText>(*positionRenderer) ? downcast<RenderText>(*positionRenderer).countRenderedCharacterOffsetsUntil(position.m_offset) : position.m_offset;
</ins><span class="cx">
</span><del>- if (renderer == posRenderer && thisRenderedOffset == posRenderedOffset)
</del><ins>+ if (renderer == positionRenderer && thisRenderedOffset == positionRenderedOffset)
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> int ignoredCaretOffset;
</span><span class="cx"> InlineBox* b1;
</span><span class="cx"> getInlineBoxAndOffset(DOWNSTREAM, b1, ignoredCaretOffset);
</span><span class="cx"> InlineBox* b2;
</span><del>- pos.getInlineBoxAndOffset(DOWNSTREAM, b2, ignoredCaretOffset);
</del><ins>+ position.getInlineBoxAndOffset(DOWNSTREAM, b2, ignoredCaretOffset);
</ins><span class="cx">
</span><span class="cx"> LOG(Editing, "renderer: %p [%p]\n", renderer, b1);
</span><span class="cx"> LOG(Editing, "thisRenderedOffset: %d\n", thisRenderedOffset);
</span><del>- LOG(Editing, "posRenderer: %p [%p]\n", posRenderer, b2);
- LOG(Editing, "posRenderedOffset: %d\n", posRenderedOffset);
</del><ins>+ LOG(Editing, "posRenderer: %p [%p]\n", positionRenderer, b2);
+ LOG(Editing, "posRenderedOffset: %d\n", positionRenderedOffset);
</ins><span class="cx"> LOG(Editing, "node min/max: %d:%d\n", caretMinOffset(*deprecatedNode()), caretMaxOffset(*deprecatedNode()));
</span><del>- LOG(Editing, "pos node min/max: %d:%d\n", caretMinOffset(*pos.deprecatedNode()), caretMaxOffset(*pos.deprecatedNode()));
</del><ins>+ LOG(Editing, "pos node min/max: %d:%d\n", caretMinOffset(*position.deprecatedNode()), caretMaxOffset(*position.deprecatedNode()));
</ins><span class="cx"> LOG(Editing, "----------------------------------------------------------------------\n");
</span><span class="cx">
</span><span class="cx"> if (!b1 || !b2) {
</span><span class="lines">@@ -1117,13 +1119,13 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (nextRenderedEditable(deprecatedNode()) == pos.deprecatedNode()
- && thisRenderedOffset == caretMaxOffset(*deprecatedNode()) && !posRenderedOffset) {
</del><ins>+ if (nextRenderedEditable(deprecatedNode()) == position.deprecatedNode()
+ && thisRenderedOffset == caretMaxOffset(*deprecatedNode()) && !positionRenderedOffset) {
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (previousRenderedEditable(deprecatedNode()) == pos.deprecatedNode()
- && !thisRenderedOffset && posRenderedOffset == caretMaxOffset(*pos.deprecatedNode())) {
</del><ins>+ if (previousRenderedEditable(deprecatedNode()) == position.deprecatedNode()
+ && !thisRenderedOffset && positionRenderedOffset == caretMaxOffset(*position.deprecatedNode())) {
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1135,10 +1137,10 @@
</span><span class="cx"> {
</span><span class="cx"> ASSERT(isEditablePosition(*this));
</span><span class="cx"> if (isNull())
</span><del>- return Position();
</del><ins>+ return { };
</ins><span class="cx">
</span><del>- if (upstream().deprecatedNode()->hasTagName(brTag))
- return Position();
</del><ins>+ if (is<HTMLBRElement>(*upstream().deprecatedNode()))
+ return { };
</ins><span class="cx">
</span><span class="cx"> Position prev = previousCharacterPosition(affinity);
</span><span class="cx"> if (prev != *this && inSameEnclosingBlockFlowElement(deprecatedNode(), prev.deprecatedNode()) && is<Text>(*prev.deprecatedNode())) {
</span><span class="lines">@@ -1149,7 +1151,7 @@
</span><span class="cx"> return prev;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- return Position();
</del><ins>+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // This assumes that it starts in editable content.
</span><span class="lines">@@ -1157,7 +1159,7 @@
</span><span class="cx"> {
</span><span class="cx"> ASSERT(isEditablePosition(*this));
</span><span class="cx"> if (isNull())
</span><del>- return Position();
</del><ins>+ return { };
</ins><span class="cx">
</span><span class="cx"> VisiblePosition v(*this);
</span><span class="cx"> UChar c = v.characterAfter();
</span><span class="lines">@@ -1166,7 +1168,7 @@
</span><span class="cx"> if (considerNonCollapsibleWhitespace ? (isSpaceOrNewline(c) || c == noBreakSpace) : deprecatedIsCollapsibleWhitespace(c))
</span><span class="cx"> return *this;
</span><span class="cx">
</span><del>- return Position();
</del><ins>+ return { };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void Position::getInlineBoxAndOffset(EAffinity affinity, InlineBox*& inlineBox, int& caretOffset) const
</span><span class="lines">@@ -1270,7 +1272,7 @@
</span><span class="cx"> inlineBox = box ? box : candidate;
</span><span class="cx"> } else {
</span><span class="cx"> inlineBox = nullptr;
</span><del>- if (canHaveChildrenForEditing(deprecatedNode()) && is<RenderBlockFlow>(*renderer) && hasRenderedNonAnonymousDescendantsWithHeight(downcast<RenderBlockFlow>(*renderer))) {
</del><ins>+ if (canHaveChildrenForEditing(*deprecatedNode()) && is<RenderBlockFlow>(*renderer) && hasRenderedNonAnonymousDescendantsWithHeight(downcast<RenderBlockFlow>(*renderer))) {
</ins><span class="cx"> // Try a visually equivalent position with possibly opposite editability. This helps in case |this| is in
</span><span class="cx"> // an editable block but surrounded by non-editable positions. It acts to negate the logic at the beginning
</span><span class="cx"> // of RenderObject::createVisiblePosition().
</span><span class="lines">@@ -1463,13 +1465,13 @@
</span><span class="cx">
</span><span class="cx"> switch (anchorType()) {
</span><span class="cx"> case PositionIsBeforeChildren:
</span><del>- ASSERT(!m_anchorNode->isTextNode());
</del><ins>+ ASSERT(!is<Text>(*m_anchorNode));
</ins><span class="cx"> switch (other.anchorType()) {
</span><span class="cx"> case PositionIsBeforeChildren:
</span><del>- ASSERT(!other.m_anchorNode->isTextNode());
</del><ins>+ ASSERT(!is<Text>(*other.m_anchorNode));
</ins><span class="cx"> return m_anchorNode == other.m_anchorNode;
</span><span class="cx"> case PositionIsAfterChildren:
</span><del>- ASSERT(!other.m_anchorNode->isTextNode());
</del><ins>+ ASSERT(!is<Text>(*other.m_anchorNode));
</ins><span class="cx"> return m_anchorNode == other.m_anchorNode && !m_anchorNode->hasChildNodes();
</span><span class="cx"> case PositionIsOffsetInAnchor:
</span><span class="cx"> return m_anchorNode == other.m_anchorNode && !other.m_offset;
</span><span class="lines">@@ -1480,13 +1482,13 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx"> case PositionIsAfterChildren:
</span><del>- ASSERT(!m_anchorNode->isTextNode());
</del><ins>+ ASSERT(!is<Text>(*m_anchorNode));
</ins><span class="cx"> switch (other.anchorType()) {
</span><span class="cx"> case PositionIsBeforeChildren:
</span><del>- ASSERT(!other.m_anchorNode->isTextNode());
</del><ins>+ ASSERT(!is<Text>(*other.m_anchorNode));
</ins><span class="cx"> return m_anchorNode == other.m_anchorNode && !m_anchorNode->hasChildNodes();
</span><span class="cx"> case PositionIsAfterChildren:
</span><del>- ASSERT(!other.m_anchorNode->isTextNode());
</del><ins>+ ASSERT(!is<Text>(*other.m_anchorNode));
</ins><span class="cx"> return m_anchorNode == other.m_anchorNode;
</span><span class="cx"> case PositionIsOffsetInAnchor:
</span><span class="cx"> return m_anchorNode == other.m_anchorNode && m_anchorNode->countChildNodes() == static_cast<unsigned>(m_offset);
</span><span class="lines">@@ -1499,10 +1501,10 @@
</span><span class="cx"> case PositionIsOffsetInAnchor:
</span><span class="cx"> switch (other.anchorType()) {
</span><span class="cx"> case PositionIsBeforeChildren:
</span><del>- ASSERT(!other.m_anchorNode->isTextNode());
</del><ins>+ ASSERT(!is<Text>(*other.m_anchorNode));
</ins><span class="cx"> return m_anchorNode == other.m_anchorNode && !m_offset;
</span><span class="cx"> case PositionIsAfterChildren:
</span><del>- ASSERT(!other.m_anchorNode->isTextNode());
</del><ins>+ ASSERT(!is<Text>(*other.m_anchorNode));
</ins><span class="cx"> return m_anchorNode == other.m_anchorNode && m_offset == static_cast<int>(other.m_anchorNode->countChildNodes());
</span><span class="cx"> case PositionIsOffsetInAnchor:
</span><span class="cx"> return m_anchorNode == other.m_anchorNode && m_offset == other.m_offset;
</span><span class="lines">@@ -1515,10 +1517,10 @@
</span><span class="cx"> case PositionIsBeforeAnchor:
</span><span class="cx"> switch (other.anchorType()) {
</span><span class="cx"> case PositionIsBeforeChildren:
</span><del>- ASSERT(!other.m_anchorNode->isTextNode());
</del><ins>+ ASSERT(!is<Text>(*other.m_anchorNode));
</ins><span class="cx"> return m_anchorNode == other.m_anchorNode->firstChild();
</span><span class="cx"> case PositionIsAfterChildren:
</span><del>- ASSERT(!other.m_anchorNode->isTextNode());
</del><ins>+ ASSERT(!is<Text>(*other.m_anchorNode));
</ins><span class="cx"> return false;
</span><span class="cx"> case PositionIsOffsetInAnchor:
</span><span class="cx"> return m_anchorNode == other.m_anchorNode->traverseToChildAt(other.m_offset);
</span><span class="lines">@@ -1531,10 +1533,10 @@
</span><span class="cx"> case PositionIsAfterAnchor:
</span><span class="cx"> switch (other.anchorType()) {
</span><span class="cx"> case PositionIsBeforeChildren:
</span><del>- ASSERT(!other.m_anchorNode->isTextNode());
</del><ins>+ ASSERT(!is<Text>(*other.m_anchorNode));
</ins><span class="cx"> return false;
</span><span class="cx"> case PositionIsAfterChildren:
</span><del>- ASSERT(!other.m_anchorNode->isTextNode());
</del><ins>+ ASSERT(!is<Text>(*other.m_anchorNode));
</ins><span class="cx"> return m_anchorNode == other.m_anchorNode->lastChild();
</span><span class="cx"> case PositionIsOffsetInAnchor:
</span><span class="cx"> return other.m_offset && m_anchorNode == other.m_anchorNode->traverseToChildAt(other.m_offset - 1);
</span></span></pre></div>
<a id="trunkSourceWebCoredomPositionIteratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/PositionIterator.cpp (200930 => 200931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/PositionIterator.cpp        2016-05-15 22:05:56 UTC (rev 200930)
+++ trunk/Source/WebCore/dom/PositionIterator.cpp        2016-05-15 22:08:52 UTC (rev 200931)
</span><span class="lines">@@ -43,11 +43,11 @@
</span><span class="cx"> if (m_nodeAfterPositionInAnchor) {
</span><span class="cx"> ASSERT(m_nodeAfterPositionInAnchor->parentNode() == m_anchorNode);
</span><span class="cx"> // FIXME: This check is inadaquete because any ancestor could be ignored by editing
</span><del>- if (positionBeforeOrAfterNodeIsCandidate(m_anchorNode))
</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><del>- if (positionBeforeOrAfterNodeIsCandidate(m_anchorNode))
</del><ins>+ if (positionBeforeOrAfterNodeIsCandidate(*m_anchorNode))
</ins><span class="cx"> return atStartOfNode() ? positionBeforeNode(m_anchorNode) : positionAfterNode(m_anchorNode);
</span><span class="cx"> if (m_anchorNode->hasChildNodes())
</span><span class="cx"> return lastPositionInOrAfterNode(m_anchorNode);
</span><span class="lines">@@ -161,7 +161,7 @@
</span><span class="cx"> if (is<RenderText>(*renderer))
</span><span class="cx"> return !Position::nodeIsUserSelectNone(m_anchorNode) && downcast<RenderText>(*renderer).containsCaretOffset(m_offsetInAnchor);
</span><span class="cx">
</span><del>- if (isRenderedTable(m_anchorNode) || editingIgnoresContent(m_anchorNode))
</del><ins>+ if (isRenderedTable(m_anchorNode) || editingIgnoresContent(*m_anchorNode))
</ins><span class="cx"> return (atStartOfNode() || atEndOfNode()) && !Position::nodeIsUserSelectNone(m_anchorNode->parentNode());
</span><span class="cx">
</span><span class="cx"> if (!is<HTMLHtmlElement>(*m_anchorNode) && is<RenderBlockFlow>(*renderer)) {
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingApplyStyleCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/ApplyStyleCommand.cpp (200930 => 200931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/ApplyStyleCommand.cpp        2016-05-15 22:05:56 UTC (rev 200930)
+++ trunk/Source/WebCore/editing/ApplyStyleCommand.cpp        2016-05-15 22:08:52 UTC (rev 200931)
</span><span class="lines">@@ -312,7 +312,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Join up any adjacent text nodes.
</span><del>- if (start.deprecatedNode()->isTextNode()) {
</del><ins>+ if (is<Text>(*start.deprecatedNode())) {
</ins><span class="cx"> joinChildTextNodes(start.deprecatedNode()->parentNode(), start, end);
</span><span class="cx"> start = startPosition();
</span><span class="cx"> end = endPosition();
</span><span class="lines">@@ -321,7 +321,7 @@
</span><span class="cx"> if (start.isNull() || end.isNull())
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- if (end.deprecatedNode()->isTextNode() && start.deprecatedNode()->parentNode() != end.deprecatedNode()->parentNode()) {
</del><ins>+ if (is<Text>(*end.deprecatedNode()) && start.deprecatedNode()->parentNode() != end.deprecatedNode()->parentNode()) {
</ins><span class="cx"> joinChildTextNodes(end.deprecatedNode()->parentNode(), start, end);
</span><span class="cx"> start = startPosition();
</span><span class="cx"> end = endPosition();
</span><span class="lines">@@ -367,7 +367,7 @@
</span><span class="cx"> if (startNode == beyondEnd)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- if (startNode->isTextNode() && start.deprecatedEditingOffset() >= caretMaxOffset(*startNode)) {
</del><ins>+ if (is<Text>(*startNode) && start.deprecatedEditingOffset() >= caretMaxOffset(*startNode)) {
</ins><span class="cx"> // Move out of text node if range does not include its characters.
</span><span class="cx"> startNode = NodeTraversal::next(*startNode);
</span><span class="cx"> if (!startNode)
</span><span class="lines">@@ -391,10 +391,10 @@
</span><span class="cx"> RefPtr<HTMLElement> element;
</span><span class="cx"> if (is<HTMLElement>(*node)) {
</span><span class="cx"> // Only work on fully selected nodes.
</span><del>- if (!nodeFullySelected(node, start, end))
</del><ins>+ if (!nodeFullySelected(downcast<HTMLElement>(*node), start, end))
</ins><span class="cx"> continue;
</span><del>- element = downcast<HTMLElement>(node);
- } else if (node->isTextNode() && node->renderer() && node->parentNode() != lastStyledNode) {
</del><ins>+ element = &downcast<HTMLElement>(*node);
+ } else if (is<Text>(*node) && node->renderer() && node->parentNode() != lastStyledNode) {
</ins><span class="cx"> // Last styled node was not parent node of this text node, but we wish to style this
</span><span class="cx"> // text node. To make this possible, add a style span to surround this text node.
</span><span class="cx"> auto span = createStyleSpanElement(document());
</span><span class="lines">@@ -626,11 +626,11 @@
</span><span class="cx">
</span><span class="cx"> // Avoid removing the dir attribute and the unicode-bidi and direction properties from the unsplit ancestors.
</span><span class="cx"> Position embeddingRemoveStart = removeStart;
</span><del>- if (startUnsplitAncestor && nodeFullySelected(startUnsplitAncestor, removeStart, end))
</del><ins>+ if (startUnsplitAncestor && nodeFullySelected(*startUnsplitAncestor, removeStart, end))
</ins><span class="cx"> embeddingRemoveStart = positionInParentAfterNode(startUnsplitAncestor);
</span><span class="cx">
</span><span class="cx"> Position embeddingRemoveEnd = end;
</span><del>- if (endUnsplitAncestor && nodeFullySelected(endUnsplitAncestor, removeStart, end))
</del><ins>+ if (endUnsplitAncestor && nodeFullySelected(*endUnsplitAncestor, removeStart, end))
</ins><span class="cx"> embeddingRemoveEnd = positionInParentBeforeNode(endUnsplitAncestor).downstream();
</span><span class="cx">
</span><span class="cx"> if (embeddingRemoveEnd != removeStart || embeddingRemoveEnd != end) {
</span><span class="lines">@@ -802,7 +802,7 @@
</span><span class="cx"> if (node->hasChildNodes()) {
</span><span class="cx"> if (node->contains(pastEndNode.get()) || containsNonEditableRegion(*node) || !node->parentNode()->hasEditableStyle())
</span><span class="cx"> continue;
</span><del>- if (editingIgnoresContent(node.get())) {
</del><ins>+ if (editingIgnoresContent(*node)) {
</ins><span class="cx"> next = NodeTraversal::nextSkippingChildren(*node);
</span><span class="cx"> continue;
</span><span class="cx"> }
</span><span class="lines">@@ -870,7 +870,7 @@
</span><span class="cx"> ASSERT(runStart && runEnd);
</span><span class="cx"> RefPtr<Node> next = runStart;
</span><span class="cx"> for (RefPtr<Node> node = next; node && node->inDocument() && node != pastEndNode; node = next) {
</span><del>- if (editingIgnoresContent(node.get())) {
</del><ins>+ if (editingIgnoresContent(*node)) {
</ins><span class="cx"> ASSERT(!node->contains(pastEndNode.get()));
</span><span class="cx"> next = NodeTraversal::nextSkippingChildren(*node);
</span><span class="cx"> } else
</span><span class="lines">@@ -1092,7 +1092,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void ApplyStyleCommand::removeInlineStyle(EditingStyle* style, const Position &start, const Position &end)
</del><ins>+void ApplyStyleCommand::removeInlineStyle(EditingStyle* style, const Position& start, const Position& end)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(start.isNotNull());
</span><span class="cx"> ASSERT(end.isNotNull());
</span><span class="lines">@@ -1105,15 +1105,14 @@
</span><span class="cx"> // If the pushDownStart is at the end of a text node, then this node is not fully selected.
</span><span class="cx"> // Move it to the next deep quivalent position to avoid removing the style from this node.
</span><span class="cx"> // e.g. if pushDownStart was at Position("hello", 5) in <b>hello<div>world</div></b>, we want Position("world", 0) instead.
</span><del>- Node* pushDownStartContainer = pushDownStart.containerNode();
- if (pushDownStartContainer && pushDownStartContainer->isTextNode()
- && pushDownStart.computeOffsetInContainerNode() == pushDownStartContainer->maxCharacterOffset())
</del><ins>+ auto* pushDownStartContainer = pushDownStart.containerNode();
+ if (is<Text>(pushDownStartContainer) && pushDownStart.computeOffsetInContainerNode() == pushDownStartContainer->maxCharacterOffset())
</ins><span class="cx"> pushDownStart = nextVisuallyDistinctCandidate(pushDownStart);
</span><span class="cx"> // If pushDownEnd is at the start of a text node, then this node is not fully selected.
</span><span class="cx"> // Move it to the previous deep equivalent position to avoid removing the style from this node.
</span><span class="cx"> Position pushDownEnd = end.upstream();
</span><del>- Node* pushDownEndContainer = pushDownEnd.containerNode();
- if (pushDownEndContainer && pushDownEndContainer->isTextNode() && !pushDownEnd.computeOffsetInContainerNode())
</del><ins>+ auto* pushDownEndContainer = pushDownEnd.containerNode();
+ if (is<Text>(pushDownEndContainer) && !pushDownEnd.computeOffsetInContainerNode())
</ins><span class="cx"> pushDownEnd = previousVisuallyDistinctCandidate(pushDownEnd);
</span><span class="cx">
</span><span class="cx"> pushDownInlineStyleAroundNode(style, pushDownStart.deprecatedNode());
</span><span class="lines">@@ -1130,32 +1129,32 @@
</span><span class="cx"> RefPtr<Node> node = start.deprecatedNode();
</span><span class="cx"> while (node) {
</span><span class="cx"> RefPtr<Node> next;
</span><del>- if (editingIgnoresContent(node.get())) {
</del><ins>+ if (editingIgnoresContent(*node)) {
</ins><span class="cx"> ASSERT(node == end.deprecatedNode() || !node->contains(end.deprecatedNode()));
</span><span class="cx"> next = NodeTraversal::nextSkippingChildren(*node);
</span><span class="cx"> } else
</span><span class="cx"> next = NodeTraversal::next(*node);
</span><span class="cx">
</span><del>- if (is<HTMLElement>(*node) && nodeFullySelected(node.get(), start, end)) {
- Ref<HTMLElement> elem = downcast<HTMLElement>(*node);
- RefPtr<Node> prev = NodeTraversal::previousPostOrder(elem);
- RefPtr<Node> next = NodeTraversal::next(elem);
</del><ins>+ if (is<HTMLElement>(*node) && nodeFullySelected(downcast<HTMLElement>(*node), start, end)) {
+ Ref<HTMLElement> element = downcast<HTMLElement>(*node);
+ RefPtr<Node> prev = NodeTraversal::previousPostOrder(element);
+ RefPtr<Node> next = NodeTraversal::next(element);
</ins><span class="cx"> RefPtr<EditingStyle> styleToPushDown;
</span><span class="cx"> RefPtr<Node> childNode;
</span><del>- if (isStyledInlineElementToRemove(elem.ptr())) {
</del><ins>+ if (isStyledInlineElementToRemove(element.ptr())) {
</ins><span class="cx"> styleToPushDown = EditingStyle::create();
</span><del>- childNode = elem->firstChild();
</del><ins>+ childNode = element->firstChild();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- removeInlineStyleFromElement(style, elem.ptr(), RemoveIfNeeded, styleToPushDown.get());
- if (!elem->inDocument()) {
- if (s.deprecatedNode() == elem.ptr()) {
</del><ins>+ removeInlineStyleFromElement(style, element.ptr(), RemoveIfNeeded, styleToPushDown.get());
+ if (!element->inDocument()) {
+ if (s.deprecatedNode() == element.ptr()) {
</ins><span class="cx"> // Since elem must have been fully selected, and it is at the start
</span><span class="cx"> // of the selection, it is clear we can set the new s offset to 0.
</span><span class="cx"> ASSERT(s.anchorType() == Position::PositionIsBeforeAnchor || s.offsetInContainerNode() <= 0);
</span><span class="cx"> s = firstPositionInOrBeforeNode(next.get());
</span><span class="cx"> }
</span><del>- if (e.deprecatedNode() == elem.ptr()) {
</del><ins>+ if (e.deprecatedNode() == element.ptr()) {
</ins><span class="cx"> // Since elem must have been fully selected, and it is at the end
</span><span class="cx"> // of the selection, it is clear we can set the new e offset to
</span><span class="cx"> // the max range offset of prev.
</span><span class="lines">@@ -1177,32 +1176,27 @@
</span><span class="cx"> updateStartEnd(s, e);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool ApplyStyleCommand::nodeFullySelected(Node *node, const Position &start, const Position &end) const
</del><ins>+bool ApplyStyleCommand::nodeFullySelected(Element& element, const Position& start, const Position& end) const
</ins><span class="cx"> {
</span><del>- ASSERT(node);
- ASSERT(node->isElementNode());
-
</del><span class="cx"> // The tree may have changed and Position::upstream() relies on an up-to-date layout.
</span><del>- node->document().updateLayoutIgnorePendingStylesheets();
</del><ins>+ element.document().updateLayoutIgnorePendingStylesheets();
</ins><span class="cx">
</span><del>- return comparePositions(firstPositionInOrBeforeNode(node), start) >= 0
- && comparePositions(lastPositionInOrAfterNode(node).upstream(), end) <= 0;
</del><ins>+ return comparePositions(firstPositionInOrBeforeNode(&element), start) >= 0
+ && comparePositions(lastPositionInOrAfterNode(&element).upstream(), end) <= 0;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool ApplyStyleCommand::nodeFullyUnselected(Node *node, const Position &start, const Position &end) const
</del><ins>+bool ApplyStyleCommand::nodeFullyUnselected(Element& element, const Position& start, const Position& end) const
</ins><span class="cx"> {
</span><del>- ASSERT(node);
- ASSERT(node->isElementNode());
</del><ins>+ // The tree may have changed and Position::upstream() relies on an up-to-date layout.
+ element.document().updateLayoutIgnorePendingStylesheets();
</ins><span class="cx">
</span><del>- bool isFullyBeforeStart = comparePositions(lastPositionInOrAfterNode(node).upstream(), start) < 0;
- bool isFullyAfterEnd = comparePositions(firstPositionInOrBeforeNode(node), end) > 0;
-
- return isFullyBeforeStart || isFullyAfterEnd;
</del><ins>+ return comparePositions(lastPositionInOrAfterNode(&element).upstream(), start) < 0
+ || comparePositions(firstPositionInOrBeforeNode(&element), end) > 0;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void ApplyStyleCommand::splitTextAtStart(const Position& start, const Position& end)
</span><span class="cx"> {
</span><del>- ASSERT(start.containerNode()->isTextNode());
</del><ins>+ ASSERT(is<Text>(start.containerNode()));
</ins><span class="cx">
</span><span class="cx"> Position newEnd;
</span><span class="cx"> if (end.anchorType() == Position::PositionIsOffsetInAnchor && start.containerNode() == end.containerNode())
</span><span class="lines">@@ -1233,7 +1227,7 @@
</span><span class="cx">
</span><span class="cx"> void ApplyStyleCommand::splitTextElementAtStart(const Position& start, const Position& end)
</span><span class="cx"> {
</span><del>- ASSERT(start.containerNode()->isTextNode());
</del><ins>+ ASSERT(is<Text>(start.containerNode()));
</ins><span class="cx">
</span><span class="cx"> Position newEnd;
</span><span class="cx"> if (start.containerNode() == end.containerNode())
</span><span class="lines">@@ -1247,7 +1241,7 @@
</span><span class="cx">
</span><span class="cx"> void ApplyStyleCommand::splitTextElementAtEnd(const Position& start, const Position& end)
</span><span class="cx"> {
</span><del>- ASSERT(end.containerNode()->isTextNode());
</del><ins>+ ASSERT(is<Text>(end.containerNode()));
</ins><span class="cx">
</span><span class="cx"> bool shouldUpdateStart = start.containerNode() == end.containerNode();
</span><span class="cx"> splitTextNodeContainingElement(end.containerText(), end.offsetInContainerNode());
</span><span class="lines">@@ -1268,13 +1262,13 @@
</span><span class="cx"> if (!is<HTMLElement>(element))
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- return shouldRemoveInlineStyleFromElement(style, downcast<HTMLElement>(element));
</del><ins>+ return shouldRemoveInlineStyleFromElement(style, &downcast<HTMLElement>(*element));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool ApplyStyleCommand::isValidCaretPositionInTextNode(const Position& position)
</span><span class="cx"> {
</span><span class="cx"> Node* node = position.containerNode();
</span><del>- if (position.anchorType() != Position::PositionIsOffsetInAnchor || !node->isTextNode())
</del><ins>+ if (position.anchorType() != Position::PositionIsOffsetInAnchor || !is<Text>(node))
</ins><span class="cx"> return false;
</span><span class="cx"> int offsetInText = position.offsetInContainerNode();
</span><span class="cx"> return offsetInText > caretMinOffset(*node) && offsetInText < caretMaxOffset(*node);
</span><span class="lines">@@ -1369,13 +1363,14 @@
</span><span class="cx">
</span><span class="cx"> RefPtr<Node> nextSibling = element->nextSibling();
</span><span class="cx"> RefPtr<Node> previousSibling = element->previousSibling();
</span><del>- if (is<Element>(nextSibling.get()) && nextSibling->hasEditableStyle() && areIdenticalElements(*element, *nextSibling))
</del><ins>+
+ if (nextSibling && nextSibling->hasEditableStyle() && areIdenticalElements(*element, *nextSibling))
</ins><span class="cx"> mergeIdenticalElements(element.get(), downcast<Element>(nextSibling.get()));
</span><span class="cx">
</span><span class="cx"> if (is<Element>(previousSibling.get()) && previousSibling->hasEditableStyle()) {
</span><del>- Node* mergedElement = previousSibling->nextSibling();
</del><ins>+ auto* mergedElement = previousSibling->nextSibling();
</ins><span class="cx"> ASSERT(mergedElement);
</span><del>- if (is<Element>(*mergedElement) && mergedElement->hasEditableStyle() && areIdenticalElements(*previousSibling, *mergedElement))
</del><ins>+ if (mergedElement->hasEditableStyle() && areIdenticalElements(*previousSibling, *mergedElement))
</ins><span class="cx"> mergeIdenticalElements(downcast<Element>(previousSibling.get()), downcast<Element>(mergedElement));
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1421,7 +1416,7 @@
</span><span class="cx"> Position ApplyStyleCommand::positionToComputeInlineStyleChange(PassRefPtr<Node> startNode, RefPtr<Node>& dummyElement)
</span><span class="cx"> {
</span><span class="cx"> // It's okay to obtain the style at the startNode because we've removed all relevant styles from the current run.
</span><del>- if (!startNode->isElementNode()) {
</del><ins>+ if (!is<Element>(*startNode)) {
</ins><span class="cx"> dummyElement = createStyleSpanElement(document());
</span><span class="cx"> insertNodeAt(dummyElement, positionBeforeNode(startNode.get()));
</span><span class="cx"> return firstPositionInOrBeforeNode(dummyElement.get());
</span><span class="lines">@@ -1440,16 +1435,19 @@
</span><span class="cx"> // Find appropriate font and span elements top-down.
</span><span class="cx"> HTMLFontElement* fontContainer = nullptr;
</span><span class="cx"> HTMLElement* styleContainer = nullptr;
</span><del>- for (Node* container = startNode.get(); container && startNode == endNode; container = container->firstChild()) {
- if (is<HTMLFontElement>(*container))
- fontContainer = downcast<HTMLFontElement>(container);
- bool styleContainerIsNotSpan = !is<HTMLSpanElement>(styleContainer);
- if (is<HTMLElement>(*container) && (is<HTMLSpanElement>(*container) || (styleContainerIsNotSpan && container->hasChildNodes())))
- styleContainer = downcast<HTMLElement>(container);
- if (!container->firstChild())
</del><ins>+ while (startNode && startNode == endNode) {
+ if (is<HTMLElement>(*startNode)) {
+ auto& container = downcast<HTMLElement>(*startNode);
+ if (is<HTMLFontElement>(container))
+ fontContainer = &downcast<HTMLFontElement>(container);
+ if (is<HTMLSpanElement>(container) || (!is<HTMLSpanElement>(styleContainer) && container.hasChildNodes()))
+ styleContainer = &container;
+ }
+ auto* startNodeFirstChild = startNode->firstChild();
+ if (!startNodeFirstChild)
</ins><span class="cx"> break;
</span><del>- startNode = container->firstChild();
- endNode = container->lastChild();
</del><ins>+ endNode = startNode->lastChild();
+ startNode = startNodeFirstChild;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Font tags need to go outside of CSS so that CSS font sizes override leagcy font sizes.
</span><span class="lines">@@ -1482,9 +1480,9 @@
</span><span class="cx"> } else
</span><span class="cx"> setNodeAttribute(styleContainer, styleAttr, styleToMerge->asText());
</span><span class="cx"> } else {
</span><del>- RefPtr<Element> styleElement = createStyleSpanElement(document());
</del><ins>+ auto styleElement = createStyleSpanElement(document());
</ins><span class="cx"> styleElement->setAttribute(styleAttr, styleToMerge->asText());
</span><del>- surroundNodeRangeWithElement(startNode, endNode, styleElement.release());
</del><ins>+ surroundNodeRangeWithElement(startNode, endNode, WTFMove(styleElement));
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingApplyStyleCommandh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/ApplyStyleCommand.h (200930 => 200931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/ApplyStyleCommand.h        2016-05-15 22:05:56 UTC (rev 200930)
+++ trunk/Source/WebCore/editing/ApplyStyleCommand.h        2016-05-15 22:08:52 UTC (rev 200931)
</span><span class="lines">@@ -86,8 +86,8 @@
</span><span class="cx"> void applyInlineStyleToPushDown(Node*, EditingStyle*);
</span><span class="cx"> void pushDownInlineStyleAroundNode(EditingStyle*, Node*);
</span><span class="cx"> void removeInlineStyle(EditingStyle* , const Position& start, const Position& end);
</span><del>- bool nodeFullySelected(Node*, const Position& start, const Position& end) const;
- bool nodeFullyUnselected(Node*, const Position& start, const Position& end) const;
</del><ins>+ bool nodeFullySelected(Element&, const Position& start, const Position& end) const;
+ bool nodeFullyUnselected(Element&, const Position& start, const Position& end) const;
</ins><span class="cx">
</span><span class="cx"> // style-application helpers
</span><span class="cx"> void applyBlockStyle(EditingStyle*);
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingCompositeEditCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/CompositeEditCommand.cpp (200930 => 200931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/CompositeEditCommand.cpp        2016-05-15 22:05:56 UTC (rev 200930)
+++ trunk/Source/WebCore/editing/CompositeEditCommand.cpp        2016-05-15 22:08:52 UTC (rev 200931)
</span><span class="lines">@@ -486,7 +486,7 @@
</span><span class="cx"> Node* refChild = p.deprecatedNode();
</span><span class="cx"> int offset = p.deprecatedEditingOffset();
</span><span class="cx">
</span><del>- if (canHaveChildrenForEditing(refChild)) {
</del><ins>+ if (canHaveChildrenForEditing(*refChild)) {
</ins><span class="cx"> Node* child = refChild->firstChild();
</span><span class="cx"> for (int i = 0; child && i < offset; i++)
</span><span class="cx"> child = child->nextSibling();
</span><span class="lines">@@ -509,7 +509,7 @@
</span><span class="cx">
</span><span class="cx"> void CompositeEditCommand::appendNode(PassRefPtr<Node> node, PassRefPtr<ContainerNode> parent)
</span><span class="cx"> {
</span><del>- ASSERT(canHaveChildrenForEditing(parent.get()));
</del><ins>+ ASSERT(canHaveChildrenForEditing(*parent));
</ins><span class="cx"> ASSERT(node);
</span><span class="cx"> applyCommandToComposite(AppendNodeCommand::create(parent, *node, editingAction()));
</span><span class="cx"> }
</span><span class="lines">@@ -1503,9 +1503,9 @@
</span><span class="cx">
</span><span class="cx"> RefPtr<Node> previousListNode = emptyListItem->isElementNode() ? ElementTraversal::previousSibling(*emptyListItem): emptyListItem->previousSibling();
</span><span class="cx"> RefPtr<Node> nextListNode = emptyListItem->isElementNode() ? ElementTraversal::nextSibling(*emptyListItem): emptyListItem->nextSibling();
</span><del>- if (isListItem(nextListNode.get()) || isListElement(nextListNode.get())) {
</del><ins>+ if (isListItem(nextListNode.get()) || isListHTMLElement(nextListNode.get())) {
</ins><span class="cx"> // If emptyListItem follows another list item or nested list, split the list node.
</span><del>- if (isListItem(previousListNode.get()) || isListElement(previousListNode.get()))
</del><ins>+ if (isListItem(previousListNode.get()) || isListHTMLElement(previousListNode.get()))
</ins><span class="cx"> splitElement(downcast<Element>(listNode.get()), emptyListItem);
</span><span class="cx">
</span><span class="cx"> // If emptyListItem is followed by other list item or nested list, then insert newBlock before the list node.
</span><span class="lines">@@ -1517,7 +1517,7 @@
</span><span class="cx"> // When emptyListItem does not follow any list item or nested list, insert newBlock after the enclosing list node.
</span><span class="cx"> // Remove the enclosing node if emptyListItem is the only child; otherwise just remove emptyListItem.
</span><span class="cx"> insertNodeAfter(newBlock, listNode);
</span><del>- removeNode(isListItem(previousListNode.get()) || isListElement(previousListNode.get()) ? emptyListItem.get() : listNode.get());
</del><ins>+ removeNode(isListItem(previousListNode.get()) || isListHTMLElement(previousListNode.get()) ? emptyListItem.get() : listNode.get());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> appendBlockPlaceholder(newBlock);
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingDeleteSelectionCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp (200930 => 200931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp        2016-05-15 22:05:56 UTC (rev 200930)
+++ trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp        2016-05-15 22:08:52 UTC (rev 200931)
</span><span class="lines">@@ -457,7 +457,7 @@
</span><span class="cx"> makeStylingElementsDirectChildrenOfEditableRootToPreventStyleLoss();
</span><span class="cx">
</span><span class="cx"> // Never remove the start block unless it's a table, in which case we won't merge content in.
</span><del>- if (startNode == m_startBlock && !startOffset && canHaveChildrenForEditing(startNode) && !is<HTMLTableElement>(*startNode)) {
</del><ins>+ if (startNode == m_startBlock && !startOffset && canHaveChildrenForEditing(*startNode) && !is<HTMLTableElement>(*startNode)) {
</ins><span class="cx"> startOffset = 0;
</span><span class="cx"> startNode = NodeTraversal::next(*startNode);
</span><span class="cx"> if (!startNode)
</span><span class="lines">@@ -538,7 +538,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (m_downstreamEnd.deprecatedNode() != startNode && !m_upstreamStart.deprecatedNode()->isDescendantOf(m_downstreamEnd.deprecatedNode()) && m_downstreamEnd.anchorNode()->inDocument() && m_downstreamEnd.deprecatedEditingOffset() >= caretMinOffset(*m_downstreamEnd.deprecatedNode())) {
</span><del>- if (m_downstreamEnd.atLastEditingPositionForNode() && !canHaveChildrenForEditing(m_downstreamEnd.deprecatedNode())) {
</del><ins>+ if (m_downstreamEnd.atLastEditingPositionForNode() && !canHaveChildrenForEditing(*m_downstreamEnd.deprecatedNode())) {
</ins><span class="cx"> // The node itself is fully selected, not just its contents. Delete it.
</span><span class="cx"> removeNode(m_downstreamEnd.deprecatedNode());
</span><span class="cx"> } else {
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingFormatBlockCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/FormatBlockCommand.cpp (200930 => 200931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/FormatBlockCommand.cpp        2016-05-15 22:05:56 UTC (rev 200930)
+++ trunk/Source/WebCore/editing/FormatBlockCommand.cpp        2016-05-15 22:08:52 UTC (rev 200931)
</span><span class="lines">@@ -24,15 +24,16 @@
</span><span class="cx"> */
</span><span class="cx">
</span><span class="cx"> #include "config.h"
</span><del>-#include "Element.h"
</del><span class="cx"> #include "FormatBlockCommand.h"
</span><ins>+
</ins><span class="cx"> #include "Document.h"
</span><ins>+#include "Element.h"
</ins><span class="cx"> #include "ExceptionCodePlaceholder.h"
</span><del>-#include "htmlediting.h"
</del><span class="cx"> #include "HTMLElement.h"
</span><span class="cx"> #include "HTMLNames.h"
</span><span class="cx"> #include "Range.h"
</span><span class="cx"> #include "VisibleUnits.h"
</span><ins>+#include "htmlediting.h"
</ins><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -41,6 +42,7 @@
</span><span class="cx">
</span><span class="cx"> static Node* enclosingBlockToSplitTreeTo(Node* startNode);
</span><span class="cx"> static bool isElementForFormatBlock(const QualifiedName& tagName);
</span><ins>+
</ins><span class="cx"> static inline bool isElementForFormatBlock(Node* node)
</span><span class="cx"> {
</span><span class="cx"> return is<Element>(*node) && isElementForFormatBlock(downcast<Element>(*node).tagQName());
</span><span class="lines">@@ -156,7 +158,7 @@
</span><span class="cx"> return n;
</span><span class="cx"> if (isBlock(n))
</span><span class="cx"> lastBlock = n;
</span><del>- if (isListElement(n))
</del><ins>+ if (isListHTMLElement(n))
</ins><span class="cx"> return n->parentNode()->hasEditableStyle() ? n->parentNode() : n;
</span><span class="cx"> }
</span><span class="cx"> return lastBlock;
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingInsertParagraphSeparatorCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp (200930 => 200931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp        2016-05-15 22:05:56 UTC (rev 200930)
+++ trunk/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp        2016-05-15 22:08:52 UTC (rev 200931)
</span><span class="lines">@@ -319,7 +319,7 @@
</span><span class="cx">
</span><span class="cx"> // If the returned position lies either at the end or at the start of an element that is ignored by editing
</span><span class="cx"> // we should move to its upstream or downstream position.
</span><del>- if (editingIgnoresContent(insertionPosition.deprecatedNode())) {
</del><ins>+ if (editingIgnoresContent(*insertionPosition.deprecatedNode())) {
</ins><span class="cx"> if (insertionPosition.atLastEditingPositionForNode())
</span><span class="cx"> insertionPosition = insertionPosition.downstream();
</span><span class="cx"> else if (insertionPosition.atFirstEditingPositionForNode())
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingModifySelectionListLevelcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/ModifySelectionListLevel.cpp (200930 => 200931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/ModifySelectionListLevel.cpp        2016-05-15 22:05:56 UTC (rev 200930)
+++ trunk/Source/WebCore/editing/ModifySelectionListLevel.cpp        2016-05-15 22:08:52 UTC (rev 200931)
</span><span class="lines">@@ -80,7 +80,7 @@
</span><span class="cx"> // if the selection ends on a list item with a sublist, include the entire sublist
</span><span class="cx"> if (endListChild->renderer()->isListItem()) {
</span><span class="cx"> RenderObject* r = endListChild->renderer()->nextSibling();
</span><del>- if (r && isListElement(r->node()))
</del><ins>+ if (r && isListHTMLElement(r->node()))
</ins><span class="cx"> endListChild = r->node();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -177,7 +177,7 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> Node* previousItem = startListChild->renderer()->previousSibling()->node();
</span><del>- if (isListElement(previousItem)) {
</del><ins>+ if (isListHTMLElement(previousItem)) {
</ins><span class="cx"> // move nodes up into preceding list
</span><span class="cx"> appendSiblingNodeRange(startListChild, endListChild, downcast<Element>(previousItem));
</span><span class="cx"> m_listElement = previousItem;
</span><span class="lines">@@ -244,11 +244,11 @@
</span><span class="cx"> {
</span><span class="cx"> if (!getStartEndListChildren(selection, start, end))
</span><span class="cx"> return false;
</span><del>-
</del><ins>+
</ins><span class="cx"> // there must be a destination list to move the items to
</span><del>- if (!isListElement(start->parentNode()->parentNode()))
</del><ins>+ if (!isListHTMLElement(start->parentNode()->parentNode()))
</ins><span class="cx"> return false;
</span><del>-
</del><ins>+
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingRemoveNodeCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/RemoveNodeCommand.cpp (200930 => 200931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/RemoveNodeCommand.cpp        2016-05-15 22:05:56 UTC (rev 200930)
+++ trunk/Source/WebCore/editing/RemoveNodeCommand.cpp        2016-05-15 22:08:52 UTC (rev 200931)
</span><span class="lines">@@ -27,7 +27,6 @@
</span><span class="cx"> #include "RemoveNodeCommand.h"
</span><span class="cx">
</span><span class="cx"> #include "ExceptionCodePlaceholder.h"
</span><del>-#include "Node.h"
</del><span class="cx"> #include "RenderElement.h"
</span><span class="cx"> #include "htmlediting.h"
</span><span class="cx"> #include <wtf/Assertions.h>
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingReplaceNodeWithSpanCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/ReplaceNodeWithSpanCommand.cpp (200930 => 200931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/ReplaceNodeWithSpanCommand.cpp        2016-05-15 22:05:56 UTC (rev 200930)
+++ trunk/Source/WebCore/editing/ReplaceNodeWithSpanCommand.cpp        2016-05-15 22:08:52 UTC (rev 200931)
</span><span class="lines">@@ -31,16 +31,11 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "ReplaceNodeWithSpanCommand.h"
</span><span class="cx">
</span><ins>+#include "HTMLSpanElement.h"
</ins><span class="cx"> #include "htmlediting.h"
</span><del>-#include "HTMLElement.h"
-#include "HTMLNames.h"
</del><span class="cx">
</span><del>-#include <wtf/Assertions.h>
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-using namespace HTMLNames;
-
</del><span class="cx"> ReplaceNodeWithSpanCommand::ReplaceNodeWithSpanCommand(PassRefPtr<HTMLElement> element)
</span><span class="cx"> : SimpleEditCommand(element->document())
</span><span class="cx"> , m_elementToReplace(element)
</span><span class="lines">@@ -69,7 +64,7 @@
</span><span class="cx"> if (!m_elementToReplace->inDocument())
</span><span class="cx"> return;
</span><span class="cx"> if (!m_spanElement)
</span><del>- m_spanElement = createHTMLElement(m_elementToReplace->document(), spanTag);
</del><ins>+ m_spanElement = HTMLSpanElement::create(m_elementToReplace->document());
</ins><span class="cx"> swapInNodePreservingAttributesAndChildren(*m_spanElement, *m_elementToReplace);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingReplaceSelectionCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp (200930 => 200931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp        2016-05-15 22:05:56 UTC (rev 200930)
+++ trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp        2016-05-15 22:08:52 UTC (rev 200931)
</span><span class="lines">@@ -101,44 +101,46 @@
</span><span class="cx"> bool m_hasInterchangeNewlineAtEnd;
</span><span class="cx"> };
</span><span class="cx">
</span><del>-static bool isInterchangeNewlineNode(const Node *node)
</del><ins>+static bool isInterchangeNewlineNode(const Node* node)
</ins><span class="cx"> {
</span><span class="cx"> static NeverDestroyed<String> interchangeNewlineClassString(AppleInterchangeNewline);
</span><del>- return node && node->hasTagName(brTag) &&
- static_cast<const Element *>(node)->getAttribute(classAttr) == interchangeNewlineClassString;
</del><ins>+ return is<HTMLBRElement>(node) && downcast<HTMLBRElement>(*node).fastGetAttribute(classAttr) == interchangeNewlineClassString;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-static bool isInterchangeConvertedSpaceSpan(const Node *node)
</del><ins>+static bool isInterchangeConvertedSpaceSpan(const Node* node)
</ins><span class="cx"> {
</span><span class="cx"> static NeverDestroyed<String> convertedSpaceSpanClassString(AppleConvertedSpace);
</span><del>- return node->isHTMLElement() &&
- static_cast<const HTMLElement *>(node)->getAttribute(classAttr) == convertedSpaceSpanClassString;
</del><ins>+ return is<HTMLElement>(node) && downcast<HTMLElement>(*node).fastGetAttribute(classAttr) == convertedSpaceSpanClassString;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-static Position positionAvoidingPrecedingNodes(Position pos)
</del><ins>+static Position positionAvoidingPrecedingNodes(Position position)
</ins><span class="cx"> {
</span><ins>+ ASSERT(position.isNotNull());
+
</ins><span class="cx"> // If we're already on a break, it's probably a placeholder and we shouldn't change our position.
</span><del>- if (editingIgnoresContent(pos.deprecatedNode()))
- return pos;
</del><ins>+ if (editingIgnoresContent(*position.deprecatedNode()))
+ return position;
</ins><span class="cx">
</span><span class="cx"> // We also stop when changing block flow elements because even though the visual position is the
</span><span class="cx"> // same. E.g.,
</span><span class="cx"> // <div>foo^</div>^
</span><span class="cx"> // The two positions above are the same visual position, but we want to stay in the same block.
</span><del>- Node* enclosingBlockNode = enclosingBlock(pos.containerNode());
- for (Position nextPosition = pos; nextPosition.containerNode() != enclosingBlockNode; pos = nextPosition) {
- if (lineBreakExistsAtPosition(pos))
</del><ins>+ auto* enclosingBlockNode = enclosingBlock(position.containerNode());
+ for (Position nextPosition = position; nextPosition.containerNode() != enclosingBlockNode; position = nextPosition) {
+ if (lineBreakExistsAtPosition(position))
</ins><span class="cx"> break;
</span><span class="cx">
</span><del>- if (pos.containerNode()->nonShadowBoundaryParentNode())
- nextPosition = positionInParentAfterNode(pos.containerNode());
-
- if (nextPosition == pos
- || enclosingBlock(nextPosition.containerNode()) != enclosingBlockNode
- || VisiblePosition(pos) != VisiblePosition(nextPosition))
</del><ins>+ if (position.containerNode()->nonShadowBoundaryParentNode())
+ nextPosition = positionInParentAfterNode(position.containerNode());
+
+ if (nextPosition == position)
</ins><span class="cx"> break;
</span><ins>+ if (enclosingBlock(nextPosition.containerNode()) != enclosingBlockNode)
+ break;
+ if (VisiblePosition(position) != VisiblePosition(nextPosition))
+ break;
</ins><span class="cx"> }
</span><del>- return pos;
</del><ins>+ return position;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ReplacementFragment::ReplacementFragment(Document& document, DocumentFragment* fragment, const VisibleSelection& selection)
</span><span class="lines">@@ -1101,7 +1103,7 @@
</span><span class="cx"> fragment.removeNode(refNode);
</span><span class="cx">
</span><span class="cx"> Node* blockStart = enclosingBlock(insertionPos.deprecatedNode());
</span><del>- if ((isListElement(refNode.get()) || (isLegacyAppleStyleSpan(refNode.get()) && isListElement(refNode->firstChild())))
</del><ins>+ if ((isListHTMLElement(refNode.get()) || (isLegacyAppleStyleSpan(refNode.get()) && isListHTMLElement(refNode->firstChild())))
</ins><span class="cx"> && blockStart && blockStart->renderer()->isListItem())
</span><span class="cx"> refNode = insertAsListItems(downcast<HTMLElement>(refNode.get()), blockStart, insertionPos, insertedNodes);
</span><span class="cx"> else {
</span><span class="lines">@@ -1439,7 +1441,7 @@
</span><span class="cx"> {
</span><span class="cx"> RefPtr<HTMLElement> listElement = prpListElement;
</span><span class="cx">
</span><del>- while (listElement->hasOneChild() && isListElement(listElement->firstChild()))
</del><ins>+ while (listElement->hasOneChild() && isListHTMLElement(listElement->firstChild()))
</ins><span class="cx"> listElement = downcast<HTMLElement>(listElement->firstChild());
</span><span class="cx">
</span><span class="cx"> bool isStart = isStartOfParagraph(insertPos);
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingSpellCheckercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/SpellChecker.cpp (200930 => 200931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/SpellChecker.cpp        2016-05-15 22:05:56 UTC (rev 200930)
+++ trunk/Source/WebCore/editing/SpellChecker.cpp        2016-05-15 22:08:52 UTC (rev 200931)
</span><span class="lines">@@ -32,7 +32,6 @@
</span><span class="cx"> #include "Frame.h"
</span><span class="cx"> #include "HTMLInputElement.h"
</span><span class="cx"> #include "HTMLTextAreaElement.h"
</span><del>-#include "Node.h"
</del><span class="cx"> #include "Page.h"
</span><span class="cx"> #include "PositionIterator.h"
</span><span class="cx"> #include "RenderObject.h"
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingTextIteratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/TextIterator.cpp (200930 => 200931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/TextIterator.cpp        2016-05-15 22:05:56 UTC (rev 200930)
+++ trunk/Source/WebCore/editing/TextIterator.cpp        2016-05-15 22:08:52 UTC (rev 200931)
</span><span class="lines">@@ -1261,10 +1261,7 @@
</span><span class="cx"> } else {
</span><span class="cx"> // Exit empty containers as we pass over them or containers
</span><span class="cx"> // where [container, 0] is where we started iterating.
</span><del>- if (!m_handledNode
- && canHaveChildrenForEditing(m_node)
- && m_node->parentNode()
- && (!m_node->lastChild() || (m_node == m_endContainer && !m_endOffset))) {
</del><ins>+ if (!m_handledNode && canHaveChildrenForEditing(*m_node) && m_node->parentNode() && (!m_node->lastChild() || (m_node == m_endContainer && !m_endOffset))) {
</ins><span class="cx"> exitNode();
</span><span class="cx"> if (m_positionNode) {
</span><span class="cx"> m_handledNode = true;
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingVisibleSelectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/VisibleSelection.cpp (200930 => 200931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/VisibleSelection.cpp        2016-05-15 22:05:56 UTC (rev 200930)
+++ trunk/Source/WebCore/editing/VisibleSelection.cpp        2016-05-15 22:08:52 UTC (rev 200931)
</span><span class="lines">@@ -95,7 +95,7 @@
</span><span class="cx">
</span><span class="cx"> VisibleSelection VisibleSelection::selectionFromContentsOfNode(Node* node)
</span><span class="cx"> {
</span><del>- ASSERT(!editingIgnoresContent(node));
</del><ins>+ ASSERT(!editingIgnoresContent(*node));
</ins><span class="cx"> return VisibleSelection(firstPositionInNode(node), lastPositionInNode(node), DOWNSTREAM);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingVisibleUnitscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/VisibleUnits.cpp (200930 => 200931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/VisibleUnits.cpp        2016-05-15 22:05:56 UTC (rev 200930)
+++ trunk/Source/WebCore/editing/VisibleUnits.cpp        2016-05-15 22:08:52 UTC (rev 200931)
</span><span class="lines">@@ -1028,7 +1028,7 @@
</span><span class="cx"> IntPoint pointInLine = absoluteLineDirectionPointToLocalPointInBlock(*root, lineDirectionPoint);
</span><span class="cx"> RenderObject& renderer = root->closestLeafChildForPoint(pointInLine, isEditablePosition(p))->renderer();
</span><span class="cx"> Node* node = renderer.node();
</span><del>- if (node && editingIgnoresContent(node))
</del><ins>+ if (node && editingIgnoresContent(*node))
</ins><span class="cx"> return positionInParentBeforeNode(node);
</span><span class="cx"> return renderer.positionForPoint(pointInLine, nullptr);
</span><span class="cx"> }
</span><span class="lines">@@ -1086,7 +1086,7 @@
</span><span class="cx"> IntPoint pointInLine = absoluteLineDirectionPointToLocalPointInBlock(*root, lineDirectionPoint);
</span><span class="cx"> RenderObject& renderer = root->closestLeafChildForPoint(pointInLine, isEditablePosition(p))->renderer();
</span><span class="cx"> Node* node = renderer.node();
</span><del>- if (node && editingIgnoresContent(node))
</del><ins>+ if (node && editingIgnoresContent(*node))
</ins><span class="cx"> return positionInParentBeforeNode(node);
</span><span class="cx"> return renderer.positionForPoint(pointInLine, nullptr);
</span><span class="cx"> }
</span><span class="lines">@@ -1198,7 +1198,7 @@
</span><span class="cx"> node = n;
</span><span class="cx"> offset = 0;
</span><span class="cx"> n = NodeTraversal::previousPostOrder(*n, startBlock);
</span><del>- } else if (editingIgnoresContent(n) || isRenderedTable(n)) {
</del><ins>+ } else if (editingIgnoresContent(*n) || isRenderedTable(n)) {
</ins><span class="cx"> node = n;
</span><span class="cx"> type = Position::PositionIsBeforeAnchor;
</span><span class="cx"> n = n->previousSibling() ? n->previousSibling() : NodeTraversal::previousPostOrder(*n, startBlock);
</span><span class="lines">@@ -1260,7 +1260,7 @@
</span><span class="cx"> node = n;
</span><span class="cx"> offset = r->caretMaxOffset();
</span><span class="cx"> n = NodeTraversal::next(*n, stayInsideBlock);
</span><del>- } else if (editingIgnoresContent(n) || isRenderedTable(n)) {
</del><ins>+ } else if (editingIgnoresContent(*n) || isRenderedTable(n)) {
</ins><span class="cx"> node = n;
</span><span class="cx"> type = Position::PositionIsAfterAnchor;
</span><span class="cx"> n = NodeTraversal::nextSkippingChildren(*n, stayInsideBlock);
</span></span></pre></div>
<a id="trunkSourceWebCoreeditinghtmleditingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/htmlediting.cpp (200930 => 200931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/htmlediting.cpp        2016-05-15 22:05:56 UTC (rev 200930)
+++ trunk/Source/WebCore/editing/htmlediting.cpp        2016-05-15 22:08:52 UTC (rev 200931)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2004-2007, 2016 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -55,6 +55,7 @@
</span><span class="cx"> #include "VisibleUnits.h"
</span><span class="cx"> #include <wtf/Assertions.h>
</span><span class="cx"> #include <wtf/StdLibExtras.h>
</span><ins>+#include <wtf/text/StringBuilder.h>
</ins><span class="cx"> #include <wtf/unicode/CharacterNames.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -63,10 +64,15 @@
</span><span class="cx">
</span><span class="cx"> static bool isVisiblyAdjacent(const Position&, const Position&);
</span><span class="cx">
</span><ins>+bool canHaveChildrenForEditing(const Node& node)
+{
+ return !is<Text>(node) && node.canContainRangeEndPoint();
+}
+
</ins><span class="cx"> // Atomic means that the node has no children, or has children which are ignored for the purposes of editing.
</span><span class="cx"> bool isAtomicNode(const Node* node)
</span><span class="cx"> {
</span><del>- return node && (!node->hasChildNodes() || editingIgnoresContent(node));
</del><ins>+ return node && (!node->hasChildNodes() || editingIgnoresContent(*node));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Compare two positions, taking into account the possibility that one or both
</span><span class="lines">@@ -373,8 +379,9 @@
</span><span class="cx"> if (node.hasChildNodes())
</span><span class="cx"> return node.countChildNodes();
</span><span class="cx">
</span><del>- // NOTE: This should preempt the countChildNodes() for, e.g., select nodes (what does this mean)?
- if (editingIgnoresContent(&node))
</del><ins>+ // NOTE: This should preempt the countChildNodes() for, e.g., select nodes.
+ // FIXME: What does the comment above mean?
+ if (editingIgnoresContent(node))
</ins><span class="cx"> return 1;
</span><span class="cx">
</span><span class="cx"> return 0;
</span><span class="lines">@@ -382,33 +389,37 @@
</span><span class="cx">
</span><span class="cx"> String stringWithRebalancedWhitespace(const String& string, bool startIsStartOfParagraph, bool endIsEndOfParagraph)
</span><span class="cx"> {
</span><del>- Vector<UChar> rebalancedString(string.length());
- StringView(string).getCharactersWithUpconvert(rebalancedString.data());
</del><ins>+ StringBuilder rebalancedString;
</ins><span class="cx">
</span><del>- bool changedSomething = false;
-
</del><span class="cx"> bool previousCharacterWasSpace = false;
</span><del>- for (size_t i = 0; i < rebalancedString.size(); i++) {
- if (!deprecatedIsEditingWhitespace(rebalancedString[i])) {
</del><ins>+ unsigned length = string.length();
+ for (unsigned i = 0; i < length; ++i) {
+ auto character = string[i];
+ if (!deprecatedIsEditingWhitespace(character)) {
</ins><span class="cx"> previousCharacterWasSpace = false;
</span><span class="cx"> continue;
</span><span class="cx"> }
</span><del>- if (previousCharacterWasSpace || (!i && startIsStartOfParagraph) || (i + 1 == rebalancedString.size() && endIsEndOfParagraph)) {
- if (rebalancedString[i] != noBreakSpace) {
- rebalancedString[i] = noBreakSpace;
- changedSomething = true;
- }
</del><ins>+ LChar selectedWhitespaceCharacter;
+ if (previousCharacterWasSpace || (!i && startIsStartOfParagraph) || (i == length - 1 && endIsEndOfParagraph)) {
+ selectedWhitespaceCharacter = noBreakSpace;
</ins><span class="cx"> previousCharacterWasSpace = false;
</span><span class="cx"> } else {
</span><del>- if (rebalancedString[i] != ' ') {
- rebalancedString[i] = ' ';
- changedSomething = true;
- }
</del><ins>+ selectedWhitespaceCharacter = ' ';
</ins><span class="cx"> previousCharacterWasSpace = true;
</span><span class="cx"> }
</span><ins>+ if (character == selectedWhitespaceCharacter)
+ continue;
+ rebalancedString.reserveCapacity(length);
+ rebalancedString.append(string, rebalancedString.length(), i - rebalancedString.length());
+ rebalancedString.append(selectedWhitespaceCharacter);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- return changedSomething ? String::adopt(rebalancedString) : string;
</del><ins>+ if (rebalancedString.isEmpty())
+ return string;
+
+ rebalancedString.reserveCapacity(length);
+ rebalancedString.append(string, rebalancedString.length(), length - rebalancedString.length());
+ return rebalancedString.toString();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool isTableStructureNode(const Node* node)
</span><span class="lines">@@ -423,7 +434,7 @@
</span><span class="cx"> return nonBreakingSpaceString;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static bool isSpecialElement(const Node* node)
</del><ins>+static bool isSpecialHTMLElement(const Node* node)
</ins><span class="cx"> {
</span><span class="cx"> if (!is<HTMLElement>(node))
</span><span class="cx"> return false;
</span><span class="lines">@@ -451,7 +462,7 @@
</span><span class="cx"> {
</span><span class="cx"> auto* rootEditableElement = position.containerNode()->rootEditableElement();
</span><span class="cx"> for (Node* node = position.deprecatedNode(); node && node->rootEditableElement() == rootEditableElement; node = node->parentNode()) {
</span><del>- if (!isSpecialElement(node))
</del><ins>+ if (!isSpecialHTMLElement(node))
</ins><span class="cx"> continue;
</span><span class="cx"> VisiblePosition vPos(position, DOWNSTREAM);
</span><span class="cx"> VisiblePosition firstInElement(firstPositionInOrBeforeNode(node), DOWNSTREAM);
</span><span class="lines">@@ -465,7 +476,7 @@
</span><span class="cx"> {
</span><span class="cx"> auto* rootEditableElement = position.containerNode()->rootEditableElement();
</span><span class="cx"> for (Node* node = position.deprecatedNode(); node && node->rootEditableElement() == rootEditableElement; node = node->parentNode()) {
</span><del>- if (!isSpecialElement(node))
</del><ins>+ if (!isSpecialHTMLElement(node))
</ins><span class="cx"> continue;
</span><span class="cx"> VisiblePosition vPos(position, DOWNSTREAM);
</span><span class="cx"> VisiblePosition lastInElement(lastPositionInOrAfterNode(node), DOWNSTREAM);
</span><span class="lines">@@ -564,14 +575,14 @@
</span><span class="cx"> return positionInParentAfterNode(&node);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool isListElement(Node* node)
</del><ins>+bool isListHTMLElement(Node* node)
</ins><span class="cx"> {
</span><del>- return node && (node->hasTagName(ulTag) || node->hasTagName(olTag) || node->hasTagName(dlTag));
</del><ins>+ return node && (is<HTMLUListElement>(*node) || is<HTMLOListElement>(*node) || is<HTMLDListElement>(*node));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool isListItem(const Node* node)
</span><span class="cx"> {
</span><del>- return node && (isListElement(node->parentNode()) || (node->renderer() && node->renderer()->isListItem()));
</del><ins>+ return node && (isListHTMLElement(node->parentNode()) || (node->renderer() && node->renderer()->isListItem()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Element* enclosingElementWithTag(const Position& position, const QualifiedName& tagName)
</span><span class="lines">@@ -590,12 +601,12 @@
</span><span class="cx"> return nullptr;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Node* enclosingNodeOfType(const Position& p, bool (*nodeIsOfType)(const Node*), EditingBoundaryCrossingRule rule)
</del><ins>+Node* enclosingNodeOfType(const Position& position, bool (*nodeIsOfType)(const Node*), EditingBoundaryCrossingRule rule)
</ins><span class="cx"> {
</span><span class="cx"> // FIXME: support CanSkipCrossEditingBoundary
</span><span class="cx"> ASSERT(rule == CanCrossEditingBoundary || rule == CannotCrossEditingBoundary);
</span><del>- auto* root = rule == CannotCrossEditingBoundary ? highestEditableRoot(p) : 0;
- for (Node* n = p.deprecatedNode(); n; n = n->parentNode()) {
</del><ins>+ auto* root = rule == CannotCrossEditingBoundary ? highestEditableRoot(position) : nullptr;
+ for (Node* n = position.deprecatedNode(); n; n = n->parentNode()) {
</ins><span class="cx"> // Don't return a non-editable node if the input position was editable, since
</span><span class="cx"> // the callers from editing will no doubt want to perform editing inside the returned node.
</span><span class="cx"> if (root && !n->hasEditableStyle())
</span><span class="lines">@@ -608,11 +619,11 @@
</span><span class="cx"> return nullptr;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Node* highestEnclosingNodeOfType(const Position& p, bool (*nodeIsOfType)(const Node*), EditingBoundaryCrossingRule rule, Node* stayWithin)
</del><ins>+Node* highestEnclosingNodeOfType(const Position& position, bool (*nodeIsOfType)(const Node*), EditingBoundaryCrossingRule rule, Node* stayWithin)
</ins><span class="cx"> {
</span><span class="cx"> Node* highest = nullptr;
</span><del>- auto* root = rule == CannotCrossEditingBoundary ? highestEditableRoot(p) : 0;
- for (Node* n = p.containerNode(); n && n != stayWithin; n = n->parentNode()) {
</del><ins>+ auto* root = rule == CannotCrossEditingBoundary ? highestEditableRoot(position) : nullptr;
+ for (Node* n = position.containerNode(); n && n != stayWithin; n = n->parentNode()) {
</ins><span class="cx"> if (root && !n->hasEditableStyle())
</span><span class="cx"> continue;
</span><span class="cx"> if (nodeIsOfType(n))
</span><span class="lines">@@ -693,7 +704,7 @@
</span><span class="cx">
</span><span class="cx"> // FIXME: This function is inappropriately named since it starts with node instead of node->parentNode()
</span><span class="cx"> for (Node* n = node; n && n->parentNode(); n = n->parentNode()) {
</span><del>- if (n->hasTagName(liTag) || (isListElement(n->parentNode()) && n != root))
</del><ins>+ if (is<HTMLLIElement>(*n) || (isListHTMLElement(n->parentNode()) && n != root))
</ins><span class="cx"> return n;
</span><span class="cx"> if (n == root || isTableCell(n))
</span><span class="cx"> return nullptr;
</span><span class="lines">@@ -706,7 +717,7 @@
</span><span class="cx"> {
</span><span class="cx"> // Check the DOM so that we'll find collapsed sublists without renderers.
</span><span class="cx"> for (Node* n = listItem->firstChild(); n; n = n->nextSibling()) {
</span><del>- if (isListElement(n))
</del><ins>+ if (isListHTMLElement(n))
</ins><span class="cx"> return downcast<HTMLElement>(n);
</span><span class="cx"> }
</span><span class="cx"> return nullptr;
</span><span class="lines">@@ -716,7 +727,7 @@
</span><span class="cx"> {
</span><span class="cx"> // Check the DOM so that we'll find collapsed sublists without renderers.
</span><span class="cx"> for (Node* n = listItem->nextSibling(); n; n = n->nextSibling()) {
</span><del>- if (isListElement(n))
</del><ins>+ if (isListHTMLElement(n))
</ins><span class="cx"> return downcast<HTMLElement>(n);
</span><span class="cx"> if (isListItem(listItem))
</span><span class="cx"> return nullptr;
</span><span class="lines">@@ -994,9 +1005,10 @@
</span><span class="cx"> int caretMaxOffset(const Node& node)
</span><span class="cx"> {
</span><span class="cx"> // For rendered text nodes, return the last position that a caret could occupy.
</span><del>- if (node.isTextNode() && node.renderer())
- return node.renderer()->caretMaxOffset();
- // For containers return the number of children. For others do the same as above.
</del><ins>+ if (is<Text>(node)) {
+ if (auto* renderer = downcast<Text>(node).renderer())
+ return renderer->caretMaxOffset();
+ }
</ins><span class="cx"> return lastOffsetForEditing(node);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1216,9 +1228,9 @@
</span><span class="cx"> return nullptr;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static inline bool caretRendersInsideNode(Node* node)
</del><ins>+static inline bool caretRendersInsideNode(Node& node)
</ins><span class="cx"> {
</span><del>- return node && !isRenderedTable(node) && !editingIgnoresContent(node);
</del><ins>+ return !isRenderedTable(&node) && !editingIgnoresContent(node);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RenderBlock* rendererForCaretPainting(Node* node)
</span><span class="lines">@@ -1231,7 +1243,7 @@
</span><span class="cx"> return nullptr;
</span><span class="cx">
</span><span class="cx"> // If caretNode is a block and caret is inside it, then caret should be painted by that block.
</span><del>- bool paintedByBlock = is<RenderBlockFlow>(*renderer) && caretRendersInsideNode(node);
</del><ins>+ bool paintedByBlock = is<RenderBlockFlow>(*renderer) && caretRendersInsideNode(*node);
</ins><span class="cx"> return paintedByBlock ? downcast<RenderBlock>(renderer) : renderer->containingBlock();
</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 (200930 => 200931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/htmlediting.h        2016-05-15 22:05:56 UTC (rev 200930)
+++ trunk/Source/WebCore/editing/htmlediting.h        2016-05-15 22:08:52 UTC (rev 200931)
</span><span class="lines">@@ -71,14 +71,13 @@
</span><span class="cx"> bool hasEditableStyle(const Node&, EditableType);
</span><span class="cx"> bool isEditableNode(const Node&);
</span><span class="cx">
</span><del>-// FIXME: editingIgnoresContent, canHaveChildrenForEditing, and isAtomicNode should be renamed to better reflect their usage.
</del><ins>+// FIXME: editingIgnoresContent, canHaveChildrenForEditing, and isAtomicNode should be named to clarify how they differ.
</ins><span class="cx">
</span><span class="cx"> // Returns true for nodes that either have no content, or have content that is ignored (skipped over) while editing.
</span><span class="cx"> // There are no VisiblePositions inside these nodes.
</span><del>-bool editingIgnoresContent(const Node*);
</del><ins>+bool editingIgnoresContent(const Node&);
</ins><span class="cx">
</span><del>-bool canHaveChildrenForEditing(const Node*);
-
</del><ins>+bool canHaveChildrenForEditing(const Node&);
</ins><span class="cx"> bool isAtomicNode(const Node*);
</span><span class="cx">
</span><span class="cx"> bool isBlock(const Node*);
</span><span class="lines">@@ -91,7 +90,7 @@
</span><span class="cx"> bool isTableCell(const Node*);
</span><span class="cx"> bool isEmptyTableCell(const Node*);
</span><span class="cx"> bool isTableStructureNode(const Node*);
</span><del>-bool isListElement(Node*);
</del><ins>+bool isListHTMLElement(Node*);
</ins><span class="cx"> bool isListItem(const Node*);
</span><span class="cx"> bool isNodeRendered(const Node&);
</span><span class="cx"> bool isRenderedAsNonInlineTableImageOrHR(const Node*);
</span><span class="lines">@@ -101,7 +100,7 @@
</span><span class="cx">
</span><span class="cx"> bool areIdenticalElements(const Node&, const Node&);
</span><span class="cx">
</span><del>-bool positionBeforeOrAfterNodeIsCandidate(Node*);
</del><ins>+bool positionBeforeOrAfterNodeIsCandidate(Node&);
</ins><span class="cx">
</span><span class="cx"> // -------------------------------------------------------------------------
</span><span class="cx"> // Position
</span><span class="lines">@@ -224,33 +223,28 @@
</span><span class="cx"> return character == '\'' || character == rightSingleQuotationMark || character == hebrewPunctuationGershayim;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-inline bool editingIgnoresContent(const Node* node)
</del><ins>+inline bool editingIgnoresContent(const Node& node)
</ins><span class="cx"> {
</span><del>- return !node->canContainRangeEndPoint();
</del><ins>+ return !node.canContainRangeEndPoint();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-inline bool canHaveChildrenForEditing(const Node* node)
</del><ins>+inline bool positionBeforeOrAfterNodeIsCandidate(Node& node)
</ins><span class="cx"> {
</span><del>- return !node->isTextNode() && node->canContainRangeEndPoint();
</del><ins>+ return isRenderedTable(&node) || editingIgnoresContent(node);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-inline bool positionBeforeOrAfterNodeIsCandidate(Node* node)
-{
- return isRenderedTable(node) || editingIgnoresContent(node);
-}
-
</del><span class="cx"> inline Position firstPositionInOrBeforeNode(Node* node)
</span><span class="cx"> {
</span><span class="cx"> if (!node)
</span><span class="cx"> return { };
</span><del>- return editingIgnoresContent(node) ? positionBeforeNode(node) : firstPositionInNode(node);
</del><ins>+ return editingIgnoresContent(*node) ? positionBeforeNode(node) : firstPositionInNode(node);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> inline Position lastPositionInOrAfterNode(Node* node)
</span><span class="cx"> {
</span><span class="cx"> if (!node)
</span><span class="cx"> return { };
</span><del>- return editingIgnoresContent(node) ? positionAfterNode(node) : lastPositionInNode(node);
</del><ins>+ return editingIgnoresContent(*node) ? positionAfterNode(node) : lastPositionInNode(node);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingmarkupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/markup.cpp (200930 => 200931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/markup.cpp        2016-05-15 22:05:56 UTC (rev 200930)
+++ trunk/Source/WebCore/editing/markup.cpp        2016-05-15 22:08:52 UTC (rev 200931)
</span><span class="lines">@@ -402,9 +402,10 @@
</span><span class="cx"> next = NodeTraversal::next(*n);
</span><span class="cx"> bool openedTag = false;
</span><span class="cx">
</span><del>- if (isBlock(n) && canHaveChildrenForEditing(n) && next == pastEnd)
</del><ins>+ if (isBlock(n) && canHaveChildrenForEditing(*n) && next == pastEnd) {
</ins><span class="cx"> // Don't write out empty block containers that aren't fully selected.
</span><span class="cx"> continue;
</span><ins>+ }
</ins><span class="cx">
</span><span class="cx"> if (!n->renderer() && !enclosingElementWithTag(firstPositionInOrBeforeNode(n), selectTag)) {
</span><span class="cx"> next = NodeTraversal::nextSkippingChildren(*n);
</span><span class="lines">@@ -529,7 +530,7 @@
</span><span class="cx">
</span><span class="cx"> static Node* highestAncestorToWrapMarkup(const Range* range, EAnnotateForInterchange shouldAnnotate)
</span><span class="cx"> {
</span><del>- Node* commonAncestor = range->commonAncestorContainer();
</del><ins>+ auto* commonAncestor = range->commonAncestorContainer();
</ins><span class="cx"> ASSERT(commonAncestor);
</span><span class="cx"> Node* specialCommonAncestor = nullptr;
</span><span class="cx"> if (shouldAnnotate == AnnotateForInterchange) {
</span><span class="lines">@@ -537,10 +538,10 @@
</span><span class="cx"> // the structure and appearance of the copied markup.
</span><span class="cx"> specialCommonAncestor = ancestorToRetainStructureAndAppearance(commonAncestor);
</span><span class="cx">
</span><del>- if (Node* parentListNode = enclosingNodeOfType(firstPositionInOrBeforeNode(range->firstNode()), isListItem)) {
- if (!editingIgnoresContent(parentListNode) && WebCore::areRangesEqual(VisibleSelection::selectionFromContentsOfNode(parentListNode).toNormalizedRange().get(), range)) {
</del><ins>+ if (auto* parentListNode = downcast<Element>(enclosingNodeOfType(firstPositionInOrBeforeNode(range->firstNode()), isListItem))) {
+ if (!editingIgnoresContent(*parentListNode) && WebCore::areRangesEqual(VisibleSelection::selectionFromContentsOfNode(parentListNode).toNormalizedRange().get(), range)) {
</ins><span class="cx"> specialCommonAncestor = parentListNode->parentNode();
</span><del>- while (specialCommonAncestor && !isListElement(specialCommonAncestor))
</del><ins>+ while (specialCommonAncestor && !isListHTMLElement(specialCommonAncestor))
</ins><span class="cx"> specialCommonAncestor = specialCommonAncestor->parentNode();
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -550,7 +551,7 @@
</span><span class="cx"> specialCommonAncestor = highestMailBlockquote;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- Node* checkAncestor = specialCommonAncestor ? specialCommonAncestor : commonAncestor;
</del><ins>+ auto* checkAncestor = specialCommonAncestor ? specialCommonAncestor : commonAncestor;
</ins><span class="cx"> if (checkAncestor->renderer() && checkAncestor->renderer()->containingBlock()) {
</span><span class="cx"> Node* newSpecialCommonAncestor = highestEnclosingNodeOfType(firstPositionInNode(checkAncestor), &isElementPresentational, CanCrossEditingBoundary, checkAncestor->renderer()->containingBlock()->element());
</span><span class="cx"> if (newSpecialCommonAncestor)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLSpanElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLSpanElement.cpp (200930 => 200931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLSpanElement.cpp        2016-05-15 22:05:56 UTC (rev 200930)
+++ trunk/Source/WebCore/html/HTMLSpanElement.cpp        2016-05-15 22:08:52 UTC (rev 200931)
</span><span class="lines">@@ -38,6 +38,11 @@
</span><span class="cx"> ASSERT(hasTagName(spanTag));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+Ref<HTMLSpanElement> HTMLSpanElement::create(Document& document)
+{
+ return adoptRef(*new HTMLSpanElement(spanTag, document));
+}
+
</ins><span class="cx"> Ref<HTMLSpanElement> HTMLSpanElement::create(const QualifiedName& tagName, Document& document)
</span><span class="cx"> {
</span><span class="cx"> return adoptRef(*new HTMLSpanElement(tagName, document));
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLSpanElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLSpanElement.h (200930 => 200931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLSpanElement.h        2016-05-15 22:05:56 UTC (rev 200930)
+++ trunk/Source/WebCore/html/HTMLSpanElement.h        2016-05-15 22:08:52 UTC (rev 200931)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx">
</span><span class="cx"> class HTMLSpanElement final : public HTMLElement {
</span><span class="cx"> public:
</span><ins>+ static Ref<HTMLSpanElement> create(Document&);
</ins><span class="cx"> static Ref<HTMLSpanElement> create(const QualifiedName&, Document&);
</span><span class="cx">
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMSelectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMSelection.cpp (200930 => 200931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMSelection.cpp        2016-05-15 22:05:56 UTC (rev 200930)
+++ trunk/Source/WebCore/page/DOMSelection.cpp        2016-05-15 22:08:52 UTC (rev 200931)
</span><span class="lines">@@ -35,12 +35,9 @@
</span><span class="cx"> #include "ExceptionCode.h"
</span><span class="cx"> #include "Frame.h"
</span><span class="cx"> #include "FrameSelection.h"
</span><del>-#include "Node.h"
</del><span class="cx"> #include "Range.h"
</span><span class="cx"> #include "TextIterator.h"
</span><del>-#include "TreeScope.h"
</del><span class="cx"> #include "htmlediting.h"
</span><del>-#include <wtf/text/WTFString.h>
</del><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (200930 => 200931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.cpp        2016-05-15 22:05:56 UTC (rev 200930)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp        2016-05-15 22:08:52 UTC (rev 200931)
</span><span class="lines">@@ -37,8 +37,8 @@
</span><span class="cx"> #include "GraphicsContext.h"
</span><span class="cx"> #include "HTMLBodyElement.h"
</span><span class="cx"> #include "HTMLButtonElement.h"
</span><del>-#include "HTMLElement.h"
</del><span class="cx"> #include "HTMLFrameOwnerElement.h"
</span><ins>+#include "HTMLHtmlElement.h"
</ins><span class="cx"> #include "HTMLInputElement.h"
</span><span class="cx"> #include "HTMLNames.h"
</span><span class="cx"> #include "HTMLTextAreaElement.h"
</span><span class="lines">@@ -4386,7 +4386,7 @@
</span><span class="cx"> // FIXME: Border/padding should be added for all elements but this workaround
</span><span class="cx"> // is needed because we use offsets inside an "atomic" element to represent
</span><span class="cx"> // positions before and after the element in deprecated editing offsets.
</span><del>- if (element() && !(editingIgnoresContent(element()) || isRenderedTable(element()))) {
</del><ins>+ if (element() && !(editingIgnoresContent(*element()) || isRenderedTable(element()))) {
</ins><span class="cx"> rect.setX(rect.x() + borderLeft() + paddingLeft());
</span><span class="cx"> rect.setY(rect.y() + paddingTop() + borderTop());
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitiosChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ios/ChangeLog (200930 => 200931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ios/ChangeLog        2016-05-15 22:05:56 UTC (rev 200930)
+++ trunk/Source/WebKit/ios/ChangeLog        2016-05-15 22:08:52 UTC (rev 200931)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-05-15 Darin Adler <darin@apple.com>
+
+ More CTTE and other cleanups for HTML editing header
+ https://bugs.webkit.org/show_bug.cgi?id=157722
+
+ Reviewed by Chris Dumez.
+
+ * WebCoreSupport/WebFrameIOS.mm:
+ (-[WebFrame previousUnperturbedDictationResultBoundaryFromPosition:]): auto
+ (-[WebFrame nextUnperturbedDictationResultBoundaryFromPosition:]): auto
+
</ins><span class="cx"> 2016-05-14 Darin Adler <darin@apple.com>
</span><span class="cx">
</span><span class="cx"> CTTE for the HTML editing header
</span></span></pre></div>
<a id="trunkSourceWebKitiosWebCoreSupportWebFrameIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ios/WebCoreSupport/WebFrameIOS.mm (200930 => 200931)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ios/WebCoreSupport/WebFrameIOS.mm        2016-05-15 22:05:56 UTC (rev 200930)
+++ trunk/Source/WebKit/ios/WebCoreSupport/WebFrameIOS.mm        2016-05-15 22:08:52 UTC (rev 200931)
</span><span class="lines">@@ -848,7 +848,7 @@
</span><span class="cx"> while (currentVisiblePosition.isNotNull()) {
</span><span class="cx"> WebVisiblePosition *currentWebVisiblePosition = [WebVisiblePosition _wrapVisiblePosition:currentVisiblePosition];
</span><span class="cx">
</span><del>- Node *currentNode = currentVisiblePosition.deepEquivalent().anchorNode();
</del><ins>+ auto* currentNode = currentVisiblePosition.deepEquivalent().anchorNode();
</ins><span class="cx"> int lastOffset = lastOffsetForEditing(*currentNode);
</span><span class="cx"> ASSERT(lastOffset >= 0);
</span><span class="cx"> if (lastOffset < 0)
</span><span class="lines">@@ -904,7 +904,7 @@
</span><span class="cx"> while (currentVisiblePosition.isNotNull()) {
</span><span class="cx"> WebVisiblePosition *currentWebVisiblePosition = [WebVisiblePosition _wrapVisiblePosition:currentVisiblePosition];
</span><span class="cx">
</span><del>- Node *currentNode = currentVisiblePosition.deepEquivalent().anchorNode();
</del><ins>+ auto* currentNode = currentVisiblePosition.deepEquivalent().anchorNode();
</ins><span class="cx"> int lastOffset = lastOffsetForEditing(*currentNode);
</span><span class="cx"> ASSERT(lastOffset >= 0);
</span><span class="cx"> if (lastOffset < 0)
</span></span></pre>
</div>
</div>
</body>
</html>