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

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

Issue 23822003: Have EditCommand classes deal with Document references, not pointers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/editing/InsertLineBreakCommand.h ('k') | Source/core/editing/InsertListCommand.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/InsertLineBreakCommand.cpp
diff --git a/Source/core/editing/InsertLineBreakCommand.cpp b/Source/core/editing/InsertLineBreakCommand.cpp
index 22d9ff26e9b0d85b2225b65b911881ee9362f7a1..4862f6f7cff45563a060114e53f3378bfae86ff1 100644
--- a/Source/core/editing/InsertLineBreakCommand.cpp
+++ b/Source/core/editing/InsertLineBreakCommand.cpp
@@ -43,7 +43,7 @@ namespace WebCore {
using namespace HTMLNames;
-InsertLineBreakCommand::InsertLineBreakCommand(Document* document)
+InsertLineBreakCommand::InsertLineBreakCommand(Document& document)
: CompositeEditCommand(document)
{
}
@@ -108,9 +108,9 @@ void InsertLineBreakCommand::doApply()
RefPtr<Node> nodeToInsert;
if (shouldUseBreakElement(pos))
- nodeToInsert = createBreakElement(document());
+ nodeToInsert = createBreakElement(&document());
else
- nodeToInsert = document()->createTextNode("\n");
+ nodeToInsert = document().createTextNode("\n");
// FIXME: Need to merge text nodes when inserting just after or before text.
@@ -145,7 +145,7 @@ void InsertLineBreakCommand::doApply()
Position endingPosition = firstPositionInNode(textNode);
// Handle whitespace that occurs after the split
- document()->updateLayoutIgnorePendingStylesheets();
+ document().updateLayoutIgnorePendingStylesheets();
if (!endingPosition.isRenderedCharacter()) {
Position positionBeforeTextNode(positionInParentBeforeNode(textNode));
// Clear out all whitespace and insert one non-breaking space
@@ -155,7 +155,7 @@ void InsertLineBreakCommand::doApply()
if (textNode->inDocument())
insertTextIntoNode(textNode, 0, nonBreakingSpaceString());
else {
- RefPtr<Text> nbspNode = document()->createTextNode(nonBreakingSpaceString());
+ RefPtr<Text> nbspNode = document().createTextNode(nonBreakingSpaceString());
insertNodeAt(nbspNode.get(), positionBeforeTextNode);
endingPosition = firstPositionInNode(nbspNode.get());
}
@@ -166,7 +166,7 @@ void InsertLineBreakCommand::doApply()
// Handle the case where there is a typing style.
- RefPtr<EditingStyle> typingStyle = document()->frame()->selection()->typingStyle();
+ RefPtr<EditingStyle> typingStyle = document().frame()->selection()->typingStyle();
if (typingStyle && !typingStyle->isEmpty()) {
// Apply the typing style to the inserted line break, so that if the selection
« no previous file with comments | « Source/core/editing/InsertLineBreakCommand.h ('k') | Source/core/editing/InsertListCommand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698