Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Unified Diff: third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp

Issue 2140733003: [Editing][CodeHealth] Make Node::rootEditableElement static (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
index 075873b2a98f0898cea62dcf6edf1ee189b165d4..f632afe5f2bcc2fc720d6ca776000b90d9c0e72b 100644
--- a/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
@@ -369,7 +369,7 @@ void DeleteSelectionCommand::removeNode(Node* node, EditingState* editingState,
}
}
- if (isTableStructureNode(node) || node->isRootEditableElement()) {
+ if (isTableStructureNode(node) || isRootEditableElement(*node)) {
// Do not remove an element of table structure; remove its contents.
// Likewise for the root editable element.
Node* child = node->firstChild();
@@ -441,12 +441,12 @@ void DeleteSelectionCommand::makeStylingElementsDirectChildrenOfEditableRootToPr
Node* nextNode = NodeTraversal::next(*node);
if (isHTMLStyleElement(*node) || isHTMLLinkElement(*node)) {
nextNode = NodeTraversal::nextSkippingChildren(*node);
- Element* rootEditableElement = node->rootEditableElement();
- if (rootEditableElement) {
+ Element* element = rootEditableElement(*node);
+ if (element) {
removeNode(node, editingState);
if (editingState->isAborted())
return;
- appendNode(node, rootEditableElement, editingState);
+ appendNode(node, element, editingState);
if (editingState->isAborted())
return;
}
@@ -809,7 +809,7 @@ void DeleteSelectionCommand::clearTransientState()
void DeleteSelectionCommand::removeRedundantBlocks(EditingState* editingState)
{
Node* node = m_endingPosition.computeContainerNode();
- Element* rootElement = node->rootEditableElement();
+ Element* rootElement = rootEditableElement(*node);
while (node != rootElement) {
if (isRemovableBlock(node)) {
@@ -840,8 +840,8 @@ void DeleteSelectionCommand::doApply(EditingState* editingState)
TextAffinity affinity = m_selectionToDelete.affinity();
Position downstreamEnd = mostForwardCaretPosition(m_selectionToDelete.end());
- bool rootWillStayOpenWithoutPlaceholder = downstreamEnd.computeContainerNode() == downstreamEnd.computeContainerNode()->rootEditableElement()
- || (downstreamEnd.computeContainerNode()->isTextNode() && downstreamEnd.computeContainerNode()->parentNode() == downstreamEnd.computeContainerNode()->rootEditableElement());
+ bool rootWillStayOpenWithoutPlaceholder = downstreamEnd.computeContainerNode() == rootEditableElement(*downstreamEnd.computeContainerNode())
+ || (downstreamEnd.computeContainerNode()->isTextNode() && downstreamEnd.computeContainerNode()->parentNode() == rootEditableElement(*downstreamEnd.computeContainerNode()));
bool lineBreakAtEndOfSelectionToDelete = lineBreakExistsAtVisiblePosition(m_selectionToDelete.visibleEnd());
m_needPlaceholder = !rootWillStayOpenWithoutPlaceholder
&& isStartOfParagraph(m_selectionToDelete.visibleStart(), CanCrossEditingBoundary)

Powered by Google App Engine
This is Rietveld 408576698