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

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

Issue 20294002: Fix trailing whitespace in .cpp, .h, and .idl files (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 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
« no previous file with comments | « Source/core/editing/InsertParagraphSeparatorCommand.h ('k') | Source/core/editing/InsertTextCommand.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/InsertParagraphSeparatorCommand.cpp
diff --git a/Source/core/editing/InsertParagraphSeparatorCommand.cpp b/Source/core/editing/InsertParagraphSeparatorCommand.cpp
index 3eca03506ca01381ae088077d269544c3a21db1a..84f830e69e159cc000f8163e8cdea30e2be0351b 100644
--- a/Source/core/editing/InsertParagraphSeparatorCommand.cpp
+++ b/Source/core/editing/InsertParagraphSeparatorCommand.cpp
@@ -20,7 +20,7 @@
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
@@ -58,7 +58,7 @@ static Element* highestVisuallyEquivalentDivBelowRoot(Element* startBlock)
return curBlock;
}
-InsertParagraphSeparatorCommand::InsertParagraphSeparatorCommand(Document *document, bool mustUseDefaultParagraphElement, bool pasteBlockqutoeIntoUnquotedArea)
+InsertParagraphSeparatorCommand::InsertParagraphSeparatorCommand(Document *document, bool mustUseDefaultParagraphElement, bool pasteBlockqutoeIntoUnquotedArea)
: CompositeEditCommand(document)
, m_mustUseDefaultParagraphElement(mustUseDefaultParagraphElement)
, m_pasteBlockqutoeIntoUnquotedArea(pasteBlockqutoeIntoUnquotedArea)
@@ -107,7 +107,7 @@ bool InsertParagraphSeparatorCommand::shouldUseDefaultParagraphElement(Node* enc
{
if (m_mustUseDefaultParagraphElement)
return true;
-
+
// Assumes that if there was a range selection, it was already deleted.
if (!isEndOfBlock(endingSelection().visibleStart()))
return false;
@@ -122,7 +122,7 @@ bool InsertParagraphSeparatorCommand::shouldUseDefaultParagraphElement(Node* enc
void InsertParagraphSeparatorCommand::getAncestorsInsideBlock(const Node* insertionNode, Element* outerBlock, Vector<RefPtr<Element> >& ancestors)
{
ancestors.clear();
-
+
// Build up list of ancestors elements between the insertion node and the outer block.
if (insertionNode != outerBlock) {
for (Element* n = insertionNode->parentElement(); n && n != outerBlock; n = n->parentElement())
@@ -141,7 +141,7 @@ PassRefPtr<Element> InsertParagraphSeparatorCommand::cloneHierarchyUnderNewBlock
appendNode(child, parent);
parent = child.release();
}
-
+
return parent.release();
}
@@ -149,11 +149,11 @@ void InsertParagraphSeparatorCommand::doApply()
{
if (!endingSelection().isNonOrphanedCaretOrRange())
return;
-
+
Position insertionPosition = endingSelection().start();
-
+
EAffinity affinity = endingSelection().affinity();
-
+
// Delete the current selection.
if (endingSelection().isRange()) {
calculateStyleBeforeInsertion(insertionPosition);
@@ -161,7 +161,7 @@ void InsertParagraphSeparatorCommand::doApply()
insertionPosition = endingSelection().start();
affinity = endingSelection().affinity();
}
-
+
// FIXME: The parentAnchoredEquivalent conversion needs to be moved into enclosingBlock.
RefPtr<Element> startBlock = enclosingBlock(insertionPosition.parentAnchoredEquivalent().containerNode());
Position canonicalPos = VisiblePosition(insertionPosition).deepEquivalent();
@@ -175,7 +175,7 @@ void InsertParagraphSeparatorCommand::doApply()
applyCommandToComposite(InsertLineBreakCommand::create(document()));
return;
}
-
+
// Use the leftmost candidate.
insertionPosition = insertionPosition.upstream();
if (!insertionPosition.isCandidate())
@@ -203,14 +203,14 @@ void InsertParagraphSeparatorCommand::doApply()
if (startBlock->isRootEditableElement()) {
blockToInsert = createDefaultParagraphElement(document());
nestNewBlock = true;
- } else if (shouldUseDefaultParagraphElement(startBlock.get()))
+ } else if (shouldUseDefaultParagraphElement(startBlock.get()))
blockToInsert = createDefaultParagraphElement(document());
else
blockToInsert = startBlock->cloneElementWithoutChildren();
//---------------------------------------------------------------------
// Handle case when position is in the last visible position in its block,
- // including when the block is empty.
+ // including when the block is empty.
if (isLastInBlock) {
if (nestNewBlock) {
if (isFirstInBlock && !lineBreakExistsAtVisiblePosition(visiblePos)) {
@@ -238,24 +238,24 @@ void InsertParagraphSeparatorCommand::doApply()
}
// Recreate the same structure in the new paragraph.
-
+
Vector<RefPtr<Element> > ancestors;
- getAncestorsInsideBlock(positionOutsideTabSpan(insertionPosition).deprecatedNode(), startBlock.get(), ancestors);
+ getAncestorsInsideBlock(positionOutsideTabSpan(insertionPosition).deprecatedNode(), startBlock.get(), ancestors);
RefPtr<Element> parent = cloneHierarchyUnderNewBlock(ancestors, blockToInsert);
-
+
appendBlockPlaceholder(parent);
setEndingSelection(VisibleSelection(firstPositionInNode(parent.get()), DOWNSTREAM, endingSelection().isDirectional()));
return;
}
-
+
//---------------------------------------------------------------------
// Handle case when position is in the first visible position in its block, and
// similar case where previous position is in another, presumeably nested, block.
if (isFirstInBlock || !inSameBlock(visiblePos, visiblePos.previous())) {
Node *refNode;
-
+
insertionPosition = positionOutsideTabSpan(insertionPosition);
if (isFirstInBlock && !nestNewBlock)
@@ -273,16 +273,16 @@ void InsertParagraphSeparatorCommand::doApply()
// find ending selection position easily before inserting the paragraph
insertionPosition = insertionPosition.downstream();
-
+
insertNodeBefore(blockToInsert, refNode);
// Recreate the same structure in the new paragraph.
Vector<RefPtr<Element> > ancestors;
getAncestorsInsideBlock(positionAvoidingSpecialElementBoundary(positionOutsideTabSpan(insertionPosition)).deprecatedNode(), startBlock.get(), ancestors);
-
+
appendBlockPlaceholder(cloneHierarchyUnderNewBlock(ancestors, blockToInsert));
-
+
// In this case, we need to set the new ending selection.
setEndingSelection(VisibleSelection(insertionPosition, DOWNSTREAM, endingSelection().isDirectional()));
return;
@@ -292,8 +292,8 @@ void InsertParagraphSeparatorCommand::doApply()
// Handle the (more complicated) general case,
// All of the content in the current block after visiblePos is
- // about to be wrapped in a new paragraph element. Add a br before
- // it if visiblePos is at the start of a paragraph so that the
+ // about to be wrapped in a new paragraph element. Add a br before
+ // it if visiblePos is at the start of a paragraph so that the
// content will move down a line.
if (isStartOfParagraph(visiblePos)) {
RefPtr<Element> br = createBreakElement(document());
@@ -306,8 +306,8 @@ void InsertParagraphSeparatorCommand::doApply()
return;
}
}
-
- // Move downstream. Typing style code will take care of carrying along the
+
+ // Move downstream. Typing style code will take care of carrying along the
// style of the upstream position.
insertionPosition = insertionPosition.downstream();
@@ -335,7 +335,7 @@ void InsertParagraphSeparatorCommand::doApply()
ASSERT(!textNode->renderer() || textNode->renderer()->style()->collapseWhiteSpace());
replaceTextInNodePreservingMarkers(textNode, leadingWhitespace.deprecatedEditingOffset(), 1, nonBreakingSpaceString());
}
-
+
// Split at pos if in the middle of a text node.
Position positionAfterSplit;
if (insertionPosition.anchorType() == Position::PositionIsOffsetInAnchor && insertionPosition.containerNode()->isTextNode()) {
@@ -362,7 +362,7 @@ void InsertParagraphSeparatorCommand::doApply()
document()->updateLayoutIgnorePendingStylesheets();
// If the paragraph separator was inserted at the end of a paragraph, an empty line must be
- // created. All of the nodes, starting at visiblePos, are about to be added to the new paragraph
+ // created. All of the nodes, starting at visiblePos, are about to be added to the new paragraph
// element. If the first node to be inserted won't be one that will hold an empty line open, add a br.
if (isEndOfParagraph(visiblePos) && !lineBreakExistsAtVisiblePosition(visiblePos))
appendNode(createBreakElement(document()).get(), blockToInsert.get());
@@ -387,7 +387,7 @@ void InsertParagraphSeparatorCommand::doApply()
}
moveRemainingSiblingsToNewParent(n, blockToInsert.get(), blockToInsert);
- }
+ }
// Handle whitespace that occurs after the split
if (positionAfterSplit.isNotNull()) {
« no previous file with comments | « Source/core/editing/InsertParagraphSeparatorCommand.h ('k') | Source/core/editing/InsertTextCommand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698