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

Side by Side Diff: Source/core/editing/InsertParagraphSeparatorCommand.cpp

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 { 74 {
75 // It is only important to set a style to apply later if we're at the bounda ries of 75 // It is only important to set a style to apply later if we're at the bounda ries of
76 // a paragraph. Otherwise, content that is moved as part of the work of the command 76 // a paragraph. Otherwise, content that is moved as part of the work of the command
77 // will lend their styles to the new paragraph without any extra work needed . 77 // will lend their styles to the new paragraph without any extra work needed .
78 VisiblePosition visiblePos(pos, VP_DEFAULT_AFFINITY); 78 VisiblePosition visiblePos(pos, VP_DEFAULT_AFFINITY);
79 if (!isStartOfParagraph(visiblePos) && !isEndOfParagraph(visiblePos)) 79 if (!isStartOfParagraph(visiblePos) && !isEndOfParagraph(visiblePos))
80 return; 80 return;
81 81
82 ASSERT(pos.isNotNull()); 82 ASSERT(pos.isNotNull());
83 m_style = EditingStyle::create(pos); 83 m_style = EditingStyle::create(pos);
84 m_style->mergeTypingStyle(pos.anchorNode()->document()); 84 m_style->mergeTypingStyle(&pos.anchorNode()->document());
85 } 85 }
86 86
87 void InsertParagraphSeparatorCommand::applyStyleAfterInsertion(Node* originalEnc losingBlock) 87 void InsertParagraphSeparatorCommand::applyStyleAfterInsertion(Node* originalEnc losingBlock)
88 { 88 {
89 // Not only do we break out of header tags, but we also do not preserve the typing style, 89 // Not only do we break out of header tags, but we also do not preserve the typing style,
90 // in order to match other browsers. 90 // in order to match other browsers.
91 if (originalEnclosingBlock->hasTagName(h1Tag) || 91 if (originalEnclosingBlock->hasTagName(h1Tag) ||
92 originalEnclosingBlock->hasTagName(h2Tag) || 92 originalEnclosingBlock->hasTagName(h2Tag) ||
93 originalEnclosingBlock->hasTagName(h3Tag) || 93 originalEnclosingBlock->hasTagName(h3Tag) ||
94 originalEnclosingBlock->hasTagName(h4Tag) || 94 originalEnclosingBlock->hasTagName(h4Tag) ||
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 if (positionAfterSplit.deprecatedNode()->isTextNode()) 399 if (positionAfterSplit.deprecatedNode()->isTextNode())
400 insertTextIntoNode(toText(positionAfterSplit.containerNode()), 0 , nonBreakingSpaceString()); 400 insertTextIntoNode(toText(positionAfterSplit.containerNode()), 0 , nonBreakingSpaceString());
401 } 401 }
402 } 402 }
403 403
404 setEndingSelection(VisibleSelection(firstPositionInNode(blockToInsert.get()) , DOWNSTREAM, endingSelection().isDirectional())); 404 setEndingSelection(VisibleSelection(firstPositionInNode(blockToInsert.get()) , DOWNSTREAM, endingSelection().isDirectional()));
405 applyStyleAfterInsertion(startBlock.get()); 405 applyStyleAfterInsertion(startBlock.get());
406 } 406 }
407 407
408 } // namespace WebCore 408 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/editing/InsertNodeBeforeCommand.cpp ('k') | Source/core/editing/MarkupAccumulator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698