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

Unified Diff: Source/core/editing/DeleteSelectionCommand.cpp

Issue 1292303005: Make core/editing/ files to match Blink coding style (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-18T10:48:50 Created 5 years, 4 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
« no previous file with comments | « Source/core/editing/CreateLinkCommand.cpp ('k') | Source/core/editing/EditAction.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/DeleteSelectionCommand.cpp
diff --git a/Source/core/editing/DeleteSelectionCommand.cpp b/Source/core/editing/DeleteSelectionCommand.cpp
index 58ad9c54fe5092a0e14befa45989e0093b3dd788..51ff2da0cf3e021786bdf275694dcc4b3b7a69bc 100644
--- a/Source/core/editing/DeleteSelectionCommand.cpp
+++ b/Source/core/editing/DeleteSelectionCommand.cpp
@@ -58,10 +58,10 @@ static bool isTableRowEmpty(Node* row)
if (!isHTMLTableRowElement(row))
return false;
- for (Node* child = row->firstChild(); child; child = child->nextSibling())
+ for (Node* child = row->firstChild(); child; child = child->nextSibling()) {
if (isTableCell(child) && !isTableCellEmpty(child))
return false;
-
+ }
return true;
}
@@ -140,15 +140,15 @@ void DeleteSelectionCommand::initializeStartEnd(Position& start, Position& end)
if (endSpecialContainer && !startSpecialContainer && comparePositions(start, positionInParentBeforeNode(*endSpecialContainer)) > -1)
break;
- if (startSpecialContainer && startSpecialContainer->isDescendantOf(endSpecialContainer))
+ if (startSpecialContainer && startSpecialContainer->isDescendantOf(endSpecialContainer)) {
// Don't adjust the end yet, it is the end of a special element that contains the start
// special element (which may or may not be fully selected).
start = s;
- else if (endSpecialContainer && endSpecialContainer->isDescendantOf(startSpecialContainer))
+ } else if (endSpecialContainer && endSpecialContainer->isDescendantOf(startSpecialContainer)) {
// Don't adjust the start yet, it is the start of a special element that contains the end
// special element (which may or may not be fully selected).
end = e;
- else {
+ } else {
start = s;
end = e;
}
@@ -208,8 +208,8 @@ void DeleteSelectionCommand::initializePositionData()
// Only apply this rule if the endingSelection is a range selection. If it is a caret, then other operations have created
// the selection we're deleting (like the process of creating a selection to delete during a backspace), and the user isn't in the situation described above.
if (numEnclosingMailBlockquotes(start) != numEnclosingMailBlockquotes(end)
- && isStartOfParagraph(visibleEnd) && isStartOfParagraph(VisiblePosition(start))
- && endingSelection().isRange()) {
+ && isStartOfParagraph(visibleEnd) && isStartOfParagraph(VisiblePosition(start))
+ && endingSelection().isRange()) {
m_mergeBlocksAfterDelete = false;
m_pruneStartBlockIfNecessary = true;
}
@@ -491,8 +491,7 @@ void DeleteSelectionCommand::handleGeneralDelete()
// The selection to delete is all in one node.
if (!startNode->layoutObject() || (!startOffset && m_downstreamEnd.atLastEditingPositionForNode()))
removeNode(startNode);
- }
- else {
+ } else {
bool startNodeWasDescendantOfEndNode = m_upstreamStart.anchorNode()->isDescendantOf(m_downstreamEnd.anchorNode());
// The selection to delete spans more than one node.
RefPtrWillBeRawPtr<Node> node(startNode);
@@ -604,7 +603,7 @@ void DeleteSelectionCommand::mergeParagraphs()
// FIXME: Deletion should adjust selection endpoints as it removes nodes so that we never get into this state (4099839).
if (!m_downstreamEnd.inDocument() || !m_upstreamStart.inDocument())
- return;
+ return;
// FIXME: The deletion algorithm shouldn't let this happen.
if (comparePositions(m_upstreamStart, m_downstreamEnd) > 0)
@@ -684,10 +683,12 @@ void DeleteSelectionCommand::removePreviouslySelectedEmptyTableRows()
Node* row = m_endTableRow->previousSibling();
while (row && row != m_startTableRow) {
RefPtrWillBeRawPtr<Node> previousRow = row->previousSibling();
- if (isTableRowEmpty(row))
- // Use a raw removeNode, instead of DeleteSelectionCommand's, because
- // that won't remove rows, it only empties them in preparation for this function.
+ if (isTableRowEmpty(row)) {
+ // Use a raw removeNode, instead of DeleteSelectionCommand's,
+ // because that won't remove rows, it only empties them in
+ // preparation for this function.
CompositeEditCommand::removeNode(row);
+ }
row = previousRow.get();
}
}
@@ -703,16 +704,19 @@ void DeleteSelectionCommand::removePreviouslySelectedEmptyTableRows()
}
}
- if (m_endTableRow && m_endTableRow->inDocument() && m_endTableRow != m_startTableRow)
+ if (m_endTableRow && m_endTableRow->inDocument() && m_endTableRow != m_startTableRow) {
if (isTableRowEmpty(m_endTableRow.get())) {
- // Don't remove m_endTableRow if it's where we're putting the ending selection.
+ // Don't remove m_endTableRow if it's where we're putting the ending
+ // selection.
if (!m_endingPosition.anchorNode()->isDescendantOf(m_endTableRow.get())) {
- // FIXME: We probably shouldn't remove m_endTableRow unless it's fully selected, even if it is empty.
- // We'll need to start adjusting the selection endpoints during deletion to know whether or not m_endTableRow
- // was fully selected here.
+ // FIXME: We probably shouldn't remove m_endTableRow unless it's
+ // fully selected, even if it is empty. We'll need to start
+ // adjusting the selection endpoints during deletion to know
+ // whether or not m_endTableRow was fully selected here.
CompositeEditCommand::removeNode(m_endTableRow.get());
}
}
+ }
}
void DeleteSelectionCommand::calculateTypingStyleAfterDelete()
@@ -769,8 +773,9 @@ void DeleteSelectionCommand::removeRedundantBlocks()
CompositeEditCommand::removeNodePreservingChildren(node);
node = m_endingPosition.anchorNode();
- } else
+ } else {
node = node->parentNode();
+ }
}
}
@@ -796,12 +801,13 @@ void DeleteSelectionCommand::doApply()
&& isEndOfParagraph(m_selectionToDelete.visibleEnd(), CanCrossEditingBoundary)
&& !lineBreakAtEndOfSelectionToDelete;
if (m_needPlaceholder) {
- // Don't need a placeholder when deleting a selection that starts just before a table
- // and ends inside it (we do need placeholders to hold open empty cells, but that's
- // handled elsewhere).
- if (Element* table = isLastPositionBeforeTable(m_selectionToDelete.visibleStart()))
+ // Don't need a placeholder when deleting a selection that starts just
+ // before a table and ends inside it (we do need placeholders to hold
+ // open empty cells, but that's handled elsewhere).
+ if (Element* table = isLastPositionBeforeTable(m_selectionToDelete.visibleStart())) {
if (m_selectionToDelete.end().anchorNode()->isDescendantOf(table))
m_needPlaceholder = false;
+ }
}
« no previous file with comments | « Source/core/editing/CreateLinkCommand.cpp ('k') | Source/core/editing/EditAction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698