<!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>[200922] 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/200922">200922</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2016-05-14 13:09:50 -0700 (Sat, 14 May 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>CTTE for the HTML editing header
https://bugs.webkit.org/show_bug.cgi?id=157676

Reviewed by Chris Dumez.

Source/WebCore:

* accessibility/AXObjectCache.cpp:
(WebCore::AccessibilityReplacedText::postTextStateChangeNotification): Use auto so we have a
change to compile more efficient code using the more specific types returned, rather than
explicitly using a less specific type like Node.
(WebCore::AXObjectCache::startCharacterOffsetOfParagraph): Ditto.
* accessibility/atk/WebKitAccessibleInterfaceText.cpp: Update for deprecatedIsEditingWhitespace name.
* dom/Position.cpp:
(WebCore::Position::offsetForPositionAfterAnchor): Update to use a reference instead of a pointer.
(WebCore::Position::next): Ditto.
(WebCore::Position::atFirstEditingPositionForNode): Ditto.
(WebCore::Position::atLastEditingPositionForNode): Ditto.
(WebCore::Position::atStartOfTree): Ditto.
(WebCore::Position::atEndOfTree): Ditto.
(WebCore::Position::upstream): Ditto.
(WebCore::Position::downstream): Ditto.
(WebCore::Position::rendersInDifferentPosition): Ditto.
* dom/PositionIterator.cpp:
(WebCore::PositionIterator::increment): Ditto.
(WebCore::PositionIterator::decrement): Ditto.
(WebCore::PositionIterator::atEnd): Ditto.
(WebCore::PositionIterator::atEndOfNode): Ditto.
* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::markPrecedingWhitespaceForDeletedAutocorrectionAfterCommand):
Use new name, deprecatedIsEditingWhitespace.
* editing/ApplyBlockElementCommand.cpp:
(WebCore::ApplyBlockElementCommand::formatSelection): Use auto (see rationale above).
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyBlockStyle): More of the same.
(WebCore::ApplyStyleCommand::applyRelativeFontStyleChange): Ditto.
(WebCore::ApplyStyleCommand::fixRangeAndApplyInlineStyle): Ditto.
(WebCore::ApplyStyleCommand::isValidCaretPositionInTextNode): Ditto.
(WebCore::ApplyStyleCommand::mergeStartWithPreviousIfIdentical): Ditto.
(WebCore::ApplyStyleCommand::mergeEndWithNextIfIdentical): Ditto.
(WebCore::ApplyStyleCommand::surroundNodeRangeWithElement): Ditto.
* editing/BreakBlockquoteCommand.cpp:
(WebCore::BreakBlockquoteCommand::doApply): Ditto.
* editing/CompositeEditCommand.cpp:
(WebCore::postTextStateChangeNotification): Ditto.
(WebCore::CompositeEditCommand::insertNodeAt): Ditto.
(WebCore::CompositeEditCommand::positionOutsideTabSpan): Ditto.
(WebCore::containsOnlyDeprecatedEditingWhitespace): Ditto.
(WebCore::CompositeEditCommand::shouldRebalanceLeadingWhitespaceFor): Ditto.
(WebCore::CompositeEditCommand::rebalanceWhitespaceAt): Ditto.
(WebCore::CompositeEditCommand::rebalanceWhitespaceOnTextSubstring): Ditto.
(WebCore::CompositeEditCommand::insertNewDefaultParagraphElementAt): Ditto.
(WebCore::CompositeEditCommand::moveParagraphWithClones): Ditto.
(WebCore::CompositeEditCommand::moveParagraphs): Ditto.
* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::initializeStartEnd): Ditto.
(WebCore::DeleteSelectionCommand::handleGeneralDelete): Ditto.
(WebCore::DeleteSelectionCommand::mergeParagraphs): Ditto.
(WebCore::DeleteSelectionCommand::doApply): Ditto.
* editing/EditCommand.cpp:
(WebCore::EditCommand::postTextStateChangeNotification): Ditto.
* editing/EditingStyle.cpp: Ditto.
* editing/Editor.cpp:
(WebCore::Editor::advanceToNextMisspelling): Ditto.
* editing/FormatBlockCommand.cpp:
(WebCore::FormatBlockCommand::formatRange): Ditto.
* editing/IndentOutdentCommand.cpp:
(WebCore::IndentOutdentCommand::outdentParagraph): Ditto.
* editing/InsertLineBreakCommand.cpp:
(WebCore::InsertLineBreakCommand::doApply): Ditto.
* editing/InsertListCommand.cpp:
(WebCore::InsertListCommand::fixOrphanedListChild): Ditto.
(WebCore::InsertListCommand::doApplyForSingleParagraph): Ditto.
(WebCore::InsertListCommand::unlistifyParagraph): Ditto.
(WebCore::InsertListCommand::listifyParagraph): Ditto.
* editing/InsertParagraphSeparatorCommand.cpp:
(WebCore::InsertParagraphSeparatorCommand::doApply): Ditto.
* editing/InsertTextCommand.cpp:
(WebCore::InsertTextCommand::insertTab): Ditto.
* editing/ModifySelectionListLevel.cpp:
(WebCore::IncreaseSelectionListLevelCommand::doApply): Ditto.
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplacementFragment::removeUnrenderedNodes): Ditto.
(WebCore::ReplaceSelectionCommand::shouldMerge): Ditto.
(WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline): Ditto.
(WebCore::ReplaceSelectionCommand::mergeEndIfNeeded): Ditto.
(WebCore::enclosingInline): Ditto.
(WebCore::ReplaceSelectionCommand::doApply): Ditto.
* editing/TextIterator.cpp:
(WebCore::maxOffsetIncludingCollapsedSpaces): Ditto.
* editing/TypingCommand.cpp:
(WebCore::TypingCommand::forwardDeleteKeyPressed): Ditto.
* editing/VisiblePosition.cpp:
(WebCore::VisiblePosition::honorEditingBoundaryAtOrBefore): Ditto.
(WebCore::VisiblePosition::honorEditingBoundaryAtOrAfter): Ditto.
* editing/VisibleSelection.cpp:
(WebCore::VisibleSelection::setStartAndEndFromBaseAndExtentRespectingGranularity): Ditto.
(WebCore::VisibleSelection::adjustSelectionToAvoidCrossingEditingBoundaries): Ditto.
* editing/VisibleUnits.cpp:
(WebCore::previousRootInlineBoxCandidatePosition): Ditto.
(WebCore::nextRootInlineBoxCandidatePosition): Ditto.
(WebCore::startOfParagraph): Ditto.
(WebCore::endOfParagraph): Ditto.
(WebCore::startOfEditableContent): Ditto.
(WebCore::endOfEditableContent): Ditto.

* editing/htmlediting.cpp:
(WebCore::highestEditableRoot): Changed return type to ContainerNode. Maybe later could
change it to Element.
(WebCore::lowestEditableAncestor): Changed return type to Element.
(WebCore::isEditableToAccessibility): Use auto.
(WebCore::isRichlyEditablePosition): Ditto.
(WebCore::editableRootForPosition): Ditto.
(WebCore::unsplittableElementForPosition):Ditto.
(WebCore::nextCandidate): Streamline.
(WebCore::nextVisuallyDistinctCandidate): Ditto.
(WebCore::previousCandidate): Ditto.
(WebCore::previousVisuallyDistinctCandidate): Ditto.
(WebCore::firstEditablePositionAfterPositionInRoot): Changed arugment type to
ContainerNode.
(WebCore::lastEditablePositionBeforePositionInRoot): Ditto.
(WebCore::lastOffsetForEditing): Changed argument type to reference.
(WebCore::stringWithRebalancedWhitespace): Optimized the case where the function does
not need to change the string, so it just returns the passed string rather than a copy.
(WebCore::isTableStructureNode): Use auto.
(WebCore::isSpecialElement): Made this function private to the file. Use auto.
(WebCore::firstInSpecialElement): Return an HTMLElement.
(WebCore::lastInSpecialElement): Ditto.
(WebCore::isFirstVisiblePositionInSpecialElement): Made this function private to the file.
(WebCore::positionBeforeContainingSpecialElement): Changed out argument to HTMLElement.
(WebCore::isLastVisiblePositionInSpecialElement): Ditto.
(WebCore::positionAfterContainingSpecialElement): Ditto.
(WebCore::positionOutsideContainingSpecialElement): Ditto.
(WebCore::isFirstPositionAfterTable): Changed return type to Element.
(WebCore::isLastPositionBeforeTable): Ditto.
(WebCore::visiblePositionBeforeNode): Changed argument type to reference.
(WebCore::visiblePositionAfterNode): Ditto.
(WebCore::enclosingElementWithTag): Use auto. Removed special case for null since the
algorithm already handles null correctly.
(WebCore::enclosingNodeOfType): Use auto.
(WebCore::highestEnclosingNodeOfType): Ditto.
(WebCore::highestNodeToRemoveInPruning): Ditto.
(WebCore::enclosingTableCell): Changed return type to Element.
(WebCore::enclosingAnchorElement): Removed special case for null since the algorithm
already handles null correctly.
(WebCore::enclosingList): Use auto.
(WebCore::enclosingListChild): Use auto.
(WebCore::enclosingEmptyListItem): Use auto.
(WebCore::outermostEnclosingList): Use auto.
(WebCore::canMergeLists): Use references and more specific type. Since both elements are
known to be HTMLElement, compare local names instead of using hasTagName.
(WebCore::isRenderedTable): Use auto.
(WebCore::isTableCell): Ditto.
(WebCore::isEmptyTableCell): Ditto.
(WebCore::createBreakElement): Deleted. Callers can use HTMLBRElement directly.
(WebCore::createOrderedListElement): Deleted. Callers can use HTMLOListElement directly.
(WebCore::createUnorderedListElement): Deleted. Callers can use HTMLUListElement directly.
(WebCore::createListItemElement): Deleted. Callers can use HTMLLIElement directly.
(WebCore::isTabSpanNode): Remove redundant checks and did more specific typecast.
(WebCore::isTabSpanTextNode): Removed redundant null checks.
(WebCore::tabSpanNode): Changed return type to HTMLSpanElement.
(WebCore::positionOutsideTabSpan): Deleted. Unused function.
(WebCore::createTabSpanElement): Made one of the overloads private to this file. Use auto.
Changed argument type since we don't need to support null. Moved createEditingTextNode code,
specific to the version without a string into that function rather than the helper function.
(WebCore::isNodeRendered): Changed argument type to a reference.
(WebCore::numEnclosingMailBlockquotes): Streamlined.
(WebCore::isMailBlockquote): Use downcast instead of static_cast.
(WebCore::caretMinOffset): Take a reference instead of a pointer.
(WebCore::caretMaxOffset): Ditto.
(WebCore::selectionForParagraphIteration): Use auto.
(WebCore::indexForVisiblePosition): Ditto.
(WebCore::visiblePositionForIndex): Ditto.
(WebCore::visiblePositionForIndexUsingCharacterIterator): Ditto.
(WebCore::isVisiblyAdjacent): Made this private to this file.
(WebCore::isNodeVisiblyContainedWithin): Changed argument type to a reference.
(WebCore::areIdenticalElements): Changed argument types to references.
(WebCore::adjustedSelectionStartForStyleComputation): Use auto.
(WebCore::isBlockFlowElement): Changed argument type to a reference. Use auto.
(WebCore::deprecatedEnclosingBlockFlowElement): Updated for reference changes.
(WebCore::rendererForCaretPainting): Use auto.

* editing/htmlediting.h: Use pragma once. Removed unneeded includes and forward declarations.
Removed various non-helpful comments (the sections still don't make sense; not really good to
group functions by their return types). Moved inline functoin bodies to the bottom of the file.
Renamed isWhitespace to deprecatedIsEditingWhitespace.

* editing/markup.cpp:
(WebCore::createFragmentFromText): Use HTMLBRElement.
* page/DOMSelection.cpp:
(WebCore::DOMSelection::extend): Updated since caretMaxOffset takes a reference.

Source/WebKit/ios:

* WebCoreSupport/WebFrameIOS.mm:
(-[WebFrame previousUnperturbedDictationResultBoundaryFromPosition:]): Update since
lastOffsetForEditing takes a reference now. Seems like this code should be in WebCore.
(-[WebFrame nextUnperturbedDictationResultBoundaryFromPosition:]): Ditto.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAXObjectCachecpp">trunk/Source/WebCore/accessibility/AXObjectCache.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityRenderObjectcpp">trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityatkWebKitAccessibleInterfaceTextcpp">trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp</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="#trunkSourceWebCoreeditingAlternativeTextControllercpp">trunk/Source/WebCore/editing/AlternativeTextController.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingApplyBlockElementCommandcpp">trunk/Source/WebCore/editing/ApplyBlockElementCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingApplyStyleCommandcpp">trunk/Source/WebCore/editing/ApplyStyleCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingBreakBlockquoteCommandcpp">trunk/Source/WebCore/editing/BreakBlockquoteCommand.cpp</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="#trunkSourceWebCoreeditingEditCommandcpp">trunk/Source/WebCore/editing/EditCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingEditingStylecpp">trunk/Source/WebCore/editing/EditingStyle.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingEditorcpp">trunk/Source/WebCore/editing/Editor.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingFormatBlockCommandcpp">trunk/Source/WebCore/editing/FormatBlockCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingIndentOutdentCommandcpp">trunk/Source/WebCore/editing/IndentOutdentCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingInsertLineBreakCommandcpp">trunk/Source/WebCore/editing/InsertLineBreakCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingInsertListCommandcpp">trunk/Source/WebCore/editing/InsertListCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingInsertParagraphSeparatorCommandcpp">trunk/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingInsertTextCommandcpp">trunk/Source/WebCore/editing/InsertTextCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingModifySelectionListLevelcpp">trunk/Source/WebCore/editing/ModifySelectionListLevel.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingReplaceSelectionCommandcpp">trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingTextIteratorcpp">trunk/Source/WebCore/editing/TextIterator.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingTypingCommandcpp">trunk/Source/WebCore/editing/TypingCommand.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingVisiblePositioncpp">trunk/Source/WebCore/editing/VisiblePosition.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="#trunkSourceWebCorepageDOMSelectioncpp">trunk/Source/WebCore/page/DOMSelection.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 (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/ChangeLog        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -1,3 +1,195 @@
</span><ins>+2016-05-14  Darin Adler  &lt;darin@apple.com&gt;
+
+        CTTE for the HTML editing header
+        https://bugs.webkit.org/show_bug.cgi?id=157676
+
+        Reviewed by Chris Dumez.
+
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::AccessibilityReplacedText::postTextStateChangeNotification): Use auto so we have a
+        change to compile more efficient code using the more specific types returned, rather than
+        explicitly using a less specific type like Node.
+        (WebCore::AXObjectCache::startCharacterOffsetOfParagraph): Ditto.
+        * accessibility/atk/WebKitAccessibleInterfaceText.cpp: Update for deprecatedIsEditingWhitespace name.
+        * dom/Position.cpp:
+        (WebCore::Position::offsetForPositionAfterAnchor): Update to use a reference instead of a pointer.
+        (WebCore::Position::next): Ditto.
+        (WebCore::Position::atFirstEditingPositionForNode): Ditto.
+        (WebCore::Position::atLastEditingPositionForNode): Ditto.
+        (WebCore::Position::atStartOfTree): Ditto.
+        (WebCore::Position::atEndOfTree): Ditto.
+        (WebCore::Position::upstream): Ditto.
+        (WebCore::Position::downstream): Ditto.
+        (WebCore::Position::rendersInDifferentPosition): Ditto.
+        * dom/PositionIterator.cpp:
+        (WebCore::PositionIterator::increment): Ditto.
+        (WebCore::PositionIterator::decrement): Ditto.
+        (WebCore::PositionIterator::atEnd): Ditto.
+        (WebCore::PositionIterator::atEndOfNode): Ditto.
+        * editing/AlternativeTextController.cpp:
+        (WebCore::AlternativeTextController::markPrecedingWhitespaceForDeletedAutocorrectionAfterCommand):
+        Use new name, deprecatedIsEditingWhitespace.
+        * editing/ApplyBlockElementCommand.cpp:
+        (WebCore::ApplyBlockElementCommand::formatSelection): Use auto (see rationale above).
+        * editing/ApplyStyleCommand.cpp:
+        (WebCore::ApplyStyleCommand::applyBlockStyle): More of the same.
+        (WebCore::ApplyStyleCommand::applyRelativeFontStyleChange): Ditto.
+        (WebCore::ApplyStyleCommand::fixRangeAndApplyInlineStyle): Ditto.
+        (WebCore::ApplyStyleCommand::isValidCaretPositionInTextNode): Ditto.
+        (WebCore::ApplyStyleCommand::mergeStartWithPreviousIfIdentical): Ditto.
+        (WebCore::ApplyStyleCommand::mergeEndWithNextIfIdentical): Ditto.
+        (WebCore::ApplyStyleCommand::surroundNodeRangeWithElement): Ditto.
+        * editing/BreakBlockquoteCommand.cpp:
+        (WebCore::BreakBlockquoteCommand::doApply): Ditto.
+        * editing/CompositeEditCommand.cpp:
+        (WebCore::postTextStateChangeNotification): Ditto.
+        (WebCore::CompositeEditCommand::insertNodeAt): Ditto.
+        (WebCore::CompositeEditCommand::positionOutsideTabSpan): Ditto.
+        (WebCore::containsOnlyDeprecatedEditingWhitespace): Ditto.
+        (WebCore::CompositeEditCommand::shouldRebalanceLeadingWhitespaceFor): Ditto.
+        (WebCore::CompositeEditCommand::rebalanceWhitespaceAt): Ditto.
+        (WebCore::CompositeEditCommand::rebalanceWhitespaceOnTextSubstring): Ditto.
+        (WebCore::CompositeEditCommand::insertNewDefaultParagraphElementAt): Ditto.
+        (WebCore::CompositeEditCommand::moveParagraphWithClones): Ditto.
+        (WebCore::CompositeEditCommand::moveParagraphs): Ditto.
+        * editing/DeleteSelectionCommand.cpp:
+        (WebCore::DeleteSelectionCommand::initializeStartEnd): Ditto.
+        (WebCore::DeleteSelectionCommand::handleGeneralDelete): Ditto.
+        (WebCore::DeleteSelectionCommand::mergeParagraphs): Ditto.
+        (WebCore::DeleteSelectionCommand::doApply): Ditto.
+        * editing/EditCommand.cpp:
+        (WebCore::EditCommand::postTextStateChangeNotification): Ditto.
+        * editing/EditingStyle.cpp: Ditto.
+        * editing/Editor.cpp:
+        (WebCore::Editor::advanceToNextMisspelling): Ditto.
+        * editing/FormatBlockCommand.cpp:
+        (WebCore::FormatBlockCommand::formatRange): Ditto.
+        * editing/IndentOutdentCommand.cpp:
+        (WebCore::IndentOutdentCommand::outdentParagraph): Ditto.
+        * editing/InsertLineBreakCommand.cpp:
+        (WebCore::InsertLineBreakCommand::doApply): Ditto.
+        * editing/InsertListCommand.cpp:
+        (WebCore::InsertListCommand::fixOrphanedListChild): Ditto.
+        (WebCore::InsertListCommand::doApplyForSingleParagraph): Ditto.
+        (WebCore::InsertListCommand::unlistifyParagraph): Ditto.
+        (WebCore::InsertListCommand::listifyParagraph): Ditto.
+        * editing/InsertParagraphSeparatorCommand.cpp:
+        (WebCore::InsertParagraphSeparatorCommand::doApply): Ditto.
+        * editing/InsertTextCommand.cpp:
+        (WebCore::InsertTextCommand::insertTab): Ditto.
+        * editing/ModifySelectionListLevel.cpp:
+        (WebCore::IncreaseSelectionListLevelCommand::doApply): Ditto.
+        * editing/ReplaceSelectionCommand.cpp:
+        (WebCore::ReplacementFragment::removeUnrenderedNodes): Ditto.
+        (WebCore::ReplaceSelectionCommand::shouldMerge): Ditto.
+        (WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline): Ditto.
+        (WebCore::ReplaceSelectionCommand::mergeEndIfNeeded): Ditto.
+        (WebCore::enclosingInline): Ditto.
+        (WebCore::ReplaceSelectionCommand::doApply): Ditto.
+        * editing/TextIterator.cpp:
+        (WebCore::maxOffsetIncludingCollapsedSpaces): Ditto.
+        * editing/TypingCommand.cpp:
+        (WebCore::TypingCommand::forwardDeleteKeyPressed): Ditto.
+        * editing/VisiblePosition.cpp:
+        (WebCore::VisiblePosition::honorEditingBoundaryAtOrBefore): Ditto.
+        (WebCore::VisiblePosition::honorEditingBoundaryAtOrAfter): Ditto.
+        * editing/VisibleSelection.cpp:
+        (WebCore::VisibleSelection::setStartAndEndFromBaseAndExtentRespectingGranularity): Ditto.
+        (WebCore::VisibleSelection::adjustSelectionToAvoidCrossingEditingBoundaries): Ditto.
+        * editing/VisibleUnits.cpp:
+        (WebCore::previousRootInlineBoxCandidatePosition): Ditto.
+        (WebCore::nextRootInlineBoxCandidatePosition): Ditto.
+        (WebCore::startOfParagraph): Ditto.
+        (WebCore::endOfParagraph): Ditto.
+        (WebCore::startOfEditableContent): Ditto.
+        (WebCore::endOfEditableContent): Ditto.
+
+        * editing/htmlediting.cpp:
+        (WebCore::highestEditableRoot): Changed return type to ContainerNode. Maybe later could
+        change it to Element.
+        (WebCore::lowestEditableAncestor): Changed return type to Element.
+        (WebCore::isEditableToAccessibility): Use auto.
+        (WebCore::isRichlyEditablePosition): Ditto.
+        (WebCore::editableRootForPosition): Ditto.
+        (WebCore::unsplittableElementForPosition):Ditto.
+        (WebCore::nextCandidate): Streamline.
+        (WebCore::nextVisuallyDistinctCandidate): Ditto.
+        (WebCore::previousCandidate): Ditto.
+        (WebCore::previousVisuallyDistinctCandidate): Ditto.
+        (WebCore::firstEditablePositionAfterPositionInRoot): Changed arugment type to
+        ContainerNode.
+        (WebCore::lastEditablePositionBeforePositionInRoot): Ditto.
+        (WebCore::lastOffsetForEditing): Changed argument type to reference.
+        (WebCore::stringWithRebalancedWhitespace): Optimized the case where the function does
+        not need to change the string, so it just returns the passed string rather than a copy.
+        (WebCore::isTableStructureNode): Use auto.
+        (WebCore::isSpecialElement): Made this function private to the file. Use auto.
+        (WebCore::firstInSpecialElement): Return an HTMLElement.
+        (WebCore::lastInSpecialElement): Ditto.
+        (WebCore::isFirstVisiblePositionInSpecialElement): Made this function private to the file.
+        (WebCore::positionBeforeContainingSpecialElement): Changed out argument to HTMLElement.
+        (WebCore::isLastVisiblePositionInSpecialElement): Ditto.
+        (WebCore::positionAfterContainingSpecialElement): Ditto.
+        (WebCore::positionOutsideContainingSpecialElement): Ditto.
+        (WebCore::isFirstPositionAfterTable): Changed return type to Element.
+        (WebCore::isLastPositionBeforeTable): Ditto.
+        (WebCore::visiblePositionBeforeNode): Changed argument type to reference.
+        (WebCore::visiblePositionAfterNode): Ditto.
+        (WebCore::enclosingElementWithTag): Use auto. Removed special case for null since the
+        algorithm already handles null correctly.
+        (WebCore::enclosingNodeOfType): Use auto.
+        (WebCore::highestEnclosingNodeOfType): Ditto.
+        (WebCore::highestNodeToRemoveInPruning): Ditto.
+        (WebCore::enclosingTableCell): Changed return type to Element.
+        (WebCore::enclosingAnchorElement): Removed special case for null since the algorithm
+        already handles null correctly.
+        (WebCore::enclosingList): Use auto.
+        (WebCore::enclosingListChild): Use auto.
+        (WebCore::enclosingEmptyListItem): Use auto.
+        (WebCore::outermostEnclosingList): Use auto.
+        (WebCore::canMergeLists): Use references and more specific type. Since both elements are
+        known to be HTMLElement, compare local names instead of using hasTagName.
+        (WebCore::isRenderedTable): Use auto.
+        (WebCore::isTableCell): Ditto.
+        (WebCore::isEmptyTableCell): Ditto.
+        (WebCore::createBreakElement): Deleted. Callers can use HTMLBRElement directly.
+        (WebCore::createOrderedListElement): Deleted. Callers can use HTMLOListElement directly.
+        (WebCore::createUnorderedListElement): Deleted. Callers can use HTMLUListElement directly.
+        (WebCore::createListItemElement): Deleted. Callers can use HTMLLIElement directly.
+        (WebCore::isTabSpanNode): Remove redundant checks and did more specific typecast.
+        (WebCore::isTabSpanTextNode): Removed redundant null checks.
+        (WebCore::tabSpanNode): Changed return type to HTMLSpanElement.
+        (WebCore::positionOutsideTabSpan): Deleted. Unused function.
+        (WebCore::createTabSpanElement): Made one of the overloads private to this file. Use auto.
+        Changed argument type since we don't need to support null. Moved createEditingTextNode code,
+        specific to the version without a string into that function rather than the helper function.
+        (WebCore::isNodeRendered): Changed argument type to a reference.
+        (WebCore::numEnclosingMailBlockquotes): Streamlined.
+        (WebCore::isMailBlockquote): Use downcast instead of static_cast.
+        (WebCore::caretMinOffset): Take a reference instead of a pointer.
+        (WebCore::caretMaxOffset): Ditto.
+        (WebCore::selectionForParagraphIteration): Use auto.
+        (WebCore::indexForVisiblePosition): Ditto.
+        (WebCore::visiblePositionForIndex): Ditto.
+        (WebCore::visiblePositionForIndexUsingCharacterIterator): Ditto.
+        (WebCore::isVisiblyAdjacent): Made this private to this file.
+        (WebCore::isNodeVisiblyContainedWithin): Changed argument type to a reference.
+        (WebCore::areIdenticalElements): Changed argument types to references.
+        (WebCore::adjustedSelectionStartForStyleComputation): Use auto.
+        (WebCore::isBlockFlowElement): Changed argument type to a reference. Use auto.
+        (WebCore::deprecatedEnclosingBlockFlowElement): Updated for reference changes.
+        (WebCore::rendererForCaretPainting): Use auto.
+
+        * editing/htmlediting.h: Use pragma once. Removed unneeded includes and forward declarations.
+        Removed various non-helpful comments (the sections still don't make sense; not really good to
+        group functions by their return types). Moved inline functoin bodies to the bottom of the file.
+        Renamed isWhitespace to deprecatedIsEditingWhitespace.
+
+        * editing/markup.cpp:
+        (WebCore::createFragmentFromText): Use HTMLBRElement.
+        * page/DOMSelection.cpp:
+        (WebCore::DOMSelection::extend): Updated since caretMaxOffset takes a reference.
+
</ins><span class="cx"> 2016-05-14  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Support ArrayBufferViews in the CSS Font Loading API
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAXObjectCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -142,7 +142,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     VisiblePosition position = selection.start();
</span><del>-    Node* node = highestEditableRoot(position.deepEquivalent(), HasEditableAXRole);
</del><ins>+    auto* node = highestEditableRoot(position.deepEquivalent(), HasEditableAXRole);
</ins><span class="cx">     if (m_replacedText.length())
</span><span class="cx">         cache-&gt;postTextReplacementNotification(node, AXTextEditTypeDelete, m_replacedText, type, text, position);
</span><span class="cx">     else
</span><span class="lines">@@ -2330,18 +2330,18 @@
</span><span class="cx">     if (characterOffset.isNull())
</span><span class="cx">         return CharacterOffset();
</span><span class="cx">     
</span><del>-    Node* startNode = characterOffset.node;
</del><ins>+    auto* startNode = characterOffset.node;
</ins><span class="cx">     
</span><span class="cx">     if (isRenderedAsNonInlineTableImageOrHR(startNode))
</span><span class="cx">         return startOrEndCharacterOffsetForRange(rangeForNodeContents(startNode), true);
</span><span class="cx">     
</span><del>-    Node* startBlock = enclosingBlock(startNode);
</del><ins>+    auto* startBlock = enclosingBlock(startNode);
</ins><span class="cx">     int offset = characterOffset.startIndex + characterOffset.offset;
</span><span class="cx">     Position p(startNode, offset, Position::PositionIsOffsetInAnchor);
</span><del>-    Node* highestRoot = highestEditableRoot(p);
</del><ins>+    auto* highestRoot = highestEditableRoot(p);
</ins><span class="cx">     Position::AnchorType type = Position::PositionIsOffsetInAnchor;
</span><span class="cx">     
</span><del>-    Node* node = findStartOfParagraph(startNode, highestRoot, startBlock, offset, type, boundaryCrossingRule);
</del><ins>+    auto* node = findStartOfParagraph(startNode, highestRoot, startBlock, offset, type, boundaryCrossingRule);
</ins><span class="cx">     
</span><span class="cx">     if (type == Position::PositionIsOffsetInAnchor)
</span><span class="cx">         return characterOffsetForNodeAndOffset(*node, offset, TraverseOptionIncludeStart);
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityRenderObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -1874,10 +1874,10 @@
</span><span class="cx">     return visiblePositionForIndexUsingCharacterIterator(*node, index);
</span><span class="cx"> }
</span><span class="cx">     
</span><del>-int AccessibilityRenderObject::indexForVisiblePosition(const VisiblePosition&amp; pos) const
</del><ins>+int AccessibilityRenderObject::indexForVisiblePosition(const VisiblePosition&amp; position) const
</ins><span class="cx"> {
</span><span class="cx">     if (isNativeTextControl())
</span><del>-        return downcast&lt;RenderTextControl&gt;(*m_renderer).textFormControlElement().indexForVisiblePosition(pos);
</del><ins>+        return downcast&lt;RenderTextControl&gt;(*m_renderer).textFormControlElement().indexForVisiblePosition(position);
</ins><span class="cx"> 
</span><span class="cx">     if (!isTextControl())
</span><span class="cx">         return 0;
</span><span class="lines">@@ -1886,7 +1886,7 @@
</span><span class="cx">     if (!node)
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><del>-    Position indexPosition = pos.deepEquivalent();
</del><ins>+    Position indexPosition = position.deepEquivalent();
</ins><span class="cx">     if (indexPosition.isNull() || highestEditableRoot(indexPosition, HasEditableAXRole) != node)
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><span class="lines">@@ -1898,7 +1898,7 @@
</span><span class="cx">     bool forSelectionPreservation = false;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    return WebCore::indexForVisiblePosition(node, pos, forSelectionPreservation);
</del><ins>+    return WebCore::indexForVisiblePosition(*node, position, forSelectionPreservation);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Element* AccessibilityRenderObject::rootEditableElementForPosition(const Position&amp; position) const
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityatkWebKitAccessibleInterfaceTextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -601,7 +601,7 @@
</span><span class="cx">         // as when at the beginning of a whitespace range between two &quot;real&quot; words,
</span><span class="cx">         // since that whitespace is considered a &quot;word&quot; as well. And in case we are
</span><span class="cx">         // already at the beginning of a &quot;real&quot; word we do not need to look backwards.
</span><del>-        if (isStartOfWord(position) &amp;&amp; isWhitespace(position.characterBefore()))
</del><ins>+        if (isStartOfWord(position) &amp;&amp; deprecatedIsEditingWhitespace(position.characterBefore()))
</ins><span class="cx">             startPosition = position;
</span><span class="cx">         else
</span><span class="cx">             startPosition = previousWordPosition(position);
</span><span class="lines">@@ -729,7 +729,7 @@
</span><span class="cx">     if (position.isNull())
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    if (!isWhitespace(position.characterAfter()))
</del><ins>+    if (!deprecatedIsEditingWhitespace(position.characterAfter()))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     VisiblePosition startOfWhiteSpace = startOfWord(position, RightWordIfOnBoundary);
</span><span class="lines">@@ -764,12 +764,12 @@
</span><span class="cx"> 
</span><span class="cx">         // startOfSentence returns a position after any white space previous to
</span><span class="cx">         // the sentence, so we might need to adjust that offset for this boundary.
</span><del>-        if (isWhitespace(startPosition.characterBefore()))
</del><ins>+        if (deprecatedIsEditingWhitespace(startPosition.characterBefore()))
</ins><span class="cx">             startPosition = startOfWord(startPosition, LeftWordIfOnBoundary);
</span><span class="cx"> 
</span><span class="cx">         // endOfSentence returns a position after any white space after the
</span><span class="cx">         // sentence, so we might need to adjust that offset for this boundary.
</span><del>-        if (isWhitespace(endPosition.characterBefore()))
</del><ins>+        if (deprecatedIsEditingWhitespace(endPosition.characterBefore()))
</ins><span class="cx">             endPosition = startOfWord(endPosition, LeftWordIfOnBoundary);
</span><span class="cx"> 
</span><span class="cx">         // Finally, do some additional adjustments that might be needed if
</span></span></pre></div>
<a id="trunkSourceWebCoredomPositioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Position.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Position.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/dom/Position.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -214,7 +214,7 @@
</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.get());
</del><ins>+    return lastOffsetForEditing(*m_anchorNode);
</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">@@ -374,7 +374,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     Node* child = node-&gt;traverseToChildAt(offset);
</span><del>-    if (child || (!node-&gt;hasChildNodes() &amp;&amp; offset &lt; lastOffsetForEditing(node))) {
</del><ins>+    if (child || (!node-&gt;hasChildNodes() &amp;&amp; offset &lt; lastOffsetForEditing(*node))) {
</ins><span class="cx">         if (child)
</span><span class="cx">             return firstPositionInOrBeforeNode(child);
</span><span class="cx"> 
</span><span class="lines">@@ -429,7 +429,7 @@
</span><span class="cx">         return true;
</span><span class="cx">     case PositionIsAfterChildren:
</span><span class="cx">     case PositionIsAfterAnchor:
</span><del>-        return !lastOffsetForEditing(deprecatedNode());
</del><ins>+        return !lastOffsetForEditing(*deprecatedNode());
</ins><span class="cx">     }
</span><span class="cx">     ASSERT_NOT_REACHED();
</span><span class="cx">     return false;
</span><span class="lines">@@ -441,7 +441,7 @@
</span><span class="cx">         return true;
</span><span class="cx">     // FIXME: Position after anchor shouldn't be considered as at the first editing position for node
</span><span class="cx">     // since that position resides outside of the node.
</span><del>-    return m_anchorType == PositionIsAfterAnchor || m_anchorType == PositionIsAfterChildren || m_offset &gt;= lastOffsetForEditing(deprecatedNode());
</del><ins>+    return m_anchorType == PositionIsAfterAnchor || m_anchorType == PositionIsAfterChildren || m_offset &gt;= lastOffsetForEditing(*deprecatedNode());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // A position is considered at editing boundary if one of the following is true:
</span><span class="lines">@@ -501,7 +501,7 @@
</span><span class="cx">     case PositionIsBeforeChildren:
</span><span class="cx">         return true;
</span><span class="cx">     case PositionIsAfterChildren:
</span><del>-        return !lastOffsetForEditing(m_anchorNode.get());
</del><ins>+        return !lastOffsetForEditing(*m_anchorNode);
</ins><span class="cx">     }
</span><span class="cx">     ASSERT_NOT_REACHED();
</span><span class="cx">     return false;
</span><span class="lines">@@ -518,13 +518,13 @@
</span><span class="cx"> 
</span><span class="cx">     switch (m_anchorType) {
</span><span class="cx">     case PositionIsOffsetInAnchor:
</span><del>-        return m_offset &gt;= lastOffsetForEditing(m_anchorNode.get());
</del><ins>+        return m_offset &gt;= lastOffsetForEditing(*m_anchorNode);
</ins><span class="cx">     case PositionIsBeforeAnchor:
</span><span class="cx">         return false;
</span><span class="cx">     case PositionIsAfterAnchor:
</span><span class="cx">         return !m_anchorNode-&gt;nextSibling();
</span><span class="cx">     case PositionIsBeforeChildren:
</span><del>-        return !lastOffsetForEditing(m_anchorNode.get());
</del><ins>+        return !lastOffsetForEditing(*m_anchorNode);
</ins><span class="cx">     case PositionIsAfterChildren:
</span><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="lines">@@ -644,7 +644,7 @@
</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><del>-    PositionIterator lastVisible = m_anchorType == PositionIsAfterAnchor ? createLegacyEditingPosition(m_anchorNode.get(), caretMaxOffset(m_anchorNode.get())) : *this;
</del><ins>+    PositionIterator lastVisible = m_anchorType == PositionIsAfterAnchor ? createLegacyEditingPosition(m_anchorNode.get(), caretMaxOffset(*m_anchorNode)) : *this;
</ins><span class="cx">     PositionIterator currentPos = lastVisible;
</span><span class="cx">     bool startEditable = startNode-&gt;hasEditableStyle();
</span><span class="cx">     Node* lastNode = startNode;
</span><span class="lines">@@ -771,7 +771,7 @@
</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><del>-    PositionIterator lastVisible = m_anchorType == PositionIsAfterAnchor ? createLegacyEditingPosition(m_anchorNode.get(), caretMaxOffset(m_anchorNode.get())) : *this;
</del><ins>+    PositionIterator lastVisible = m_anchorType == PositionIsAfterAnchor ? createLegacyEditingPosition(m_anchorNode.get(), caretMaxOffset(*m_anchorNode)) : *this;
</ins><span class="cx">     PositionIterator currentPos = lastVisible;
</span><span class="cx">     bool startEditable = startNode-&gt;hasEditableStyle();
</span><span class="cx">     Node* lastNode = startNode;
</span><span class="lines">@@ -1105,8 +1105,8 @@
</span><span class="cx">     LOG(Editing, &quot;thisRenderedOffset:         %d\n&quot;, thisRenderedOffset);
</span><span class="cx">     LOG(Editing, &quot;posRenderer:            %p [%p]\n&quot;, posRenderer, b2);
</span><span class="cx">     LOG(Editing, &quot;posRenderedOffset:      %d\n&quot;, posRenderedOffset);
</span><del>-    LOG(Editing, &quot;node min/max:           %d:%d\n&quot;, caretMinOffset(deprecatedNode()), caretMaxOffset(deprecatedNode()));
-    LOG(Editing, &quot;pos node min/max:       %d:%d\n&quot;, caretMinOffset(pos.deprecatedNode()), caretMaxOffset(pos.deprecatedNode()));
</del><ins>+    LOG(Editing, &quot;node min/max:           %d:%d\n&quot;, caretMinOffset(*deprecatedNode()), caretMaxOffset(*deprecatedNode()));
+    LOG(Editing, &quot;pos node min/max:       %d:%d\n&quot;, caretMinOffset(*pos.deprecatedNode()), caretMaxOffset(*pos.deprecatedNode()));
</ins><span class="cx">     LOG(Editing, &quot;----------------------------------------------------------------------\n&quot;);
</span><span class="cx"> 
</span><span class="cx">     if (!b1 || !b2) {
</span><span class="lines">@@ -1118,12 +1118,12 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (nextRenderedEditable(deprecatedNode()) == pos.deprecatedNode()
</span><del>-        &amp;&amp; thisRenderedOffset == caretMaxOffset(deprecatedNode()) &amp;&amp; !posRenderedOffset) {
</del><ins>+        &amp;&amp; thisRenderedOffset == caretMaxOffset(*deprecatedNode()) &amp;&amp; !posRenderedOffset) {
</ins><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     if (previousRenderedEditable(deprecatedNode()) == pos.deprecatedNode()
</span><del>-        &amp;&amp; !thisRenderedOffset &amp;&amp; posRenderedOffset == caretMaxOffset(pos.deprecatedNode())) {
</del><ins>+        &amp;&amp; !thisRenderedOffset &amp;&amp; posRenderedOffset == caretMaxOffset(*pos.deprecatedNode())) {
</ins><span class="cx">         return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomPositionIteratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/PositionIterator.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/PositionIterator.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/dom/PositionIterator.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (m_anchorNode-&gt;renderer() &amp;&amp; !m_anchorNode-&gt;hasChildNodes() &amp;&amp; m_offsetInAnchor &lt; lastOffsetForEditing(m_anchorNode))
</del><ins>+    if (m_anchorNode-&gt;renderer() &amp;&amp; !m_anchorNode-&gt;hasChildNodes() &amp;&amp; m_offsetInAnchor &lt; lastOffsetForEditing(*m_anchorNode))
</ins><span class="cx">         m_offsetInAnchor = Position::uncheckedNextOffset(m_anchorNode, m_offsetInAnchor);
</span><span class="cx">     else {
</span><span class="cx">         m_nodeAfterPositionInAnchor = m_anchorNode;
</span><span class="lines">@@ -85,7 +85,7 @@
</span><span class="cx">         m_anchorNode = m_nodeAfterPositionInAnchor-&gt;previousSibling();
</span><span class="cx">         if (m_anchorNode) {
</span><span class="cx">             m_nodeAfterPositionInAnchor = nullptr;
</span><del>-            m_offsetInAnchor = m_anchorNode-&gt;hasChildNodes() ? 0 : lastOffsetForEditing(m_anchorNode);
</del><ins>+            m_offsetInAnchor = m_anchorNode-&gt;hasChildNodes() ? 0 : lastOffsetForEditing(*m_anchorNode);
</ins><span class="cx">         } else {
</span><span class="cx">             m_nodeAfterPositionInAnchor = m_nodeAfterPositionInAnchor-&gt;parentNode();
</span><span class="cx">             m_anchorNode = m_nodeAfterPositionInAnchor-&gt;parentNode();
</span><span class="lines">@@ -96,7 +96,7 @@
</span><span class="cx">     
</span><span class="cx">     if (m_anchorNode-&gt;hasChildNodes()) {
</span><span class="cx">         m_anchorNode = m_anchorNode-&gt;lastChild();
</span><del>-        m_offsetInAnchor = m_anchorNode-&gt;hasChildNodes()? 0: lastOffsetForEditing(m_anchorNode);
</del><ins>+        m_offsetInAnchor = m_anchorNode-&gt;hasChildNodes()? 0: lastOffsetForEditing(*m_anchorNode);
</ins><span class="cx">     } else {
</span><span class="cx">         if (m_offsetInAnchor &amp;&amp; m_anchorNode-&gt;renderer())
</span><span class="cx">             m_offsetInAnchor = Position::uncheckedPreviousOffset(m_anchorNode, m_offsetInAnchor);
</span><span class="lines">@@ -122,7 +122,7 @@
</span><span class="cx">         return true;
</span><span class="cx">     if (m_nodeAfterPositionInAnchor)
</span><span class="cx">         return false;
</span><del>-    return !m_anchorNode-&gt;parentNode() &amp;&amp; (m_anchorNode-&gt;hasChildNodes() || m_offsetInAnchor &gt;= lastOffsetForEditing(m_anchorNode));
</del><ins>+    return !m_anchorNode-&gt;parentNode() &amp;&amp; (m_anchorNode-&gt;hasChildNodes() || m_offsetInAnchor &gt;= lastOffsetForEditing(*m_anchorNode));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool PositionIterator::atStartOfNode() const
</span><span class="lines">@@ -140,7 +140,7 @@
</span><span class="cx">         return true;
</span><span class="cx">     if (m_nodeAfterPositionInAnchor)
</span><span class="cx">         return false;
</span><del>-    return m_anchorNode-&gt;hasChildNodes() || m_offsetInAnchor &gt;= lastOffsetForEditing(m_anchorNode);
</del><ins>+    return m_anchorNode-&gt;hasChildNodes() || m_offsetInAnchor &gt;= lastOffsetForEditing(*m_anchorNode);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool PositionIterator::isCandidate() const
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingAlternativeTextControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/AlternativeTextController.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/AlternativeTextController.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/editing/AlternativeTextController.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -583,7 +583,7 @@
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;Range&gt; precedingCharacterRange = Range::create(*m_frame.document(), precedingCharacterPosition, endOfSelection);
</span><span class="cx">     String string = plainText(precedingCharacterRange.get());
</span><del>-    if (string.isEmpty() || !isWhitespace(string[string.length() - 1]))
</del><ins>+    if (string.isEmpty() || !deprecatedIsEditingWhitespace(string[string.length() - 1]))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     // Mark this whitespace to indicate we have deleted an autocorrection following this
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingApplyBlockElementCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/ApplyBlockElementCommand.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/ApplyBlockElementCommand.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/editing/ApplyBlockElementCommand.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -27,7 +27,7 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;ApplyBlockElementCommand.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;HTMLElement.h&quot;
</del><ins>+#include &quot;HTMLBRElement.h&quot;
</ins><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="cx"> #include &quot;RenderElement.h&quot;
</span><span class="cx"> #include &quot;RenderStyle.h&quot;
</span><span class="lines">@@ -113,11 +113,11 @@
</span><span class="cx">     // and there's nothing to move.
</span><span class="cx">     Position start = startOfSelection.deepEquivalent().downstream();
</span><span class="cx">     if (isAtUnsplittableElement(start) &amp;&amp; startOfParagraph(start) == endOfParagraph(endOfSelection)) {
</span><del>-        RefPtr&lt;Element&gt; blockquote = createBlockElement();
-        insertNodeAt(blockquote, start);
-        RefPtr&lt;Element&gt; placeholder = createBreakElement(document());
-        appendNode(placeholder, blockquote);
-        setEndingSelection(VisibleSelection(positionBeforeNode(placeholder.get()), DOWNSTREAM, endingSelection().isDirectional()));
</del><ins>+        auto blockquote = createBlockElement();
+        insertNodeAt(blockquote.copyRef(), start);
+        auto placeholder = HTMLBRElement::create(document());
+        appendNode(placeholder.copyRef(), WTFMove(blockquote));
+        setEndingSelection(VisibleSelection(positionBeforeNode(placeholder.ptr()), DOWNSTREAM, endingSelection().isDirectional()));
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingApplyStyleCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/ApplyStyleCommand.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/ApplyStyleCommand.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/editing/ApplyStyleCommand.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -245,7 +245,7 @@
</span><span class="cx">     // Save and restore the selection endpoints using their indices in the editable root, since
</span><span class="cx">     // addBlockStyleIfNeeded may moveParagraphs, which can remove these endpoints.
</span><span class="cx">     // Calculate start and end indices from the start of the tree that they're in.
</span><del>-    Node* scope = highestEditableRoot(visibleStart.deepEquivalent());
</del><ins>+    auto* scope = highestEditableRoot(visibleStart.deepEquivalent());
</ins><span class="cx">     if (!scope)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -283,8 +283,8 @@
</span><span class="cx">         nextParagraphStart = endOfParagraph(paragraphStart).next();
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    startRange = TextIterator::rangeFromLocationAndLength(downcast&lt;ContainerNode&gt;(scope), startIndex, 0, true);
-    endRange = TextIterator::rangeFromLocationAndLength(downcast&lt;ContainerNode&gt;(scope), endIndex, 0, true);
</del><ins>+    startRange = TextIterator::rangeFromLocationAndLength(scope, startIndex, 0, true);
+    endRange = TextIterator::rangeFromLocationAndLength(scope, endIndex, 0, true);
</ins><span class="cx">     if (startRange &amp;&amp; endRange)
</span><span class="cx">         updateStartEnd(startRange-&gt;startPosition(), endRange-&gt;startPosition());
</span><span class="cx"> }
</span><span class="lines">@@ -363,12 +363,11 @@
</span><span class="cx">     start = start.upstream(); // Move upstream to ensure we do not add redundant spans.
</span><span class="cx">     Node* startNode = start.deprecatedNode();
</span><span class="cx"> 
</span><del>-    // Make sure we're not already at the end or the next NodeTraversal::next() will traverse
-    // past it.
</del><ins>+    // Make sure we're not already at the end or the next NodeTraversal::next() will traverse past it.
</ins><span class="cx">     if (startNode == beyondEnd)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    if (startNode-&gt;isTextNode() &amp;&amp; start.deprecatedEditingOffset() &gt;= caretMaxOffset(startNode)) {
</del><ins>+    if (startNode-&gt;isTextNode() &amp;&amp; start.deprecatedEditingOffset() &gt;= 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">@@ -701,28 +700,29 @@
</span><span class="cx"> {
</span><span class="cx">     Node* startNode = start.deprecatedNode();
</span><span class="cx"> 
</span><del>-    if (start.deprecatedEditingOffset() &gt;= caretMaxOffset(start.deprecatedNode())) {
</del><ins>+    if (start.deprecatedEditingOffset() &gt;= caretMaxOffset(*startNode)) {
</ins><span class="cx">         startNode = NodeTraversal::next(*startNode);
</span><span class="cx">         if (!startNode || comparePositions(end, firstPositionInOrBeforeNode(startNode)) &lt; 0)
</span><span class="cx">             return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     Node* pastEndNode = end.deprecatedNode();
</span><del>-    if (end.deprecatedEditingOffset() &gt;= caretMaxOffset(end.deprecatedNode()))
-        pastEndNode = NodeTraversal::nextSkippingChildren(*end.deprecatedNode());
</del><ins>+    if (end.deprecatedEditingOffset() &gt;= caretMaxOffset(*pastEndNode))
+        pastEndNode = NodeTraversal::nextSkippingChildren(*pastEndNode);
</ins><span class="cx"> 
</span><span class="cx">     // FIXME: Callers should perform this operation on a Range that includes the br
</span><span class="cx">     // if they want style applied to the empty line.
</span><ins>+    // FIXME: Should this be using startNode instead of start.deprecatedNode()?
</ins><span class="cx">     if (start == end &amp;&amp; start.deprecatedNode()-&gt;hasTagName(brTag))
</span><span class="cx">         pastEndNode = NodeTraversal::next(*start.deprecatedNode());
</span><span class="cx"> 
</span><span class="cx">     // Start from the highest fully selected ancestor so that we can modify the fully selected node.
</span><span class="cx">     // e.g. When applying font-size: large on &lt;font color=&quot;blue&quot;&gt;hello&lt;/font&gt;, we need to include the font element in our run
</span><span class="cx">     // to generate &lt;font color=&quot;blue&quot; size=&quot;4&quot;&gt;hello&lt;/font&gt; instead of &lt;font color=&quot;blue&quot;&gt;&lt;font size=&quot;4&quot;&gt;hello&lt;/font&gt;&lt;/font&gt;
</span><del>-    RefPtr&lt;Range&gt; range = Range::create(startNode-&gt;document(), start, end);
-    Element* editableRoot = startNode-&gt;rootEditableElement();
</del><ins>+    auto range = Range::create(startNode-&gt;document(), start, end);
+    auto* editableRoot = startNode-&gt;rootEditableElement();
</ins><span class="cx">     if (startNode != editableRoot) {
</span><del>-        while (editableRoot &amp;&amp; startNode-&gt;parentNode() != editableRoot &amp;&amp; isNodeVisiblyContainedWithin(*startNode-&gt;parentNode(), range.get()))
</del><ins>+        while (editableRoot &amp;&amp; startNode-&gt;parentNode() != editableRoot &amp;&amp; isNodeVisiblyContainedWithin(*startNode-&gt;parentNode(), range))
</ins><span class="cx">             startNode = startNode-&gt;parentNode();
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1277,12 +1277,12 @@
</span><span class="cx">     if (position.anchorType() != Position::PositionIsOffsetInAnchor || !node-&gt;isTextNode())
</span><span class="cx">         return false;
</span><span class="cx">     int offsetInText = position.offsetInContainerNode();
</span><del>-    return offsetInText &gt; caretMinOffset(node) &amp;&amp; offsetInText &lt; caretMaxOffset(node);
</del><ins>+    return offsetInText &gt; caretMinOffset(*node) &amp;&amp; offsetInText &lt; caretMaxOffset(*node);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool ApplyStyleCommand::mergeStartWithPreviousIfIdentical(const Position&amp; start, const Position&amp; end)
</span><span class="cx"> {
</span><del>-    Node* startNode = start.containerNode();
</del><ins>+    auto* startNode = start.containerNode();
</ins><span class="cx">     int startOffset = start.computeOffsetInContainerNode();
</span><span class="cx">     if (startOffset)
</span><span class="cx">         return false;
</span><span class="lines">@@ -1296,26 +1296,21 @@
</span><span class="cx">         startNode = startNode-&gt;parentNode();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (!startNode-&gt;isElementNode())
</del><ins>+    auto* previousSibling = startNode-&gt;previousSibling();
+    if (!previousSibling || !areIdenticalElements(*startNode, *previousSibling))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    Node* previousSibling = startNode-&gt;previousSibling();
</del><ins>+    auto&amp; previousElement = downcast&lt;Element&gt;(*previousSibling);
+    auto&amp; element = downcast&lt;Element&gt;(*startNode);
+    auto* startChild = element.firstChild();
+    ASSERT(startChild);
+    mergeIdenticalElements(&amp;previousElement, &amp;element);
</ins><span class="cx"> 
</span><del>-    if (previousSibling &amp;&amp; areIdenticalElements(startNode, previousSibling)) {
-        Element* previousElement = downcast&lt;Element&gt;(previousSibling);
-        Element* element = downcast&lt;Element&gt;(startNode);
-        Node* startChild = element-&gt;firstChild();
-        ASSERT(startChild);
-        mergeIdenticalElements(previousElement, element);
-
-        unsigned startOffsetAdjustment = startChild-&gt;computeNodeIndex();
-        unsigned endOffsetAdjustment = startNode == end.deprecatedNode() ? startOffsetAdjustment : 0;
-        updateStartEnd(Position(startNode, startOffsetAdjustment, Position::PositionIsOffsetInAnchor),
-                       Position(end.deprecatedNode(), end.deprecatedEditingOffset() + endOffsetAdjustment, Position::PositionIsOffsetInAnchor)); 
-        return true;
-    }
-
-    return false;
</del><ins>+    int startOffsetAdjustment = startChild-&gt;computeNodeIndex();
+    int endOffsetAdjustment = startNode == end.deprecatedNode() ? startOffsetAdjustment : 0;
+    updateStartEnd({ startNode, startOffsetAdjustment, Position::PositionIsOffsetInAnchor},
+        { end.deprecatedNode(), end.deprecatedEditingOffset() + endOffsetAdjustment, Position::PositionIsOffsetInAnchor });
+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool ApplyStyleCommand::mergeEndWithNextIfIdentical(const Position&amp; start, const Position&amp; end)
</span><span class="lines">@@ -1330,25 +1325,24 @@
</span><span class="cx">         endNode = end.deprecatedNode()-&gt;parentNode();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (!endNode-&gt;isElementNode() || endNode-&gt;hasTagName(brTag))
</del><ins>+    if (endNode-&gt;hasTagName(brTag))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     Node* nextSibling = endNode-&gt;nextSibling();
</span><del>-    if (nextSibling &amp;&amp; areIdenticalElements(endNode, nextSibling)) {
-        Element* nextElement = downcast&lt;Element&gt;(nextSibling);
-        Element* element = downcast&lt;Element&gt;(endNode);
-        Node* nextChild = nextElement-&gt;firstChild();
</del><ins>+    if (!nextSibling || !areIdenticalElements(*endNode, *nextSibling))
+        return false;
</ins><span class="cx"> 
</span><del>-        mergeIdenticalElements(element, nextElement);
</del><ins>+    auto&amp; nextElement = downcast&lt;Element&gt;(*nextSibling);
+    auto&amp; element = downcast&lt;Element&gt;(*endNode);
+    Node* nextChild = nextElement.firstChild();
</ins><span class="cx"> 
</span><del>-        bool shouldUpdateStart = start.containerNode() == endNode;
-        unsigned endOffset = nextChild ? nextChild-&gt;computeNodeIndex() : nextElement-&gt;countChildNodes();
-        updateStartEnd(shouldUpdateStart ? Position(nextElement, start.offsetInContainerNode(), Position::PositionIsOffsetInAnchor) : start,
-                       Position(nextElement, endOffset, Position::PositionIsOffsetInAnchor));
-        return true;
-    }
</del><ins>+    mergeIdenticalElements(&amp;element, &amp;nextElement);
</ins><span class="cx"> 
</span><del>-    return false;
</del><ins>+    bool shouldUpdateStart = start.containerNode() == endNode;
+    int endOffset = nextChild ? nextChild-&gt;computeNodeIndex() : nextElement.countChildNodes();
+    updateStartEnd(shouldUpdateStart ? Position(&amp;nextElement, start.offsetInContainerNode(), Position::PositionIsOffsetInAnchor) : start,
+        { &amp;nextElement, endOffset, Position::PositionIsOffsetInAnchor });
+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ApplyStyleCommand::surroundNodeRangeWithElement(PassRefPtr&lt;Node&gt; passedStartNode, PassRefPtr&lt;Node&gt; endNode, PassRefPtr&lt;Element&gt; elementToInsert)
</span><span class="lines">@@ -1375,15 +1369,13 @@
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;Node&gt; nextSibling = element-&gt;nextSibling();
</span><span class="cx">     RefPtr&lt;Node&gt; previousSibling = element-&gt;previousSibling();
</span><del>-    if (is&lt;Element&gt;(nextSibling.get()) &amp;&amp; nextSibling-&gt;hasEditableStyle()
-        &amp;&amp; areIdenticalElements(element.get(), downcast&lt;Element&gt;(nextSibling.get())))
</del><ins>+    if (is&lt;Element&gt;(nextSibling.get()) &amp;&amp; nextSibling-&gt;hasEditableStyle() &amp;&amp; areIdenticalElements(*element, *nextSibling))
</ins><span class="cx">         mergeIdenticalElements(element.get(), downcast&lt;Element&gt;(nextSibling.get()));
</span><span class="cx"> 
</span><span class="cx">     if (is&lt;Element&gt;(previousSibling.get()) &amp;&amp; previousSibling-&gt;hasEditableStyle()) {
</span><span class="cx">         Node* mergedElement = previousSibling-&gt;nextSibling();
</span><span class="cx">         ASSERT(mergedElement);
</span><del>-        if (is&lt;Element&gt;(*mergedElement) &amp;&amp; mergedElement-&gt;hasEditableStyle()
-            &amp;&amp; areIdenticalElements(downcast&lt;Element&gt;(previousSibling.get()), downcast&lt;Element&gt;(mergedElement)))
</del><ins>+        if (is&lt;Element&gt;(*mergedElement) &amp;&amp; mergedElement-&gt;hasEditableStyle() &amp;&amp; areIdenticalElements(*previousSibling, *mergedElement))
</ins><span class="cx">             mergeIdenticalElements(downcast&lt;Element&gt;(previousSibling.get()), downcast&lt;Element&gt;(mergedElement));
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingBreakBlockquoteCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/BreakBlockquoteCommand.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/BreakBlockquoteCommand.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/editing/BreakBlockquoteCommand.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;BreakBlockquoteCommand.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;HTMLElement.h&quot;
</del><ins>+#include &quot;HTMLBRElement.h&quot;
</ins><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="cx"> #include &quot;NodeTraversal.h&quot;
</span><span class="cx"> #include &quot;RenderListItem.h&quot;
</span><span class="lines">@@ -70,25 +70,25 @@
</span><span class="cx">     if (!topBlockquote || !topBlockquote-&gt;parentNode() || !topBlockquote-&gt;isElementNode())
</span><span class="cx">         return;
</span><span class="cx">     
</span><del>-    RefPtr&lt;Element&gt; breakNode = createBreakElement(document());
</del><ins>+    auto breakNode = HTMLBRElement::create(document());
</ins><span class="cx"> 
</span><span class="cx">     bool isLastVisPosInNode = isLastVisiblePositionInNode(visiblePos, topBlockquote);
</span><span class="cx"> 
</span><span class="cx">     // If the position is at the beginning of the top quoted content, we don't need to break the quote.
</span><span class="cx">     // Instead, insert the break before the blockquote, unless the position is as the end of the the quoted content.
</span><span class="cx">     if (isFirstVisiblePositionInNode(visiblePos, topBlockquote) &amp;&amp; !isLastVisPosInNode) {
</span><del>-        insertNodeBefore(breakNode.get(), topBlockquote);
-        setEndingSelection(VisibleSelection(positionBeforeNode(breakNode.get()), DOWNSTREAM, endingSelection().isDirectional()));
</del><ins>+        insertNodeBefore(breakNode.copyRef(), topBlockquote);
+        setEndingSelection(VisibleSelection(positionBeforeNode(breakNode.ptr()), DOWNSTREAM, endingSelection().isDirectional()));
</ins><span class="cx">         rebalanceWhitespace();   
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     // Insert a break after the top blockquote.
</span><del>-    insertNodeAfter(breakNode.get(), topBlockquote);
</del><ins>+    insertNodeAfter(breakNode.copyRef(), topBlockquote);
</ins><span class="cx"> 
</span><span class="cx">     // If we're inserting the break at the end of the quoted content, we don't need to break the quote.
</span><span class="cx">     if (isLastVisPosInNode) {
</span><del>-        setEndingSelection(VisibleSelection(positionBeforeNode(breakNode.get()), DOWNSTREAM, endingSelection().isDirectional()));
</del><ins>+        setEndingSelection(VisibleSelection(positionBeforeNode(breakNode.ptr()), DOWNSTREAM, endingSelection().isDirectional()));
</ins><span class="cx">         rebalanceWhitespace();
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="lines">@@ -132,7 +132,7 @@
</span><span class="cx">     
</span><span class="cx">     // Insert a clone of the top blockquote after the break.
</span><span class="cx">     RefPtr&lt;Element&gt; clonedBlockquote = downcast&lt;Element&gt;(*topBlockquote).cloneElementWithoutChildren(document());
</span><del>-    insertNodeAfter(clonedBlockquote.get(), breakNode.get());
</del><ins>+    insertNodeAfter(clonedBlockquote.get(), breakNode.copyRef());
</ins><span class="cx">     
</span><span class="cx">     // Clone startNode's ancestors into the cloned blockquote.
</span><span class="cx">     // On exiting this loop, clonedAncestor is the lowest ancestor
</span><span class="lines">@@ -180,7 +180,7 @@
</span><span class="cx">     addBlockPlaceholderIfNeeded(clonedBlockquote.get());
</span><span class="cx">     
</span><span class="cx">     // Put the selection right before the break.
</span><del>-    setEndingSelection(VisibleSelection(positionBeforeNode(breakNode.get()), DOWNSTREAM, endingSelection().isDirectional()));
</del><ins>+    setEndingSelection(VisibleSelection(positionBeforeNode(breakNode.ptr()), DOWNSTREAM, endingSelection().isDirectional()));
</ins><span class="cx">     rebalanceWhitespace();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingCompositeEditCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/CompositeEditCommand.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/CompositeEditCommand.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/editing/CompositeEditCommand.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -41,10 +41,11 @@
</span><span class="cx"> #include &quot;Event.h&quot;
</span><span class="cx"> #include &quot;ExceptionCodePlaceholder.h&quot;
</span><span class="cx"> #include &quot;Frame.h&quot;
</span><ins>+#include &quot;HTMLBRElement.h&quot;
</ins><span class="cx"> #include &quot;HTMLDivElement.h&quot;
</span><del>-#include &quot;HTMLElement.h&quot;
</del><span class="cx"> #include &quot;HTMLLIElement.h&quot;
</span><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><ins>+#include &quot;HTMLSpanElement.h&quot;
</ins><span class="cx"> #include &quot;InlineTextBox.h&quot;
</span><span class="cx"> #include &quot;InsertIntoTextNodeCommand.h&quot;
</span><span class="cx"> #include &quot;InsertLineBreakCommand.h&quot;
</span><span class="lines">@@ -150,7 +151,7 @@
</span><span class="cx"> static void postTextStateChangeNotification(AXObjectCache* cache, const VisiblePosition&amp; position, const String&amp; deletedText, const String&amp; insertedText)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(cache);
</span><del>-    Node* node = highestEditableRoot(position.deepEquivalent(), HasEditableAXRole);
</del><ins>+    auto* node = highestEditableRoot(position.deepEquivalent(), HasEditableAXRole);
</ins><span class="cx">     if (!node)
</span><span class="cx">         return;
</span><span class="cx">     if (insertedText.length() &amp;&amp; deletedText.length())
</span><span class="lines">@@ -493,9 +494,9 @@
</span><span class="cx">             insertNodeBefore(insertChild, child);
</span><span class="cx">         else
</span><span class="cx">             appendNode(insertChild, downcast&lt;ContainerNode&gt;(refChild));
</span><del>-    } else if (caretMinOffset(refChild) &gt;= offset)
</del><ins>+    } else if (caretMinOffset(*refChild) &gt;= offset)
</ins><span class="cx">         insertNodeBefore(insertChild, refChild);
</span><del>-    else if (is&lt;Text&gt;(*refChild) &amp;&amp; caretMaxOffset(refChild) &gt; offset) {
</del><ins>+    else if (is&lt;Text&gt;(*refChild) &amp;&amp; caretMaxOffset(*refChild) &gt; offset) {
</ins><span class="cx">         splitTextNode(downcast&lt;Text&gt;(refChild), offset);
</span><span class="cx"> 
</span><span class="cx">         // Mutation events (bug 22634) from the text node insertion may have removed the refChild
</span><span class="lines">@@ -715,33 +716,33 @@
</span><span class="cx"> #endif // PLATFORM(IOS)
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Position CompositeEditCommand::positionOutsideTabSpan(const Position&amp; pos)
</del><ins>+Position CompositeEditCommand::positionOutsideTabSpan(const Position&amp; position)
</ins><span class="cx"> {
</span><del>-    if (!isTabSpanTextNode(pos.anchorNode()))
-        return pos;
</del><ins>+    if (!isTabSpanTextNode(position.anchorNode()))
+        return position;
</ins><span class="cx"> 
</span><del>-    switch (pos.anchorType()) {
</del><ins>+    switch (position.anchorType()) {
</ins><span class="cx">     case Position::PositionIsBeforeChildren:
</span><span class="cx">     case Position::PositionIsAfterChildren:
</span><span class="cx">         ASSERT_NOT_REACHED();
</span><del>-        return pos;
</del><ins>+        return position;
</ins><span class="cx">     case Position::PositionIsOffsetInAnchor:
</span><span class="cx">         break;
</span><span class="cx">     case Position::PositionIsBeforeAnchor:
</span><del>-        return positionInParentBeforeNode(pos.anchorNode());
</del><ins>+        return positionInParentBeforeNode(position.anchorNode());
</ins><span class="cx">     case Position::PositionIsAfterAnchor:
</span><del>-        return positionInParentAfterNode(pos.anchorNode());
</del><ins>+        return positionInParentAfterNode(position.anchorNode());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    Node* tabSpan = tabSpanNode(pos.containerNode());
</del><ins>+    auto* tabSpan = tabSpanNode(position.containerNode());
</ins><span class="cx"> 
</span><del>-    if (pos.offsetInContainerNode() &lt;= caretMinOffset(pos.containerNode()))
</del><ins>+    if (position.offsetInContainerNode() &lt;= caretMinOffset(*position.containerNode()))
</ins><span class="cx">         return positionInParentBeforeNode(tabSpan);
</span><span class="cx"> 
</span><del>-    if (pos.offsetInContainerNode() &gt;= caretMaxOffset(pos.containerNode()))
</del><ins>+    if (position.offsetInContainerNode() &gt;= caretMaxOffset(*position.containerNode()))
</ins><span class="cx">         return positionInParentAfterNode(tabSpan);
</span><span class="cx"> 
</span><del>-    splitTextNodeContainingElement(downcast&lt;Text&gt;(pos.containerNode()), pos.offsetInContainerNode());
</del><ins>+    splitTextNodeContainingElement(&amp;downcast&lt;Text&gt;(*position.containerNode()), position.offsetInContainerNode());
</ins><span class="cx">     return positionInParentBeforeNode(tabSpan);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -788,19 +789,18 @@
</span><span class="cx">     applyCommandToComposite(SetNodeAttributeCommand::create(element, attribute, value));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline bool containsOnlyWhitespace(const String&amp; text)
</del><ins>+static inline bool containsOnlyDeprecatedEditingWhitespace(const String&amp; text)
</ins><span class="cx"> {
</span><span class="cx">     for (unsigned i = 0; i &lt; text.length(); ++i) {
</span><del>-        if (!isWhitespace(text[i]))
</del><ins>+        if (!deprecatedIsEditingWhitespace(text[i]))
</ins><span class="cx">             return false;
</span><span class="cx">     }
</span><del>-    
</del><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool CompositeEditCommand::shouldRebalanceLeadingWhitespaceFor(const String&amp; text) const
</span><span class="cx"> {
</span><del>-    return containsOnlyWhitespace(text);
</del><ins>+    return containsOnlyDeprecatedEditingWhitespace(text);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool CompositeEditCommand::canRebalance(const Position&amp; position) const
</span><span class="lines">@@ -832,9 +832,9 @@
</span><span class="cx">     // If the rebalance is for the single offset, and neither text[offset] nor text[offset - 1] are some form of whitespace, do nothing.
</span><span class="cx">     int offset = position.deprecatedEditingOffset();
</span><span class="cx">     String text = downcast&lt;Text&gt;(*node).data();
</span><del>-    if (!isWhitespace(text[offset])) {
</del><ins>+    if (!deprecatedIsEditingWhitespace(text[offset])) {
</ins><span class="cx">         offset--;
</span><del>-        if (offset &lt; 0 || !isWhitespace(text[offset]))
</del><ins>+        if (offset &lt; 0 || !deprecatedIsEditingWhitespace(text[offset]))
</ins><span class="cx">             return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -850,11 +850,11 @@
</span><span class="cx"> 
</span><span class="cx">     // Set upstream and downstream to define the extent of the whitespace surrounding text[offset].
</span><span class="cx">     int upstream = startOffset;
</span><del>-    while (upstream &gt; 0 &amp;&amp; isWhitespace(text[upstream - 1]))
</del><ins>+    while (upstream &gt; 0 &amp;&amp; deprecatedIsEditingWhitespace(text[upstream - 1]))
</ins><span class="cx">         upstream--;
</span><span class="cx">     
</span><span class="cx">     int downstream = endOffset;
</span><del>-    while ((unsigned)downstream &lt; text.length() &amp;&amp; isWhitespace(text[downstream]))
</del><ins>+    while ((unsigned)downstream &lt; text.length() &amp;&amp; deprecatedIsEditingWhitespace(text[downstream]))
</ins><span class="cx">         downstream++;
</span><span class="cx">     
</span><span class="cx">     int length = downstream - upstream;
</span><span class="lines">@@ -1089,7 +1089,7 @@
</span><span class="cx"> Ref&lt;HTMLElement&gt; CompositeEditCommand::insertNewDefaultParagraphElementAt(const Position&amp; position)
</span><span class="cx"> {
</span><span class="cx">     auto paragraphElement = createDefaultParagraphElement(document());
</span><del>-    paragraphElement-&gt;appendChild(createBreakElement(document()), IGNORE_EXCEPTION);
</del><ins>+    paragraphElement-&gt;appendChild(HTMLBRElement::create(document()), IGNORE_EXCEPTION);
</ins><span class="cx">     insertNodeAt(paragraphElement.ptr(), position);
</span><span class="cx">     return paragraphElement;
</span><span class="cx"> }
</span><span class="lines">@@ -1326,7 +1326,7 @@
</span><span class="cx">         &amp;&amp; ((!isEndOfParagraph(beforeParagraph) &amp;&amp; !isStartOfParagraph(beforeParagraph)) || beforeParagraph == afterParagraph)
</span><span class="cx">         &amp;&amp; isEditablePosition(beforeParagraph.deepEquivalent())) {
</span><span class="cx">         // FIXME: Trim text between beforeParagraph and afterParagraph if they aren't equal.
</span><del>-        insertNodeAt(createBreakElement(document()), beforeParagraph.deepEquivalent());
</del><ins>+        insertNodeAt(HTMLBRElement::create(document()), beforeParagraph.deepEquivalent());
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx">     
</span><span class="lines">@@ -1429,7 +1429,7 @@
</span><span class="cx">     afterParagraph = VisiblePosition(afterParagraph.deepEquivalent());
</span><span class="cx">     if (beforeParagraph.isNotNull() &amp;&amp; (!isEndOfParagraph(beforeParagraph) || beforeParagraph == afterParagraph)) {
</span><span class="cx">         // FIXME: Trim text between beforeParagraph and afterParagraph if they aren't equal.
</span><del>-        insertNodeAt(createBreakElement(document()), beforeParagraph.deepEquivalent());
</del><ins>+        insertNodeAt(HTMLBRElement::create(document()), beforeParagraph.deepEquivalent());
</ins><span class="cx">         // Need an updateLayout here in case inserting the br has split a text node.
</span><span class="cx">         document().updateLayoutIgnorePendingStylesheets();
</span><span class="cx">     }
</span><span class="lines">@@ -1485,18 +1485,18 @@
</span><span class="cx">     RefPtr&lt;Element&gt; newBlock;
</span><span class="cx">     if (ContainerNode* blockEnclosingList = listNode-&gt;parentNode()) {
</span><span class="cx">         if (is&lt;HTMLLIElement&gt;(*blockEnclosingList)) { // listNode is inside another list item
</span><del>-            if (visiblePositionAfterNode(blockEnclosingList) == visiblePositionAfterNode(listNode.get())) {
</del><ins>+            if (visiblePositionAfterNode(*blockEnclosingList) == visiblePositionAfterNode(*listNode)) {
</ins><span class="cx">                 // If listNode appears at the end of the outer list item, then move listNode outside of this list item
</span><span class="cx">                 // e.g. &lt;ul&gt;&lt;li&gt;hello &lt;ul&gt;&lt;li&gt;&lt;br&gt;&lt;/li&gt;&lt;/ul&gt; &lt;/li&gt;&lt;/ul&gt; should become &lt;ul&gt;&lt;li&gt;hello&lt;/li&gt; &lt;ul&gt;&lt;li&gt;&lt;br&gt;&lt;/li&gt;&lt;/ul&gt; &lt;/ul&gt; after this section
</span><span class="cx">                 // If listNode does NOT appear at the end, then we should consider it as a regular paragraph.
</span><span class="cx">                 // e.g. &lt;ul&gt;&lt;li&gt; &lt;ul&gt;&lt;li&gt;&lt;br&gt;&lt;/li&gt;&lt;/ul&gt; hello&lt;/li&gt;&lt;/ul&gt; should become &lt;ul&gt;&lt;li&gt; &lt;div&gt;&lt;br&gt;&lt;/div&gt; hello&lt;/li&gt;&lt;/ul&gt; at the end
</span><span class="cx">                 splitElement(downcast&lt;HTMLLIElement&gt;(blockEnclosingList), listNode);
</span><span class="cx">                 removeNodePreservingChildren(listNode-&gt;parentNode());
</span><del>-                newBlock = createListItemElement(document());
</del><ins>+                newBlock = HTMLLIElement::create(document());
</ins><span class="cx">             }
</span><span class="cx">             // If listNode does NOT appear at the end of the outer list item, then behave as if in a regular paragraph.
</span><span class="cx">         } else if (blockEnclosingList-&gt;hasTagName(olTag) || blockEnclosingList-&gt;hasTagName(ulTag))
</span><del>-            newBlock = createListItemElement(document());
</del><ins>+            newBlock = HTMLLIElement::create(document());
</ins><span class="cx">     }
</span><span class="cx">     if (!newBlock)
</span><span class="cx">         newBlock = createDefaultParagraphElement(document());
</span><span class="lines">@@ -1541,16 +1541,16 @@
</span><span class="cx">     Node* highestBlockquote = highestEnclosingNodeOfType(caret.deepEquivalent(), &amp;isMailBlockquote);
</span><span class="cx">     if (!highestBlockquote)
</span><span class="cx">         return false;
</span><del>-        
</del><ins>+
</ins><span class="cx">     if (!isStartOfParagraph(caret) || !isEndOfParagraph(caret))
</span><span class="cx">         return false;
</span><del>-    
</del><ins>+
</ins><span class="cx">     VisiblePosition previous(caret.previous(CannotCrossEditingBoundary));
</span><span class="cx">     // Only move forward if there's nothing before the caret, or if there's unquoted content before it.
</span><span class="cx">     if (enclosingNodeOfType(previous.deepEquivalent(), &amp;isMailBlockquote))
</span><span class="cx">         return false;
</span><span class="cx">     
</span><del>-    RefPtr&lt;Node&gt; br = createBreakElement(document());
</del><ins>+    RefPtr&lt;Node&gt; br = HTMLBRElement::create(document());
</ins><span class="cx">     // We want to replace this quoted paragraph with an unquoted one, so insert a br
</span><span class="cx">     // to hold the caret before the highest blockquote.
</span><span class="cx">     insertNodeBefore(br, highestBlockquote);
</span><span class="lines">@@ -1558,7 +1558,7 @@
</span><span class="cx">     // If the br we inserted collapsed, for example foo&lt;br&gt;&lt;blockquote&gt;...&lt;/blockquote&gt;, insert
</span><span class="cx">     // a second one.
</span><span class="cx">     if (!isStartOfParagraph(atBR))
</span><del>-        insertNodeBefore(createBreakElement(document()), br);
</del><ins>+        insertNodeBefore(HTMLBRElement::create(document()), br);
</ins><span class="cx">     setEndingSelection(VisibleSelection(atBR, endingSelection().isDirectional()));
</span><span class="cx">     
</span><span class="cx">     // If this is an empty paragraph there must be a line break here.
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingDeleteSelectionCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/editing/DeleteSelectionCommand.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -30,9 +30,8 @@
</span><span class="cx"> #include &quot;DocumentMarkerController.h&quot;
</span><span class="cx"> #include &quot;Editor.h&quot;
</span><span class="cx"> #include &quot;EditorClient.h&quot;
</span><del>-#include &quot;Element.h&quot;
</del><span class="cx"> #include &quot;Frame.h&quot;
</span><del>-#include &quot;htmlediting.h&quot;
</del><ins>+#include &quot;HTMLBRElement.h&quot;
</ins><span class="cx"> #include &quot;HTMLInputElement.h&quot;
</span><span class="cx"> #include &quot;HTMLLinkElement.h&quot;
</span><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="lines">@@ -44,6 +43,7 @@
</span><span class="cx"> #include &quot;RenderedDocumentMarker.h&quot;
</span><span class="cx"> #include &quot;Text.h&quot;
</span><span class="cx"> #include &quot;VisibleUnits.h&quot;
</span><ins>+#include &quot;htmlediting.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -103,8 +103,8 @@
</span><span class="cx"> 
</span><span class="cx"> void DeleteSelectionCommand::initializeStartEnd(Position&amp; start, Position&amp; end)
</span><span class="cx"> {
</span><del>-    Node* startSpecialContainer = nullptr;
-    Node* endSpecialContainer = nullptr;
</del><ins>+    HTMLElement* startSpecialContainer = nullptr;
+    HTMLElement* endSpecialContainer = nullptr;
</ins><span class="cx">  
</span><span class="cx">     start = m_selectionToDelete.start();
</span><span class="cx">     end = m_selectionToDelete.end();
</span><span class="lines">@@ -464,13 +464,14 @@
</span><span class="cx">             return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (startOffset &gt;= caretMaxOffset(startNode) &amp;&amp; is&lt;Text&gt;(*startNode)) {
</del><ins>+    int startNodeCaretMaxOffset = caretMaxOffset(*startNode);
+    if (startOffset &gt;= startNodeCaretMaxOffset &amp;&amp; is&lt;Text&gt;(*startNode)) {
</ins><span class="cx">         Text&amp; text = downcast&lt;Text&gt;(*startNode);
</span><del>-        if (text.length() &gt; static_cast&lt;unsigned&gt;(caretMaxOffset(startNode)))
-            deleteTextFromNode(&amp;text, caretMaxOffset(startNode), text.length() - caretMaxOffset(startNode));
</del><ins>+        if (text.length() &gt; static_cast&lt;unsigned&gt;(startNodeCaretMaxOffset))
+            deleteTextFromNode(&amp;text, startNodeCaretMaxOffset, text.length() - startNodeCaretMaxOffset);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (startOffset &gt;= lastOffsetForEditing(startNode)) {
</del><ins>+    if (startOffset &gt;= lastOffsetForEditing(*startNode)) {
</ins><span class="cx">         startNode = NodeTraversal::nextSkippingChildren(*startNode);
</span><span class="cx">         startOffset = 0;
</span><span class="cx">     }
</span><span class="lines">@@ -528,7 +529,7 @@
</span><span class="cx">                 node = nextNode.get();
</span><span class="cx">             } else {
</span><span class="cx">                 Node* n = node-&gt;lastDescendant();
</span><del>-                if (m_downstreamEnd.deprecatedNode() == n &amp;&amp; m_downstreamEnd.deprecatedEditingOffset() &gt;= caretMaxOffset(n)) {
</del><ins>+                if (m_downstreamEnd.deprecatedNode() == n &amp;&amp; m_downstreamEnd.deprecatedEditingOffset() &gt;= caretMaxOffset(*n)) {
</ins><span class="cx">                     removeNode(node.get());
</span><span class="cx">                     node = nullptr;
</span><span class="cx">                 } else
</span><span class="lines">@@ -536,7 +537,7 @@
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx">         
</span><del>-        if (m_downstreamEnd.deprecatedNode() != startNode &amp;&amp; !m_upstreamStart.deprecatedNode()-&gt;isDescendantOf(m_downstreamEnd.deprecatedNode()) &amp;&amp; m_downstreamEnd.anchorNode()-&gt;inDocument() &amp;&amp; m_downstreamEnd.deprecatedEditingOffset() &gt;= caretMinOffset(m_downstreamEnd.deprecatedNode())) {
</del><ins>+        if (m_downstreamEnd.deprecatedNode() != startNode &amp;&amp; !m_upstreamStart.deprecatedNode()-&gt;isDescendantOf(m_downstreamEnd.deprecatedNode()) &amp;&amp; m_downstreamEnd.anchorNode()-&gt;inDocument() &amp;&amp; m_downstreamEnd.deprecatedEditingOffset() &gt;= caretMinOffset(*m_downstreamEnd.deprecatedNode())) {
</ins><span class="cx">             if (m_downstreamEnd.atLastEditingPositionForNode() &amp;&amp; !canHaveChildrenForEditing(m_downstreamEnd.deprecatedNode())) {
</span><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="lines">@@ -629,7 +630,7 @@
</span><span class="cx">     
</span><span class="cx">     // We need to merge into m_upstreamStart's block, but it's been emptied out and collapsed by deletion.
</span><span class="cx">     if (!mergeDestination.deepEquivalent().deprecatedNode() || !mergeDestination.deepEquivalent().deprecatedNode()-&gt;isDescendantOf(enclosingBlock(m_upstreamStart.containerNode())) || m_startsAtEmptyLine) {
</span><del>-        insertNodeAt(createBreakElement(document()).ptr(), m_upstreamStart);
</del><ins>+        insertNodeAt(HTMLBRElement::create(document()).ptr(), m_upstreamStart);
</ins><span class="cx">         mergeDestination = VisiblePosition(m_upstreamStart);
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="lines">@@ -852,12 +853,10 @@
</span><span class="cx">     
</span><span class="cx">     removePreviouslySelectedEmptyTableRows();
</span><span class="cx">     
</span><del>-    RefPtr&lt;Node&gt; placeholder = m_needPlaceholder ? createBreakElement(document()).ptr() : nullptr;
-    
-    if (placeholder) {
</del><ins>+    if (m_needPlaceholder) {
</ins><span class="cx">         if (m_sanitizeMarkup)
</span><span class="cx">             removeRedundantBlocks();
</span><del>-        insertNodeAt(placeholder.get(), m_endingPosition);
</del><ins>+        insertNodeAt(HTMLBRElement::create(document()), m_endingPosition);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     bool shouldRebalaceWhiteSpace = true;
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/EditCommand.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/EditCommand.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/editing/EditCommand.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -125,10 +125,10 @@
</span><span class="cx">         return;
</span><span class="cx">     if (!text.length())
</span><span class="cx">         return;
</span><del>-    AXObjectCache* cache = document().existingAXObjectCache();
</del><ins>+    auto* cache = document().existingAXObjectCache();
</ins><span class="cx">     if (!cache)
</span><span class="cx">         return;
</span><del>-    Node* node = highestEditableRoot(position.deepEquivalent(), HasEditableAXRole);
</del><ins>+    auto* node = highestEditableRoot(position.deepEquivalent(), HasEditableAXRole);
</ins><span class="cx">     cache-&gt;postTextStateChangeNotification(node, type, text, position);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditingStylecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/EditingStyle.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/EditingStyle.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/editing/EditingStyle.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx"> #include &quot;HTMLFontElement.h&quot;
</span><span class="cx"> #include &quot;HTMLInterchange.h&quot;
</span><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><ins>+#include &quot;HTMLSpanElement.h&quot;
</ins><span class="cx"> #include &quot;Node.h&quot;
</span><span class="cx"> #include &quot;NodeTraversal.h&quot;
</span><span class="cx"> #include &quot;QualifiedName.h&quot;
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/Editor.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/Editor.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/editing/Editor.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -1955,10 +1955,10 @@
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     // topNode defines the whole range we want to operate on 
</span><del>-    Node* topNode = highestEditableRoot(position);
</del><ins>+    auto* topNode = highestEditableRoot(position);
</ins><span class="cx">     // FIXME: lastOffsetForEditing() is wrong here if editingIgnoresContent(highestEditableRoot()) returns true (e.g. a &lt;table&gt;)
</span><span class="cx">     if (topNode)
</span><del>-        spellingSearchRange-&gt;setEnd(*topNode, lastOffsetForEditing(topNode), IGNORE_EXCEPTION);
</del><ins>+        spellingSearchRange-&gt;setEnd(*topNode, lastOffsetForEditing(*topNode), IGNORE_EXCEPTION);
</ins><span class="cx"> 
</span><span class="cx">     // If spellingSearchRange starts in the middle of a word, advance to the next word so we start checking
</span><span class="cx">     // at a word boundary. Going back by one char and then forward by a word does the trick.
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingFormatBlockCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/FormatBlockCommand.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/FormatBlockCommand.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/editing/FormatBlockCommand.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -73,7 +73,7 @@
</span><span class="cx">     if (!root || !refNode)
</span><span class="cx">         return;
</span><span class="cx">     if (isElementForFormatBlock(refNode-&gt;tagQName()) &amp;&amp; start == startOfBlock(start)
</span><del>-        &amp;&amp; (end == endOfBlock(end) || isNodeVisiblyContainedWithin(*refNode, range.get()))
</del><ins>+        &amp;&amp; (end == endOfBlock(end) || isNodeVisiblyContainedWithin(*refNode, *range))
</ins><span class="cx">         &amp;&amp; refNode != root &amp;&amp; !root-&gt;isDescendantOf(refNode)) {
</span><span class="cx">         // Already in a block element that only contains the current paragraph
</span><span class="cx">         if (refNode-&gt;hasTagName(tagName()))
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingIndentOutdentCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/IndentOutdentCommand.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/IndentOutdentCommand.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/editing/IndentOutdentCommand.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -28,11 +28,11 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;Document.h&quot;
</span><span class="cx"> #include &quot;ElementTraversal.h&quot;
</span><del>-#include &quot;HTMLElement.h&quot;
</del><ins>+#include &quot;HTMLBRElement.h&quot;
</ins><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="cx"> #include &quot;InsertLineBreakCommand.h&quot;
</span><span class="cx"> #include &quot;InsertListCommand.h&quot;
</span><del>-#include &quot;RenderObject.h&quot;
</del><ins>+#include &quot;RenderElement.h&quot;
</ins><span class="cx"> #include &quot;SplitElementCommand.h&quot;
</span><span class="cx"> #include &quot;Text.h&quot;
</span><span class="cx"> #include &quot;VisibleUnits.h&quot;
</span><span class="lines">@@ -122,7 +122,7 @@
</span><span class="cx">     VisiblePosition visibleStartOfParagraph = startOfParagraph(endingSelection().visibleStart());
</span><span class="cx">     VisiblePosition visibleEndOfParagraph = endOfParagraph(visibleStartOfParagraph);
</span><span class="cx"> 
</span><del>-    Node* enclosingNode = enclosingNodeOfType(visibleStartOfParagraph.deepEquivalent(), &amp;isListOrIndentBlockquote);
</del><ins>+    auto* enclosingNode = downcast&lt;HTMLElement&gt;(enclosingNodeOfType(visibleStartOfParagraph.deepEquivalent(), &amp;isListOrIndentBlockquote));
</ins><span class="cx">     if (!enclosingNode || !enclosingNode-&gt;parentNode()-&gt;hasEditableStyle()) // We can't outdent if there is no place to go!
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -163,24 +163,24 @@
</span><span class="cx">         visibleStartOfParagraph = VisiblePosition(visibleStartOfParagraph.deepEquivalent());
</span><span class="cx">         visibleEndOfParagraph = VisiblePosition(visibleEndOfParagraph.deepEquivalent());
</span><span class="cx">         if (visibleStartOfParagraph.isNotNull() &amp;&amp; !isStartOfParagraph(visibleStartOfParagraph))
</span><del>-            insertNodeAt(createBreakElement(document()), visibleStartOfParagraph.deepEquivalent());
</del><ins>+            insertNodeAt(HTMLBRElement::create(document()), visibleStartOfParagraph.deepEquivalent());
</ins><span class="cx">         if (visibleEndOfParagraph.isNotNull() &amp;&amp; !isEndOfParagraph(visibleEndOfParagraph))
</span><del>-            insertNodeAt(createBreakElement(document()), visibleEndOfParagraph.deepEquivalent());
</del><ins>+            insertNodeAt(HTMLBRElement::create(document()), visibleEndOfParagraph.deepEquivalent());
</ins><span class="cx"> 
</span><span class="cx">         return;
</span><span class="cx">     }
</span><del>-    Node* enclosingBlockFlow = enclosingBlock(visibleStartOfParagraph.deepEquivalent().deprecatedNode());
</del><ins>+    auto* enclosingBlockFlow = enclosingBlock(visibleStartOfParagraph.deepEquivalent().deprecatedNode());
</ins><span class="cx">     RefPtr&lt;Node&gt; splitBlockquoteNode = enclosingNode;
</span><span class="cx">     if (enclosingBlockFlow != enclosingNode)
</span><span class="cx">         splitBlockquoteNode = splitTreeToNode(enclosingBlockFlow, enclosingNode, true);
</span><span class="cx">     else {
</span><span class="cx">         // We split the blockquote at where we start outdenting.
</span><del>-        Node* highestInlineNode = highestEnclosingNodeOfType(visibleStartOfParagraph.deepEquivalent(), isInline, CannotCrossEditingBoundary, enclosingBlockFlow);
-        splitElement(downcast&lt;Element&gt;(enclosingNode), highestInlineNode ? highestInlineNode : visibleStartOfParagraph.deepEquivalent().deprecatedNode());
</del><ins>+        auto* highestInlineNode = highestEnclosingNodeOfType(visibleStartOfParagraph.deepEquivalent(), isInline, CannotCrossEditingBoundary, enclosingBlockFlow);
+        splitElement(enclosingNode, highestInlineNode ? highestInlineNode : visibleStartOfParagraph.deepEquivalent().deprecatedNode());
</ins><span class="cx">     }
</span><del>-    RefPtr&lt;Node&gt; placeholder = createBreakElement(document());
-    insertNodeBefore(placeholder, splitBlockquoteNode);
-    moveParagraph(startOfParagraph(visibleStartOfParagraph), endOfParagraph(visibleEndOfParagraph), positionBeforeNode(placeholder.get()), true);
</del><ins>+    auto placeholder = HTMLBRElement::create(document());
+    insertNodeBefore(placeholder.copyRef(), splitBlockquoteNode);
+    moveParagraph(startOfParagraph(visibleStartOfParagraph), endOfParagraph(visibleEndOfParagraph), positionBeforeNode(placeholder.ptr()), true);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // FIXME: We should merge this function with ApplyBlockElementCommand::formatSelection
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingInsertLineBreakCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/InsertLineBreakCommand.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/InsertLineBreakCommand.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/editing/InsertLineBreakCommand.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -29,7 +29,7 @@
</span><span class="cx"> #include &quot;Document.h&quot;
</span><span class="cx"> #include &quot;Frame.h&quot;
</span><span class="cx"> #include &quot;FrameSelection.h&quot;
</span><del>-#include &quot;HTMLElement.h&quot;
</del><ins>+#include &quot;HTMLBRElement.h&quot;
</ins><span class="cx"> #include &quot;HTMLHRElement.h&quot;
</span><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="cx"> #include &quot;HTMLTableElement.h&quot;
</span><span class="lines">@@ -53,38 +53,38 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void InsertLineBreakCommand::insertNodeAfterPosition(Node* node, const Position&amp; pos)
</del><ins>+void InsertLineBreakCommand::insertNodeAfterPosition(Node* node, const Position&amp; position)
</ins><span class="cx"> {
</span><span class="cx">     // Insert the BR after the caret position. In the case the
</span><span class="cx">     // position is a block, do an append. We don't want to insert
</span><span class="cx">     // the BR *after* the block.
</span><del>-    Element* cb = deprecatedEnclosingBlockFlowElement(pos.deprecatedNode());
-    if (cb == pos.deprecatedNode())
-        appendNode(node, cb);
</del><ins>+    auto* element = deprecatedEnclosingBlockFlowElement(position.deprecatedNode());
+    if (element == position.deprecatedNode())
+        appendNode(node, element);
</ins><span class="cx">     else
</span><del>-        insertNodeAfter(node, pos.deprecatedNode());
</del><ins>+        insertNodeAfter(node, position.deprecatedNode());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void InsertLineBreakCommand::insertNodeBeforePosition(Node* node, const Position&amp; pos)
</del><ins>+void InsertLineBreakCommand::insertNodeBeforePosition(Node* node, const Position&amp; position)
</ins><span class="cx"> {
</span><span class="cx">     // Insert the BR after the caret position. In the case the
</span><span class="cx">     // position is a block, do an append. We don't want to insert
</span><span class="cx">     // the BR *before* the block.
</span><del>-    Element* cb = deprecatedEnclosingBlockFlowElement(pos.deprecatedNode());
-    if (cb == pos.deprecatedNode())
-        appendNode(node, cb);
</del><ins>+    auto* element = deprecatedEnclosingBlockFlowElement(position.deprecatedNode());
+    if (element == position.deprecatedNode())
+        appendNode(node, element);
</ins><span class="cx">     else
</span><del>-        insertNodeBefore(node, pos.deprecatedNode());
</del><ins>+        insertNodeBefore(node, position.deprecatedNode());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Whether we should insert a break element or a '\n'.
</span><del>-bool InsertLineBreakCommand::shouldUseBreakElement(const Position&amp; insertionPos)
</del><ins>+bool InsertLineBreakCommand::shouldUseBreakElement(const Position&amp; position)
</ins><span class="cx"> {
</span><span class="cx">     // An editing position like [input, 0] actually refers to the position before
</span><span class="cx">     // the input element, and in that case we need to check the input element's
</span><span class="cx">     // parent's renderer.
</span><del>-    Position p(insertionPos.parentAnchoredEquivalent());
-    return p.deprecatedNode()-&gt;renderer() &amp;&amp; !p.deprecatedNode()-&gt;renderer()-&gt;style().preserveNewline();
</del><ins>+    auto* node = position.parentAnchoredEquivalent().deprecatedNode();
+    return node-&gt;renderer() &amp;&amp; !node-&gt;renderer()-&gt;style().preserveNewline();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InsertLineBreakCommand::doApply()
</span><span class="lines">@@ -100,32 +100,31 @@
</span><span class="cx">     if (caret.isNull())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    Position pos(caret.deepEquivalent());
</del><ins>+    Position position(caret.deepEquivalent());
</ins><span class="cx"> 
</span><del>-    pos = positionAvoidingSpecialElementBoundary(pos);
-    
-    pos = positionOutsideTabSpan(pos);
</del><ins>+    position = positionAvoidingSpecialElementBoundary(position);
+    position = positionOutsideTabSpan(position);
</ins><span class="cx"> 
</span><span class="cx">     RefPtr&lt;Node&gt; nodeToInsert;
</span><del>-    if (shouldUseBreakElement(pos))
-        nodeToInsert = createBreakElement(document());
</del><ins>+    if (shouldUseBreakElement(position))
+        nodeToInsert = HTMLBRElement::create(document());
</ins><span class="cx">     else
</span><span class="cx">         nodeToInsert = document().createTextNode(&quot;\n&quot;);
</span><span class="cx">     
</span><span class="cx">     // FIXME: Need to merge text nodes when inserting just after or before text.
</span><span class="cx">     
</span><span class="cx">     if (isEndOfParagraph(caret) &amp;&amp; !lineBreakExistsAtVisiblePosition(caret)) {
</span><del>-        bool needExtraLineBreak = !is&lt;HTMLHRElement&gt;(*pos.deprecatedNode()) &amp;&amp; !is&lt;HTMLTableElement&gt;(*pos.deprecatedNode());
</del><ins>+        bool needExtraLineBreak = !is&lt;HTMLHRElement&gt;(*position.deprecatedNode()) &amp;&amp; !is&lt;HTMLTableElement&gt;(*position.deprecatedNode());
</ins><span class="cx">         
</span><del>-        insertNodeAt(nodeToInsert.get(), pos);
</del><ins>+        insertNodeAt(nodeToInsert.get(), position);
</ins><span class="cx">         
</span><span class="cx">         if (needExtraLineBreak)
</span><span class="cx">             insertNodeBefore(nodeToInsert-&gt;cloneNode(false), nodeToInsert);
</span><span class="cx">         
</span><span class="cx">         VisiblePosition endingPosition(positionBeforeNode(nodeToInsert.get()));
</span><span class="cx">         setEndingSelection(VisibleSelection(endingPosition, endingSelection().isDirectional()));
</span><del>-    } else if (pos.deprecatedEditingOffset() &lt;= caretMinOffset(pos.deprecatedNode())) {
-        insertNodeAt(nodeToInsert.get(), pos);
</del><ins>+    } else if (position.deprecatedEditingOffset() &lt;= caretMinOffset(*position.deprecatedNode())) {
+        insertNodeAt(nodeToInsert.get(), position);
</ins><span class="cx">         
</span><span class="cx">         // Insert an extra br or '\n' if the just inserted one collapsed.
</span><span class="cx">         if (!isStartOfParagraph(positionBeforeNode(nodeToInsert.get())))
</span><span class="lines">@@ -134,13 +133,13 @@
</span><span class="cx">         setEndingSelection(VisibleSelection(positionInParentAfterNode(nodeToInsert.get()), DOWNSTREAM, endingSelection().isDirectional()));
</span><span class="cx">     // If we're inserting after all of the rendered text in a text node, or into a non-text node,
</span><span class="cx">     // a simple insertion is sufficient.
</span><del>-    } else if (pos.deprecatedEditingOffset() &gt;= caretMaxOffset(pos.deprecatedNode()) || !pos.deprecatedNode()-&gt;isTextNode()) {
-        insertNodeAt(nodeToInsert.get(), pos);
</del><ins>+    } else if (position.deprecatedEditingOffset() &gt;= caretMaxOffset(*position.deprecatedNode()) || !is&lt;Text&gt;(*position.deprecatedNode())) {
+        insertNodeAt(nodeToInsert.get(), position);
</ins><span class="cx">         setEndingSelection(VisibleSelection(positionInParentAfterNode(nodeToInsert.get()), DOWNSTREAM, endingSelection().isDirectional()));
</span><del>-    } else if (is&lt;Text&gt;(*pos.deprecatedNode())) {
</del><ins>+    } else if (is&lt;Text&gt;(*position.deprecatedNode())) {
</ins><span class="cx">         // Split a text node
</span><del>-        Text&amp; textNode = downcast&lt;Text&gt;(*pos.deprecatedNode());
-        splitTextNode(&amp;textNode, pos.deprecatedEditingOffset());
</del><ins>+        Text&amp; textNode = downcast&lt;Text&gt;(*position.deprecatedNode());
+        splitTextNode(&amp;textNode, position.deprecatedEditingOffset());
</ins><span class="cx">         insertNodeBefore(nodeToInsert, &amp;textNode);
</span><span class="cx">         Position endingPosition = firstPositionInNode(&amp;textNode);
</span><span class="cx">         
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingInsertListCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/InsertListCommand.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/InsertListCommand.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/editing/InsertListCommand.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -26,14 +26,15 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;InsertListCommand.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;Element.h&quot;
</del><span class="cx"> #include &quot;ElementTraversal.h&quot;
</span><span class="cx"> #include &quot;ExceptionCodePlaceholder.h&quot;
</span><del>-#include &quot;htmlediting.h&quot;
-#include &quot;HTMLElement.h&quot;
</del><ins>+#include &quot;HTMLBRElement.h&quot;
+#include &quot;HTMLLIElement.h&quot;
</ins><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><ins>+#include &quot;HTMLUListElement.h&quot;
</ins><span class="cx"> #include &quot;Range.h&quot;
</span><span class="cx"> #include &quot;VisibleUnits.h&quot;
</span><ins>+#include &quot;htmlediting.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -56,12 +57,12 @@
</span><span class="cx"> 
</span><span class="cx"> HTMLElement* InsertListCommand::fixOrphanedListChild(Node* node)
</span><span class="cx"> {
</span><del>-    RefPtr&lt;HTMLElement&gt; listElement = createUnorderedListElement(document());
-    insertNodeBefore(listElement, node);
</del><ins>+    auto listElement = HTMLUListElement::create(document());
+    insertNodeBefore(listElement.copyRef(), node);
</ins><span class="cx">     removeNode(node);
</span><del>-    appendNode(node, listElement);
-    m_listElement = listElement;
-    return listElement.get();
</del><ins>+    appendNode(node, listElement.copyRef());
+    m_listElement = listElement.copyRef();
+    return listElement.ptr();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;HTMLElement&gt; InsertListCommand::mergeWithNeighboringLists(PassRefPtr&lt;HTMLElement&gt; passedList)
</span><span class="lines">@@ -220,15 +221,15 @@
</span><span class="cx">             return;
</span><span class="cx"> 
</span><span class="cx">         // If the entire list is selected, then convert the whole list.
</span><del>-        if (switchListType &amp;&amp; isNodeVisiblyContainedWithin(*listNode, currentSelection)) {
-            bool rangeStartIsInList = visiblePositionBeforeNode(listNode.get()) == currentSelection-&gt;startPosition();
-            bool rangeEndIsInList = visiblePositionAfterNode(listNode.get()) == currentSelection-&gt;endPosition();
</del><ins>+        if (switchListType &amp;&amp; isNodeVisiblyContainedWithin(*listNode, *currentSelection)) {
+            bool rangeStartIsInList = visiblePositionBeforeNode(*listNode) == currentSelection-&gt;startPosition();
+            bool rangeEndIsInList = visiblePositionAfterNode(*listNode) == currentSelection-&gt;endPosition();
</ins><span class="cx"> 
</span><span class="cx">             RefPtr&lt;HTMLElement&gt; newList = createHTMLElement(document(), listTag);
</span><span class="cx">             insertNodeBefore(newList, listNode);
</span><span class="cx"> 
</span><del>-            Node* firstChildInList = enclosingListChild(VisiblePosition(firstPositionInNode(listNode.get())).deepEquivalent().deprecatedNode(), listNode.get());
-            Node* outerBlock = isBlockFlowElement(firstChildInList) ? firstChildInList : listNode.get();
</del><ins>+            auto* firstChildInList = enclosingListChild(VisiblePosition(firstPositionInNode(listNode.get())).deepEquivalent().deprecatedNode(), listNode.get());
+            Node* outerBlock = firstChildInList &amp;&amp; isBlockFlowElement(*firstChildInList) ? firstChildInList : listNode.get();
</ins><span class="cx">             
</span><span class="cx">             moveParagraphWithClones(firstPositionInNode(listNode.get()), lastPositionInNode(listNode.get()), newList.get(), outerBlock);
</span><span class="cx"> 
</span><span class="lines">@@ -281,12 +282,12 @@
</span><span class="cx">     }
</span><span class="cx">     // When removing a list, we must always create a placeholder to act as a point of insertion
</span><span class="cx">     // for the list content being removed.
</span><del>-    RefPtr&lt;Element&gt; placeholder = createBreakElement(document());
</del><ins>+    RefPtr&lt;Element&gt; placeholder = HTMLBRElement::create(document());
</ins><span class="cx">     RefPtr&lt;Element&gt; nodeToInsert = placeholder;
</span><span class="cx">     // If the content of the list item will be moved into another list, put it in a list item
</span><span class="cx">     // so that we don't create an orphaned list child.
</span><span class="cx">     if (enclosingList(listNode)) {
</span><del>-        nodeToInsert = createListItemElement(document());
</del><ins>+        nodeToInsert = HTMLLIElement::create(document());
</ins><span class="cx">         appendNode(placeholder, nodeToInsert);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -343,29 +344,29 @@
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><span class="cx">     // Check for adjoining lists.
</span><del>-    RefPtr&lt;HTMLElement&gt; listItemElement = createListItemElement(document());
-    RefPtr&lt;HTMLElement&gt; placeholder = createBreakElement(document());
-    appendNode(placeholder, listItemElement);
</del><ins>+    auto listItemElement = HTMLLIElement::create(document());
+    auto placeholder = HTMLBRElement::create(document());
+    appendNode(placeholder.copyRef(), listItemElement.copyRef());
</ins><span class="cx"> 
</span><span class="cx">     // Place list item into adjoining lists.
</span><span class="cx">     Element* previousList = adjacentEnclosingList(start.deepEquivalent(), start.previous(CannotCrossEditingBoundary), listTag);
</span><span class="cx">     Element* nextList = adjacentEnclosingList(start.deepEquivalent(), end.next(CannotCrossEditingBoundary), listTag);
</span><span class="cx">     RefPtr&lt;HTMLElement&gt; listElement;
</span><span class="cx">     if (previousList)
</span><del>-        appendNode(listItemElement, previousList);
</del><ins>+        appendNode(WTFMove(listItemElement), previousList);
</ins><span class="cx">     else if (nextList)
</span><del>-        insertNodeAt(listItemElement, positionBeforeNode(nextList));
</del><ins>+        insertNodeAt(WTFMove(listItemElement), positionBeforeNode(nextList));
</ins><span class="cx">     else {
</span><span class="cx">         // Create the list.
</span><span class="cx">         listElement = createHTMLElement(document(), listTag);
</span><del>-        appendNode(listItemElement, listElement);
</del><ins>+        appendNode(WTFMove(listItemElement), listElement);
</ins><span class="cx"> 
</span><span class="cx">         if (start == end &amp;&amp; isBlock(start.deepEquivalent().deprecatedNode())) {
</span><span class="cx">             // Inserting the list into an empty paragraph that isn't held open 
</span><span class="cx">             // by a br or a '\n', will invalidate start and end.  Insert 
</span><span class="cx">             // a placeholder and then recompute start and end.
</span><del>-            RefPtr&lt;Node&gt; placeholder = insertBlockPlaceholder(start.deepEquivalent());
-            start = positionBeforeNode(placeholder.get());
</del><ins>+            auto blockPlaceholder = insertBlockPlaceholder(start.deepEquivalent());
+            start = positionBeforeNode(blockPlaceholder.get());
</ins><span class="cx">             end = start;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -393,7 +394,7 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    moveParagraph(start, end, positionBeforeNode(placeholder.get()), true);
</del><ins>+    moveParagraph(start, end, positionBeforeNode(placeholder.ptr()), true);
</ins><span class="cx"> 
</span><span class="cx">     if (listElement)
</span><span class="cx">         return mergeWithNeighboringLists(listElement);
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingInsertParagraphSeparatorCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;Document.h&quot;
</span><span class="cx"> #include &quot;EditingStyle.h&quot;
</span><del>-#include &quot;HTMLElement.h&quot;
</del><ins>+#include &quot;HTMLBRElement.h&quot;
</ins><span class="cx"> #include &quot;HTMLFormElement.h&quot;
</span><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="cx"> #include &quot;InsertLineBreakCommand.h&quot;
</span><span class="lines">@@ -297,7 +297,7 @@
</span><span class="cx">     // it if visiblePos is at the start of a paragraph so that the 
</span><span class="cx">     // content will move down a line.
</span><span class="cx">     if (isStartOfParagraph(visiblePos)) {
</span><del>-        RefPtr&lt;Element&gt; br = createBreakElement(document());
</del><ins>+        RefPtr&lt;Element&gt; br = HTMLBRElement::create(document());
</ins><span class="cx">         insertNodeAt(br.get(), insertionPosition);
</span><span class="cx">         insertionPosition = positionInParentAfterNode(br.get());
</span><span class="cx">         // If the insertion point is a break element, there is nothing else
</span><span class="lines">@@ -368,7 +368,7 @@
</span><span class="cx">     // created.  All of the nodes, starting at visiblePos, are about to be added to the new paragraph 
</span><span class="cx">     // element.  If the first node to be inserted won't be one that will hold an empty line open, add a br.
</span><span class="cx">     if (isEndOfParagraph(visiblePos) &amp;&amp; !lineBreakExistsAtVisiblePosition(visiblePos))
</span><del>-        appendNode(createBreakElement(document()), blockToInsert.get());
</del><ins>+        appendNode(HTMLBRElement::create(document()), blockToInsert.get());
</ins><span class="cx"> 
</span><span class="cx">     // Move the start node and the siblings of the start node.
</span><span class="cx">     if (VisiblePosition(insertionPosition) != VisiblePosition(positionBeforeNode(blockToInsert.get()))) {
</span><span class="lines">@@ -377,7 +377,7 @@
</span><span class="cx">             n = insertionPosition.computeNodeAfterPosition();
</span><span class="cx">         else {
</span><span class="cx">             Node* splitTo = insertionPosition.containerNode();
</span><del>-            if (splitTo-&gt;isTextNode() &amp;&amp; insertionPosition.offsetInContainerNode() &gt;= caretMaxOffset(splitTo))
</del><ins>+            if (is&lt;Text&gt;(*splitTo) &amp;&amp; insertionPosition.offsetInContainerNode() &gt;= caretMaxOffset(*splitTo))
</ins><span class="cx">                 splitTo = NodeTraversal::next(*splitTo, startBlock.get());
</span><span class="cx">             ASSERT(splitTo);
</span><span class="cx">             splitTreeToNode(splitTo, startBlock.get());
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingInsertTextCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/InsertTextCommand.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/InsertTextCommand.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/editing/InsertTextCommand.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -27,9 +27,9 @@
</span><span class="cx"> #include &quot;InsertTextCommand.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;Document.h&quot;
</span><del>-#include &quot;Element.h&quot;
</del><span class="cx"> #include &quot;Editor.h&quot;
</span><span class="cx"> #include &quot;Frame.h&quot;
</span><ins>+#include &quot;HTMLElement.h&quot;
</ins><span class="cx"> #include &quot;HTMLInterchange.h&quot;
</span><span class="cx"> #include &quot;Text.h&quot;
</span><span class="cx"> #include &quot;VisibleUnits.h&quot;
</span><span class="lines">@@ -249,15 +249,15 @@
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     // create new tab span
</span><del>-    RefPtr&lt;Element&gt; spanNode = createTabSpanElement(document());
</del><ins>+    auto spanNode = createTabSpanElement(document());
</ins><span class="cx">     
</span><span class="cx">     // place it
</span><del>-    if (!is&lt;Text&gt;(*node)) {
-        insertNodeAt(spanNode.get(), insertPos);
-    } else {
</del><ins>+    if (!is&lt;Text&gt;(*node))
+        insertNodeAt(spanNode.ptr(), insertPos);
+    else {
</ins><span class="cx">         RefPtr&lt;Text&gt; textNode = downcast&lt;Text&gt;(node);
</span><span class="cx">         if (offset &gt;= textNode-&gt;length())
</span><del>-            insertNodeAfter(spanNode, textNode.release());
</del><ins>+            insertNodeAfter(spanNode.copyRef(), WTFMove(textNode));
</ins><span class="cx">         else {
</span><span class="cx">             // split node to make room for the span
</span><span class="cx">             // NOTE: splitTextNode uses textNode for the
</span><span class="lines">@@ -265,12 +265,12 @@
</span><span class="cx">             // insert the span before it.
</span><span class="cx">             if (offset &gt; 0)
</span><span class="cx">                 splitTextNode(textNode, offset);
</span><del>-            insertNodeBefore(spanNode, textNode.release());
</del><ins>+            insertNodeBefore(spanNode.copyRef(), WTFMove(textNode));
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // return the position following the new tab
</span><del>-    return lastPositionInNode(spanNode.get());
</del><ins>+    return lastPositionInNode(spanNode.ptr());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingModifySelectionListLevelcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/ModifySelectionListLevel.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/ModifySelectionListLevel.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/editing/ModifySelectionListLevel.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -29,7 +29,8 @@
</span><span class="cx"> #include &quot;Document.h&quot;
</span><span class="cx"> #include &quot;Frame.h&quot;
</span><span class="cx"> #include &quot;FrameSelection.h&quot;
</span><del>-#include &quot;HTMLElement.h&quot;
</del><ins>+#include &quot;HTMLOListElement.h&quot;
+#include &quot;HTMLUListElement.h&quot;
</ins><span class="cx"> #include &quot;RenderObject.h&quot;
</span><span class="cx"> #include &quot;htmlediting.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -190,10 +191,10 @@
</span><span class="cx">                     newParent = newParent-&gt;cloneElementWithoutChildren(document());
</span><span class="cx">                 break;
</span><span class="cx">             case OrderedList:
</span><del>-                newParent = createOrderedListElement(document());
</del><ins>+                newParent = HTMLOListElement::create(document());
</ins><span class="cx">                 break;
</span><span class="cx">             case UnorderedList:
</span><del>-                newParent = createUnorderedListElement(document());
</del><ins>+                newParent = HTMLUListElement::create(document());
</ins><span class="cx">                 break;
</span><span class="cx">         }
</span><span class="cx">         insertNodeBefore(newParent, startListChild);
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingReplaceSelectionCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -34,19 +34,19 @@
</span><span class="cx"> #include &quot;CSSStyleDeclaration.h&quot;
</span><span class="cx"> #include &quot;Document.h&quot;
</span><span class="cx"> #include &quot;DocumentFragment.h&quot;
</span><del>-#include &quot;Element.h&quot;
</del><span class="cx"> #include &quot;ElementIterator.h&quot;
</span><span class="cx"> #include &quot;EventNames.h&quot;
</span><span class="cx"> #include &quot;ExceptionCodePlaceholder.h&quot;
</span><span class="cx"> #include &quot;Frame.h&quot;
</span><span class="cx"> #include &quot;FrameSelection.h&quot;
</span><ins>+#include &quot;HTMLBRElement.h&quot;
</ins><span class="cx"> #include &quot;HTMLInputElement.h&quot;
</span><ins>+#include &quot;HTMLLIElement.h&quot;
</ins><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="cx"> #include &quot;HTMLTitleElement.h&quot;
</span><span class="cx"> #include &quot;NodeList.h&quot;
</span><span class="cx"> #include &quot;NodeRenderStyle.h&quot;
</span><span class="cx"> #include &quot;RenderInline.h&quot;
</span><del>-#include &quot;RenderObject.h&quot;
</del><span class="cx"> #include &quot;RenderText.h&quot;
</span><span class="cx"> #include &quot;SimplifyMarkupCommand.h&quot;
</span><span class="cx"> #include &quot;SmartReplace.h&quot;
</span><span class="lines">@@ -281,7 +281,7 @@
</span><span class="cx">     Vector&lt;RefPtr&lt;Node&gt;&gt; unrendered;
</span><span class="cx"> 
</span><span class="cx">     for (Node* node = holder-&gt;firstChild(); node; node = NodeTraversal::next(*node, holder)) {
</span><del>-        if (!isNodeRendered(node) &amp;&amp; !isTableStructureNode(node))
</del><ins>+        if (!isNodeRendered(*node) &amp;&amp; !isTableStructureNode(node))
</ins><span class="cx">             unrendered.append(node);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -456,18 +456,19 @@
</span><span class="cx">     if (source.isNull() || destination.isNull())
</span><span class="cx">         return false;
</span><span class="cx">         
</span><del>-    Node* sourceNode = source.deepEquivalent().deprecatedNode();
-    Node* destinationNode = destination.deepEquivalent().deprecatedNode();
-    Node* sourceBlock = enclosingBlock(sourceNode);
-    Node* destinationBlock = enclosingBlock(destinationNode);
-    return !enclosingNodeOfType(source.deepEquivalent(), &amp;isMailPasteAsQuotationNode) &amp;&amp;
-           sourceBlock &amp;&amp; (!sourceBlock-&gt;hasTagName(blockquoteTag) || isMailBlockquote(sourceBlock))  &amp;&amp;
-           enclosingListChild(sourceBlock) == enclosingListChild(destinationNode) &amp;&amp;
-           enclosingTableCell(source.deepEquivalent()) == enclosingTableCell(destination.deepEquivalent()) &amp;&amp;
-           (!isHeaderElement(sourceBlock) || haveSameTagName(sourceBlock, destinationBlock)) &amp;&amp;
-           // Don't merge to or from a position before or after a block because it would
-           // be a no-op and cause infinite recursion.
-           !isBlock(sourceNode) &amp;&amp; !isBlock(destinationNode);
</del><ins>+    auto* sourceNode = source.deepEquivalent().deprecatedNode();
+    auto* destinationNode = destination.deepEquivalent().deprecatedNode();
+    auto* sourceBlock = enclosingBlock(sourceNode);
+    auto* destinationBlock = enclosingBlock(destinationNode);
+    return !enclosingNodeOfType(source.deepEquivalent(), &amp;isMailPasteAsQuotationNode)
+        &amp;&amp; sourceBlock
+        &amp;&amp; (!sourceBlock-&gt;hasTagName(blockquoteTag) || isMailBlockquote(sourceBlock))
+        &amp;&amp; enclosingListChild(sourceBlock) == enclosingListChild(destinationNode)
+        &amp;&amp; enclosingTableCell(source.deepEquivalent()) == enclosingTableCell(destination.deepEquivalent())
+        &amp;&amp; (!isHeaderElement(sourceBlock) || haveSameTagName(sourceBlock, destinationBlock))
+        // Don't merge to or from a position before or after a block because it would
+        // be a no-op and cause infinite recursion.
+        &amp;&amp; !isBlock(sourceNode) &amp;&amp; !isBlock(destinationNode);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Style rules that match just inserted elements could change their appearance, like
</span><span class="lines">@@ -527,7 +528,7 @@
</span><span class="cx">             setNodeAttribute(element, styleAttr, newInlineStyle-&gt;style()-&gt;asText());
</span><span class="cx"> 
</span><span class="cx">         // FIXME: Tolerate differences in id, class, and style attributes.
</span><del>-        if (element-&gt;parentNode() &amp;&amp; isNonTableCellHTMLBlockElement(element) &amp;&amp; areIdenticalElements(element, element-&gt;parentNode())
</del><ins>+        if (element-&gt;parentNode() &amp;&amp; isNonTableCellHTMLBlockElement(element) &amp;&amp; areIdenticalElements(*element, *element-&gt;parentNode())
</ins><span class="cx">             &amp;&amp; VisiblePosition(firstPositionInNode(element-&gt;parentNode())) == VisiblePosition(firstPositionInNode(element))
</span><span class="cx">             &amp;&amp; VisiblePosition(lastPositionInNode(element-&gt;parentNode())) == VisiblePosition(lastPositionInNode(element))) {
</span><span class="cx">             insertedNodes.willRemoveNodePreservingChildren(element);
</span><span class="lines">@@ -842,7 +843,7 @@
</span><span class="cx">     // Merging forward could result in deleting the destination anchor node.
</span><span class="cx">     // To avoid this, we add a placeholder node before the start of the paragraph.
</span><span class="cx">     if (endOfParagraph(startOfParagraphToMove) == destination) {
</span><del>-        RefPtr&lt;Node&gt; placeholder = createBreakElement(document());
</del><ins>+        RefPtr&lt;Node&gt; placeholder = HTMLBRElement::create(document());
</ins><span class="cx">         insertNodeBefore(placeholder, startOfParagraphToMove.deepEquivalent().deprecatedNode());
</span><span class="cx">         destination = VisiblePosition(positionBeforeNode(placeholder.get()));
</span><span class="cx">     }
</span><span class="lines">@@ -863,11 +864,11 @@
</span><span class="cx"> static Node* enclosingInline(Node* node)
</span><span class="cx"> {
</span><span class="cx">     while (ContainerNode* parent = node-&gt;parentNode()) {
</span><del>-        if (isBlockFlowElement(parent) || parent-&gt;hasTagName(bodyTag))
</del><ins>+        if (isBlockFlowElement(*parent) || parent-&gt;hasTagName(bodyTag))
</ins><span class="cx">             return node;
</span><span class="cx">         // Stop if any previous sibling is a block.
</span><span class="cx">         for (Node* sibling = node-&gt;previousSibling(); sibling; sibling = sibling-&gt;previousSibling()) {
</span><del>-            if (isBlockFlowElement(sibling))
</del><ins>+            if (isBlockFlowElement(*sibling))
</ins><span class="cx">                 return node;
</span><span class="cx">         }
</span><span class="cx">         node = parent;
</span><span class="lines">@@ -1144,7 +1145,7 @@
</span><span class="cx">     // We inserted before the insertionBlock to prevent nesting, and the content before the insertionBlock wasn't in its own block and
</span><span class="cx">     // didn't have a br after it, so the inserted content ended up in the same paragraph.
</span><span class="cx">     if (!startOfInsertedContent.isNull() &amp;&amp; insertionBlock &amp;&amp; insertionPos.deprecatedNode() == insertionBlock-&gt;parentNode() &amp;&amp; (unsigned)insertionPos.deprecatedEditingOffset() &lt; insertionBlock-&gt;computeNodeIndex() &amp;&amp; !isStartOfParagraph(startOfInsertedContent))
</span><del>-        insertNodeAt(createBreakElement(document()), startOfInsertedContent.deepEquivalent());
</del><ins>+        insertNodeAt(HTMLBRElement::create(document()), startOfInsertedContent.deepEquivalent());
</ins><span class="cx"> 
</span><span class="cx">     if (endBR &amp;&amp; (plainTextFragment || shouldRemoveEndBR(endBR.get(), originalVisPosBeforeEndBR))) {
</span><span class="cx">         RefPtr&lt;Node&gt; parent = endBR-&gt;parentNode();
</span><span class="lines">@@ -1179,7 +1180,7 @@
</span><span class="cx">         // We insert a placeholder before the newly inserted content to avoid being merged into the inline.
</span><span class="cx">         Node* destinationNode = destination.deepEquivalent().deprecatedNode();
</span><span class="cx">         if (m_shouldMergeEnd &amp;&amp; destinationNode != enclosingInline(destinationNode) &amp;&amp; enclosingInline(destinationNode)-&gt;nextSibling())
</span><del>-            insertNodeBefore(createBreakElement(document()), refNode.get());
</del><ins>+            insertNodeBefore(HTMLBRElement::create(document()), refNode.get());
</ins><span class="cx">         
</span><span class="cx">         // Merging the the first paragraph of inserted content with the content that came
</span><span class="cx">         // before the selection that was pasted into would also move content after 
</span><span class="lines">@@ -1190,7 +1191,7 @@
</span><span class="cx">         // comes after and prevent that from happening.
</span><span class="cx">         VisiblePosition endOfInsertedContent = positionAtEndOfInsertedContent();
</span><span class="cx">         if (startOfParagraph(endOfInsertedContent) == startOfParagraphToMove) {
</span><del>-            insertNodeAt(createBreakElement(document()), endOfInsertedContent.deepEquivalent());
</del><ins>+            insertNodeAt(HTMLBRElement::create(document()), endOfInsertedContent.deepEquivalent());
</ins><span class="cx">             // Mutation events (bug 22634) triggered by inserting the &lt;br&gt; might have removed the content we're about to move
</span><span class="cx">             if (!startOfParagraphToMove.deepEquivalent().anchorNode()-&gt;inDocument())
</span><span class="cx">                 return;
</span><span class="lines">@@ -1214,9 +1215,9 @@
</span><span class="cx">                 setEndingSelection(endOfInsertedContent);
</span><span class="cx">                 Node* enclosingNode = enclosingBlock(endOfInsertedContent.deepEquivalent().deprecatedNode());
</span><span class="cx">                 if (isListItem(enclosingNode)) {
</span><del>-                    RefPtr&lt;Node&gt; newListItem = createListItemElement(document());
-                    insertNodeAfter(newListItem, enclosingNode);
-                    setEndingSelection(VisiblePosition(firstPositionInNode(newListItem.get())));
</del><ins>+                    auto newListItem = HTMLLIElement::create(document());
+                    insertNodeAfter(newListItem.copyRef(), enclosingNode);
+                    setEndingSelection(VisiblePosition(firstPositionInNode(newListItem.ptr())));
</ins><span class="cx">                 } else {
</span><span class="cx">                     // Use a default paragraph element (a plain div) for the empty paragraph, using the last paragraph
</span><span class="cx">                     // block's style seems to annoy users.
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingTextIteratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/TextIterator.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/TextIterator.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/editing/TextIterator.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -974,7 +974,7 @@
</span><span class="cx"> 
</span><span class="cx"> static int maxOffsetIncludingCollapsedSpaces(Node&amp; node)
</span><span class="cx"> {
</span><del>-    int offset = caretMaxOffset(&amp;node);
</del><ins>+    int offset = caretMaxOffset(node);
</ins><span class="cx">     if (auto* renderer = node.renderer()) {
</span><span class="cx">         if (is&lt;RenderText&gt;(*renderer))
</span><span class="cx">             offset += collapsedSpaceLength(downcast&lt;RenderText&gt;(*renderer), offset);
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingTypingCommandcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/TypingCommand.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/TypingCommand.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/editing/TypingCommand.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -620,7 +620,7 @@
</span><span class="cx">             downstreamEnd = visibleEnd.next(CannotCrossEditingBoundary).deepEquivalent().downstream();
</span><span class="cx">         // When deleting tables: Select the table first, then perform the deletion
</span><span class="cx">         if (downstreamEnd.containerNode() &amp;&amp; downstreamEnd.containerNode()-&gt;renderer() &amp;&amp; downstreamEnd.containerNode()-&gt;renderer()-&gt;isTable()
</span><del>-            &amp;&amp; downstreamEnd.computeOffsetInContainerNode() &lt;= caretMinOffset(downstreamEnd.containerNode())) {
</del><ins>+            &amp;&amp; downstreamEnd.computeOffsetInContainerNode() &lt;= caretMinOffset(*downstreamEnd.containerNode())) {
</ins><span class="cx">             setEndingSelection(VisibleSelection(endingSelection().end(), positionAfterNode(downstreamEnd.containerNode()), DOWNSTREAM, endingSelection().isDirectional()));
</span><span class="cx">             typingAddedToOpenCommand(ForwardDeleteKey);
</span><span class="cx">             return;
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingVisiblePositioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/VisiblePosition.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/VisiblePosition.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/editing/VisiblePosition.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -455,29 +455,29 @@
</span><span class="cx">     return honorEditingBoundaryAtOrAfter(right, reachedBoundary);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-VisiblePosition VisiblePosition::honorEditingBoundaryAtOrBefore(const VisiblePosition &amp;pos, bool* reachedBoundary) const
</del><ins>+VisiblePosition VisiblePosition::honorEditingBoundaryAtOrBefore(const VisiblePosition&amp; position, bool* reachedBoundary) const
</ins><span class="cx"> {
</span><span class="cx">     if (reachedBoundary)
</span><span class="cx">         *reachedBoundary = false;
</span><del>-    if (pos.isNull())
-        return pos;
</del><ins>+    if (position.isNull())
+        return position;
</ins><span class="cx">     
</span><del>-    Node* highestRoot = highestEditableRoot(deepEquivalent());
</del><ins>+    auto* highestRoot = highestEditableRoot(deepEquivalent());
</ins><span class="cx">     
</span><span class="cx">     // Return empty position if pos is not somewhere inside the editable region containing this position
</span><del>-    if (highestRoot &amp;&amp; !pos.deepEquivalent().deprecatedNode()-&gt;isDescendantOf(highestRoot)) {
</del><ins>+    if (highestRoot &amp;&amp; !position.deepEquivalent().deprecatedNode()-&gt;isDescendantOf(highestRoot)) {
</ins><span class="cx">         if (reachedBoundary)
</span><span class="cx">             *reachedBoundary = true;
</span><span class="cx">         return VisiblePosition();
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    // Return pos itself if the two are from the very same editable region, or both are non-editable
</del><ins>+    // Return position itself if the two are from the very same editable region, or both are non-editable
</ins><span class="cx">     // FIXME: In the non-editable case, just because the new position is non-editable doesn't mean movement
</span><span class="cx">     // to it is allowed.  VisibleSelection::adjustForEditableContent has this problem too.
</span><del>-    if (highestEditableRoot(pos.deepEquivalent()) == highestRoot) {
</del><ins>+    if (highestEditableRoot(position.deepEquivalent()) == highestRoot) {
</ins><span class="cx">         if (reachedBoundary)
</span><del>-            *reachedBoundary = *this == pos;
-        return pos;
</del><ins>+            *reachedBoundary = *this == position;
+        return position;
</ins><span class="cx">     }
</span><span class="cx">   
</span><span class="cx">     // Return empty position if this position is non-editable, but pos is editable
</span><span class="lines">@@ -489,7 +489,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Return the last position before pos that is in the same editable region as this position
</span><del>-    return lastEditablePositionBeforePositionInRoot(pos.deepEquivalent(), highestRoot);
</del><ins>+    return lastEditablePositionBeforePositionInRoot(position.deepEquivalent(), highestRoot);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> VisiblePosition VisiblePosition::honorEditingBoundaryAtOrAfter(const VisiblePosition &amp;pos, bool* reachedBoundary) const
</span><span class="lines">@@ -499,7 +499,7 @@
</span><span class="cx">     if (pos.isNull())
</span><span class="cx">         return pos;
</span><span class="cx">     
</span><del>-    Node* highestRoot = highestEditableRoot(deepEquivalent());
</del><ins>+    auto* highestRoot = highestEditableRoot(deepEquivalent());
</ins><span class="cx">     
</span><span class="cx">     // Return empty position if pos is not somewhere inside the editable region containing this position
</span><span class="cx">     if (highestRoot &amp;&amp; !pos.deepEquivalent().deprecatedNode()-&gt;isDescendantOf(highestRoot)) {
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingVisibleSelectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/VisibleSelection.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/VisibleSelection.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/editing/VisibleSelection.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -307,7 +307,7 @@
</span><span class="cx">                 // the next one) to match TextEdit.
</span><span class="cx">                 end = wordEnd.next();
</span><span class="cx">                 
</span><del>-                if (Node* table = isFirstPositionAfterTable(end)) {
</del><ins>+                if (auto* table = isFirstPositionAfterTable(end)) {
</ins><span class="cx">                     // The paragraph break after the last paragraph in the last cell of a block table ends
</span><span class="cx">                     // at the start of the paragraph after the table.
</span><span class="cx">                     if (isBlock(table))
</span><span class="lines">@@ -534,11 +534,11 @@
</span><span class="cx">     if (m_base == m_start &amp;&amp; m_base == m_end)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    Node* baseRoot = highestEditableRoot(m_base);
-    Node* startRoot = highestEditableRoot(m_start);
-    Node* endRoot = highestEditableRoot(m_end);
</del><ins>+    auto* baseRoot = highestEditableRoot(m_base);
+    auto* startRoot = highestEditableRoot(m_start);
+    auto* endRoot = highestEditableRoot(m_end);
</ins><span class="cx">     
</span><del>-    Node* baseEditableAncestor = lowestEditableAncestor(m_base.containerNode());
</del><ins>+    auto* baseEditableAncestor = lowestEditableAncestor(m_base.containerNode());
</ins><span class="cx">     
</span><span class="cx">     // The base, start and end are all in the same region.  No adjustment necessary.
</span><span class="cx">     if (baseRoot == startRoot &amp;&amp; baseRoot == endRoot)
</span><span class="lines">@@ -573,7 +573,7 @@
</span><span class="cx">     
</span><span class="cx">         // The selection ends in editable content or non-editable content inside a different editable ancestor, 
</span><span class="cx">         // move backward until non-editable content inside the same lowest editable ancestor is reached.
</span><del>-        Node* endEditableAncestor = lowestEditableAncestor(m_end.containerNode());
</del><ins>+        auto* endEditableAncestor = lowestEditableAncestor(m_end.containerNode());
</ins><span class="cx">         if (endRoot || endEditableAncestor != baseEditableAncestor) {
</span><span class="cx">             
</span><span class="cx">             Position p = previousVisuallyDistinctCandidate(m_end);
</span><span class="lines">@@ -603,7 +603,7 @@
</span><span class="cx"> 
</span><span class="cx">         // The selection starts in editable content or non-editable content inside a different editable ancestor, 
</span><span class="cx">         // move forward until non-editable content inside the same lowest editable ancestor is reached.
</span><del>-        Node* startEditableAncestor = lowestEditableAncestor(m_start.containerNode());      
</del><ins>+        auto* startEditableAncestor = lowestEditableAncestor(m_start.containerNode());
</ins><span class="cx">         if (startRoot || startEditableAncestor != baseEditableAncestor) {
</span><span class="cx">             Position p = nextVisuallyDistinctCandidate(m_start);
</span><span class="cx">             Node* shadowAncestor = startRoot ? startRoot-&gt;shadowHost() : 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingVisibleUnitscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/VisibleUnits.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/VisibleUnits.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/editing/VisibleUnits.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -76,7 +76,7 @@
</span><span class="cx"> // FIXME: consolidate with code in previousLinePosition.
</span><span class="cx"> static Position previousRootInlineBoxCandidatePosition(Node* node, const VisiblePosition&amp; visiblePosition, EditableType editableType)
</span><span class="cx"> {
</span><del>-    Node* highestRoot = highestEditableRoot(visiblePosition.deepEquivalent(), editableType);
</del><ins>+    auto* highestRoot = highestEditableRoot(visiblePosition.deepEquivalent(), editableType);
</ins><span class="cx">     Node* previousNode = previousLeafWithSameEditability(node, editableType);
</span><span class="cx"> 
</span><span class="cx">     while (previousNode &amp;&amp; (!previousNode-&gt;renderer() || inSameLine(firstPositionInOrBeforeNode(previousNode), visiblePosition)))
</span><span class="lines">@@ -87,7 +87,7 @@
</span><span class="cx">             break;
</span><span class="cx"> 
</span><span class="cx">         Position pos = previousNode-&gt;hasTagName(brTag) ? positionBeforeNode(previousNode) :
</span><del>-            createLegacyEditingPosition(previousNode, caretMaxOffset(previousNode));
</del><ins>+            createLegacyEditingPosition(previousNode, caretMaxOffset(*previousNode));
</ins><span class="cx">         
</span><span class="cx">         if (pos.isCandidate())
</span><span class="cx">             return pos;
</span><span class="lines">@@ -99,7 +99,7 @@
</span><span class="cx"> 
</span><span class="cx"> static Position nextRootInlineBoxCandidatePosition(Node* node, const VisiblePosition&amp; visiblePosition, EditableType editableType)
</span><span class="cx"> {
</span><del>-    Node* highestRoot = highestEditableRoot(visiblePosition.deepEquivalent(), editableType);
</del><ins>+    auto* highestRoot = highestEditableRoot(visiblePosition.deepEquivalent(), editableType);
</ins><span class="cx">     Node* nextNode = nextLeafWithSameEditability(node, editableType);
</span><span class="cx">     while (nextNode &amp;&amp; (!nextNode-&gt;renderer() || inSameLine(firstPositionInOrBeforeNode(nextNode), visiblePosition)))
</span><span class="cx">         nextNode = nextLeafWithSameEditability(nextNode, ContentIsEditable);
</span><span class="lines">@@ -109,7 +109,7 @@
</span><span class="cx">             break;
</span><span class="cx"> 
</span><span class="cx">         Position pos;
</span><del>-        pos = createLegacyEditingPosition(nextNode, caretMinOffset(nextNode));
</del><ins>+        pos = createLegacyEditingPosition(nextNode, caretMinOffset(*nextNode));
</ins><span class="cx">         
</span><span class="cx">         if (pos.isCandidate())
</span><span class="cx">             return pos;
</span><span class="lines">@@ -1273,7 +1273,7 @@
</span><span class="cx"> VisiblePosition startOfParagraph(const VisiblePosition&amp; c, EditingBoundaryCrossingRule boundaryCrossingRule)
</span><span class="cx"> {
</span><span class="cx">     Position p = c.deepEquivalent();
</span><del>-    Node* startNode = p.deprecatedNode();
</del><ins>+    auto* startNode = p.deprecatedNode();
</ins><span class="cx">     
</span><span class="cx">     if (!startNode)
</span><span class="cx">         return VisiblePosition();
</span><span class="lines">@@ -1283,11 +1283,11 @@
</span><span class="cx">     
</span><span class="cx">     Node* startBlock = enclosingBlock(startNode);
</span><span class="cx">     
</span><del>-    Node* highestRoot = highestEditableRoot(p);
</del><ins>+    auto* highestRoot = highestEditableRoot(p);
</ins><span class="cx">     int offset = p.deprecatedEditingOffset();
</span><span class="cx">     Position::AnchorType type = p.anchorType();
</span><span class="cx">     
</span><del>-    Node* node = findStartOfParagraph(startNode, highestRoot, startBlock, offset, type, boundaryCrossingRule);
</del><ins>+    auto* node = findStartOfParagraph(startNode, highestRoot, startBlock, offset, type, boundaryCrossingRule);
</ins><span class="cx">     
</span><span class="cx">     if (is&lt;Text&gt;(node))
</span><span class="cx">         return VisiblePosition(Position(downcast&lt;Text&gt;(node), offset), DOWNSTREAM);
</span><span class="lines">@@ -1306,19 +1306,19 @@
</span><span class="cx">         return VisiblePosition();
</span><span class="cx">     
</span><span class="cx">     Position p = c.deepEquivalent();
</span><del>-    Node* startNode = p.deprecatedNode();
</del><ins>+    auto* startNode = p.deprecatedNode();
</ins><span class="cx">     
</span><span class="cx">     if (isRenderedAsNonInlineTableImageOrHR(startNode))
</span><span class="cx">         return positionAfterNode(startNode);
</span><span class="cx">     
</span><del>-    Node* startBlock = enclosingBlock(startNode);
-    Node* stayInsideBlock = startBlock;
</del><ins>+    auto* startBlock = enclosingBlock(startNode);
+    auto* stayInsideBlock = startBlock;
</ins><span class="cx">     
</span><del>-    Node* highestRoot = highestEditableRoot(p);
</del><ins>+    auto* highestRoot = highestEditableRoot(p);
</ins><span class="cx">     int offset = p.deprecatedEditingOffset();
</span><span class="cx">     Position::AnchorType type = p.anchorType();
</span><span class="cx">     
</span><del>-    Node* node = findEndOfParagraph(startNode, highestRoot, stayInsideBlock, offset, type, boundaryCrossingRule);
</del><ins>+    auto* node = findEndOfParagraph(startNode, highestRoot, stayInsideBlock, offset, type, boundaryCrossingRule);
</ins><span class="cx">     
</span><span class="cx">     if (is&lt;Text&gt;(node))
</span><span class="cx">         return VisiblePosition(Position(downcast&lt;Text&gt;(node), offset), DOWNSTREAM);
</span><span class="lines">@@ -1484,18 +1484,18 @@
</span><span class="cx"> 
</span><span class="cx"> VisiblePosition startOfEditableContent(const VisiblePosition&amp; visiblePosition)
</span><span class="cx"> {
</span><del>-    Node* highestRoot = highestEditableRoot(visiblePosition.deepEquivalent());
</del><ins>+    auto* highestRoot = highestEditableRoot(visiblePosition.deepEquivalent());
</ins><span class="cx">     if (!highestRoot)
</span><del>-        return VisiblePosition();
</del><ins>+        return { };
</ins><span class="cx"> 
</span><span class="cx">     return firstPositionInNode(highestRoot);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> VisiblePosition endOfEditableContent(const VisiblePosition&amp; visiblePosition)
</span><span class="cx"> {
</span><del>-    Node* highestRoot = highestEditableRoot(visiblePosition.deepEquivalent());
</del><ins>+    auto* highestRoot = highestEditableRoot(visiblePosition.deepEquivalent());
</ins><span class="cx">     if (!highestRoot)
</span><del>-        return VisiblePosition();
</del><ins>+        return { };
</ins><span class="cx"> 
</span><span class="cx">     return lastPositionInNode(highestRoot);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreeditinghtmleditingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/htmlediting.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/htmlediting.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/editing/htmlediting.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx"> #include &quot;HTMLOListElement.h&quot;
</span><span class="cx"> #include &quot;HTMLObjectElement.h&quot;
</span><span class="cx"> #include &quot;HTMLParagraphElement.h&quot;
</span><ins>+#include &quot;HTMLSpanElement.h&quot;
</ins><span class="cx"> #include &quot;HTMLTableElement.h&quot;
</span><span class="cx"> #include &quot;HTMLTextFormControlElement.h&quot;
</span><span class="cx"> #include &quot;HTMLUListElement.h&quot;
</span><span class="lines">@@ -60,9 +61,10 @@
</span><span class="cx"> 
</span><span class="cx"> using namespace HTMLNames;
</span><span class="cx"> 
</span><del>-// Atomic means that the node has no children, or has children which are ignored for the
-// purposes of editing.
-bool isAtomicNode(const Node *node)
</del><ins>+static bool isVisiblyAdjacent(const Position&amp;, const Position&amp;);
+
+// Atomic means that the node has no children, or has children which are ignored for the purposes of editing.
+bool isAtomicNode(const Node* node)
</ins><span class="cx"> {
</span><span class="cx">     return node &amp;&amp; (!node-&gt;hasChildNodes() || editingIgnoresContent(node));
</span><span class="cx"> }
</span><span class="lines">@@ -103,21 +105,17 @@
</span><span class="cx">     return comparePositions(a.deepEquivalent(), b.deepEquivalent());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Node* highestEditableRoot(const Position&amp; position, EditableType editableType)
</del><ins>+ContainerNode* highestEditableRoot(const Position&amp; position, EditableType editableType)
</ins><span class="cx"> {
</span><del>-    Node* node = position.deprecatedNode();
-    if (!node)
-        return 0;
-
-    Node* highestEditableRoot = editableRootForPosition(position, editableType);
</del><ins>+    ContainerNode* highestEditableRoot = editableRootForPosition(position, editableType);
</ins><span class="cx">     if (!highestEditableRoot)
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx"> 
</span><del>-    node = highestEditableRoot;
-    while (!node-&gt;hasTagName(bodyTag)) {
</del><ins>+    for (ContainerNode* node = highestEditableRoot; !is&lt;HTMLBodyElement&gt;(*node); ) {
</ins><span class="cx">         node = node-&gt;parentNode();
</span><span class="cx">         if (!node)
</span><span class="cx">             break;
</span><ins>+        // FIXME: Can this ever be a Document or DocumentFragment? If not, this should return Element* instead.
</ins><span class="cx">         if (hasEditableStyle(*node, editableType))
</span><span class="cx">             highestEditableRoot = node;
</span><span class="cx">     }
</span><span class="lines">@@ -125,20 +123,15 @@
</span><span class="cx">     return highestEditableRoot;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Node* lowestEditableAncestor(Node* node)
</del><ins>+Element* lowestEditableAncestor(Node* node)
</ins><span class="cx"> {
</span><del>-    if (!node)
-        return 0;
-    
-    while (node) {
</del><ins>+    for (; node; node = node-&gt;parentNode()) {
</ins><span class="cx">         if (node-&gt;hasEditableStyle())
</span><span class="cx">             return node-&gt;rootEditableElement();
</span><del>-        if (node-&gt;hasTagName(bodyTag))
</del><ins>+        if (is&lt;HTMLBodyElement&gt;(*node))
</ins><span class="cx">             break;
</span><del>-        node = node-&gt;parentNode();
</del><span class="cx">     }
</span><del>-    
-    return 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static bool isEditableToAccessibility(const Node&amp; node)
</span><span class="lines">@@ -146,7 +139,7 @@
</span><span class="cx">     ASSERT(AXObjectCache::accessibilityEnabled());
</span><span class="cx">     ASSERT(node.document().existingAXObjectCache());
</span><span class="cx"> 
</span><del>-    if (AXObjectCache* cache = node.document().existingAXObjectCache())
</del><ins>+    if (auto* cache = node.document().existingAXObjectCache())
</ins><span class="cx">         return cache-&gt;rootAXEditableElement(&amp;node);
</span><span class="cx"> 
</span><span class="cx">     return false;
</span><span class="lines">@@ -183,165 +176,159 @@
</span><span class="cx">     return node &amp;&amp; computeEditability(*node, editableType, Node::ShouldUpdateStyle::Update);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool isAtUnsplittableElement(const Position&amp; pos)
</del><ins>+bool isAtUnsplittableElement(const Position&amp; position)
</ins><span class="cx"> {
</span><del>-    Node* node = pos.containerNode();
-    return (node == editableRootForPosition(pos) || node == enclosingNodeOfType(pos, &amp;isTableCell));
</del><ins>+    Node* node = position.containerNode();
+    return node == editableRootForPosition(position) || node == enclosingNodeOfType(position, isTableCell);
</ins><span class="cx"> }
</span><del>-    
-    
</del><ins>+
</ins><span class="cx"> bool isRichlyEditablePosition(const Position&amp; position)
</span><span class="cx"> {
</span><del>-    Node* node = position.containerNode();
-    if (!node)
-        return false;
-    return node-&gt;hasRichlyEditableStyle();
</del><ins>+    auto* node = position.containerNode();
+    return node &amp;&amp; node-&gt;hasRichlyEditableStyle();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-Element* editableRootForPosition(const Position&amp; p, EditableType editableType)
</del><ins>+Element* editableRootForPosition(const Position&amp; position, EditableType editableType)
</ins><span class="cx"> {
</span><del>-    Node* node = p.containerNode();
</del><ins>+    Node* node = position.containerNode();
</ins><span class="cx">     if (!node)
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx"> 
</span><span class="cx">     switch (editableType) {
</span><span class="cx">     case HasEditableAXRole:
</span><del>-        if (AXObjectCache* cache = node-&gt;document().existingAXObjectCache())
</del><ins>+        if (auto* cache = node-&gt;document().existingAXObjectCache())
</ins><span class="cx">             return const_cast&lt;Element*&gt;(cache-&gt;rootAXEditableElement(node));
</span><span class="cx">         FALLTHROUGH;
</span><span class="cx">     case ContentIsEditable:
</span><span class="cx">         return node-&gt;rootEditableElement();
</span><span class="cx">     }
</span><del>-    return 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Finds the enclosing element until which the tree can be split.
</span><span class="cx"> // When a user hits ENTER, he/she won't expect this element to be split into two.
</span><span class="cx"> // You may pass it as the second argument of splitTreeToNode.
</span><del>-Element* unsplittableElementForPosition(const Position&amp; p)
</del><ins>+Element* unsplittableElementForPosition(const Position&amp; position)
</ins><span class="cx"> {
</span><span class="cx">     // Since enclosingNodeOfType won't search beyond the highest root editable node,
</span><span class="cx">     // this code works even if the closest table cell was outside of the root editable node.
</span><del>-    Element* enclosingCell = downcast&lt;Element&gt;(enclosingNodeOfType(p, &amp;isTableCell));
-    if (enclosingCell)
</del><ins>+    if (auto* enclosingCell = downcast&lt;Element&gt;(enclosingNodeOfType(position, &amp;isTableCell)))
</ins><span class="cx">         return enclosingCell;
</span><del>-
-    return editableRootForPosition(p);
</del><ins>+    return editableRootForPosition(position);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Position nextCandidate(const Position&amp; position)
</span><span class="cx"> {
</span><del>-    PositionIterator p = position;
-    while (!p.atEnd()) {
-        p.increment();
-        if (p.isCandidate())
-            return p;
</del><ins>+    for (PositionIterator nextPosition = position; !nextPosition.atEnd(); ) {
+        nextPosition.increment();
+        if (nextPosition.isCandidate())
+            return nextPosition;
</ins><span class="cx">     }
</span><del>-    return Position();
</del><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Position nextVisuallyDistinctCandidate(const Position&amp; position)
</span><span class="cx"> {
</span><span class="cx">     // FIXME: Use PositionIterator instead.
</span><del>-    Position p = position;
-    Position downstreamStart = p.downstream();
-    while (!p.atEndOfTree()) {
-        p = p.next(Character);
-        if (p.isCandidate() &amp;&amp; p.downstream() != downstreamStart)
-            return p;
-        if (auto* node = p.containerNode()) {
</del><ins>+    Position nextPosition = position;
+    Position downstreamStart = nextPosition.downstream();
+    while (!nextPosition.atEndOfTree()) {
+        nextPosition = nextPosition.next(Character);
+        if (nextPosition.isCandidate() &amp;&amp; nextPosition.downstream() != downstreamStart)
+            return nextPosition;
+        if (auto* node = nextPosition.containerNode()) {
</ins><span class="cx">             if (!node-&gt;renderer())
</span><del>-                p = lastPositionInOrAfterNode(node);
</del><ins>+                nextPosition = lastPositionInOrAfterNode(node);
</ins><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"> Position previousCandidate(const Position&amp; position)
</span><span class="cx"> {
</span><del>-    PositionIterator p = position;
-    while (!p.atStart()) {
-        p.decrement();
-        if (p.isCandidate())
-            return p;
</del><ins>+    PositionIterator previousPosition = position;
+    while (!previousPosition.atStart()) {
+        previousPosition.decrement();
+        if (previousPosition.isCandidate())
+            return previousPosition;
</ins><span class="cx">     }
</span><del>-    return Position();
</del><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Position previousVisuallyDistinctCandidate(const Position&amp; position)
</span><span class="cx"> {
</span><span class="cx">     // FIXME: Use PositionIterator instead.
</span><del>-    Position p = position;
-    Position downstreamStart = p.downstream();
-    while (!p.atStartOfTree()) {
-        p = p.previous(Character);
-        if (p.isCandidate() &amp;&amp; p.downstream() != downstreamStart)
-            return p;
-        if (auto* node = p.containerNode()) {
</del><ins>+    Position previousPosition = position;
+    Position downstreamStart = previousPosition.downstream();
+    while (!previousPosition.atStartOfTree()) {
+        previousPosition = previousPosition.previous(Character);
+        if (previousPosition.isCandidate() &amp;&amp; previousPosition.downstream() != downstreamStart)
+            return previousPosition;
+        if (auto* node = previousPosition.containerNode()) {
</ins><span class="cx">             if (!node-&gt;renderer())
</span><del>-                p = firstPositionInOrBeforeNode(node);
</del><ins>+                previousPosition = firstPositionInOrBeforeNode(node);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><del>-    return Position();
</del><ins>+    return { };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-Position firstEditablePositionAfterPositionInRoot(const Position&amp; position, Node* highestRoot)
</del><ins>+Position firstEditablePositionAfterPositionInRoot(const Position&amp; position, ContainerNode* highestRoot)
</ins><span class="cx"> {
</span><span class="cx">     if (!highestRoot)
</span><del>-        return Position();
</del><ins>+        return { };
</ins><span class="cx"> 
</span><span class="cx">     // position falls before highestRoot.
</span><span class="cx">     if (comparePositions(position, firstPositionInNode(highestRoot)) == -1 &amp;&amp; highestRoot-&gt;hasEditableStyle())
</span><span class="cx">         return firstPositionInNode(highestRoot);
</span><span class="cx"> 
</span><del>-    Position p = position;
</del><ins>+    Position candidate = position;
</ins><span class="cx"> 
</span><span class="cx">     if (&amp;position.deprecatedNode()-&gt;treeScope() != &amp;highestRoot-&gt;treeScope()) {
</span><del>-        Node* shadowAncestor = highestRoot-&gt;treeScope().ancestorInThisScope(p.deprecatedNode());
</del><ins>+        auto* shadowAncestor = highestRoot-&gt;treeScope().ancestorInThisScope(position.deprecatedNode());
</ins><span class="cx">         if (!shadowAncestor)
</span><del>-            return Position();
</del><ins>+            return { };
</ins><span class="cx"> 
</span><del>-        p = positionAfterNode(shadowAncestor);
</del><ins>+        candidate = positionAfterNode(shadowAncestor);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    while (p.deprecatedNode() &amp;&amp; !isEditablePosition(p) &amp;&amp; p.deprecatedNode()-&gt;isDescendantOf(highestRoot))
-        p = isAtomicNode(p.deprecatedNode()) ? positionInParentAfterNode(p.deprecatedNode()) : nextVisuallyDistinctCandidate(p);
-    
-    if (p.deprecatedNode() &amp;&amp; p.deprecatedNode() != highestRoot &amp;&amp; !p.deprecatedNode()-&gt;isDescendantOf(highestRoot))
-        return Position();
-    
-    return p;
</del><ins>+    while (candidate.deprecatedNode() &amp;&amp; !isEditablePosition(candidate) &amp;&amp; candidate.deprecatedNode()-&gt;isDescendantOf(highestRoot))
+        candidate = isAtomicNode(candidate.deprecatedNode()) ? positionInParentAfterNode(candidate.deprecatedNode()) : nextVisuallyDistinctCandidate(candidate);
+
+    if (candidate.deprecatedNode() &amp;&amp; candidate.deprecatedNode() != highestRoot &amp;&amp; !candidate.deprecatedNode()-&gt;isDescendantOf(highestRoot))
+        return { };
+
+    return candidate;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-Position lastEditablePositionBeforePositionInRoot(const Position&amp; position, Node* highestRoot)
</del><ins>+Position lastEditablePositionBeforePositionInRoot(const Position&amp; position, ContainerNode* highestRoot)
</ins><span class="cx"> {
</span><span class="cx">     if (!highestRoot)
</span><del>-        return Position();
</del><ins>+        return { };
</ins><span class="cx"> 
</span><span class="cx">     // When position falls after highestRoot, the result is easy to compute.
</span><span class="cx">     if (comparePositions(position, lastPositionInNode(highestRoot)) == 1)
</span><span class="cx">         return lastPositionInNode(highestRoot);
</span><span class="cx"> 
</span><del>-    Position p = position;
</del><ins>+    Position candidate = position;
</ins><span class="cx"> 
</span><span class="cx">     if (&amp;position.deprecatedNode()-&gt;treeScope() != &amp;highestRoot-&gt;treeScope()) {
</span><del>-        Node* shadowAncestor = highestRoot-&gt;treeScope().ancestorInThisScope(p.deprecatedNode());
</del><ins>+        auto* shadowAncestor = highestRoot-&gt;treeScope().ancestorInThisScope(position.deprecatedNode());
</ins><span class="cx">         if (!shadowAncestor)
</span><del>-            return Position();
</del><ins>+            return { };
</ins><span class="cx"> 
</span><del>-        p = firstPositionInOrBeforeNode(shadowAncestor);
</del><ins>+        candidate = firstPositionInOrBeforeNode(shadowAncestor);
</ins><span class="cx">     }
</span><ins>+
+    while (candidate.deprecatedNode() &amp;&amp; !isEditablePosition(candidate) &amp;&amp; candidate.deprecatedNode()-&gt;isDescendantOf(highestRoot))
+        candidate = isAtomicNode(candidate.deprecatedNode()) ? positionInParentBeforeNode(candidate.deprecatedNode()) : previousVisuallyDistinctCandidate(candidate);
</ins><span class="cx">     
</span><del>-    while (p.deprecatedNode() &amp;&amp; !isEditablePosition(p) &amp;&amp; p.deprecatedNode()-&gt;isDescendantOf(highestRoot))
-        p = isAtomicNode(p.deprecatedNode()) ? positionInParentBeforeNode(p.deprecatedNode()) : previousVisuallyDistinctCandidate(p);
</del><ins>+    if (candidate.deprecatedNode() &amp;&amp; candidate.deprecatedNode() != highestRoot &amp;&amp; !candidate.deprecatedNode()-&gt;isDescendantOf(highestRoot))
+        return { };
</ins><span class="cx">     
</span><del>-    if (p.deprecatedNode() &amp;&amp; p.deprecatedNode() != highestRoot &amp;&amp; !p.deprecatedNode()-&gt;isDescendantOf(highestRoot))
-        return Position();
-    
-    return p;
</del><ins>+    return candidate;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-// FIXME: The method name, comment, and code say three different things here!
</del><ins>+// FIXME: The function name, comment, and code say three different things here!
</ins><span class="cx"> // Whether or not content before and after this node will collapse onto the same line as it.
</span><span class="cx"> bool isBlock(const Node* node)
</span><span class="cx"> {
</span><span class="lines">@@ -378,19 +365,16 @@
</span><span class="cx"> // in a node. It returns 1 for some elements even though they do not have children, which
</span><span class="cx"> // creates technically invalid DOM Positions. Be sure to call parentAnchoredEquivalent
</span><span class="cx"> // on a Position before using it to create a DOM Range, or an exception will be thrown.
</span><del>-int lastOffsetForEditing(const Node* node)
</del><ins>+int lastOffsetForEditing(const Node&amp; node)
</ins><span class="cx"> {
</span><del>-    ASSERT(node);
-    if (!node)
-        return 0;
-    if (node-&gt;offsetInCharacters())
-        return node-&gt;maxCharacterOffset();
</del><ins>+    if (node.offsetInCharacters())
+        return node.maxCharacterOffset();
</ins><span class="cx"> 
</span><del>-    if (node-&gt;hasChildNodes())
-        return node-&gt;countChildNodes();
</del><ins>+    if (node.hasChildNodes())
+        return node.countChildNodes();
</ins><span class="cx"> 
</span><span class="cx">     // NOTE: This should preempt the countChildNodes() for, e.g., select nodes (what does this mean)?
</span><del>-    if (editingIgnoresContent(node))
</del><ins>+    if (editingIgnoresContent(&amp;node))
</ins><span class="cx">         return 1;
</span><span class="cx"> 
</span><span class="cx">     return 0;
</span><span class="lines">@@ -401,29 +385,36 @@
</span><span class="cx">     Vector&lt;UChar&gt; rebalancedString(string.length());
</span><span class="cx">     StringView(string).getCharactersWithUpconvert(rebalancedString.data());
</span><span class="cx"> 
</span><ins>+    bool changedSomething = false;
+
</ins><span class="cx">     bool previousCharacterWasSpace = false;
</span><span class="cx">     for (size_t i = 0; i &lt; rebalancedString.size(); i++) {
</span><del>-        if (!isWhitespace(rebalancedString[i])) {
</del><ins>+        if (!deprecatedIsEditingWhitespace(rebalancedString[i])) {
</ins><span class="cx">             previousCharacterWasSpace = false;
</span><span class="cx">             continue;
</span><span class="cx">         }
</span><del>-
</del><span class="cx">         if (previousCharacterWasSpace || (!i &amp;&amp; startIsStartOfParagraph) || (i + 1 == rebalancedString.size() &amp;&amp; endIsEndOfParagraph)) {
</span><del>-            rebalancedString[i] = noBreakSpace;
</del><ins>+            if (rebalancedString[i] != noBreakSpace) {
+                rebalancedString[i] = noBreakSpace;
+                changedSomething = true;
+            }
</ins><span class="cx">             previousCharacterWasSpace = false;
</span><span class="cx">         } else {
</span><del>-            rebalancedString[i] = ' ';
</del><ins>+            if (rebalancedString[i] != ' ') {
+                rebalancedString[i] = ' ';
+                changedSomething = true;
+            }
</ins><span class="cx">             previousCharacterWasSpace = true;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return String::adopt(rebalancedString);
</del><ins>+    return changedSomething ? String::adopt(rebalancedString) : string;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool isTableStructureNode(const Node *node)
</del><ins>+bool isTableStructureNode(const Node* node)
</ins><span class="cx"> {
</span><del>-    RenderObject* renderer = node-&gt;renderer();
-    return (renderer &amp;&amp; (renderer-&gt;isTableCell() || renderer-&gt;isTableRow() || renderer-&gt;isTableSection() || renderer-&gt;isRenderTableCol()));
</del><ins>+    auto* renderer = node-&gt;renderer();
+    return renderer &amp;&amp; (renderer-&gt;isTableCell() || renderer-&gt;isTableRow() || renderer-&gt;isTableSection() || renderer-&gt;isRenderTableCol());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> const String&amp; nonBreakingSpaceString()
</span><span class="lines">@@ -432,22 +423,18 @@
</span><span class="cx">     return nonBreakingSpaceString;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-// FIXME: need to dump this
-bool isSpecialElement(const Node *n)
</del><ins>+static bool isSpecialElement(const Node* node)
</ins><span class="cx"> {
</span><del>-    if (!n)
</del><ins>+    if (!is&lt;HTMLElement&gt;(node))
</ins><span class="cx">         return false;
</span><del>-        
-    if (!n-&gt;isHTMLElement())
-        return false;
</del><span class="cx"> 
</span><del>-    if (n-&gt;isLink())
</del><ins>+    if (downcast&lt;HTMLElement&gt;(*node).isLink())
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    RenderObject* renderer = n-&gt;renderer();
</del><ins>+    auto* renderer = downcast&lt;HTMLElement&gt;(*node).renderer();
</ins><span class="cx">     if (!renderer)
</span><span class="cx">         return false;
</span><del>-        
</del><ins>+
</ins><span class="cx">     if (renderer-&gt;style().display() == TABLE || renderer-&gt;style().display() == INLINE_TABLE)
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="lines">@@ -456,152 +443,150 @@
</span><span class="cx"> 
</span><span class="cx">     if (renderer-&gt;style().position() != StaticPosition)
</span><span class="cx">         return true;
</span><del>-        
</del><ins>+
</ins><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static Node* firstInSpecialElement(const Position&amp; pos)
</del><ins>+static HTMLElement* firstInSpecialElement(const Position&amp; position)
</ins><span class="cx"> {
</span><del>-    Node* rootEditableElement = pos.containerNode()-&gt;rootEditableElement();
-    for (Node* n = pos.deprecatedNode(); n &amp;&amp; n-&gt;rootEditableElement() == rootEditableElement; n = n-&gt;parentNode())
-        if (isSpecialElement(n)) {
-            VisiblePosition vPos = VisiblePosition(pos, DOWNSTREAM);
-            VisiblePosition firstInElement = VisiblePosition(firstPositionInOrBeforeNode(n), DOWNSTREAM);
-            if (isRenderedTable(n) &amp;&amp; vPos == firstInElement.next())
-                return n;
-            if (vPos == firstInElement)
-                return n;
-        }
-    return 0;
</del><ins>+    auto* rootEditableElement = position.containerNode()-&gt;rootEditableElement();
+    for (Node* node = position.deprecatedNode(); node &amp;&amp; node-&gt;rootEditableElement() == rootEditableElement; node = node-&gt;parentNode()) {
+        if (!isSpecialElement(node))
+            continue;
+        VisiblePosition vPos(position, DOWNSTREAM);
+        VisiblePosition firstInElement(firstPositionInOrBeforeNode(node), DOWNSTREAM);
+        if ((isRenderedTable(node) &amp;&amp; vPos == firstInElement.next()) || vPos == firstInElement)
+            return &amp;downcast&lt;HTMLElement&gt;(*node);
+    }
+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static Node* lastInSpecialElement(const Position&amp; pos)
</del><ins>+static HTMLElement* lastInSpecialElement(const Position&amp; position)
</ins><span class="cx"> {
</span><del>-    Node* rootEditableElement = pos.containerNode()-&gt;rootEditableElement();
-    for (Node* n = pos.deprecatedNode(); n &amp;&amp; n-&gt;rootEditableElement() == rootEditableElement; n = n-&gt;parentNode())
-        if (isSpecialElement(n)) {
-            VisiblePosition vPos = VisiblePosition(pos, DOWNSTREAM);
-            VisiblePosition lastInElement = VisiblePosition(lastPositionInOrAfterNode(n), DOWNSTREAM);
-            if (isRenderedTable(n) &amp;&amp; vPos == lastInElement.previous())
-                return n;
-            if (vPos == lastInElement)
-                return n;
-        }
-    return 0;
</del><ins>+    auto* rootEditableElement = position.containerNode()-&gt;rootEditableElement();
+    for (Node* node = position.deprecatedNode(); node &amp;&amp; node-&gt;rootEditableElement() == rootEditableElement; node = node-&gt;parentNode()) {
+        if (!isSpecialElement(node))
+            continue;
+        VisiblePosition vPos(position, DOWNSTREAM);
+        VisiblePosition lastInElement(lastPositionInOrAfterNode(node), DOWNSTREAM);
+        if ((isRenderedTable(node) &amp;&amp; vPos == lastInElement.previous()) || vPos == lastInElement)
+            return &amp;downcast&lt;HTMLElement&gt;(*node);
+    }
+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool isFirstVisiblePositionInSpecialElement(const Position&amp; pos)
</del><ins>+static bool isFirstVisiblePositionInSpecialElement(const Position&amp; position)
</ins><span class="cx"> {
</span><del>-    return firstInSpecialElement(pos);
</del><ins>+    return firstInSpecialElement(position);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-Position positionBeforeContainingSpecialElement(const Position&amp; pos, Node** containingSpecialElement)
</del><ins>+Position positionBeforeContainingSpecialElement(const Position&amp; position, HTMLElement** containingSpecialElement)
</ins><span class="cx"> {
</span><del>-    Node* n = firstInSpecialElement(pos);
-    if (!n)
-        return pos;
-    Position result = positionInParentBeforeNode(n);
-    if (result.isNull() || result.deprecatedNode()-&gt;rootEditableElement() != pos.deprecatedNode()-&gt;rootEditableElement())
-        return pos;
</del><ins>+    auto* element = firstInSpecialElement(position);
+    if (!element)
+        return position;
+    Position result = positionInParentBeforeNode(element);
+    if (result.isNull() || result.deprecatedNode()-&gt;rootEditableElement() != position.deprecatedNode()-&gt;rootEditableElement())
+        return position;
</ins><span class="cx">     if (containingSpecialElement)
</span><del>-        *containingSpecialElement = n;
</del><ins>+        *containingSpecialElement = element;
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool isLastVisiblePositionInSpecialElement(const Position&amp; pos)
</del><ins>+static bool isLastVisiblePositionInSpecialElement(const Position&amp; position)
</ins><span class="cx"> {
</span><del>-    return lastInSpecialElement(pos);
</del><ins>+    return lastInSpecialElement(position);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-Position positionAfterContainingSpecialElement(const Position&amp; pos, Node **containingSpecialElement)
</del><ins>+Position positionAfterContainingSpecialElement(const Position&amp; position, HTMLElement** containingSpecialElement)
</ins><span class="cx"> {
</span><del>-    Node* n = lastInSpecialElement(pos);
-    if (!n)
-        return pos;
-    Position result = positionInParentAfterNode(n);
-    if (result.isNull() || result.deprecatedNode()-&gt;rootEditableElement() != pos.deprecatedNode()-&gt;rootEditableElement())
-        return pos;
</del><ins>+    auto* element = lastInSpecialElement(position);
+    if (!element)
+        return position;
+    Position result = positionInParentAfterNode(element);
+    if (result.isNull() || result.deprecatedNode()-&gt;rootEditableElement() != position.deprecatedNode()-&gt;rootEditableElement())
+        return position;
</ins><span class="cx">     if (containingSpecialElement)
</span><del>-        *containingSpecialElement = n;
</del><ins>+        *containingSpecialElement = element;
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Position positionOutsideContainingSpecialElement(const Position &amp;pos, Node **containingSpecialElement)
</del><ins>+Position positionOutsideContainingSpecialElement(const Position&amp; position, HTMLElement** containingSpecialElement)
</ins><span class="cx"> {
</span><del>-    if (isFirstVisiblePositionInSpecialElement(pos))
-        return positionBeforeContainingSpecialElement(pos, containingSpecialElement);
-    if (isLastVisiblePositionInSpecialElement(pos))
-        return positionAfterContainingSpecialElement(pos, containingSpecialElement);
-    return pos;
</del><ins>+    if (isFirstVisiblePositionInSpecialElement(position))
+        return positionBeforeContainingSpecialElement(position, containingSpecialElement);
+    if (isLastVisiblePositionInSpecialElement(position))
+        return positionAfterContainingSpecialElement(position, containingSpecialElement);
+    return position;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-Node* isFirstPositionAfterTable(const VisiblePosition&amp; visiblePosition)
</del><ins>+Element* isFirstPositionAfterTable(const VisiblePosition&amp; position)
</ins><span class="cx"> {
</span><del>-    Position upstream(visiblePosition.deepEquivalent().upstream());
-    if (upstream.deprecatedNode() &amp;&amp; upstream.deprecatedNode()-&gt;renderer() &amp;&amp; upstream.deprecatedNode()-&gt;renderer()-&gt;isTable() &amp;&amp; upstream.atLastEditingPositionForNode())
-        return upstream.deprecatedNode();
-    
-    return 0;
</del><ins>+    Position upstream(position.deepEquivalent().upstream());
+    auto* node = upstream.deprecatedNode();
+    if (!node)
+        return nullptr;
+    auto* renderer = node-&gt;renderer();
+    if (!renderer || !renderer-&gt;isTable() || !upstream.atLastEditingPositionForNode())
+        return nullptr;
+    return &amp;downcast&lt;Element&gt;(*node);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-Node* isLastPositionBeforeTable(const VisiblePosition&amp; visiblePosition)
</del><ins>+Element* isLastPositionBeforeTable(const VisiblePosition&amp; position)
</ins><span class="cx"> {
</span><del>-    Position downstream(visiblePosition.deepEquivalent().downstream());
-    if (downstream.deprecatedNode() &amp;&amp; downstream.deprecatedNode()-&gt;renderer() &amp;&amp; downstream.deprecatedNode()-&gt;renderer()-&gt;isTable() &amp;&amp; downstream.atFirstEditingPositionForNode())
-        return downstream.deprecatedNode();
-    
-    return 0;
</del><ins>+    Position downstream(position.deepEquivalent().downstream());
+    auto* node = downstream.deprecatedNode();
+    if (!node)
+        return nullptr;
+    auto* renderer = node-&gt;renderer();
+    if (!renderer || !renderer-&gt;isTable() || !downstream.atFirstEditingPositionForNode())
+        return nullptr;
+    return &amp;downcast&lt;Element&gt;(*node);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Returns the visible position at the beginning of a node
</span><del>-VisiblePosition visiblePositionBeforeNode(Node* node)
</del><ins>+VisiblePosition visiblePositionBeforeNode(Node&amp; node)
</ins><span class="cx"> {
</span><del>-    ASSERT(node);
-    if (node-&gt;hasChildNodes())
-        return VisiblePosition(firstPositionInOrBeforeNode(node), DOWNSTREAM);
-    ASSERT(node-&gt;parentNode());
-    ASSERT(!node-&gt;parentNode()-&gt;isShadowRoot());
-    return positionInParentBeforeNode(node);
</del><ins>+    if (node.hasChildNodes())
+        return VisiblePosition(firstPositionInOrBeforeNode(&amp;node), DOWNSTREAM);
+    ASSERT(node.parentNode());
+    ASSERT(!node.parentNode()-&gt;isShadowRoot());
+    return positionInParentBeforeNode(&amp;node);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Returns the visible position at the ending of a node
</span><del>-VisiblePosition visiblePositionAfterNode(Node* node)
</del><ins>+VisiblePosition visiblePositionAfterNode(Node&amp; node)
</ins><span class="cx"> {
</span><del>-    ASSERT(node);
-    if (node-&gt;hasChildNodes())
-        return VisiblePosition(lastPositionInOrAfterNode(node), DOWNSTREAM);
-    ASSERT(node-&gt;parentNode());
-    ASSERT(!node-&gt;parentNode()-&gt;isShadowRoot());
-    return positionInParentAfterNode(node);
</del><ins>+    if (node.hasChildNodes())
+        return VisiblePosition(lastPositionInOrAfterNode(&amp;node), DOWNSTREAM);
+    ASSERT(node.parentNode());
+    ASSERT(!node.parentNode()-&gt;isShadowRoot());
+    return positionInParentAfterNode(&amp;node);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool isListElement(Node *n)
</del><ins>+bool isListElement(Node* node)
</ins><span class="cx"> {
</span><del>-    return (n &amp;&amp; (n-&gt;hasTagName(ulTag) || n-&gt;hasTagName(olTag) || n-&gt;hasTagName(dlTag)));
</del><ins>+    return node &amp;&amp; (node-&gt;hasTagName(ulTag) || node-&gt;hasTagName(olTag) || node-&gt;hasTagName(dlTag));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool isListItem(const Node *n)
</del><ins>+bool isListItem(const Node* node)
</ins><span class="cx"> {
</span><del>-    return n &amp;&amp; (isListElement(n-&gt;parentNode()) || (n-&gt;renderer() &amp;&amp; n-&gt;renderer()-&gt;isListItem()));
</del><ins>+    return node &amp;&amp; (isListElement(node-&gt;parentNode()) || (node-&gt;renderer() &amp;&amp; node-&gt;renderer()-&gt;isListItem()));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Element* enclosingElementWithTag(const Position&amp; position, const QualifiedName&amp; tagName)
</span><span class="cx"> {
</span><del>-    if (position.isNull())
-        return nullptr;
-
-    Node* root = highestEditableRoot(position);
</del><ins>+    auto* root = highestEditableRoot(position);
</ins><span class="cx">     for (Node* node = position.deprecatedNode(); node; node = node-&gt;parentNode()) {
</span><span class="cx">         if (root &amp;&amp; !node-&gt;hasEditableStyle())
</span><span class="cx">             continue;
</span><span class="cx">         if (!is&lt;Element&gt;(*node))
</span><span class="cx">             continue;
</span><span class="cx">         if (downcast&lt;Element&gt;(*node).hasTagName(tagName))
</span><del>-            return downcast&lt;Element&gt;(node);
</del><ins>+            return &amp;downcast&lt;Element&gt;(*node);
</ins><span class="cx">         if (node == root)
</span><span class="cx">             return nullptr;
</span><span class="cx">     }
</span><del>-
</del><span class="cx">     return nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -609,10 +594,7 @@
</span><span class="cx"> {
</span><span class="cx">     // FIXME: support CanSkipCrossEditingBoundary
</span><span class="cx">     ASSERT(rule == CanCrossEditingBoundary || rule == CannotCrossEditingBoundary);
</span><del>-    if (p.isNull())
-        return 0;
-        
-    Node* root = rule == CannotCrossEditingBoundary ? highestEditableRoot(p) : 0;
</del><ins>+    auto* root = rule == CannotCrossEditingBoundary ? highestEditableRoot(p) : 0;
</ins><span class="cx">     for (Node* n = p.deprecatedNode(); n; n = n-&gt;parentNode()) {
</span><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="lines">@@ -621,16 +603,15 @@
</span><span class="cx">         if (nodeIsOfType(n))
</span><span class="cx">             return n;
</span><span class="cx">         if (n == root)
</span><del>-            return 0;
</del><ins>+            return nullptr;
</ins><span class="cx">     }
</span><del>-    
-    return 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Node* highestEnclosingNodeOfType(const Position&amp; p, bool (*nodeIsOfType)(const Node*), EditingBoundaryCrossingRule rule, Node* stayWithin)
</span><span class="cx"> {
</span><span class="cx">     Node* highest = nullptr;
</span><del>-    Node* root = rule == CannotCrossEditingBoundary ? highestEditableRoot(p) : 0;
</del><ins>+    auto* root = rule == CannotCrossEditingBoundary ? highestEditableRoot(p) : 0;
</ins><span class="cx">     for (Node* n = p.containerNode(); n &amp;&amp; n != stayWithin; n = n-&gt;parentNode()) {
</span><span class="cx">         if (root &amp;&amp; !n-&gt;hasEditableStyle())
</span><span class="cx">             continue;
</span><span class="lines">@@ -639,7 +620,6 @@
</span><span class="cx">         if (n == root)
</span><span class="cx">             break;
</span><span class="cx">     }
</span><del>-    
</del><span class="cx">     return highest;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -660,27 +640,24 @@
</span><span class="cx"> Node* highestNodeToRemoveInPruning(Node* node)
</span><span class="cx"> {
</span><span class="cx">     Node* previousNode = nullptr;
</span><del>-    Node* rootEditableElement = node ? node-&gt;rootEditableElement() : 0;
</del><ins>+    auto* rootEditableElement = node ? node-&gt;rootEditableElement() : nullptr;
</ins><span class="cx">     for (; node; node = node-&gt;parentNode()) {
</span><del>-        if (RenderObject* renderer = node-&gt;renderer()) {
</del><ins>+        if (auto* renderer = node-&gt;renderer()) {
</ins><span class="cx">             if (!renderer-&gt;canHaveChildren() || hasARenderedDescendant(node, previousNode) || rootEditableElement == node)
</span><span class="cx">                 return previousNode;
</span><span class="cx">         }
</span><span class="cx">         previousNode = node;
</span><span class="cx">     }
</span><del>-    return 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-Node* enclosingTableCell(const Position&amp; p)
</del><ins>+Element* enclosingTableCell(const Position&amp; position)
</ins><span class="cx"> {
</span><del>-    return downcast&lt;Element&gt;(enclosingNodeOfType(p, isTableCell));
</del><ins>+    return downcast&lt;Element&gt;(enclosingNodeOfType(position, isTableCell));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Element* enclosingAnchorElement(const Position&amp; p)
</span><span class="cx"> {
</span><del>-    if (p.isNull())
-        return nullptr;
-
</del><span class="cx">     for (Node* node = p.deprecatedNode(); node; node = node-&gt;parentNode()) {
</span><span class="cx">         if (is&lt;Element&gt;(*node) &amp;&amp; node-&gt;isLink())
</span><span class="cx">             return downcast&lt;Element&gt;(node);
</span><span class="lines">@@ -693,7 +670,7 @@
</span><span class="cx">     if (!node)
</span><span class="cx">         return nullptr;
</span><span class="cx">         
</span><del>-    Node* root = highestEditableRoot(firstPositionInOrBeforeNode(node));
</del><ins>+    auto* root = highestEditableRoot(firstPositionInOrBeforeNode(node));
</ins><span class="cx">     
</span><span class="cx">     for (ContainerNode* ancestor = node-&gt;parentNode(); ancestor; ancestor = ancestor-&gt;parentNode()) {
</span><span class="cx">         if (is&lt;HTMLUListElement&gt;(*ancestor) || is&lt;HTMLOListElement&gt;(*ancestor))
</span><span class="lines">@@ -709,18 +686,19 @@
</span><span class="cx"> {
</span><span class="cx">     if (!node)
</span><span class="cx">         return nullptr;
</span><ins>+
</ins><span class="cx">     // Check for a list item element, or for a node whose parent is a list element. Such a node
</span><span class="cx">     // will appear visually as a list item (but without a list marker)
</span><del>-    Node* root = highestEditableRoot(firstPositionInOrBeforeNode(node));
</del><ins>+    auto* root = highestEditableRoot(firstPositionInOrBeforeNode(node));
</ins><span class="cx">     
</span><del>-    // FIXME: This function is inappropriately named if it starts with node instead of node-&gt;parentNode()
</del><ins>+    // FIXME: This function is inappropriately named since it starts with node instead of node-&gt;parentNode()
</ins><span class="cx">     for (Node* n = node; n &amp;&amp; n-&gt;parentNode(); n = n-&gt;parentNode()) {
</span><span class="cx">         if (n-&gt;hasTagName(liTag) || (isListElement(n-&gt;parentNode()) &amp;&amp; n != root))
</span><span class="cx">             return n;
</span><span class="cx">         if (n == root || isTableCell(n))
</span><span class="cx">             return nullptr;
</span><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     return nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -731,7 +709,6 @@
</span><span class="cx">         if (isListElement(n))
</span><span class="cx">             return downcast&lt;HTMLElement&gt;(n);
</span><span class="cx">     }
</span><del>-    
</del><span class="cx">     return nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -748,33 +725,33 @@
</span><span class="cx">     return nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-// FIXME: This method should not need to call isStartOfParagraph/isEndOfParagraph
-Node* enclosingEmptyListItem(const VisiblePosition&amp; visiblePos)
</del><ins>+// FIXME: This function should not need to call isStartOfParagraph/isEndOfParagraph.
+Node* enclosingEmptyListItem(const VisiblePosition&amp; position)
</ins><span class="cx"> {
</span><span class="cx">     // Check that position is on a line by itself inside a list item
</span><del>-    Node* listChildNode = enclosingListChild(visiblePos.deepEquivalent().deprecatedNode());
-    if (!listChildNode || !isStartOfParagraph(visiblePos) || !isEndOfParagraph(visiblePos))
-        return 0;
</del><ins>+    auto* listChildNode = enclosingListChild(position.deepEquivalent().deprecatedNode());
+    if (!listChildNode || !isStartOfParagraph(position) || !isEndOfParagraph(position))
+        return nullptr;
</ins><span class="cx"> 
</span><span class="cx">     VisiblePosition firstInListChild(firstPositionInOrBeforeNode(listChildNode));
</span><span class="cx">     VisiblePosition lastInListChild(lastPositionInOrAfterNode(listChildNode));
</span><span class="cx"> 
</span><del>-    if (firstInListChild != visiblePos || lastInListChild != visiblePos)
-        return 0;
-    
</del><ins>+    if (firstInListChild != position || lastInListChild != position)
+        return nullptr;
+
</ins><span class="cx">     if (embeddedSublist(listChildNode) || appendedSublist(listChildNode))
</span><del>-        return 0;
-        
</del><ins>+        return nullptr;
+
</ins><span class="cx">     return listChildNode;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> HTMLElement* outermostEnclosingList(Node* node, Node* rootList)
</span><span class="cx"> {
</span><del>-    HTMLElement* list = enclosingList(node);
</del><ins>+    auto* list = enclosingList(node);
</ins><span class="cx">     if (!list)
</span><del>-        return 0;
</del><ins>+        return nullptr;
</ins><span class="cx"> 
</span><del>-    while (HTMLElement* nextList = enclosingList(list)) {
</del><ins>+    while (auto* nextList = enclosingList(list)) {
</ins><span class="cx">         if (nextList == rootList)
</span><span class="cx">             break;
</span><span class="cx">         list = nextList;
</span><span class="lines">@@ -785,14 +762,17 @@
</span><span class="cx"> 
</span><span class="cx"> bool canMergeLists(Element* firstList, Element* secondList)
</span><span class="cx"> {
</span><del>-    if (!firstList || !secondList || !firstList-&gt;isHTMLElement() || !secondList-&gt;isHTMLElement())
</del><ins>+    if (!is&lt;HTMLElement&gt;(firstList) || !is&lt;HTMLElement&gt;(secondList))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    return firstList-&gt;hasTagName(secondList-&gt;tagQName()) // make sure the list types match (ol vs. ul)
-    &amp;&amp; firstList-&gt;hasEditableStyle() &amp;&amp; secondList-&gt;hasEditableStyle() // both lists are editable
-    &amp;&amp; firstList-&gt;rootEditableElement() == secondList-&gt;rootEditableElement() // don't cross editing boundaries
-    &amp;&amp; isVisiblyAdjacent(positionInParentAfterNode(firstList), positionInParentBeforeNode(secondList));
-    // Make sure there is no visible content between this li and the previous list
</del><ins>+    auto&amp; first = downcast&lt;HTMLElement&gt;(*firstList);
+    auto&amp; second = downcast&lt;HTMLElement&gt;(*secondList);
+
+    return first.localName() == second.localName() // make sure the list types match (ol vs. ul)
+        &amp;&amp; first.hasEditableStyle() &amp;&amp; second.hasEditableStyle() // both lists are editable
+        &amp;&amp; first.rootEditableElement() == second.rootEditableElement() // don't cross editing boundaries
+        // Make sure there is no visible content between this li and the previous list.
+        &amp;&amp; isVisiblyAdjacent(positionInParentAfterNode(&amp;first), positionInParentBeforeNode(&amp;second));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static Node* previousNodeConsideringAtomicNodes(const Node* node)
</span><span class="lines">@@ -805,7 +785,7 @@
</span><span class="cx">     }
</span><span class="cx">     if (node-&gt;parentNode())
</span><span class="cx">         return node-&gt;parentNode();
</span><del>-    return 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static Node* nextNodeConsideringAtomicNodes(const Node* node)
</span><span class="lines">@@ -819,48 +799,42 @@
</span><span class="cx">         n = n-&gt;parentNode();
</span><span class="cx">     if (n)
</span><span class="cx">         return n-&gt;nextSibling();
</span><del>-    return 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Node* previousLeafNode(const Node* node)
</span><span class="cx"> {
</span><del>-    Node* n = previousNodeConsideringAtomicNodes(node);
-    while (n) {
-        if (isAtomicNode(n))
-            return n;
-        n = previousNodeConsideringAtomicNodes(n);
</del><ins>+    while ((node = previousNodeConsideringAtomicNodes(node))) {
+        if (isAtomicNode(node))
+            return const_cast&lt;Node*&gt;(node);
</ins><span class="cx">     }
</span><del>-    return 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Node* nextLeafNode(const Node* node)
</span><span class="cx"> {
</span><del>-    Node* n = nextNodeConsideringAtomicNodes(node);
-    while (n) {
-        if (isAtomicNode(n))
-            return n;
-        n = nextNodeConsideringAtomicNodes(n);
</del><ins>+    while ((node = nextNodeConsideringAtomicNodes(node))) {
+        if (isAtomicNode(node))
+            return const_cast&lt;Node*&gt;(node);
</ins><span class="cx">     }
</span><del>-    return 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-// FIXME: do not require renderer, so that this can be used within fragments
-bool isRenderedTable(const Node* n)
</del><ins>+// FIXME: Do not require renderer, so that this can be used within fragments.
+bool isRenderedTable(const Node* node)
</ins><span class="cx"> {
</span><del>-    if (!n || !n-&gt;isElementNode())
</del><ins>+    if (!is&lt;Element&gt;(node))
</ins><span class="cx">         return false;
</span><del>-
-    RenderObject* renderer = n-&gt;renderer();
-    return (renderer &amp;&amp; renderer-&gt;isTable());
</del><ins>+    auto* renderer = downcast&lt;Element&gt;(*node).renderer();
+    return renderer &amp;&amp; renderer-&gt;isTable();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool isTableCell(const Node* node)
</span><span class="cx"> {
</span><del>-    RenderObject* r = node-&gt;renderer();
-    if (!r)
</del><ins>+    auto* renderer = node-&gt;renderer();
+    if (!renderer)
</ins><span class="cx">         return node-&gt;hasTagName(tdTag) || node-&gt;hasTagName(thTag);
</span><del>-    
-    return r-&gt;isTableCell();
</del><ins>+    return renderer-&gt;isTableCell();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool isEmptyTableCell(const Node* node)
</span><span class="lines">@@ -878,7 +852,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Make sure the rendered node is a table cell or &lt;br&gt;.
</span><span class="cx">     // If it's a &lt;br&gt;, then the parent node has to be a table cell.
</span><del>-    RenderObject* renderer = node-&gt;renderer();
</del><ins>+    auto* renderer = node-&gt;renderer();
</ins><span class="cx">     if (renderer-&gt;isBR()) {
</span><span class="cx">         renderer = renderer-&gt;parent();
</span><span class="cx">         if (!renderer)
</span><span class="lines">@@ -888,7 +862,7 @@
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     // Check that the table cell contains no child renderers except for perhaps a single &lt;br&gt;.
</span><del>-    RenderObject* childRenderer = downcast&lt;RenderTableCell&gt;(*renderer).firstChild();
</del><ins>+    auto* childRenderer = downcast&lt;RenderTableCell&gt;(*renderer).firstChild();
</ins><span class="cx">     if (!childRenderer)
</span><span class="cx">         return true;
</span><span class="cx">     if (!childRenderer-&gt;isBR())
</span><span class="lines">@@ -907,26 +881,6 @@
</span><span class="cx">     return HTMLParagraphElement::create(document);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Ref&lt;HTMLElement&gt; createBreakElement(Document&amp; document)
-{
-    return HTMLBRElement::create(document);
-}
-
-Ref&lt;HTMLElement&gt; createOrderedListElement(Document&amp; document)
-{
-    return HTMLOListElement::create(document);
-}
-
-Ref&lt;HTMLElement&gt; createUnorderedListElement(Document&amp; document)
-{
-    return HTMLUListElement::create(document);
-}
-
-Ref&lt;HTMLElement&gt; createListItemElement(Document&amp; document)
-{
-    return HTMLLIElement::create(document);
-}
-
</del><span class="cx"> Ref&lt;HTMLElement&gt; createHTMLElement(Document&amp; document, const QualifiedName&amp; name)
</span><span class="cx"> {
</span><span class="cx">     return HTMLElementFactory::createElement(name, document);
</span><span class="lines">@@ -937,48 +891,30 @@
</span><span class="cx">     return createHTMLElement(document, QualifiedName(nullAtom, tagName, xhtmlNamespaceURI));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool isTabSpanNode(const Node *node)
</del><ins>+bool isTabSpanNode(const Node* node)
</ins><span class="cx"> {
</span><del>-    return node &amp;&amp; node-&gt;hasTagName(spanTag) &amp;&amp; node-&gt;isElementNode() &amp;&amp; static_cast&lt;const Element *&gt;(node)-&gt;getAttribute(classAttr) == AppleTabSpanClass;
</del><ins>+    return is&lt;HTMLSpanElement&gt;(node) &amp;&amp; downcast&lt;HTMLSpanElement&gt;(*node).fastGetAttribute(classAttr) == AppleTabSpanClass;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool isTabSpanTextNode(const Node *node)
</del><ins>+bool isTabSpanTextNode(const Node* node)
</ins><span class="cx"> {
</span><del>-    return node &amp;&amp; node-&gt;isTextNode() &amp;&amp; node-&gt;parentNode() &amp;&amp; isTabSpanNode(node-&gt;parentNode());
</del><ins>+    return is&lt;Text&gt;(node) &amp;&amp; isTabSpanNode(node-&gt;parentNode());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-Node* tabSpanNode(const Node *node)
</del><ins>+HTMLSpanElement* tabSpanNode(const Node* node)
</ins><span class="cx"> {
</span><del>-    return isTabSpanTextNode(node) ? node-&gt;parentNode() : 0;
</del><ins>+    return isTabSpanTextNode(node) ? downcast&lt;HTMLSpanElement&gt;(node-&gt;parentNode()) : nullptr;
</ins><span class="cx"> }
</span><del>-    
-Position positionOutsideTabSpan(const Position&amp; pos)
-{
-    Node* node = pos.containerNode();
-    if (isTabSpanTextNode(node))
-        node = tabSpanNode(node);
-    else if (!isTabSpanNode(node))
-        return pos;
</del><span class="cx"> 
</span><del>-    if (node &amp;&amp; VisiblePosition(pos) == lastPositionInNode(node))
-        return positionInParentAfterNode(node);
-
-    return positionInParentBeforeNode(node);
-}
-
-Ref&lt;Element&gt; createTabSpanElement(Document&amp; document, RefPtr&lt;Node&gt;&amp;&amp; tabTextNode)
</del><ins>+static Ref&lt;Element&gt; createTabSpanElement(Document&amp; document, Text&amp; tabTextNode)
</ins><span class="cx"> {
</span><del>-    // Make the span to hold the tab.
-    Ref&lt;Element&gt; spanElement = document.createElement(spanTag, false);
</del><ins>+    auto spanElement = document.createElement(spanTag, false);
+
</ins><span class="cx">     spanElement-&gt;setAttribute(classAttr, AppleTabSpanClass);
</span><span class="cx">     spanElement-&gt;setAttribute(styleAttr, &quot;white-space:pre&quot;);
</span><span class="cx"> 
</span><del>-    // Add tab text to that span.
-    if (!tabTextNode)
-        tabTextNode = document.createEditingTextNode(&quot;\t&quot;);
</del><ins>+    spanElement-&gt;appendChild(tabTextNode, ASSERT_NO_EXCEPTION);
</ins><span class="cx"> 
</span><del>-    spanElement-&gt;appendChild(*tabTextNode, ASSERT_NO_EXCEPTION);
-
</del><span class="cx">     return spanElement;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -989,29 +925,23 @@
</span><span class="cx"> 
</span><span class="cx"> Ref&lt;Element&gt; createTabSpanElement(Document&amp; document)
</span><span class="cx"> {
</span><del>-    return createTabSpanElement(document, RefPtr&lt;Node&gt;());
</del><ins>+    return createTabSpanElement(document, document.createEditingTextNode(ASCIILiteral(&quot;\t&quot;)));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool isNodeRendered(const Node* node)
</del><ins>+bool isNodeRendered(const Node&amp; node)
</ins><span class="cx"> {
</span><del>-    if (!node)
-        return false;
-
-    RenderObject* renderer = node-&gt;renderer();
-    if (!renderer)
-        return false;
-
-    return renderer-&gt;style().visibility() == VISIBLE;
</del><ins>+    auto* renderer = node.renderer();
+    return renderer &amp;&amp; renderer-&gt;style().visibility() == VISIBLE;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-unsigned numEnclosingMailBlockquotes(const Position&amp; p)
</del><ins>+unsigned numEnclosingMailBlockquotes(const Position&amp; position)
</ins><span class="cx"> {
</span><del>-    unsigned num = 0;
-    for (Node* n = p.deprecatedNode(); n; n = n-&gt;parentNode())
-        if (isMailBlockquote(n))
-            num++;
-    
-    return num;
</del><ins>+    unsigned count = 0;
+    for (Node* node = position.deprecatedNode(); node; node = node-&gt;parentNode()) {
+        if (isMailBlockquote(node))
+            ++count;
+    }
+    return count;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void updatePositionForNodeRemoval(Position&amp; position, Node&amp; node)
</span><span class="lines">@@ -1044,48 +974,48 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool isMailBlockquote(const Node *node)
</del><ins>+bool isMailBlockquote(const Node* node)
</ins><span class="cx"> {
</span><del>-    if (!node || !node-&gt;hasTagName(blockquoteTag))
</del><ins>+    ASSERT(node);
+    if (!node-&gt;hasTagName(blockquoteTag))
</ins><span class="cx">         return false;
</span><del>-        
-    return static_cast&lt;const Element *&gt;(node)-&gt;getAttribute(&quot;type&quot;) == &quot;cite&quot;;
</del><ins>+    return downcast&lt;HTMLElement&gt;(*node).fastGetAttribute(typeAttr) == &quot;cite&quot;;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-int caretMinOffset(const Node* n)
</del><ins>+int caretMinOffset(const Node&amp; node)
</ins><span class="cx"> {
</span><del>-    RenderObject* r = n-&gt;renderer();
-    ASSERT(!n-&gt;isCharacterDataNode() || !r || r-&gt;isText()); // FIXME: This was a runtime check that seemingly couldn't fail; changed it to an assertion for now.
-    return r ? r-&gt;caretMinOffset() : 0;
</del><ins>+    auto* renderer = node.renderer();
+    ASSERT(!node.isCharacterDataNode() || !renderer || renderer-&gt;isText());
+    return renderer ? renderer-&gt;caretMinOffset() : 0;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // If a node can contain candidates for VisiblePositions, return the offset of the last candidate, otherwise 
</span><span class="cx"> // return the number of children for container nodes and the length for unrendered text nodes.
</span><del>-int caretMaxOffset(const Node* n)
</del><ins>+int caretMaxOffset(const Node&amp; node)
</ins><span class="cx"> {
</span><span class="cx">     // For rendered text nodes, return the last position that a caret could occupy.
</span><del>-    if (n-&gt;isTextNode() &amp;&amp; n-&gt;renderer())
-        return n-&gt;renderer()-&gt;caretMaxOffset();
</del><ins>+    if (node.isTextNode() &amp;&amp; node.renderer())
+        return node.renderer()-&gt;caretMaxOffset();
</ins><span class="cx">     // For containers return the number of children. For others do the same as above.
</span><del>-    return lastOffsetForEditing(n);
</del><ins>+    return lastOffsetForEditing(node);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool lineBreakExistsAtVisiblePosition(const VisiblePosition&amp; visiblePosition)
</del><ins>+bool lineBreakExistsAtVisiblePosition(const VisiblePosition&amp; position)
</ins><span class="cx"> {
</span><del>-    return lineBreakExistsAtPosition(visiblePosition.deepEquivalent().downstream());
</del><ins>+    return lineBreakExistsAtPosition(position.deepEquivalent().downstream());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool lineBreakExistsAtPosition(const Position&amp; position)
</span><span class="cx"> {
</span><span class="cx">     if (position.isNull())
</span><span class="cx">         return false;
</span><del>-    
</del><ins>+
</ins><span class="cx">     if (position.anchorNode()-&gt;hasTagName(brTag) &amp;&amp; position.atFirstEditingPositionForNode())
</span><span class="cx">         return true;
</span><del>-    
</del><ins>+
</ins><span class="cx">     if (!position.anchorNode()-&gt;renderer())
</span><span class="cx">         return false;
</span><del>-    
</del><ins>+
</ins><span class="cx">     if (!is&lt;Text&gt;(*position.anchorNode()) || !position.anchorNode()-&gt;renderer()-&gt;style().preserveNewline())
</span><span class="cx">         return false;
</span><span class="cx">     
</span><span class="lines">@@ -1107,17 +1037,19 @@
</span><span class="cx">     // if the start of the selection is inside that table, then the last paragraph
</span><span class="cx">     // that we'll want modify is the last one inside the table, not the table itself
</span><span class="cx">     // (a table is itself a paragraph).
</span><del>-    if (Node* table = isFirstPositionAfterTable(endOfSelection))
</del><ins>+    if (auto* table = isFirstPositionAfterTable(endOfSelection)) {
</ins><span class="cx">         if (startOfSelection.deepEquivalent().deprecatedNode()-&gt;isDescendantOf(table))
</span><span class="cx">             newSelection = VisibleSelection(startOfSelection, endOfSelection.previous(CannotCrossEditingBoundary));
</span><ins>+    }
</ins><span class="cx">     
</span><span class="cx">     // If the start of the selection to modify is just before a table,
</span><span class="cx">     // and if the end of the selection is inside that table, then the first paragraph
</span><span class="cx">     // we'll want to modify is the first one inside the table, not the paragraph
</span><span class="cx">     // containing the table itself.
</span><del>-    if (Node* table = isLastPositionBeforeTable(startOfSelection))
</del><ins>+    if (auto* table = isLastPositionBeforeTable(startOfSelection)) {
</ins><span class="cx">         if (endOfSelection.deepEquivalent().deprecatedNode()-&gt;isDescendantOf(table))
</span><span class="cx">             newSelection = VisibleSelection(startOfSelection.next(CannotCrossEditingBoundary), endOfSelection);
</span><ins>+    }
</ins><span class="cx">     
</span><span class="cx">     return newSelection;
</span><span class="cx"> }
</span><span class="lines">@@ -1133,12 +1065,12 @@
</span><span class="cx">     if (visiblePosition.isNull())
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><del>-    Position position = visiblePosition.deepEquivalent();
</del><ins>+    auto position = visiblePosition.deepEquivalent();
</ins><span class="cx">     auto&amp; document = *position.document();
</span><span class="cx"> 
</span><del>-    Node* editableRoot = highestEditableRoot(position, AXObjectCache::accessibilityEnabled() ? HasEditableAXRole : ContentIsEditable);
</del><ins>+    auto* editableRoot = highestEditableRoot(position, AXObjectCache::accessibilityEnabled() ? HasEditableAXRole : ContentIsEditable);
</ins><span class="cx">     if (editableRoot &amp;&amp; !document.inDesignMode())
</span><del>-        scope = downcast&lt;ContainerNode&gt;(editableRoot);
</del><ins>+        scope = editableRoot;
</ins><span class="cx">     else {
</span><span class="cx">         if (position.containerNode()-&gt;isInShadowTree())
</span><span class="cx">             scope = position.containerNode()-&gt;containingShadowRoot();
</span><span class="lines">@@ -1150,58 +1082,56 @@
</span><span class="cx">     return TextIterator::rangeLength(range.ptr(), true);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-// FIXME: Merge these two functions.
-int indexForVisiblePosition(Node* node, const VisiblePosition&amp; visiblePosition, bool forSelectionPreservation)
</del><ins>+// FIXME: Merge this function with the one above.
+int indexForVisiblePosition(Node&amp; node, const VisiblePosition&amp; visiblePosition, bool forSelectionPreservation)
</ins><span class="cx"> {
</span><del>-    ASSERT(node);
-    RefPtr&lt;Range&gt; range = Range::create(node-&gt;document(), firstPositionInNode(node), visiblePosition.deepEquivalent().parentAnchoredEquivalent());
-    return TextIterator::rangeLength(range.get(), forSelectionPreservation);
</del><ins>+    auto range = Range::create(node.document(), firstPositionInNode(&amp;node), visiblePosition.deepEquivalent().parentAnchoredEquivalent());
+    return TextIterator::rangeLength(range.ptr(), forSelectionPreservation);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> VisiblePosition visiblePositionForIndex(int index, ContainerNode* scope)
</span><span class="cx"> {
</span><del>-    RefPtr&lt;Range&gt; range = TextIterator::rangeFromLocationAndLength(scope, index, 0, true);
</del><ins>+    auto range = TextIterator::rangeFromLocationAndLength(scope, index, 0, true);
</ins><span class="cx">     // Check for an invalid index. Certain editing operations invalidate indices because 
</span><span class="cx">     // of problems with TextIteratorEmitsCharactersBetweenAllVisiblePositions.
</span><span class="cx">     if (!range)
</span><del>-        return VisiblePosition();
-    return VisiblePosition(range-&gt;startPosition());
</del><ins>+        return { };
+    return { range-&gt;startPosition() };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> VisiblePosition visiblePositionForIndexUsingCharacterIterator(Node&amp; node, int index)
</span><span class="cx"> {
</span><span class="cx">     if (index &lt;= 0)
</span><del>-        return VisiblePosition(firstPositionInOrBeforeNode(&amp;node), DOWNSTREAM);
</del><ins>+        return { firstPositionInOrBeforeNode(&amp;node), DOWNSTREAM };
</ins><span class="cx"> 
</span><span class="cx">     RefPtr&lt;Range&gt; range = Range::create(node.document());
</span><span class="cx">     range-&gt;selectNodeContents(node, IGNORE_EXCEPTION);
</span><span class="cx">     CharacterIterator it(*range);
</span><span class="cx">     it.advance(index - 1);
</span><del>-    return VisiblePosition(it.atEnd() ? range-&gt;endPosition() : it.range()-&gt;endPosition(), UPSTREAM);
</del><ins>+    return { it.atEnd() ? range-&gt;endPosition() : it.range()-&gt;endPosition(), UPSTREAM };
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Determines whether two positions are visibly next to each other (first then second)
</span><span class="cx"> // while ignoring whitespaces and unrendered nodes
</span><del>-bool isVisiblyAdjacent(const Position&amp; first, const Position&amp; second)
</del><ins>+static bool isVisiblyAdjacent(const Position&amp; first, const Position&amp; second)
</ins><span class="cx"> {
</span><span class="cx">     return VisiblePosition(first) == VisiblePosition(second.upstream());
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Determines whether a node is inside a range or visibly starts and ends at the boundaries of the range.
</span><span class="cx"> // Call this function to determine whether a node is visibly fit inside selectedRange
</span><del>-bool isNodeVisiblyContainedWithin(Node&amp; node, const Range* selectedRange)
</del><ins>+bool isNodeVisiblyContainedWithin(Node&amp; node, const Range&amp; range)
</ins><span class="cx"> {
</span><del>-    ASSERT(selectedRange);
</del><span class="cx">     // If the node is inside the range, then it surely is contained within
</span><del>-    if (selectedRange-&gt;compareNode(node, IGNORE_EXCEPTION) == Range::NODE_INSIDE)
</del><ins>+    if (range.compareNode(node, IGNORE_EXCEPTION) == Range::NODE_INSIDE)
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    bool startIsVisuallySame = visiblePositionBeforeNode(&amp;node) == selectedRange-&gt;startPosition();
-    if (startIsVisuallySame &amp;&amp; comparePositions(positionInParentAfterNode(&amp;node), selectedRange-&gt;endPosition()) &lt; 0)
</del><ins>+    bool startIsVisuallySame = visiblePositionBeforeNode(node) == range.startPosition();
+    if (startIsVisuallySame &amp;&amp; comparePositions(positionInParentAfterNode(&amp;node), range.endPosition()) &lt; 0)
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    bool endIsVisuallySame = visiblePositionAfterNode(&amp;node) == selectedRange-&gt;endPosition();
-    if (endIsVisuallySame &amp;&amp; comparePositions(selectedRange-&gt;startPosition(), positionInParentBeforeNode(&amp;node)) &lt; 0)
</del><ins>+    bool endIsVisuallySame = visiblePositionAfterNode(node) == range.endPosition();
+    if (endIsVisuallySame &amp;&amp; comparePositions(range.startPosition(), positionInParentBeforeNode(&amp;node)) &lt; 0)
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="cx">     return startIsVisuallySame &amp;&amp; endIsVisuallySame;
</span><span class="lines">@@ -1215,17 +1145,13 @@
</span><span class="cx">     return renderer &amp;&amp; ((renderer-&gt;isTable() &amp;&amp; !renderer-&gt;isInline()) || (renderer-&gt;isImage() &amp;&amp; !renderer-&gt;isInline()) || renderer-&gt;isHR());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool areIdenticalElements(const Node* first, const Node* second)
</del><ins>+bool areIdenticalElements(const Node&amp; first, const Node&amp; second)
</ins><span class="cx"> {
</span><del>-    if (!is&lt;Element&gt;(*first) || !is&lt;Element&gt;(*second))
</del><ins>+    if (!is&lt;Element&gt;(first) || !is&lt;Element&gt;(second))
</ins><span class="cx">         return false;
</span><del>-
-    const Element&amp; firstElement = downcast&lt;Element&gt;(*first);
-    const Element&amp; secondElement = downcast&lt;Element&gt;(*second);
-    if (!firstElement.hasTagName(secondElement.tagQName()))
-        return false;
-
-    return firstElement.hasEquivalentAttributes(&amp;secondElement);
</del><ins>+    auto&amp; firstElement = downcast&lt;Element&gt;(first);
+    auto&amp; secondElement = downcast&lt;Element&gt;(second);
+    return firstElement.hasTagName(secondElement.tagQName()) &amp;&amp; firstElement.hasEquivalentAttributes(&amp;secondElement);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool isNonTableCellHTMLBlockElement(const Node* node)
</span><span class="lines">@@ -1250,9 +1176,9 @@
</span><span class="cx">     // It is important to skip certain irrelevant content at the start of the selection, so we do not wind up 
</span><span class="cx">     // with a spurious &quot;mixed&quot; style.
</span><span class="cx"> 
</span><del>-    VisiblePosition visiblePosition = selection.start();
</del><ins>+    auto visiblePosition = selection.visibleStart();
</ins><span class="cx">     if (visiblePosition.isNull())
</span><del>-        return Position();
</del><ins>+        return { };
</ins><span class="cx"> 
</span><span class="cx">     // if the selection is a caret, just return the position, since the style
</span><span class="cx">     // behind us is relevant
</span><span class="lines">@@ -1269,11 +1195,11 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // FIXME: Should this be deprecated like deprecatedEnclosingBlockFlowElement is?
</span><del>-bool isBlockFlowElement(const Node* node)
</del><ins>+bool isBlockFlowElement(const Node&amp; node)
</ins><span class="cx"> {
</span><del>-    if (!node-&gt;isElementNode())
</del><ins>+    if (!node.isElementNode())
</ins><span class="cx">         return false;
</span><del>-    RenderObject* renderer = node-&gt;renderer();
</del><ins>+    auto* renderer = downcast&lt;Element&gt;(node).renderer();
</ins><span class="cx">     return renderer &amp;&amp; renderer-&gt;isRenderBlockFlow();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1281,10 +1207,10 @@
</span><span class="cx"> {
</span><span class="cx">     if (!node)
</span><span class="cx">         return nullptr;
</span><del>-    if (isBlockFlowElement(node))
</del><ins>+    if (isBlockFlowElement(*node))
</ins><span class="cx">         return downcast&lt;Element&gt;(node);
</span><span class="cx">     while ((node = node-&gt;parentNode())) {
</span><del>-        if (isBlockFlowElement(node) || is&lt;HTMLBodyElement&gt;(*node))
</del><ins>+        if (isBlockFlowElement(*node) || is&lt;HTMLBodyElement&gt;(*node))
</ins><span class="cx">             return downcast&lt;Element&gt;(node);
</span><span class="cx">     }
</span><span class="cx">     return nullptr;
</span><span class="lines">@@ -1300,7 +1226,7 @@
</span><span class="cx">     if (!node)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    RenderObject* renderer = node-&gt;renderer();
</del><ins>+    auto* renderer = node-&gt;renderer();
</ins><span class="cx">     if (!renderer)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreeditinghtmleditingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/htmlediting.h (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/htmlediting.h        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/editing/htmlediting.h        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2004, 2006, 2008, 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">@@ -23,90 +23,67 @@
</span><span class="cx">  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef htmlediting_h
-#define htmlediting_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><del>-#include &quot;EditingBoundary.h&quot;
</del><span class="cx"> #include &quot;Position.h&quot;
</span><del>-#include &quot;TextFlags.h&quot;
</del><span class="cx"> #include &lt;wtf/Forward.h&gt;
</span><span class="cx"> #include &lt;wtf/unicode/CharacterNames.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class Document;
</span><del>-class Element;
</del><span class="cx"> class HTMLElement;
</span><ins>+class HTMLSpanElement;
</ins><span class="cx"> class HTMLTextFormControlElement;
</span><del>-class Node;
-class Position;
-class Range;
</del><span class="cx"> class RenderBlock;
</span><span class="cx"> class VisiblePosition;
</span><span class="cx"> class VisibleSelection;
</span><span class="cx"> 
</span><del>-// This file contains a set of helper functions used by the editing commands
-
</del><span class="cx"> // -------------------------------------------------------------------------
</span><span class="cx"> // Node
</span><span class="cx"> // -------------------------------------------------------------------------
</span><span class="cx"> 
</span><del>-// Functions returning Node
</del><ins>+ContainerNode* highestEditableRoot(const Position&amp;, EditableType = ContentIsEditable);
</ins><span class="cx"> 
</span><del>-Node* highestEditableRoot(const Position&amp;, EditableType = ContentIsEditable);
-
-Node* highestEnclosingNodeOfType(const Position&amp;, bool (*nodeIsOfType)(const Node*),
-    EditingBoundaryCrossingRule = CannotCrossEditingBoundary, Node* stayWithin = nullptr);
</del><ins>+Node* highestEnclosingNodeOfType(const Position&amp;, bool (*nodeIsOfType)(const Node*), EditingBoundaryCrossingRule = CannotCrossEditingBoundary, Node* stayWithin = nullptr);
</ins><span class="cx"> Node* highestNodeToRemoveInPruning(Node*);
</span><del>-Node* lowestEditableAncestor(Node*);
</del><ins>+Element* lowestEditableAncestor(Node*);
</ins><span class="cx"> 
</span><span class="cx"> Element* deprecatedEnclosingBlockFlowElement(Node*); // Use enclosingBlock instead.
</span><span class="cx"> Element* enclosingBlock(Node*, EditingBoundaryCrossingRule = CannotCrossEditingBoundary);
</span><del>-Node* enclosingTableCell(const Position&amp;);
</del><ins>+Element* enclosingTableCell(const Position&amp;);
</ins><span class="cx"> Node* enclosingEmptyListItem(const VisiblePosition&amp;);
</span><span class="cx"> Element* enclosingAnchorElement(const Position&amp;);
</span><span class="cx"> Element* enclosingElementWithTag(const Position&amp;, const QualifiedName&amp;);
</span><span class="cx"> Node* enclosingNodeOfType(const Position&amp;, bool (*nodeIsOfType)(const Node*), EditingBoundaryCrossingRule = CannotCrossEditingBoundary);
</span><ins>+HTMLSpanElement* tabSpanNode(const Node*);
+Element* isLastPositionBeforeTable(const VisiblePosition&amp;); // FIXME: Strange to name this isXXX, but return an element.
+Element* isFirstPositionAfterTable(const VisiblePosition&amp;); // FIXME: Strange to name this isXXX, but return an element.
</ins><span class="cx"> 
</span><del>-Node* tabSpanNode(const Node*);
-Node* isLastPositionBeforeTable(const VisiblePosition&amp;);
-Node* isFirstPositionAfterTable(const VisiblePosition&amp;);
-
</del><span class="cx"> // These two deliver leaf nodes as if the whole DOM tree were a linear chain of its leaf nodes.
</span><span class="cx"> Node* nextLeafNode(const Node*);
</span><span class="cx"> Node* previousLeafNode(const Node*);
</span><span class="cx"> 
</span><del>-// offset functions on Node
</del><ins>+WEBCORE_EXPORT int lastOffsetForEditing(const Node&amp;);
+int caretMinOffset(const Node&amp;);
+int caretMaxOffset(const Node&amp;);
</ins><span class="cx"> 
</span><del>-WEBCORE_EXPORT int lastOffsetForEditing(const Node*);
-int caretMinOffset(const Node*);
-int caretMaxOffset(const Node*);
-
-// boolean functions on Node
-
</del><span class="cx"> bool hasEditableStyle(const Node&amp;, EditableType);
</span><span class="cx"> bool isEditableNode(const Node&amp;);
</span><span class="cx"> 
</span><del>-// FIXME: editingIgnoresContent, canHaveChildrenForEditing, and isAtomicNode
-// should be renamed to reflect its usage.
</del><ins>+// FIXME: editingIgnoresContent, canHaveChildrenForEditing, and isAtomicNode should be renamed to better reflect their usage.
</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>-inline bool editingIgnoresContent(const Node* node)
-{
-    return !node-&gt;canContainRangeEndPoint();
-}
</del><ins>+bool editingIgnoresContent(const Node*);
</ins><span class="cx"> 
</span><del>-inline bool canHaveChildrenForEditing(const Node* node)
-{
-    return !node-&gt;isTextNode() &amp;&amp; node-&gt;canContainRangeEndPoint();
-}
</del><ins>+bool canHaveChildrenForEditing(const Node*);
</ins><span class="cx"> 
</span><span class="cx"> bool isAtomicNode(const Node*);
</span><ins>+
</ins><span class="cx"> bool isBlock(const Node*);
</span><del>-bool isBlockFlowElement(const Node*);
</del><ins>+bool isBlockFlowElement(const Node&amp;);
</ins><span class="cx"> bool isInline(const Node*);
</span><del>-bool isSpecialElement(const Node*);
</del><span class="cx"> bool isTabSpanNode(const Node*);
</span><span class="cx"> bool isTabSpanTextNode(const Node*);
</span><span class="cx"> bool isMailBlockquote(const Node*);
</span><span class="lines">@@ -116,101 +93,69 @@
</span><span class="cx"> bool isTableStructureNode(const Node*);
</span><span class="cx"> bool isListElement(Node*);
</span><span class="cx"> bool isListItem(const Node*);
</span><del>-bool isNodeRendered(const Node*);
-bool isNodeVisiblyContainedWithin(Node&amp;, const Range*);
</del><ins>+bool isNodeRendered(const Node&amp;);
</ins><span class="cx"> bool isRenderedAsNonInlineTableImageOrHR(const Node*);
</span><del>-bool areIdenticalElements(const Node*, const Node*);
</del><span class="cx"> bool isNonTableCellHTMLBlockElement(const Node*);
</span><span class="cx"> 
</span><del>-inline bool positionBeforeOrAfterNodeIsCandidate(Node* node)
-{
-    return isRenderedTable(node) || editingIgnoresContent(node);
-}
</del><ins>+bool isNodeVisiblyContainedWithin(Node&amp;, const Range&amp;);
</ins><span class="cx"> 
</span><del>-WEBCORE_EXPORT TextDirection directionOfEnclosingBlock(const Position&amp;);
</del><ins>+bool areIdenticalElements(const Node&amp;, const Node&amp;);
</ins><span class="cx"> 
</span><ins>+bool positionBeforeOrAfterNodeIsCandidate(Node*);
+
</ins><span class="cx"> // -------------------------------------------------------------------------
</span><span class="cx"> // Position
</span><span class="cx"> // -------------------------------------------------------------------------
</span><del>-    
-// Functions returning Position
-    
</del><ins>+
</ins><span class="cx"> Position nextCandidate(const Position&amp;);
</span><span class="cx"> Position previousCandidate(const Position&amp;);
</span><del>-    
</del><ins>+
</ins><span class="cx"> Position nextVisuallyDistinctCandidate(const Position&amp;);
</span><span class="cx"> Position previousVisuallyDistinctCandidate(const Position&amp;);
</span><span class="cx"> 
</span><del>-Position positionOutsideTabSpan(const Position&amp;);
-Position positionBeforeContainingSpecialElement(const Position&amp;, Node** containingSpecialElement = nullptr);
-Position positionAfterContainingSpecialElement(const Position&amp;, Node** containingSpecialElement = nullptr);
-Position positionOutsideContainingSpecialElement(const Position&amp;, Node** containingSpecialElement = nullptr);
</del><ins>+Position positionBeforeContainingSpecialElement(const Position&amp;, HTMLElement** containingSpecialElement = nullptr);
+Position positionAfterContainingSpecialElement(const Position&amp;, HTMLElement** containingSpecialElement = nullptr);
+Position positionOutsideContainingSpecialElement(const Position&amp;, HTMLElement** containingSpecialElement = nullptr);
</ins><span class="cx"> 
</span><del>-inline Position firstPositionInOrBeforeNode(Node* node)
-{
-    if (!node)
-        return Position();
-    return editingIgnoresContent(node) ? positionBeforeNode(node) : firstPositionInNode(node);
-}
</del><ins>+Position firstPositionInOrBeforeNode(Node*);
+Position lastPositionInOrAfterNode(Node*);
</ins><span class="cx"> 
</span><del>-inline Position lastPositionInOrAfterNode(Node* node)
-{
-    if (!node)
-        return Position();
-    return editingIgnoresContent(node) ? positionAfterNode(node) : lastPositionInNode(node);
-}
</del><ins>+Position firstEditablePositionAfterPositionInRoot(const Position&amp;, ContainerNode* root);
+Position lastEditablePositionBeforePositionInRoot(const Position&amp;, ContainerNode* root);
</ins><span class="cx"> 
</span><del>-Position firstEditablePositionAfterPositionInRoot(const Position&amp;, Node*);
-Position lastEditablePositionBeforePositionInRoot(const Position&amp;, Node*);
-
-// comparision functions on Position
-    
</del><span class="cx"> int comparePositions(const Position&amp;, const Position&amp;);
</span><span class="cx"> 
</span><del>-// boolean functions on Position
-
</del><span class="cx"> WEBCORE_EXPORT bool isEditablePosition(const Position&amp;, EditableType = ContentIsEditable);
</span><span class="cx"> bool isRichlyEditablePosition(const Position&amp;);
</span><del>-bool isFirstVisiblePositionInSpecialElement(const Position&amp;);
-bool isLastVisiblePositionInSpecialElement(const Position&amp;);
</del><span class="cx"> bool lineBreakExistsAtPosition(const Position&amp;);
</span><del>-bool isVisiblyAdjacent(const Position&amp; first, const Position&amp; second);
</del><span class="cx"> bool isAtUnsplittableElement(const Position&amp;);
</span><span class="cx"> 
</span><del>-// miscellaneous functions on Position
-
</del><span class="cx"> unsigned numEnclosingMailBlockquotes(const Position&amp;);
</span><span class="cx"> void updatePositionForNodeRemoval(Position&amp;, Node&amp;);
</span><span class="cx"> 
</span><ins>+WEBCORE_EXPORT TextDirection directionOfEnclosingBlock(const Position&amp;);
+
</ins><span class="cx"> // -------------------------------------------------------------------------
</span><span class="cx"> // VisiblePosition
</span><span class="cx"> // -------------------------------------------------------------------------
</span><del>-    
-// Functions returning VisiblePosition
</del><span class="cx"> 
</span><del>-VisiblePosition visiblePositionBeforeNode(Node*);
-VisiblePosition visiblePositionAfterNode(Node*);
</del><ins>+VisiblePosition visiblePositionBeforeNode(Node&amp;);
+VisiblePosition visiblePositionAfterNode(Node&amp;);
</ins><span class="cx"> 
</span><span class="cx"> bool lineBreakExistsAtVisiblePosition(const VisiblePosition&amp;);
</span><del>-    
</del><ins>+
</ins><span class="cx"> int comparePositions(const VisiblePosition&amp;, const VisiblePosition&amp;);
</span><span class="cx"> 
</span><span class="cx"> int indexForVisiblePosition(const VisiblePosition&amp;, RefPtr&lt;ContainerNode&gt;&amp; scope);
</span><del>-int indexForVisiblePosition(Node*, const VisiblePosition&amp;, bool forSelectionPreservation);
</del><ins>+int indexForVisiblePosition(Node&amp;, const VisiblePosition&amp;, bool forSelectionPreservation);
</ins><span class="cx"> VisiblePosition visiblePositionForIndex(int index, ContainerNode* scope);
</span><span class="cx"> VisiblePosition visiblePositionForIndexUsingCharacterIterator(Node&amp;, int index); // FIXME: Why do we need this version?
</span><span class="cx"> 
</span><span class="cx"> // -------------------------------------------------------------------------
</span><span class="cx"> // HTMLElement
</span><span class="cx"> // -------------------------------------------------------------------------
</span><del>-    
-// Functions returning HTMLElement
-    
</del><ins>+
</ins><span class="cx"> WEBCORE_EXPORT Ref&lt;HTMLElement&gt; createDefaultParagraphElement(Document&amp;);
</span><del>-Ref&lt;HTMLElement&gt; createBreakElement(Document&amp;);
-Ref&lt;HTMLElement&gt; createOrderedListElement(Document&amp;);
-Ref&lt;HTMLElement&gt; createUnorderedListElement(Document&amp;);
-Ref&lt;HTMLElement&gt; createListItemElement(Document&amp;);
</del><span class="cx"> Ref&lt;HTMLElement&gt; createHTMLElement(Document&amp;, const QualifiedName&amp;);
</span><span class="cx"> Ref&lt;HTMLElement&gt; createHTMLElement(Document&amp;, const AtomicString&amp;);
</span><span class="cx"> 
</span><span class="lines">@@ -223,7 +168,6 @@
</span><span class="cx"> // -------------------------------------------------------------------------
</span><span class="cx"> 
</span><span class="cx"> Ref&lt;Element&gt; createTabSpanElement(Document&amp;);
</span><del>-Ref&lt;Element&gt; createTabSpanElement(Document&amp;, RefPtr&lt;Node&gt;&amp;&amp; tabTextNode);
</del><span class="cx"> Ref&lt;Element&gt; createTabSpanElement(Document&amp;, const String&amp; tabText);
</span><span class="cx"> Ref&lt;Element&gt; createBlockPlaceholderElement(Document&amp;);
</span><span class="cx"> 
</span><span class="lines">@@ -231,19 +175,37 @@
</span><span class="cx"> Element* unsplittableElementForPosition(const Position&amp;);
</span><span class="cx"> 
</span><span class="cx"> bool canMergeLists(Element* firstList, Element* secondList);
</span><del>-    
</del><ins>+
</ins><span class="cx"> // -------------------------------------------------------------------------
</span><span class="cx"> // VisibleSelection
</span><span class="cx"> // -------------------------------------------------------------------------
</span><span class="cx"> 
</span><span class="cx"> VisibleSelection selectionForParagraphIteration(const VisibleSelection&amp;);
</span><del>-
</del><span class="cx"> Position adjustedSelectionStartForStyleComputation(const VisibleSelection&amp;);
</span><del>-    
</del><ins>+
</ins><span class="cx"> // -------------------------------------------------------------------------
</span><span class="cx"> 
</span><del>-// FIXME: This is only one of many definitions of whitespace, so the name is not specific enough.
-inline bool isWhitespace(UChar c)
</del><ins>+// FIXME: This is only one of many definitions of whitespace. Possibly never the right one to use.
+bool deprecatedIsEditingWhitespace(UChar);
+
+// FIXME: Can't answer this question correctly without being passed the white-space mode.
+bool deprecatedIsCollapsibleWhitespace(UChar);
+
+bool isAmbiguousBoundaryCharacter(UChar);
+
+String stringWithRebalancedWhitespace(const String&amp;, bool startIsStartOfParagraph, bool endIsEndOfParagraph);
+const String&amp; nonBreakingSpaceString();
+
+// Miscellaneous functions for caret rendering.
+
+RenderBlock* rendererForCaretPainting(Node*);
+LayoutRect localCaretRectInRendererForCaretPainting(const VisiblePosition&amp;, RenderBlock*&amp;);
+LayoutRect localCaretRectInRendererForRect(LayoutRect&amp;, Node*, RenderObject*, RenderBlock*&amp;);
+IntRect absoluteBoundsForLocalCaretRect(RenderBlock* rendererForCaretPainting, const LayoutRect&amp;);
+
+// -------------------------------------------------------------------------
+
+inline bool deprecatedIsEditingWhitespace(UChar c)
</ins><span class="cx"> {
</span><span class="cx">     return c == noBreakSpace || c == ' ' || c == '\n' || c == '\t';
</span><span class="cx"> }
</span><span class="lines">@@ -262,16 +224,33 @@
</span><span class="cx">     return character == '\'' || character == rightSingleQuotationMark || character == hebrewPunctuationGershayim;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-String stringWithRebalancedWhitespace(const String&amp;, bool startIsStartOfParagraph, bool endIsEndOfParagraph);
-const String&amp; nonBreakingSpaceString();
</del><ins>+inline bool editingIgnoresContent(const Node* node)
+{
+    return !node-&gt;canContainRangeEndPoint();
+}
</ins><span class="cx"> 
</span><del>-// Miscellaaneous functions that for caret rendering
</del><ins>+inline bool canHaveChildrenForEditing(const Node* node)
+{
+    return !node-&gt;isTextNode() &amp;&amp; node-&gt;canContainRangeEndPoint();
+}
</ins><span class="cx"> 
</span><del>-RenderBlock* rendererForCaretPainting(Node*);
-LayoutRect localCaretRectInRendererForCaretPainting(const VisiblePosition&amp;, RenderBlock*&amp;);
-LayoutRect localCaretRectInRendererForRect(LayoutRect&amp;, Node*, RenderObject*, RenderBlock*&amp;);
-IntRect absoluteBoundsForLocalCaretRect(RenderBlock* rendererForCaretPainting, const LayoutRect&amp;);
</del><ins>+inline bool positionBeforeOrAfterNodeIsCandidate(Node* node)
+{
+    return isRenderedTable(node) || editingIgnoresContent(node);
+}
</ins><span class="cx"> 
</span><ins>+inline Position firstPositionInOrBeforeNode(Node* node)
+{
+    if (!node)
+        return { };
+    return editingIgnoresContent(node) ? positionBeforeNode(node) : firstPositionInNode(node);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-#endif
</del><ins>+inline Position lastPositionInOrAfterNode(Node* node)
+{
+    if (!node)
+        return { };
+    return editingIgnoresContent(node) ? positionAfterNode(node) : lastPositionInNode(node);
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreeditingmarkupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/markup.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/markup.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/editing/markup.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -44,9 +44,9 @@
</span><span class="cx"> #include &quot;File.h&quot;
</span><span class="cx"> #include &quot;Frame.h&quot;
</span><span class="cx"> #include &quot;HTMLAttachmentElement.h&quot;
</span><ins>+#include &quot;HTMLBRElement.h&quot;
</ins><span class="cx"> #include &quot;HTMLBodyElement.h&quot;
</span><span class="cx"> #include &quot;HTMLDivElement.h&quot;
</span><del>-#include &quot;HTMLElement.h&quot;
</del><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="cx"> #include &quot;HTMLTableElement.h&quot;
</span><span class="cx"> #include &quot;HTMLTextAreaElement.h&quot;
</span><span class="lines">@@ -792,7 +792,7 @@
</span><span class="cx">     if (contextPreservesNewline(context)) {
</span><span class="cx">         fragment-&gt;appendChild(document.createTextNode(string), ASSERT_NO_EXCEPTION);
</span><span class="cx">         if (string.endsWith('\n')) {
</span><del>-            auto element = createBreakElement(document);
</del><ins>+            auto element = HTMLBRElement::create(document);
</ins><span class="cx">             element-&gt;setAttribute(classAttr, AppleInterchangeNewline);            
</span><span class="cx">             fragment-&gt;appendChild(element, ASSERT_NO_EXCEPTION);
</span><span class="cx">         }
</span><span class="lines">@@ -824,10 +824,10 @@
</span><span class="cx">         RefPtr&lt;Element&gt; element;
</span><span class="cx">         if (s.isEmpty() &amp;&amp; i + 1 == numLines) {
</span><span class="cx">             // For last line, use the &quot;magic BR&quot; rather than a P.
</span><del>-            element = createBreakElement(document);
</del><ins>+            element = HTMLBRElement::create(document);
</ins><span class="cx">             element-&gt;setAttribute(classAttr, AppleInterchangeNewline);
</span><span class="cx">         } else if (useLineBreak) {
</span><del>-            element = createBreakElement(document);
</del><ins>+            element = HTMLBRElement::create(document);
</ins><span class="cx">             fillContainerFromString(fragment, s);
</span><span class="cx">         } else {
</span><span class="cx">             if (useClonesOfEnclosingBlock)
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMSelectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMSelection.cpp (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMSelection.cpp        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebCore/page/DOMSelection.cpp        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -332,7 +332,7 @@
</span><span class="cx">     if (!m_frame)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    if (offset &lt; 0 || offset &gt; (node.offsetInCharacters() ? caretMaxOffset(&amp;node) : static_cast&lt;int&gt;(node.countChildNodes()))) {
</del><ins>+    if (offset &lt; 0 || offset &gt; (node.offsetInCharacters() ? caretMaxOffset(node) : static_cast&lt;int&gt;(node.countChildNodes()))) {
</ins><span class="cx">         ec = INDEX_SIZE_ERR;
</span><span class="cx">         return;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebKitiosChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ios/ChangeLog (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ios/ChangeLog        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebKit/ios/ChangeLog        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2016-05-14  Darin Adler  &lt;darin@apple.com&gt;
+
+        CTTE for the HTML editing header
+        https://bugs.webkit.org/show_bug.cgi?id=157676
+
+        Reviewed by Chris Dumez.
+
+        * WebCoreSupport/WebFrameIOS.mm:
+        (-[WebFrame previousUnperturbedDictationResultBoundaryFromPosition:]): Update since
+        lastOffsetForEditing takes a reference now. Seems like this code should be in WebCore.
+        (-[WebFrame nextUnperturbedDictationResultBoundaryFromPosition:]): Ditto.
+
</ins><span class="cx"> 2016-05-13  Beth Dakin  &lt;bdakin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add dyldSPI.h for linked on or after checks, and add one for link preview
</span></span></pre></div>
<a id="trunkSourceWebKitiosWebCoreSupportWebFrameIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ios/WebCoreSupport/WebFrameIOS.mm (200921 => 200922)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ios/WebCoreSupport/WebFrameIOS.mm        2016-05-14 19:18:34 UTC (rev 200921)
+++ trunk/Source/WebKit/ios/WebCoreSupport/WebFrameIOS.mm        2016-05-14 20:09:50 UTC (rev 200922)
</span><span class="lines">@@ -849,7 +849,7 @@
</span><span class="cx">         WebVisiblePosition *currentWebVisiblePosition = [WebVisiblePosition _wrapVisiblePosition:currentVisiblePosition];
</span><span class="cx">         
</span><span class="cx">         Node *currentNode = currentVisiblePosition.deepEquivalent().anchorNode();
</span><del>-        int lastOffset = lastOffsetForEditing(currentNode);
</del><ins>+        int lastOffset = lastOffsetForEditing(*currentNode);
</ins><span class="cx">         ASSERT(lastOffset &gt;= 0);
</span><span class="cx">         if (lastOffset &lt; 0)
</span><span class="cx">             return currentWebVisiblePosition;
</span><span class="lines">@@ -905,7 +905,7 @@
</span><span class="cx">         WebVisiblePosition *currentWebVisiblePosition = [WebVisiblePosition _wrapVisiblePosition:currentVisiblePosition];
</span><span class="cx">         
</span><span class="cx">         Node *currentNode = currentVisiblePosition.deepEquivalent().anchorNode();
</span><del>-        int lastOffset = lastOffsetForEditing(currentNode);
</del><ins>+        int lastOffset = lastOffsetForEditing(*currentNode);
</ins><span class="cx">         ASSERT(lastOffset &gt;= 0);
</span><span class="cx">         if (lastOffset &lt; 0)
</span><span class="cx">             return currentWebVisiblePosition;
</span></span></pre>
</div>
</div>

</body>
</html>