<!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 <darin@apple.com>
+
+ 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 <mmaxfield@apple.com>
</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->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& pos) const
</del><ins>+int AccessibilityRenderObject::indexForVisiblePosition(const VisiblePosition& position) const
</ins><span class="cx"> {
</span><span class="cx"> if (isNativeTextControl())
</span><del>- return downcast<RenderTextControl>(*m_renderer).textFormControlElement().indexForVisiblePosition(pos);
</del><ins>+ return downcast<RenderTextControl>(*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& 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 "real" words,
</span><span class="cx"> // since that whitespace is considered a "word" as well. And in case we are
</span><span class="cx"> // already at the beginning of a "real" word we do not need to look backwards.
</span><del>- if (isStartOfWord(position) && isWhitespace(position.characterBefore()))
</del><ins>+ if (isStartOfWord(position) && 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->traverseToChildAt(offset);
</span><del>- if (child || (!node->hasChildNodes() && offset < lastOffsetForEditing(node))) {
</del><ins>+ if (child || (!node->hasChildNodes() && offset < 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 >= lastOffsetForEditing(deprecatedNode());
</del><ins>+ return m_anchorType == PositionIsAfterAnchor || m_anchorType == PositionIsAfterChildren || m_offset >= 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 >= lastOffsetForEditing(m_anchorNode.get());
</del><ins>+ return m_offset >= 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->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->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->hasEditableStyle();
</span><span class="cx"> Node* lastNode = startNode;
</span><span class="lines">@@ -1105,8 +1105,8 @@
</span><span class="cx"> LOG(Editing, "thisRenderedOffset: %d\n", thisRenderedOffset);
</span><span class="cx"> LOG(Editing, "posRenderer: %p [%p]\n", posRenderer, b2);
</span><span class="cx"> LOG(Editing, "posRenderedOffset: %d\n", posRenderedOffset);
</span><del>- LOG(Editing, "node min/max: %d:%d\n", caretMinOffset(deprecatedNode()), caretMaxOffset(deprecatedNode()));
- LOG(Editing, "pos node min/max: %d:%d\n", caretMinOffset(pos.deprecatedNode()), caretMaxOffset(pos.deprecatedNode()));
</del><ins>+ LOG(Editing, "node min/max: %d:%d\n", caretMinOffset(*deprecatedNode()), caretMaxOffset(*deprecatedNode()));
+ LOG(Editing, "pos node min/max: %d:%d\n", caretMinOffset(*pos.deprecatedNode()), caretMaxOffset(*pos.deprecatedNode()));
</ins><span class="cx"> LOG(Editing, "----------------------------------------------------------------------\n");
</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>- && thisRenderedOffset == caretMaxOffset(deprecatedNode()) && !posRenderedOffset) {
</del><ins>+ && thisRenderedOffset == caretMaxOffset(*deprecatedNode()) && !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>- && !thisRenderedOffset && posRenderedOffset == caretMaxOffset(pos.deprecatedNode())) {
</del><ins>+ && !thisRenderedOffset && 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->renderer() && !m_anchorNode->hasChildNodes() && m_offsetInAnchor < lastOffsetForEditing(m_anchorNode))
</del><ins>+ if (m_anchorNode->renderer() && !m_anchorNode->hasChildNodes() && m_offsetInAnchor < 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->previousSibling();
</span><span class="cx"> if (m_anchorNode) {
</span><span class="cx"> m_nodeAfterPositionInAnchor = nullptr;
</span><del>- m_offsetInAnchor = m_anchorNode->hasChildNodes() ? 0 : lastOffsetForEditing(m_anchorNode);
</del><ins>+ m_offsetInAnchor = m_anchorNode->hasChildNodes() ? 0 : lastOffsetForEditing(*m_anchorNode);
</ins><span class="cx"> } else {
</span><span class="cx"> m_nodeAfterPositionInAnchor = m_nodeAfterPositionInAnchor->parentNode();
</span><span class="cx"> m_anchorNode = m_nodeAfterPositionInAnchor->parentNode();
</span><span class="lines">@@ -96,7 +96,7 @@
</span><span class="cx">
</span><span class="cx"> if (m_anchorNode->hasChildNodes()) {
</span><span class="cx"> m_anchorNode = m_anchorNode->lastChild();
</span><del>- m_offsetInAnchor = m_anchorNode->hasChildNodes()? 0: lastOffsetForEditing(m_anchorNode);
</del><ins>+ m_offsetInAnchor = m_anchorNode->hasChildNodes()? 0: lastOffsetForEditing(*m_anchorNode);
</ins><span class="cx"> } else {
</span><span class="cx"> if (m_offsetInAnchor && m_anchorNode->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->parentNode() && (m_anchorNode->hasChildNodes() || m_offsetInAnchor >= lastOffsetForEditing(m_anchorNode));
</del><ins>+ return !m_anchorNode->parentNode() && (m_anchorNode->hasChildNodes() || m_offsetInAnchor >= 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->hasChildNodes() || m_offsetInAnchor >= lastOffsetForEditing(m_anchorNode);
</del><ins>+ return m_anchorNode->hasChildNodes() || m_offsetInAnchor >= 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<Range> 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 "config.h"
</span><span class="cx"> #include "ApplyBlockElementCommand.h"
</span><span class="cx">
</span><del>-#include "HTMLElement.h"
</del><ins>+#include "HTMLBRElement.h"
</ins><span class="cx"> #include "HTMLNames.h"
</span><span class="cx"> #include "RenderElement.h"
</span><span class="cx"> #include "RenderStyle.h"
</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) && startOfParagraph(start) == endOfParagraph(endOfSelection)) {
</span><del>- RefPtr<Element> blockquote = createBlockElement();
- insertNodeAt(blockquote, start);
- RefPtr<Element> 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<ContainerNode>(scope), startIndex, 0, true);
- endRange = TextIterator::rangeFromLocationAndLength(downcast<ContainerNode>(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 && endRange)
</span><span class="cx"> updateStartEnd(startRange->startPosition(), endRange->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->isTextNode() && start.deprecatedEditingOffset() >= caretMaxOffset(startNode)) {
</del><ins>+ if (startNode->isTextNode() && start.deprecatedEditingOffset() >= caretMaxOffset(*startNode)) {
</ins><span class="cx"> // Move out of text node if range does not include its characters.
</span><span class="cx"> startNode = NodeTraversal::next(*startNode);
</span><span class="cx"> if (!startNode)
</span><span class="lines">@@ -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() >= caretMaxOffset(start.deprecatedNode())) {
</del><ins>+ if (start.deprecatedEditingOffset() >= caretMaxOffset(*startNode)) {
</ins><span class="cx"> startNode = NodeTraversal::next(*startNode);
</span><span class="cx"> if (!startNode || comparePositions(end, firstPositionInOrBeforeNode(startNode)) < 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() >= caretMaxOffset(end.deprecatedNode()))
- pastEndNode = NodeTraversal::nextSkippingChildren(*end.deprecatedNode());
</del><ins>+ if (end.deprecatedEditingOffset() >= 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 && start.deprecatedNode()->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 <font color="blue">hello</font>, we need to include the font element in our run
</span><span class="cx"> // to generate <font color="blue" size="4">hello</font> instead of <font color="blue"><font size="4">hello</font></font>
</span><del>- RefPtr<Range> range = Range::create(startNode->document(), start, end);
- Element* editableRoot = startNode->rootEditableElement();
</del><ins>+ auto range = Range::create(startNode->document(), start, end);
+ auto* editableRoot = startNode->rootEditableElement();
</ins><span class="cx"> if (startNode != editableRoot) {
</span><del>- while (editableRoot && startNode->parentNode() != editableRoot && isNodeVisiblyContainedWithin(*startNode->parentNode(), range.get()))
</del><ins>+ while (editableRoot && startNode->parentNode() != editableRoot && isNodeVisiblyContainedWithin(*startNode->parentNode(), range))
</ins><span class="cx"> startNode = startNode->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->isTextNode())
</span><span class="cx"> return false;
</span><span class="cx"> int offsetInText = position.offsetInContainerNode();
</span><del>- return offsetInText > caretMinOffset(node) && offsetInText < caretMaxOffset(node);
</del><ins>+ return offsetInText > caretMinOffset(*node) && offsetInText < caretMaxOffset(*node);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool ApplyStyleCommand::mergeStartWithPreviousIfIdentical(const Position& start, const Position& 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->parentNode();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (!startNode->isElementNode())
</del><ins>+ auto* previousSibling = startNode->previousSibling();
+ if (!previousSibling || !areIdenticalElements(*startNode, *previousSibling))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- Node* previousSibling = startNode->previousSibling();
</del><ins>+ auto& previousElement = downcast<Element>(*previousSibling);
+ auto& element = downcast<Element>(*startNode);
+ auto* startChild = element.firstChild();
+ ASSERT(startChild);
+ mergeIdenticalElements(&previousElement, &element);
</ins><span class="cx">
</span><del>- if (previousSibling && areIdenticalElements(startNode, previousSibling)) {
- Element* previousElement = downcast<Element>(previousSibling);
- Element* element = downcast<Element>(startNode);
- Node* startChild = element->firstChild();
- ASSERT(startChild);
- mergeIdenticalElements(previousElement, element);
-
- unsigned startOffsetAdjustment = startChild->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->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& start, const Position& end)
</span><span class="lines">@@ -1330,25 +1325,24 @@
</span><span class="cx"> endNode = end.deprecatedNode()->parentNode();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (!endNode->isElementNode() || endNode->hasTagName(brTag))
</del><ins>+ if (endNode->hasTagName(brTag))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> Node* nextSibling = endNode->nextSibling();
</span><del>- if (nextSibling && areIdenticalElements(endNode, nextSibling)) {
- Element* nextElement = downcast<Element>(nextSibling);
- Element* element = downcast<Element>(endNode);
- Node* nextChild = nextElement->firstChild();
</del><ins>+ if (!nextSibling || !areIdenticalElements(*endNode, *nextSibling))
+ return false;
</ins><span class="cx">
</span><del>- mergeIdenticalElements(element, nextElement);
</del><ins>+ auto& nextElement = downcast<Element>(*nextSibling);
+ auto& element = downcast<Element>(*endNode);
+ Node* nextChild = nextElement.firstChild();
</ins><span class="cx">
</span><del>- bool shouldUpdateStart = start.containerNode() == endNode;
- unsigned endOffset = nextChild ? nextChild->computeNodeIndex() : nextElement->countChildNodes();
- updateStartEnd(shouldUpdateStart ? Position(nextElement, start.offsetInContainerNode(), Position::PositionIsOffsetInAnchor) : start,
- Position(nextElement, endOffset, Position::PositionIsOffsetInAnchor));
- return true;
- }
</del><ins>+ mergeIdenticalElements(&element, &nextElement);
</ins><span class="cx">
</span><del>- return false;
</del><ins>+ bool shouldUpdateStart = start.containerNode() == endNode;
+ int endOffset = nextChild ? nextChild->computeNodeIndex() : nextElement.countChildNodes();
+ updateStartEnd(shouldUpdateStart ? Position(&nextElement, start.offsetInContainerNode(), Position::PositionIsOffsetInAnchor) : start,
+ { &nextElement, endOffset, Position::PositionIsOffsetInAnchor });
+ return true;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void ApplyStyleCommand::surroundNodeRangeWithElement(PassRefPtr<Node> passedStartNode, PassRefPtr<Node> endNode, PassRefPtr<Element> elementToInsert)
</span><span class="lines">@@ -1375,15 +1369,13 @@
</span><span class="cx">
</span><span class="cx"> RefPtr<Node> nextSibling = element->nextSibling();
</span><span class="cx"> RefPtr<Node> previousSibling = element->previousSibling();
</span><del>- if (is<Element>(nextSibling.get()) && nextSibling->hasEditableStyle()
- && areIdenticalElements(element.get(), downcast<Element>(nextSibling.get())))
</del><ins>+ if (is<Element>(nextSibling.get()) && nextSibling->hasEditableStyle() && areIdenticalElements(*element, *nextSibling))
</ins><span class="cx"> mergeIdenticalElements(element.get(), downcast<Element>(nextSibling.get()));
</span><span class="cx">
</span><span class="cx"> if (is<Element>(previousSibling.get()) && previousSibling->hasEditableStyle()) {
</span><span class="cx"> Node* mergedElement = previousSibling->nextSibling();
</span><span class="cx"> ASSERT(mergedElement);
</span><del>- if (is<Element>(*mergedElement) && mergedElement->hasEditableStyle()
- && areIdenticalElements(downcast<Element>(previousSibling.get()), downcast<Element>(mergedElement)))
</del><ins>+ if (is<Element>(*mergedElement) && mergedElement->hasEditableStyle() && areIdenticalElements(*previousSibling, *mergedElement))
</ins><span class="cx"> mergeIdenticalElements(downcast<Element>(previousSibling.get()), downcast<Element>(mergedElement));
</span><span class="cx"> }
</span><span class="cx">
</span></span></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 "config.h"
</span><span class="cx"> #include "BreakBlockquoteCommand.h"
</span><span class="cx">
</span><del>-#include "HTMLElement.h"
</del><ins>+#include "HTMLBRElement.h"
</ins><span class="cx"> #include "HTMLNames.h"
</span><span class="cx"> #include "NodeTraversal.h"
</span><span class="cx"> #include "RenderListItem.h"
</span><span class="lines">@@ -70,25 +70,25 @@
</span><span class="cx"> if (!topBlockquote || !topBlockquote->parentNode() || !topBlockquote->isElementNode())
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- RefPtr<Element> 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) && !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<Element> clonedBlockquote = downcast<Element>(*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 "Event.h"
</span><span class="cx"> #include "ExceptionCodePlaceholder.h"
</span><span class="cx"> #include "Frame.h"
</span><ins>+#include "HTMLBRElement.h"
</ins><span class="cx"> #include "HTMLDivElement.h"
</span><del>-#include "HTMLElement.h"
</del><span class="cx"> #include "HTMLLIElement.h"
</span><span class="cx"> #include "HTMLNames.h"
</span><ins>+#include "HTMLSpanElement.h"
</ins><span class="cx"> #include "InlineTextBox.h"
</span><span class="cx"> #include "InsertIntoTextNodeCommand.h"
</span><span class="cx"> #include "InsertLineBreakCommand.h"
</span><span class="lines">@@ -150,7 +151,7 @@
</span><span class="cx"> static void postTextStateChangeNotification(AXObjectCache* cache, const VisiblePosition& position, const String& deletedText, const String& 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() && 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<ContainerNode>(refChild));
</span><del>- } else if (caretMinOffset(refChild) >= offset)
</del><ins>+ } else if (caretMinOffset(*refChild) >= offset)
</ins><span class="cx"> insertNodeBefore(insertChild, refChild);
</span><del>- else if (is<Text>(*refChild) && caretMaxOffset(refChild) > offset) {
</del><ins>+ else if (is<Text>(*refChild) && caretMaxOffset(*refChild) > offset) {
</ins><span class="cx"> splitTextNode(downcast<Text>(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& pos)
</del><ins>+Position CompositeEditCommand::positionOutsideTabSpan(const Position& 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() <= caretMinOffset(pos.containerNode()))
</del><ins>+ if (position.offsetInContainerNode() <= caretMinOffset(*position.containerNode()))
</ins><span class="cx"> return positionInParentBeforeNode(tabSpan);
</span><span class="cx">
</span><del>- if (pos.offsetInContainerNode() >= caretMaxOffset(pos.containerNode()))
</del><ins>+ if (position.offsetInContainerNode() >= caretMaxOffset(*position.containerNode()))
</ins><span class="cx"> return positionInParentAfterNode(tabSpan);
</span><span class="cx">
</span><del>- splitTextNodeContainingElement(downcast<Text>(pos.containerNode()), pos.offsetInContainerNode());
</del><ins>+ splitTextNodeContainingElement(&downcast<Text>(*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& text)
</del><ins>+static inline bool containsOnlyDeprecatedEditingWhitespace(const String& text)
</ins><span class="cx"> {
</span><span class="cx"> for (unsigned i = 0; i < 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& 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& 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<Text>(*node).data();
</span><del>- if (!isWhitespace(text[offset])) {
</del><ins>+ if (!deprecatedIsEditingWhitespace(text[offset])) {
</ins><span class="cx"> offset--;
</span><del>- if (offset < 0 || !isWhitespace(text[offset]))
</del><ins>+ if (offset < 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 > 0 && isWhitespace(text[upstream - 1]))
</del><ins>+ while (upstream > 0 && 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 < text.length() && isWhitespace(text[downstream]))
</del><ins>+ while ((unsigned)downstream < text.length() && 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<HTMLElement> CompositeEditCommand::insertNewDefaultParagraphElementAt(const Position& position)
</span><span class="cx"> {
</span><span class="cx"> auto paragraphElement = createDefaultParagraphElement(document());
</span><del>- paragraphElement->appendChild(createBreakElement(document()), IGNORE_EXCEPTION);
</del><ins>+ paragraphElement->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"> && ((!isEndOfParagraph(beforeParagraph) && !isStartOfParagraph(beforeParagraph)) || beforeParagraph == afterParagraph)
</span><span class="cx"> && 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() && (!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<Element> newBlock;
</span><span class="cx"> if (ContainerNode* blockEnclosingList = listNode->parentNode()) {
</span><span class="cx"> if (is<HTMLLIElement>(*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. <ul><li>hello <ul><li><br></li></ul> </li></ul> should become <ul><li>hello</li> <ul><li><br></li></ul> </ul> 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. <ul><li> <ul><li><br></li></ul> hello</li></ul> should become <ul><li> <div><br></div> hello</li></ul> at the end
</span><span class="cx"> splitElement(downcast<HTMLLIElement>(blockEnclosingList), listNode);
</span><span class="cx"> removeNodePreservingChildren(listNode->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->hasTagName(olTag) || blockEnclosingList->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(), &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(), &isMailBlockquote))
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- RefPtr<Node> br = createBreakElement(document());
</del><ins>+ RefPtr<Node> 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<br><blockquote>...</blockquote>, 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 "DocumentMarkerController.h"
</span><span class="cx"> #include "Editor.h"
</span><span class="cx"> #include "EditorClient.h"
</span><del>-#include "Element.h"
</del><span class="cx"> #include "Frame.h"
</span><del>-#include "htmlediting.h"
</del><ins>+#include "HTMLBRElement.h"
</ins><span class="cx"> #include "HTMLInputElement.h"
</span><span class="cx"> #include "HTMLLinkElement.h"
</span><span class="cx"> #include "HTMLNames.h"
</span><span class="lines">@@ -44,6 +43,7 @@
</span><span class="cx"> #include "RenderedDocumentMarker.h"
</span><span class="cx"> #include "Text.h"
</span><span class="cx"> #include "VisibleUnits.h"
</span><ins>+#include "htmlediting.h"
</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& start, Position& 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 >= caretMaxOffset(startNode) && is<Text>(*startNode)) {
</del><ins>+ int startNodeCaretMaxOffset = caretMaxOffset(*startNode);
+ if (startOffset >= startNodeCaretMaxOffset && is<Text>(*startNode)) {
</ins><span class="cx"> Text& text = downcast<Text>(*startNode);
</span><del>- if (text.length() > static_cast<unsigned>(caretMaxOffset(startNode)))
- deleteTextFromNode(&text, caretMaxOffset(startNode), text.length() - caretMaxOffset(startNode));
</del><ins>+ if (text.length() > static_cast<unsigned>(startNodeCaretMaxOffset))
+ deleteTextFromNode(&text, startNodeCaretMaxOffset, text.length() - startNodeCaretMaxOffset);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (startOffset >= lastOffsetForEditing(startNode)) {
</del><ins>+ if (startOffset >= 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->lastDescendant();
</span><del>- if (m_downstreamEnd.deprecatedNode() == n && m_downstreamEnd.deprecatedEditingOffset() >= caretMaxOffset(n)) {
</del><ins>+ if (m_downstreamEnd.deprecatedNode() == n && m_downstreamEnd.deprecatedEditingOffset() >= 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 && !m_upstreamStart.deprecatedNode()->isDescendantOf(m_downstreamEnd.deprecatedNode()) && m_downstreamEnd.anchorNode()->inDocument() && m_downstreamEnd.deprecatedEditingOffset() >= caretMinOffset(m_downstreamEnd.deprecatedNode())) {
</del><ins>+ if (m_downstreamEnd.deprecatedNode() != startNode && !m_upstreamStart.deprecatedNode()->isDescendantOf(m_downstreamEnd.deprecatedNode()) && m_downstreamEnd.anchorNode()->inDocument() && m_downstreamEnd.deprecatedEditingOffset() >= caretMinOffset(*m_downstreamEnd.deprecatedNode())) {
</ins><span class="cx"> if (m_downstreamEnd.atLastEditingPositionForNode() && !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()->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<Node> 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->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 "HTMLFontElement.h"
</span><span class="cx"> #include "HTMLInterchange.h"
</span><span class="cx"> #include "HTMLNames.h"
</span><ins>+#include "HTMLSpanElement.h"
</ins><span class="cx"> #include "Node.h"
</span><span class="cx"> #include "NodeTraversal.h"
</span><span class="cx"> #include "QualifiedName.h"
</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 <table>)
</span><span class="cx"> if (topNode)
</span><del>- spellingSearchRange->setEnd(*topNode, lastOffsetForEditing(topNode), IGNORE_EXCEPTION);
</del><ins>+ spellingSearchRange->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->tagQName()) && start == startOfBlock(start)
</span><del>- && (end == endOfBlock(end) || isNodeVisiblyContainedWithin(*refNode, range.get()))
</del><ins>+ && (end == endOfBlock(end) || isNodeVisiblyContainedWithin(*refNode, *range))
</ins><span class="cx"> && refNode != root && !root->isDescendantOf(refNode)) {
</span><span class="cx"> // Already in a block element that only contains the current paragraph
</span><span class="cx"> if (refNode->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 "Document.h"
</span><span class="cx"> #include "ElementTraversal.h"
</span><del>-#include "HTMLElement.h"
</del><ins>+#include "HTMLBRElement.h"
</ins><span class="cx"> #include "HTMLNames.h"
</span><span class="cx"> #include "InsertLineBreakCommand.h"
</span><span class="cx"> #include "InsertListCommand.h"
</span><del>-#include "RenderObject.h"
</del><ins>+#include "RenderElement.h"
</ins><span class="cx"> #include "SplitElementCommand.h"
</span><span class="cx"> #include "Text.h"
</span><span class="cx"> #include "VisibleUnits.h"
</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(), &isListOrIndentBlockquote);
</del><ins>+ auto* enclosingNode = downcast<HTMLElement>(enclosingNodeOfType(visibleStartOfParagraph.deepEquivalent(), &isListOrIndentBlockquote));
</ins><span class="cx"> if (!enclosingNode || !enclosingNode->parentNode()->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() && !isStartOfParagraph(visibleStartOfParagraph))
</span><del>- insertNodeAt(createBreakElement(document()), visibleStartOfParagraph.deepEquivalent());
</del><ins>+ insertNodeAt(HTMLBRElement::create(document()), visibleStartOfParagraph.deepEquivalent());
</ins><span class="cx"> if (visibleEndOfParagraph.isNotNull() && !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<Node> 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<Element>(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<Node> 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 "Document.h"
</span><span class="cx"> #include "Frame.h"
</span><span class="cx"> #include "FrameSelection.h"
</span><del>-#include "HTMLElement.h"
</del><ins>+#include "HTMLBRElement.h"
</ins><span class="cx"> #include "HTMLHRElement.h"
</span><span class="cx"> #include "HTMLNames.h"
</span><span class="cx"> #include "HTMLTableElement.h"
</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& pos)
</del><ins>+void InsertLineBreakCommand::insertNodeAfterPosition(Node* node, const Position& 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& pos)
</del><ins>+void InsertLineBreakCommand::insertNodeBeforePosition(Node* node, const Position& 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& insertionPos)
</del><ins>+bool InsertLineBreakCommand::shouldUseBreakElement(const Position& 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()->renderer() && !p.deprecatedNode()->renderer()->style().preserveNewline();
</del><ins>+ auto* node = position.parentAnchoredEquivalent().deprecatedNode();
+ return node->renderer() && !node->renderer()->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<Node> 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("\n");
</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) && !lineBreakExistsAtVisiblePosition(caret)) {
</span><del>- bool needExtraLineBreak = !is<HTMLHRElement>(*pos.deprecatedNode()) && !is<HTMLTableElement>(*pos.deprecatedNode());
</del><ins>+ bool needExtraLineBreak = !is<HTMLHRElement>(*position.deprecatedNode()) && !is<HTMLTableElement>(*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->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() <= caretMinOffset(pos.deprecatedNode())) {
- insertNodeAt(nodeToInsert.get(), pos);
</del><ins>+ } else if (position.deprecatedEditingOffset() <= 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() >= caretMaxOffset(pos.deprecatedNode()) || !pos.deprecatedNode()->isTextNode()) {
- insertNodeAt(nodeToInsert.get(), pos);
</del><ins>+ } else if (position.deprecatedEditingOffset() >= caretMaxOffset(*position.deprecatedNode()) || !is<Text>(*position.deprecatedNode())) {
+ insertNodeAt(nodeToInsert.get(), position);
</ins><span class="cx"> setEndingSelection(VisibleSelection(positionInParentAfterNode(nodeToInsert.get()), DOWNSTREAM, endingSelection().isDirectional()));
</span><del>- } else if (is<Text>(*pos.deprecatedNode())) {
</del><ins>+ } else if (is<Text>(*position.deprecatedNode())) {
</ins><span class="cx"> // Split a text node
</span><del>- Text& textNode = downcast<Text>(*pos.deprecatedNode());
- splitTextNode(&textNode, pos.deprecatedEditingOffset());
</del><ins>+ Text& textNode = downcast<Text>(*position.deprecatedNode());
+ splitTextNode(&textNode, position.deprecatedEditingOffset());
</ins><span class="cx"> insertNodeBefore(nodeToInsert, &textNode);
</span><span class="cx"> Position endingPosition = firstPositionInNode(&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 "config.h"
</span><span class="cx"> #include "InsertListCommand.h"
</span><span class="cx">
</span><del>-#include "Element.h"
</del><span class="cx"> #include "ElementTraversal.h"
</span><span class="cx"> #include "ExceptionCodePlaceholder.h"
</span><del>-#include "htmlediting.h"
-#include "HTMLElement.h"
</del><ins>+#include "HTMLBRElement.h"
+#include "HTMLLIElement.h"
</ins><span class="cx"> #include "HTMLNames.h"
</span><ins>+#include "HTMLUListElement.h"
</ins><span class="cx"> #include "Range.h"
</span><span class="cx"> #include "VisibleUnits.h"
</span><ins>+#include "htmlediting.h"
</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<HTMLElement> 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<HTMLElement> InsertListCommand::mergeWithNeighboringLists(PassRefPtr<HTMLElement> 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 && isNodeVisiblyContainedWithin(*listNode, currentSelection)) {
- bool rangeStartIsInList = visiblePositionBeforeNode(listNode.get()) == currentSelection->startPosition();
- bool rangeEndIsInList = visiblePositionAfterNode(listNode.get()) == currentSelection->endPosition();
</del><ins>+ if (switchListType && isNodeVisiblyContainedWithin(*listNode, *currentSelection)) {
+ bool rangeStartIsInList = visiblePositionBeforeNode(*listNode) == currentSelection->startPosition();
+ bool rangeEndIsInList = visiblePositionAfterNode(*listNode) == currentSelection->endPosition();
</ins><span class="cx">
</span><span class="cx"> RefPtr<HTMLElement> 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 && 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<Element> placeholder = createBreakElement(document());
</del><ins>+ RefPtr<Element> placeholder = HTMLBRElement::create(document());
</ins><span class="cx"> RefPtr<Element> 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<HTMLElement> listItemElement = createListItemElement(document());
- RefPtr<HTMLElement> 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<HTMLElement> 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 && 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<Node> 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 "Document.h"
</span><span class="cx"> #include "EditingStyle.h"
</span><del>-#include "HTMLElement.h"
</del><ins>+#include "HTMLBRElement.h"
</ins><span class="cx"> #include "HTMLFormElement.h"
</span><span class="cx"> #include "HTMLNames.h"
</span><span class="cx"> #include "InsertLineBreakCommand.h"
</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<Element> br = createBreakElement(document());
</del><ins>+ RefPtr<Element> 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) && !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->isTextNode() && insertionPosition.offsetInContainerNode() >= caretMaxOffset(splitTo))
</del><ins>+ if (is<Text>(*splitTo) && insertionPosition.offsetInContainerNode() >= 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 "InsertTextCommand.h"
</span><span class="cx">
</span><span class="cx"> #include "Document.h"
</span><del>-#include "Element.h"
</del><span class="cx"> #include "Editor.h"
</span><span class="cx"> #include "Frame.h"
</span><ins>+#include "HTMLElement.h"
</ins><span class="cx"> #include "HTMLInterchange.h"
</span><span class="cx"> #include "Text.h"
</span><span class="cx"> #include "VisibleUnits.h"
</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<Element> spanNode = createTabSpanElement(document());
</del><ins>+ auto spanNode = createTabSpanElement(document());
</ins><span class="cx">
</span><span class="cx"> // place it
</span><del>- if (!is<Text>(*node)) {
- insertNodeAt(spanNode.get(), insertPos);
- } else {
</del><ins>+ if (!is<Text>(*node))
+ insertNodeAt(spanNode.ptr(), insertPos);
+ else {
</ins><span class="cx"> RefPtr<Text> textNode = downcast<Text>(node);
</span><span class="cx"> if (offset >= textNode->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 > 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 "Document.h"
</span><span class="cx"> #include "Frame.h"
</span><span class="cx"> #include "FrameSelection.h"
</span><del>-#include "HTMLElement.h"
</del><ins>+#include "HTMLOListElement.h"
+#include "HTMLUListElement.h"
</ins><span class="cx"> #include "RenderObject.h"
</span><span class="cx"> #include "htmlediting.h"
</span><span class="cx">
</span><span class="lines">@@ -190,10 +191,10 @@
</span><span class="cx"> newParent = newParent->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 "CSSStyleDeclaration.h"
</span><span class="cx"> #include "Document.h"
</span><span class="cx"> #include "DocumentFragment.h"
</span><del>-#include "Element.h"
</del><span class="cx"> #include "ElementIterator.h"
</span><span class="cx"> #include "EventNames.h"
</span><span class="cx"> #include "ExceptionCodePlaceholder.h"
</span><span class="cx"> #include "Frame.h"
</span><span class="cx"> #include "FrameSelection.h"
</span><ins>+#include "HTMLBRElement.h"
</ins><span class="cx"> #include "HTMLInputElement.h"
</span><ins>+#include "HTMLLIElement.h"
</ins><span class="cx"> #include "HTMLNames.h"
</span><span class="cx"> #include "HTMLTitleElement.h"
</span><span class="cx"> #include "NodeList.h"
</span><span class="cx"> #include "NodeRenderStyle.h"
</span><span class="cx"> #include "RenderInline.h"
</span><del>-#include "RenderObject.h"
</del><span class="cx"> #include "RenderText.h"
</span><span class="cx"> #include "SimplifyMarkupCommand.h"
</span><span class="cx"> #include "SmartReplace.h"
</span><span class="lines">@@ -281,7 +281,7 @@
</span><span class="cx"> Vector<RefPtr<Node>> unrendered;
</span><span class="cx">
</span><span class="cx"> for (Node* node = holder->firstChild(); node; node = NodeTraversal::next(*node, holder)) {
</span><del>- if (!isNodeRendered(node) && !isTableStructureNode(node))
</del><ins>+ if (!isNodeRendered(*node) && !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(), &isMailPasteAsQuotationNode) &&
- sourceBlock && (!sourceBlock->hasTagName(blockquoteTag) || isMailBlockquote(sourceBlock)) &&
- enclosingListChild(sourceBlock) == enclosingListChild(destinationNode) &&
- enclosingTableCell(source.deepEquivalent()) == enclosingTableCell(destination.deepEquivalent()) &&
- (!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.
- !isBlock(sourceNode) && !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(), &isMailPasteAsQuotationNode)
+ && sourceBlock
+ && (!sourceBlock->hasTagName(blockquoteTag) || isMailBlockquote(sourceBlock))
+ && enclosingListChild(sourceBlock) == enclosingListChild(destinationNode)
+ && enclosingTableCell(source.deepEquivalent()) == enclosingTableCell(destination.deepEquivalent())
+ && (!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.
+ && !isBlock(sourceNode) && !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->style()->asText());
</span><span class="cx">
</span><span class="cx"> // FIXME: Tolerate differences in id, class, and style attributes.
</span><del>- if (element->parentNode() && isNonTableCellHTMLBlockElement(element) && areIdenticalElements(element, element->parentNode())
</del><ins>+ if (element->parentNode() && isNonTableCellHTMLBlockElement(element) && areIdenticalElements(*element, *element->parentNode())
</ins><span class="cx"> && VisiblePosition(firstPositionInNode(element->parentNode())) == VisiblePosition(firstPositionInNode(element))
</span><span class="cx"> && VisiblePosition(lastPositionInNode(element->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<Node> placeholder = createBreakElement(document());
</del><ins>+ RefPtr<Node> 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->parentNode()) {
</span><del>- if (isBlockFlowElement(parent) || parent->hasTagName(bodyTag))
</del><ins>+ if (isBlockFlowElement(*parent) || parent->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->previousSibling(); sibling; sibling = sibling->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() && insertionBlock && insertionPos.deprecatedNode() == insertionBlock->parentNode() && (unsigned)insertionPos.deprecatedEditingOffset() < insertionBlock->computeNodeIndex() && !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 && (plainTextFragment || shouldRemoveEndBR(endBR.get(), originalVisPosBeforeEndBR))) {
</span><span class="cx"> RefPtr<Node> parent = endBR->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 && destinationNode != enclosingInline(destinationNode) && enclosingInline(destinationNode)->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 <br> might have removed the content we're about to move
</span><span class="cx"> if (!startOfParagraphToMove.deepEquivalent().anchorNode()->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<Node> 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& node)
</span><span class="cx"> {
</span><del>- int offset = caretMaxOffset(&node);
</del><ins>+ int offset = caretMaxOffset(node);
</ins><span class="cx"> if (auto* renderer = node.renderer()) {
</span><span class="cx"> if (is<RenderText>(*renderer))
</span><span class="cx"> offset += collapsedSpaceLength(downcast<RenderText>(*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() && downstreamEnd.containerNode()->renderer() && downstreamEnd.containerNode()->renderer()->isTable()
</span><del>- && downstreamEnd.computeOffsetInContainerNode() <= caretMinOffset(downstreamEnd.containerNode())) {
</del><ins>+ && downstreamEnd.computeOffsetInContainerNode() <= 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 &pos, bool* reachedBoundary) const
</del><ins>+VisiblePosition VisiblePosition::honorEditingBoundaryAtOrBefore(const VisiblePosition& 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 && !pos.deepEquivalent().deprecatedNode()->isDescendantOf(highestRoot)) {
</del><ins>+ if (highestRoot && !position.deepEquivalent().deprecatedNode()->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 &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 && !pos.deepEquivalent().deprecatedNode()->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 && 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 && 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->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& 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 && (!previousNode->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->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& 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 && (!nextNode->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& 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<Text>(node))
</span><span class="cx"> return VisiblePosition(Position(downcast<Text>(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<Text>(node))
</span><span class="cx"> return VisiblePosition(Position(downcast<Text>(node), offset), DOWNSTREAM);
</span><span class="lines">@@ -1484,18 +1484,18 @@
</span><span class="cx">
</span><span class="cx"> VisiblePosition startOfEditableContent(const VisiblePosition& 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& 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 "HTMLOListElement.h"
</span><span class="cx"> #include "HTMLObjectElement.h"
</span><span class="cx"> #include "HTMLParagraphElement.h"
</span><ins>+#include "HTMLSpanElement.h"
</ins><span class="cx"> #include "HTMLTableElement.h"
</span><span class="cx"> #include "HTMLTextFormControlElement.h"
</span><span class="cx"> #include "HTMLUListElement.h"
</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&, const Position&);
+
+// 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 && (!node->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& position, EditableType editableType)
</del><ins>+ContainerNode* highestEditableRoot(const Position& 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->hasTagName(bodyTag)) {
</del><ins>+ for (ContainerNode* node = highestEditableRoot; !is<HTMLBodyElement>(*node); ) {
</ins><span class="cx"> node = node->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->parentNode()) {
</ins><span class="cx"> if (node->hasEditableStyle())
</span><span class="cx"> return node->rootEditableElement();
</span><del>- if (node->hasTagName(bodyTag))
</del><ins>+ if (is<HTMLBodyElement>(*node))
</ins><span class="cx"> break;
</span><del>- node = node->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& 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->rootAXEditableElement(&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 && computeEditability(*node, editableType, Node::ShouldUpdateStyle::Update);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool isAtUnsplittableElement(const Position& pos)
</del><ins>+bool isAtUnsplittableElement(const Position& position)
</ins><span class="cx"> {
</span><del>- Node* node = pos.containerNode();
- return (node == editableRootForPosition(pos) || node == enclosingNodeOfType(pos, &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& position)
</span><span class="cx"> {
</span><del>- Node* node = position.containerNode();
- if (!node)
- return false;
- return node->hasRichlyEditableStyle();
</del><ins>+ auto* node = position.containerNode();
+ return node && node->hasRichlyEditableStyle();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-Element* editableRootForPosition(const Position& p, EditableType editableType)
</del><ins>+Element* editableRootForPosition(const Position& 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->document().existingAXObjectCache())
</del><ins>+ if (auto* cache = node->document().existingAXObjectCache())
</ins><span class="cx"> return const_cast<Element*>(cache->rootAXEditableElement(node));
</span><span class="cx"> FALLTHROUGH;
</span><span class="cx"> case ContentIsEditable:
</span><span class="cx"> return node->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& p)
</del><ins>+Element* unsplittableElementForPosition(const Position& 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<Element>(enclosingNodeOfType(p, &isTableCell));
- if (enclosingCell)
</del><ins>+ if (auto* enclosingCell = downcast<Element>(enclosingNodeOfType(position, &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& 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& 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() && 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() && nextPosition.downstream() != downstreamStart)
+ return nextPosition;
+ if (auto* node = nextPosition.containerNode()) {
</ins><span class="cx"> if (!node->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& 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& 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() && 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() && previousPosition.downstream() != downstreamStart)
+ return previousPosition;
+ if (auto* node = previousPosition.containerNode()) {
</ins><span class="cx"> if (!node->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& position, Node* highestRoot)
</del><ins>+Position firstEditablePositionAfterPositionInRoot(const Position& 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 && highestRoot->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 (&position.deprecatedNode()->treeScope() != &highestRoot->treeScope()) {
</span><del>- Node* shadowAncestor = highestRoot->treeScope().ancestorInThisScope(p.deprecatedNode());
</del><ins>+ auto* shadowAncestor = highestRoot->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() && !isEditablePosition(p) && p.deprecatedNode()->isDescendantOf(highestRoot))
- p = isAtomicNode(p.deprecatedNode()) ? positionInParentAfterNode(p.deprecatedNode()) : nextVisuallyDistinctCandidate(p);
-
- if (p.deprecatedNode() && p.deprecatedNode() != highestRoot && !p.deprecatedNode()->isDescendantOf(highestRoot))
- return Position();
-
- return p;
</del><ins>+ while (candidate.deprecatedNode() && !isEditablePosition(candidate) && candidate.deprecatedNode()->isDescendantOf(highestRoot))
+ candidate = isAtomicNode(candidate.deprecatedNode()) ? positionInParentAfterNode(candidate.deprecatedNode()) : nextVisuallyDistinctCandidate(candidate);
+
+ if (candidate.deprecatedNode() && candidate.deprecatedNode() != highestRoot && !candidate.deprecatedNode()->isDescendantOf(highestRoot))
+ return { };
+
+ return candidate;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-Position lastEditablePositionBeforePositionInRoot(const Position& position, Node* highestRoot)
</del><ins>+Position lastEditablePositionBeforePositionInRoot(const Position& 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 (&position.deprecatedNode()->treeScope() != &highestRoot->treeScope()) {
</span><del>- Node* shadowAncestor = highestRoot->treeScope().ancestorInThisScope(p.deprecatedNode());
</del><ins>+ auto* shadowAncestor = highestRoot->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() && !isEditablePosition(candidate) && candidate.deprecatedNode()->isDescendantOf(highestRoot))
+ candidate = isAtomicNode(candidate.deprecatedNode()) ? positionInParentBeforeNode(candidate.deprecatedNode()) : previousVisuallyDistinctCandidate(candidate);
</ins><span class="cx">
</span><del>- while (p.deprecatedNode() && !isEditablePosition(p) && p.deprecatedNode()->isDescendantOf(highestRoot))
- p = isAtomicNode(p.deprecatedNode()) ? positionInParentBeforeNode(p.deprecatedNode()) : previousVisuallyDistinctCandidate(p);
</del><ins>+ if (candidate.deprecatedNode() && candidate.deprecatedNode() != highestRoot && !candidate.deprecatedNode()->isDescendantOf(highestRoot))
+ return { };
</ins><span class="cx">
</span><del>- if (p.deprecatedNode() && p.deprecatedNode() != highestRoot && !p.deprecatedNode()->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& node)
</ins><span class="cx"> {
</span><del>- ASSERT(node);
- if (!node)
- return 0;
- if (node->offsetInCharacters())
- return node->maxCharacterOffset();
</del><ins>+ if (node.offsetInCharacters())
+ return node.maxCharacterOffset();
</ins><span class="cx">
</span><del>- if (node->hasChildNodes())
- return node->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(&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<UChar> 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 < 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 && startIsStartOfParagraph) || (i + 1 == rebalancedString.size() && 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->renderer();
- return (renderer && (renderer->isTableCell() || renderer->isTableRow() || renderer->isTableSection() || renderer->isRenderTableCol()));
</del><ins>+ auto* renderer = node->renderer();
+ return renderer && (renderer->isTableCell() || renderer->isTableRow() || renderer->isTableSection() || renderer->isRenderTableCol());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> const String& 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<HTMLElement>(node))
</ins><span class="cx"> return false;
</span><del>-
- if (!n->isHTMLElement())
- return false;
</del><span class="cx">
</span><del>- if (n->isLink())
</del><ins>+ if (downcast<HTMLElement>(*node).isLink())
</ins><span class="cx"> return true;
</span><span class="cx">
</span><del>- RenderObject* renderer = n->renderer();
</del><ins>+ auto* renderer = downcast<HTMLElement>(*node).renderer();
</ins><span class="cx"> if (!renderer)
</span><span class="cx"> return false;
</span><del>-
</del><ins>+
</ins><span class="cx"> if (renderer->style().display() == TABLE || renderer->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->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& pos)
</del><ins>+static HTMLElement* firstInSpecialElement(const Position& position)
</ins><span class="cx"> {
</span><del>- Node* rootEditableElement = pos.containerNode()->rootEditableElement();
- for (Node* n = pos.deprecatedNode(); n && n->rootEditableElement() == rootEditableElement; n = n->parentNode())
- if (isSpecialElement(n)) {
- VisiblePosition vPos = VisiblePosition(pos, DOWNSTREAM);
- VisiblePosition firstInElement = VisiblePosition(firstPositionInOrBeforeNode(n), DOWNSTREAM);
- if (isRenderedTable(n) && vPos == firstInElement.next())
- return n;
- if (vPos == firstInElement)
- return n;
- }
- return 0;
</del><ins>+ auto* rootEditableElement = position.containerNode()->rootEditableElement();
+ for (Node* node = position.deprecatedNode(); node && node->rootEditableElement() == rootEditableElement; node = node->parentNode()) {
+ if (!isSpecialElement(node))
+ continue;
+ VisiblePosition vPos(position, DOWNSTREAM);
+ VisiblePosition firstInElement(firstPositionInOrBeforeNode(node), DOWNSTREAM);
+ if ((isRenderedTable(node) && vPos == firstInElement.next()) || vPos == firstInElement)
+ return &downcast<HTMLElement>(*node);
+ }
+ return nullptr;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-static Node* lastInSpecialElement(const Position& pos)
</del><ins>+static HTMLElement* lastInSpecialElement(const Position& position)
</ins><span class="cx"> {
</span><del>- Node* rootEditableElement = pos.containerNode()->rootEditableElement();
- for (Node* n = pos.deprecatedNode(); n && n->rootEditableElement() == rootEditableElement; n = n->parentNode())
- if (isSpecialElement(n)) {
- VisiblePosition vPos = VisiblePosition(pos, DOWNSTREAM);
- VisiblePosition lastInElement = VisiblePosition(lastPositionInOrAfterNode(n), DOWNSTREAM);
- if (isRenderedTable(n) && vPos == lastInElement.previous())
- return n;
- if (vPos == lastInElement)
- return n;
- }
- return 0;
</del><ins>+ auto* rootEditableElement = position.containerNode()->rootEditableElement();
+ for (Node* node = position.deprecatedNode(); node && node->rootEditableElement() == rootEditableElement; node = node->parentNode()) {
+ if (!isSpecialElement(node))
+ continue;
+ VisiblePosition vPos(position, DOWNSTREAM);
+ VisiblePosition lastInElement(lastPositionInOrAfterNode(node), DOWNSTREAM);
+ if ((isRenderedTable(node) && vPos == lastInElement.previous()) || vPos == lastInElement)
+ return &downcast<HTMLElement>(*node);
+ }
+ return nullptr;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool isFirstVisiblePositionInSpecialElement(const Position& pos)
</del><ins>+static bool isFirstVisiblePositionInSpecialElement(const Position& 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& pos, Node** containingSpecialElement)
</del><ins>+Position positionBeforeContainingSpecialElement(const Position& 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()->rootEditableElement() != pos.deprecatedNode()->rootEditableElement())
- return pos;
</del><ins>+ auto* element = firstInSpecialElement(position);
+ if (!element)
+ return position;
+ Position result = positionInParentBeforeNode(element);
+ if (result.isNull() || result.deprecatedNode()->rootEditableElement() != position.deprecatedNode()->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& pos)
</del><ins>+static bool isLastVisiblePositionInSpecialElement(const Position& 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& pos, Node **containingSpecialElement)
</del><ins>+Position positionAfterContainingSpecialElement(const Position& 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()->rootEditableElement() != pos.deprecatedNode()->rootEditableElement())
- return pos;
</del><ins>+ auto* element = lastInSpecialElement(position);
+ if (!element)
+ return position;
+ Position result = positionInParentAfterNode(element);
+ if (result.isNull() || result.deprecatedNode()->rootEditableElement() != position.deprecatedNode()->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 &pos, Node **containingSpecialElement)
</del><ins>+Position positionOutsideContainingSpecialElement(const Position& 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& visiblePosition)
</del><ins>+Element* isFirstPositionAfterTable(const VisiblePosition& position)
</ins><span class="cx"> {
</span><del>- Position upstream(visiblePosition.deepEquivalent().upstream());
- if (upstream.deprecatedNode() && upstream.deprecatedNode()->renderer() && upstream.deprecatedNode()->renderer()->isTable() && 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->renderer();
+ if (!renderer || !renderer->isTable() || !upstream.atLastEditingPositionForNode())
+ return nullptr;
+ return &downcast<Element>(*node);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-Node* isLastPositionBeforeTable(const VisiblePosition& visiblePosition)
</del><ins>+Element* isLastPositionBeforeTable(const VisiblePosition& position)
</ins><span class="cx"> {
</span><del>- Position downstream(visiblePosition.deepEquivalent().downstream());
- if (downstream.deprecatedNode() && downstream.deprecatedNode()->renderer() && downstream.deprecatedNode()->renderer()->isTable() && 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->renderer();
+ if (!renderer || !renderer->isTable() || !downstream.atFirstEditingPositionForNode())
+ return nullptr;
+ return &downcast<Element>(*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& node)
</ins><span class="cx"> {
</span><del>- ASSERT(node);
- if (node->hasChildNodes())
- return VisiblePosition(firstPositionInOrBeforeNode(node), DOWNSTREAM);
- ASSERT(node->parentNode());
- ASSERT(!node->parentNode()->isShadowRoot());
- return positionInParentBeforeNode(node);
</del><ins>+ if (node.hasChildNodes())
+ return VisiblePosition(firstPositionInOrBeforeNode(&node), DOWNSTREAM);
+ ASSERT(node.parentNode());
+ ASSERT(!node.parentNode()->isShadowRoot());
+ return positionInParentBeforeNode(&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& node)
</ins><span class="cx"> {
</span><del>- ASSERT(node);
- if (node->hasChildNodes())
- return VisiblePosition(lastPositionInOrAfterNode(node), DOWNSTREAM);
- ASSERT(node->parentNode());
- ASSERT(!node->parentNode()->isShadowRoot());
- return positionInParentAfterNode(node);
</del><ins>+ if (node.hasChildNodes())
+ return VisiblePosition(lastPositionInOrAfterNode(&node), DOWNSTREAM);
+ ASSERT(node.parentNode());
+ ASSERT(!node.parentNode()->isShadowRoot());
+ return positionInParentAfterNode(&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 && (n->hasTagName(ulTag) || n->hasTagName(olTag) || n->hasTagName(dlTag)));
</del><ins>+ return node && (node->hasTagName(ulTag) || node->hasTagName(olTag) || node->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 && (isListElement(n->parentNode()) || (n->renderer() && n->renderer()->isListItem()));
</del><ins>+ return node && (isListElement(node->parentNode()) || (node->renderer() && node->renderer()->isListItem()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Element* enclosingElementWithTag(const Position& position, const QualifiedName& tagName)
</span><span class="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->parentNode()) {
</span><span class="cx"> if (root && !node->hasEditableStyle())
</span><span class="cx"> continue;
</span><span class="cx"> if (!is<Element>(*node))
</span><span class="cx"> continue;
</span><span class="cx"> if (downcast<Element>(*node).hasTagName(tagName))
</span><del>- return downcast<Element>(node);
</del><ins>+ return &downcast<Element>(*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->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& 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 && n != stayWithin; n = n->parentNode()) {
</span><span class="cx"> if (root && !n->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->rootEditableElement() : 0;
</del><ins>+ auto* rootEditableElement = node ? node->rootEditableElement() : nullptr;
</ins><span class="cx"> for (; node; node = node->parentNode()) {
</span><del>- if (RenderObject* renderer = node->renderer()) {
</del><ins>+ if (auto* renderer = node->renderer()) {
</ins><span class="cx"> if (!renderer->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& p)
</del><ins>+Element* enclosingTableCell(const Position& position)
</ins><span class="cx"> {
</span><del>- return downcast<Element>(enclosingNodeOfType(p, isTableCell));
</del><ins>+ return downcast<Element>(enclosingNodeOfType(position, isTableCell));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Element* enclosingAnchorElement(const Position& p)
</span><span class="cx"> {
</span><del>- if (p.isNull())
- return nullptr;
-
</del><span class="cx"> for (Node* node = p.deprecatedNode(); node; node = node->parentNode()) {
</span><span class="cx"> if (is<Element>(*node) && node->isLink())
</span><span class="cx"> return downcast<Element>(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->parentNode(); ancestor; ancestor = ancestor->parentNode()) {
</span><span class="cx"> if (is<HTMLUListElement>(*ancestor) || is<HTMLOListElement>(*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->parentNode()
</del><ins>+ // FIXME: This function is inappropriately named since it starts with node instead of node->parentNode()
</ins><span class="cx"> for (Node* n = node; n && n->parentNode(); n = n->parentNode()) {
</span><span class="cx"> if (n->hasTagName(liTag) || (isListElement(n->parentNode()) && 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<HTMLElement>(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& visiblePos)
</del><ins>+// FIXME: This function should not need to call isStartOfParagraph/isEndOfParagraph.
+Node* enclosingEmptyListItem(const VisiblePosition& 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->isHTMLElement() || !secondList->isHTMLElement())
</del><ins>+ if (!is<HTMLElement>(firstList) || !is<HTMLElement>(secondList))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- return firstList->hasTagName(secondList->tagQName()) // make sure the list types match (ol vs. ul)
- && firstList->hasEditableStyle() && secondList->hasEditableStyle() // both lists are editable
- && firstList->rootEditableElement() == secondList->rootEditableElement() // don't cross editing boundaries
- && isVisiblyAdjacent(positionInParentAfterNode(firstList), positionInParentBeforeNode(secondList));
- // Make sure there is no visible content between this li and the previous list
</del><ins>+ auto& first = downcast<HTMLElement>(*firstList);
+ auto& second = downcast<HTMLElement>(*secondList);
+
+ return first.localName() == second.localName() // make sure the list types match (ol vs. ul)
+ && first.hasEditableStyle() && second.hasEditableStyle() // both lists are editable
+ && first.rootEditableElement() == second.rootEditableElement() // don't cross editing boundaries
+ // Make sure there is no visible content between this li and the previous list.
+ && isVisiblyAdjacent(positionInParentAfterNode(&first), positionInParentBeforeNode(&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->parentNode())
</span><span class="cx"> return node->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->parentNode();
</span><span class="cx"> if (n)
</span><span class="cx"> return n->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<Node*>(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<Node*>(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->isElementNode())
</del><ins>+ if (!is<Element>(node))
</ins><span class="cx"> return false;
</span><del>-
- RenderObject* renderer = n->renderer();
- return (renderer && renderer->isTable());
</del><ins>+ auto* renderer = downcast<Element>(*node).renderer();
+ return renderer && renderer->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->renderer();
- if (!r)
</del><ins>+ auto* renderer = node->renderer();
+ if (!renderer)
</ins><span class="cx"> return node->hasTagName(tdTag) || node->hasTagName(thTag);
</span><del>-
- return r->isTableCell();
</del><ins>+ return renderer->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 <br>.
</span><span class="cx"> // If it's a <br>, then the parent node has to be a table cell.
</span><del>- RenderObject* renderer = node->renderer();
</del><ins>+ auto* renderer = node->renderer();
</ins><span class="cx"> if (renderer->isBR()) {
</span><span class="cx"> renderer = renderer->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 <br>.
</span><del>- RenderObject* childRenderer = downcast<RenderTableCell>(*renderer).firstChild();
</del><ins>+ auto* childRenderer = downcast<RenderTableCell>(*renderer).firstChild();
</ins><span class="cx"> if (!childRenderer)
</span><span class="cx"> return true;
</span><span class="cx"> if (!childRenderer->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<HTMLElement> createBreakElement(Document& document)
-{
- return HTMLBRElement::create(document);
-}
-
-Ref<HTMLElement> createOrderedListElement(Document& document)
-{
- return HTMLOListElement::create(document);
-}
-
-Ref<HTMLElement> createUnorderedListElement(Document& document)
-{
- return HTMLUListElement::create(document);
-}
-
-Ref<HTMLElement> createListItemElement(Document& document)
-{
- return HTMLLIElement::create(document);
-}
-
</del><span class="cx"> Ref<HTMLElement> createHTMLElement(Document& document, const QualifiedName& 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 && node->hasTagName(spanTag) && node->isElementNode() && static_cast<const Element *>(node)->getAttribute(classAttr) == AppleTabSpanClass;
</del><ins>+ return is<HTMLSpanElement>(node) && downcast<HTMLSpanElement>(*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 && node->isTextNode() && node->parentNode() && isTabSpanNode(node->parentNode());
</del><ins>+ return is<Text>(node) && isTabSpanNode(node->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->parentNode() : 0;
</del><ins>+ return isTabSpanTextNode(node) ? downcast<HTMLSpanElement>(node->parentNode()) : nullptr;
</ins><span class="cx"> }
</span><del>-
-Position positionOutsideTabSpan(const Position& 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 && VisiblePosition(pos) == lastPositionInNode(node))
- return positionInParentAfterNode(node);
-
- return positionInParentBeforeNode(node);
-}
-
-Ref<Element> createTabSpanElement(Document& document, RefPtr<Node>&& tabTextNode)
</del><ins>+static Ref<Element> createTabSpanElement(Document& document, Text& tabTextNode)
</ins><span class="cx"> {
</span><del>- // Make the span to hold the tab.
- Ref<Element> spanElement = document.createElement(spanTag, false);
</del><ins>+ auto spanElement = document.createElement(spanTag, false);
+
</ins><span class="cx"> spanElement->setAttribute(classAttr, AppleTabSpanClass);
</span><span class="cx"> spanElement->setAttribute(styleAttr, "white-space:pre");
</span><span class="cx">
</span><del>- // Add tab text to that span.
- if (!tabTextNode)
- tabTextNode = document.createEditingTextNode("\t");
</del><ins>+ spanElement->appendChild(tabTextNode, ASSERT_NO_EXCEPTION);
</ins><span class="cx">
</span><del>- spanElement->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<Element> createTabSpanElement(Document& document)
</span><span class="cx"> {
</span><del>- return createTabSpanElement(document, RefPtr<Node>());
</del><ins>+ return createTabSpanElement(document, document.createEditingTextNode(ASCIILiteral("\t")));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool isNodeRendered(const Node* node)
</del><ins>+bool isNodeRendered(const Node& node)
</ins><span class="cx"> {
</span><del>- if (!node)
- return false;
-
- RenderObject* renderer = node->renderer();
- if (!renderer)
- return false;
-
- return renderer->style().visibility() == VISIBLE;
</del><ins>+ auto* renderer = node.renderer();
+ return renderer && renderer->style().visibility() == VISIBLE;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-unsigned numEnclosingMailBlockquotes(const Position& p)
</del><ins>+unsigned numEnclosingMailBlockquotes(const Position& position)
</ins><span class="cx"> {
</span><del>- unsigned num = 0;
- for (Node* n = p.deprecatedNode(); n; n = n->parentNode())
- if (isMailBlockquote(n))
- num++;
-
- return num;
</del><ins>+ unsigned count = 0;
+ for (Node* node = position.deprecatedNode(); node; node = node->parentNode()) {
+ if (isMailBlockquote(node))
+ ++count;
+ }
+ return count;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void updatePositionForNodeRemoval(Position& position, Node& 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->hasTagName(blockquoteTag))
</del><ins>+ ASSERT(node);
+ if (!node->hasTagName(blockquoteTag))
</ins><span class="cx"> return false;
</span><del>-
- return static_cast<const Element *>(node)->getAttribute("type") == "cite";
</del><ins>+ return downcast<HTMLElement>(*node).fastGetAttribute(typeAttr) == "cite";
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-int caretMinOffset(const Node* n)
</del><ins>+int caretMinOffset(const Node& node)
</ins><span class="cx"> {
</span><del>- RenderObject* r = n->renderer();
- ASSERT(!n->isCharacterDataNode() || !r || r->isText()); // FIXME: This was a runtime check that seemingly couldn't fail; changed it to an assertion for now.
- return r ? r->caretMinOffset() : 0;
</del><ins>+ auto* renderer = node.renderer();
+ ASSERT(!node.isCharacterDataNode() || !renderer || renderer->isText());
+ return renderer ? renderer->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& 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->isTextNode() && n->renderer())
- return n->renderer()->caretMaxOffset();
</del><ins>+ if (node.isTextNode() && node.renderer())
+ return node.renderer()->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& visiblePosition)
</del><ins>+bool lineBreakExistsAtVisiblePosition(const VisiblePosition& 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& 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()->hasTagName(brTag) && position.atFirstEditingPositionForNode())
</span><span class="cx"> return true;
</span><del>-
</del><ins>+
</ins><span class="cx"> if (!position.anchorNode()->renderer())
</span><span class="cx"> return false;
</span><del>-
</del><ins>+
</ins><span class="cx"> if (!is<Text>(*position.anchorNode()) || !position.anchorNode()->renderer()->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()->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()->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& 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 && !document.inDesignMode())
</span><del>- scope = downcast<ContainerNode>(editableRoot);
</del><ins>+ scope = editableRoot;
</ins><span class="cx"> else {
</span><span class="cx"> if (position.containerNode()->isInShadowTree())
</span><span class="cx"> scope = position.containerNode()->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& visiblePosition, bool forSelectionPreservation)
</del><ins>+// FIXME: Merge this function with the one above.
+int indexForVisiblePosition(Node& node, const VisiblePosition& visiblePosition, bool forSelectionPreservation)
</ins><span class="cx"> {
</span><del>- ASSERT(node);
- RefPtr<Range> range = Range::create(node->document(), firstPositionInNode(node), visiblePosition.deepEquivalent().parentAnchoredEquivalent());
- return TextIterator::rangeLength(range.get(), forSelectionPreservation);
</del><ins>+ auto range = Range::create(node.document(), firstPositionInNode(&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<Range> 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->startPosition());
</del><ins>+ return { };
+ return { range->startPosition() };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> VisiblePosition visiblePositionForIndexUsingCharacterIterator(Node& node, int index)
</span><span class="cx"> {
</span><span class="cx"> if (index <= 0)
</span><del>- return VisiblePosition(firstPositionInOrBeforeNode(&node), DOWNSTREAM);
</del><ins>+ return { firstPositionInOrBeforeNode(&node), DOWNSTREAM };
</ins><span class="cx">
</span><span class="cx"> RefPtr<Range> range = Range::create(node.document());
</span><span class="cx"> range->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->endPosition() : it.range()->endPosition(), UPSTREAM);
</del><ins>+ return { it.atEnd() ? range->endPosition() : it.range()->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& first, const Position& second)
</del><ins>+static bool isVisiblyAdjacent(const Position& first, const Position& 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& node, const Range* selectedRange)
</del><ins>+bool isNodeVisiblyContainedWithin(Node& node, const Range& 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->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(&node) == selectedRange->startPosition();
- if (startIsVisuallySame && comparePositions(positionInParentAfterNode(&node), selectedRange->endPosition()) < 0)
</del><ins>+ bool startIsVisuallySame = visiblePositionBeforeNode(node) == range.startPosition();
+ if (startIsVisuallySame && comparePositions(positionInParentAfterNode(&node), range.endPosition()) < 0)
</ins><span class="cx"> return true;
</span><span class="cx">
</span><del>- bool endIsVisuallySame = visiblePositionAfterNode(&node) == selectedRange->endPosition();
- if (endIsVisuallySame && comparePositions(selectedRange->startPosition(), positionInParentBeforeNode(&node)) < 0)
</del><ins>+ bool endIsVisuallySame = visiblePositionAfterNode(node) == range.endPosition();
+ if (endIsVisuallySame && comparePositions(range.startPosition(), positionInParentBeforeNode(&node)) < 0)
</ins><span class="cx"> return true;
</span><span class="cx">
</span><span class="cx"> return startIsVisuallySame && endIsVisuallySame;
</span><span class="lines">@@ -1215,17 +1145,13 @@
</span><span class="cx"> return renderer && ((renderer->isTable() && !renderer->isInline()) || (renderer->isImage() && !renderer->isInline()) || renderer->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& first, const Node& second)
</ins><span class="cx"> {
</span><del>- if (!is<Element>(*first) || !is<Element>(*second))
</del><ins>+ if (!is<Element>(first) || !is<Element>(second))
</ins><span class="cx"> return false;
</span><del>-
- const Element& firstElement = downcast<Element>(*first);
- const Element& secondElement = downcast<Element>(*second);
- if (!firstElement.hasTagName(secondElement.tagQName()))
- return false;
-
- return firstElement.hasEquivalentAttributes(&secondElement);
</del><ins>+ auto& firstElement = downcast<Element>(first);
+ auto& secondElement = downcast<Element>(second);
+ return firstElement.hasTagName(secondElement.tagQName()) && firstElement.hasEquivalentAttributes(&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 "mixed" 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& node)
</ins><span class="cx"> {
</span><del>- if (!node->isElementNode())
</del><ins>+ if (!node.isElementNode())
</ins><span class="cx"> return false;
</span><del>- RenderObject* renderer = node->renderer();
</del><ins>+ auto* renderer = downcast<Element>(node).renderer();
</ins><span class="cx"> return renderer && renderer->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<Element>(node);
</span><span class="cx"> while ((node = node->parentNode())) {
</span><del>- if (isBlockFlowElement(node) || is<HTMLBodyElement>(*node))
</del><ins>+ if (isBlockFlowElement(*node) || is<HTMLBodyElement>(*node))
</ins><span class="cx"> return downcast<Element>(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->renderer();
</del><ins>+ auto* renderer = node->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 "EditingBoundary.h"
</del><span class="cx"> #include "Position.h"
</span><del>-#include "TextFlags.h"
</del><span class="cx"> #include <wtf/Forward.h>
</span><span class="cx"> #include <wtf/unicode/CharacterNames.h>
</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&, EditableType = ContentIsEditable);
</ins><span class="cx">
</span><del>-Node* highestEditableRoot(const Position&, EditableType = ContentIsEditable);
-
-Node* highestEnclosingNodeOfType(const Position&, bool (*nodeIsOfType)(const Node*),
- EditingBoundaryCrossingRule = CannotCrossEditingBoundary, Node* stayWithin = nullptr);
</del><ins>+Node* highestEnclosingNodeOfType(const Position&, 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&);
</del><ins>+Element* enclosingTableCell(const Position&);
</ins><span class="cx"> Node* enclosingEmptyListItem(const VisiblePosition&);
</span><span class="cx"> Element* enclosingAnchorElement(const Position&);
</span><span class="cx"> Element* enclosingElementWithTag(const Position&, const QualifiedName&);
</span><span class="cx"> Node* enclosingNodeOfType(const Position&, bool (*nodeIsOfType)(const Node*), EditingBoundaryCrossingRule = CannotCrossEditingBoundary);
</span><ins>+HTMLSpanElement* tabSpanNode(const Node*);
+Element* isLastPositionBeforeTable(const VisiblePosition&); // FIXME: Strange to name this isXXX, but return an element.
+Element* isFirstPositionAfterTable(const VisiblePosition&); // FIXME: Strange to name this isXXX, but return an element.
</ins><span class="cx">
</span><del>-Node* tabSpanNode(const Node*);
-Node* isLastPositionBeforeTable(const VisiblePosition&);
-Node* isFirstPositionAfterTable(const VisiblePosition&);
-
</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&);
+int caretMinOffset(const Node&);
+int caretMaxOffset(const Node&);
</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&, EditableType);
</span><span class="cx"> bool isEditableNode(const Node&);
</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->canContainRangeEndPoint();
-}
</del><ins>+bool editingIgnoresContent(const Node*);
</ins><span class="cx">
</span><del>-inline bool canHaveChildrenForEditing(const Node* node)
-{
- return !node->isTextNode() && node->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&);
</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&, const Range*);
</del><ins>+bool isNodeRendered(const Node&);
</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&, const Range&);
</ins><span class="cx">
</span><del>-WEBCORE_EXPORT TextDirection directionOfEnclosingBlock(const Position&);
</del><ins>+bool areIdenticalElements(const Node&, const Node&);
</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&);
</span><span class="cx"> Position previousCandidate(const Position&);
</span><del>-
</del><ins>+
</ins><span class="cx"> Position nextVisuallyDistinctCandidate(const Position&);
</span><span class="cx"> Position previousVisuallyDistinctCandidate(const Position&);
</span><span class="cx">
</span><del>-Position positionOutsideTabSpan(const Position&);
-Position positionBeforeContainingSpecialElement(const Position&, Node** containingSpecialElement = nullptr);
-Position positionAfterContainingSpecialElement(const Position&, Node** containingSpecialElement = nullptr);
-Position positionOutsideContainingSpecialElement(const Position&, Node** containingSpecialElement = nullptr);
</del><ins>+Position positionBeforeContainingSpecialElement(const Position&, HTMLElement** containingSpecialElement = nullptr);
+Position positionAfterContainingSpecialElement(const Position&, HTMLElement** containingSpecialElement = nullptr);
+Position positionOutsideContainingSpecialElement(const Position&, 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&, ContainerNode* root);
+Position lastEditablePositionBeforePositionInRoot(const Position&, ContainerNode* root);
</ins><span class="cx">
</span><del>-Position firstEditablePositionAfterPositionInRoot(const Position&, Node*);
-Position lastEditablePositionBeforePositionInRoot(const Position&, Node*);
-
-// comparision functions on Position
-
</del><span class="cx"> int comparePositions(const Position&, const Position&);
</span><span class="cx">
</span><del>-// boolean functions on Position
-
</del><span class="cx"> WEBCORE_EXPORT bool isEditablePosition(const Position&, EditableType = ContentIsEditable);
</span><span class="cx"> bool isRichlyEditablePosition(const Position&);
</span><del>-bool isFirstVisiblePositionInSpecialElement(const Position&);
-bool isLastVisiblePositionInSpecialElement(const Position&);
</del><span class="cx"> bool lineBreakExistsAtPosition(const Position&);
</span><del>-bool isVisiblyAdjacent(const Position& first, const Position& second);
</del><span class="cx"> bool isAtUnsplittableElement(const Position&);
</span><span class="cx">
</span><del>-// miscellaneous functions on Position
-
</del><span class="cx"> unsigned numEnclosingMailBlockquotes(const Position&);
</span><span class="cx"> void updatePositionForNodeRemoval(Position&, Node&);
</span><span class="cx">
</span><ins>+WEBCORE_EXPORT TextDirection directionOfEnclosingBlock(const Position&);
+
</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&);
+VisiblePosition visiblePositionAfterNode(Node&);
</ins><span class="cx">
</span><span class="cx"> bool lineBreakExistsAtVisiblePosition(const VisiblePosition&);
</span><del>-
</del><ins>+
</ins><span class="cx"> int comparePositions(const VisiblePosition&, const VisiblePosition&);
</span><span class="cx">
</span><span class="cx"> int indexForVisiblePosition(const VisiblePosition&, RefPtr<ContainerNode>& scope);
</span><del>-int indexForVisiblePosition(Node*, const VisiblePosition&, bool forSelectionPreservation);
</del><ins>+int indexForVisiblePosition(Node&, const VisiblePosition&, bool forSelectionPreservation);
</ins><span class="cx"> VisiblePosition visiblePositionForIndex(int index, ContainerNode* scope);
</span><span class="cx"> VisiblePosition visiblePositionForIndexUsingCharacterIterator(Node&, 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<HTMLElement> createDefaultParagraphElement(Document&);
</span><del>-Ref<HTMLElement> createBreakElement(Document&);
-Ref<HTMLElement> createOrderedListElement(Document&);
-Ref<HTMLElement> createUnorderedListElement(Document&);
-Ref<HTMLElement> createListItemElement(Document&);
</del><span class="cx"> Ref<HTMLElement> createHTMLElement(Document&, const QualifiedName&);
</span><span class="cx"> Ref<HTMLElement> createHTMLElement(Document&, const AtomicString&);
</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<Element> createTabSpanElement(Document&);
</span><del>-Ref<Element> createTabSpanElement(Document&, RefPtr<Node>&& tabTextNode);
</del><span class="cx"> Ref<Element> createTabSpanElement(Document&, const String& tabText);
</span><span class="cx"> Ref<Element> createBlockPlaceholderElement(Document&);
</span><span class="cx">
</span><span class="lines">@@ -231,19 +175,37 @@
</span><span class="cx"> Element* unsplittableElementForPosition(const Position&);
</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&);
</span><del>-
</del><span class="cx"> Position adjustedSelectionStartForStyleComputation(const VisibleSelection&);
</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&, bool startIsStartOfParagraph, bool endIsEndOfParagraph);
+const String& nonBreakingSpaceString();
+
+// Miscellaneous functions for caret rendering.
+
+RenderBlock* rendererForCaretPainting(Node*);
+LayoutRect localCaretRectInRendererForCaretPainting(const VisiblePosition&, RenderBlock*&);
+LayoutRect localCaretRectInRendererForRect(LayoutRect&, Node*, RenderObject*, RenderBlock*&);
+IntRect absoluteBoundsForLocalCaretRect(RenderBlock* rendererForCaretPainting, const LayoutRect&);
+
+// -------------------------------------------------------------------------
+
+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&, bool startIsStartOfParagraph, bool endIsEndOfParagraph);
-const String& nonBreakingSpaceString();
</del><ins>+inline bool editingIgnoresContent(const Node* node)
+{
+ return !node->canContainRangeEndPoint();
+}
</ins><span class="cx">
</span><del>-// Miscellaaneous functions that for caret rendering
</del><ins>+inline bool canHaveChildrenForEditing(const Node* node)
+{
+ return !node->isTextNode() && node->canContainRangeEndPoint();
+}
</ins><span class="cx">
</span><del>-RenderBlock* rendererForCaretPainting(Node*);
-LayoutRect localCaretRectInRendererForCaretPainting(const VisiblePosition&, RenderBlock*&);
-LayoutRect localCaretRectInRendererForRect(LayoutRect&, Node*, RenderObject*, RenderBlock*&);
-IntRect absoluteBoundsForLocalCaretRect(RenderBlock* rendererForCaretPainting, const LayoutRect&);
</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 "File.h"
</span><span class="cx"> #include "Frame.h"
</span><span class="cx"> #include "HTMLAttachmentElement.h"
</span><ins>+#include "HTMLBRElement.h"
</ins><span class="cx"> #include "HTMLBodyElement.h"
</span><span class="cx"> #include "HTMLDivElement.h"
</span><del>-#include "HTMLElement.h"
</del><span class="cx"> #include "HTMLNames.h"
</span><span class="cx"> #include "HTMLTableElement.h"
</span><span class="cx"> #include "HTMLTextAreaElement.h"
</span><span class="lines">@@ -792,7 +792,7 @@
</span><span class="cx"> if (contextPreservesNewline(context)) {
</span><span class="cx"> fragment->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->setAttribute(classAttr, AppleInterchangeNewline);
</span><span class="cx"> fragment->appendChild(element, ASSERT_NO_EXCEPTION);
</span><span class="cx"> }
</span><span class="lines">@@ -824,10 +824,10 @@
</span><span class="cx"> RefPtr<Element> element;
</span><span class="cx"> if (s.isEmpty() && i + 1 == numLines) {
</span><span class="cx"> // For last line, use the "magic BR" rather than a P.
</span><del>- element = createBreakElement(document);
</del><ins>+ element = HTMLBRElement::create(document);
</ins><span class="cx"> element->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 < 0 || offset > (node.offsetInCharacters() ? caretMaxOffset(&node) : static_cast<int>(node.countChildNodes()))) {
</del><ins>+ if (offset < 0 || offset > (node.offsetInCharacters() ? caretMaxOffset(node) : static_cast<int>(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 <darin@apple.com>
+
+ 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 <bdakin@apple.com>
</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 >= 0);
</span><span class="cx"> if (lastOffset < 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 >= 0);
</span><span class="cx"> if (lastOffset < 0)
</span><span class="cx"> return currentWebVisiblePosition;
</span></span></pre>
</div>
</div>
</body>
</html>