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

Unified Diff: Source/core/editing/CompositeEditCommand.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/BreakBlockquoteCommand.cpp ('k') | Source/core/editing/CreateLinkCommand.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/CompositeEditCommand.cpp
diff --git a/Source/core/editing/CompositeEditCommand.cpp b/Source/core/editing/CompositeEditCommand.cpp
index 7947efae524173099cd4cd5f3cbc3dc486a7f317..ca322e7fb3e2b3d7d8a5a9b55f7be7ca106b8749 100644
--- a/Source/core/editing/CompositeEditCommand.cpp
+++ b/Source/core/editing/CompositeEditCommand.cpp
@@ -320,9 +320,9 @@ void CompositeEditCommand::insertNodeAfter(PassRefPtrWillBeRawPtr<Node> insertCh
ContainerNode* parent = refChild->parentNode();
ASSERT(parent);
ASSERT(!parent->isShadowRoot());
- if (parent->lastChild() == refChild)
+ if (parent->lastChild() == refChild) {
appendNode(insertChild, parent);
- else {
+ } else {
ASSERT(refChild->nextSibling());
insertNodeBefore(insertChild, refChild->nextSibling());
}
@@ -345,17 +345,18 @@ void CompositeEditCommand::insertNodeAt(PassRefPtrWillBeRawPtr<Node> insertChild
insertNodeBefore(insertChild, child);
else
appendNode(insertChild, toContainerNode(refChild));
- } else if (caretMinOffset(refChild) >= offset)
+ } else if (caretMinOffset(refChild) >= offset) {
insertNodeBefore(insertChild, refChild);
- else if (refChild->isTextNode() && caretMaxOffset(refChild) > offset) {
+ } else if (refChild->isTextNode() && caretMaxOffset(refChild) > offset) {
splitTextNode(toText(refChild), offset);
// Mutation events (bug 22634) from the text node insertion may have removed the refChild
if (!refChild->inDocument())
return;
insertNodeBefore(insertChild, refChild);
- } else
+ } else {
insertNodeAfter(insertChild, refChild);
+ }
}
void CompositeEditCommand::appendNode(PassRefPtrWillBeRawPtr<Node> node, PassRefPtrWillBeRawPtr<ContainerNode> parent)
@@ -674,10 +675,12 @@ void CompositeEditCommand::rebalanceWhitespaceOnTextSubstring(PassRefPtrWillBeRa
String string = text.substring(upstream, length);
String rebalancedString = stringWithRebalancedWhitespace(string,
- // FIXME: Because of the problem mentioned at the top of this function, we must also use nbsps at the start/end of the string because
- // this function doesn't get all surrounding whitespace, just the whitespace in the current text node.
- isStartOfParagraph(visibleUpstreamPos) || upstream == 0,
- isEndOfParagraph(visibleDownstreamPos) || (unsigned)downstream == text.length());
+ // FIXME: Because of the problem mentioned at the top of this function, we
+ // must also use nbsps at the start/end of the string because this function
+ // doesn't get all surrounding whitespace, just the whitespace in the
+ // current text node.
+ isStartOfParagraph(visibleUpstreamPos) || upstream == 0,
+ isEndOfParagraph(visibleDownstreamPos) || (unsigned)downstream == text.length());
if (string != rebalancedString)
replaceTextInNodePreservingMarkers(textNode.release(), upstream, length, rebalancedString);
@@ -769,9 +772,10 @@ void CompositeEditCommand::deleteInsignificantText(PassRefPtrWillBeRawPtr<Text>
// and also will look at the gap after the last box.
while (prevBox || box) {
unsigned gapStart = prevBox ? prevBox->start() + prevBox->len() : 0;
- if (end < gapStart)
+ if (end < gapStart) {
// No more chance for any intersections
break;
+ }
unsigned gapEnd = box ? box->start() : length;
bool indicesIntersect = start <= gapEnd && end >= gapStart;
@@ -796,9 +800,9 @@ void CompositeEditCommand::deleteInsignificantText(PassRefPtrWillBeRawPtr<Text>
if (!str.isNull()) {
// Replace the text between start and end with our pruned version.
- if (!str.isEmpty())
+ if (!str.isEmpty()) {
replaceTextInNode(textNode, start, end - start, str);
- else {
+ } else {
// Assert that we are not going to delete all of the text in the node.
// If we were, that should have been done above with the call to
// removeNode and return.
@@ -1103,8 +1107,7 @@ void CompositeEditCommand::cleanupAfterDeletion(VisiblePosition destination)
return;
}
removeNodeAndPruneAncestors(node, destinationNode);
- }
- else if (lineBreakExistsAtPosition(position)) {
+ } else if (lineBreakExistsAtPosition(position)) {
// There is a preserved '\n' at caretAfterDelete.
// We can safely assume this is a text node.
Text* textNode = toText(node);
« no previous file with comments | « Source/core/editing/BreakBlockquoteCommand.cpp ('k') | Source/core/editing/CreateLinkCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698