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

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

Issue 2149893003: Rename Node::inShadowIncludingDocument() to Node::isConnected() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed 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 f632afe5f2bcc2fc720d6ca776000b90d9c0e72b..1034596615e1f722207656ac81c84221c37fd687 100644
--- a/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
@@ -557,7 +557,7 @@ void DeleteSelectionCommand::handleGeneralDelete(EditingState* editingState)
}
}
- if (m_downstreamEnd.anchorNode() != startNode && !m_upstreamStart.anchorNode()->isDescendantOf(m_downstreamEnd.anchorNode()) && m_downstreamEnd.inShadowIncludingDocument() && m_downstreamEnd.computeEditingOffset() >= caretMinOffset(m_downstreamEnd.anchorNode())) {
+ if (m_downstreamEnd.anchorNode() != startNode && !m_upstreamStart.anchorNode()->isDescendantOf(m_downstreamEnd.anchorNode()) && m_downstreamEnd.isConnected() && m_downstreamEnd.computeEditingOffset() >= caretMinOffset(m_downstreamEnd.anchorNode())) {
if (m_downstreamEnd.atLastEditingPositionForNode() && !canHaveChildrenForEditing(m_downstreamEnd.anchorNode())) {
// The node itself is fully selected, not just its contents. Delete it.
removeNode(m_downstreamEnd.anchorNode(), editingState);
@@ -574,7 +574,7 @@ void DeleteSelectionCommand::handleGeneralDelete(EditingState* editingState)
// know how many children to remove.
// FIXME: Make m_upstreamStart a position we update as we remove content, then we can
// always know which children to remove.
- } else if (!(startNodeWasDescendantOfEndNode && !m_upstreamStart.inShadowIncludingDocument())) {
+ } else if (!(startNodeWasDescendantOfEndNode && !m_upstreamStart.isConnected())) {
int offset = 0;
if (m_upstreamStart.anchorNode()->isDescendantOf(m_downstreamEnd.anchorNode())) {
Node* n = m_upstreamStart.anchorNode();
@@ -632,7 +632,7 @@ void DeleteSelectionCommand::mergeParagraphs(EditingState* editingState)
DCHECK(!m_pruneStartBlockIfNecessary);
// FIXME: Deletion should adjust selection endpoints as it removes nodes so that we never get into this state (4099839).
- if (!m_downstreamEnd.inShadowIncludingDocument() || !m_upstreamStart.inShadowIncludingDocument())
+ if (!m_downstreamEnd.isConnected() || !m_upstreamStart.isConnected())
return;
// FIXME: The deletion algorithm shouldn't let this happen.
@@ -717,7 +717,7 @@ void DeleteSelectionCommand::mergeParagraphs(EditingState* editingState)
void DeleteSelectionCommand::removePreviouslySelectedEmptyTableRows(EditingState* editingState)
{
- if (m_endTableRow && m_endTableRow->inShadowIncludingDocument() && m_endTableRow != m_startTableRow) {
+ if (m_endTableRow && m_endTableRow->isConnected() && m_endTableRow != m_startTableRow) {
Node* row = m_endTableRow->previousSibling();
while (row && row != m_startTableRow) {
Node* previousRow = row->previousSibling();
@@ -734,7 +734,7 @@ void DeleteSelectionCommand::removePreviouslySelectedEmptyTableRows(EditingState
}
// Remove empty rows after the start row.
- if (m_startTableRow && m_startTableRow->inShadowIncludingDocument() && m_startTableRow != m_endTableRow) {
+ if (m_startTableRow && m_startTableRow->isConnected() && m_startTableRow != m_endTableRow) {
Node* row = m_startTableRow->nextSibling();
while (row && row != m_endTableRow) {
Node* nextRow = row->nextSibling();
@@ -747,7 +747,7 @@ void DeleteSelectionCommand::removePreviouslySelectedEmptyTableRows(EditingState
}
}
- if (m_endTableRow && m_endTableRow->inShadowIncludingDocument() && m_endTableRow != m_startTableRow) {
+ if (m_endTableRow && m_endTableRow->isConnected() && m_endTableRow != m_startTableRow) {
if (isTableRowEmpty(m_endTableRow.get())) {
// Don't remove m_endTableRow if it's where we're putting the ending
// selection.
@@ -914,7 +914,7 @@ void DeleteSelectionCommand::doApply(EditingState* editingState)
}
// handleGeneralDelete cause DOM mutation events so |m_endingPosition|
// can be out of document.
- if (m_endingPosition.inShadowIncludingDocument()) {
+ if (m_endingPosition.isConnected()) {
insertNodeAt(placeholder, m_endingPosition, editingState);
if (editingState->isAborted())
return;

Powered by Google App Engine
This is Rietveld 408576698