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

Unified Diff: Source/core/editing/InsertTextCommand.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/InsertTextCommand.h ('k') | Source/core/editing/MergeIdenticalElementsCommand.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/InsertTextCommand.cpp
diff --git a/Source/core/editing/InsertTextCommand.cpp b/Source/core/editing/InsertTextCommand.cpp
index 092578c8169b4b36f55f4089111995d8efd6ca39..330246b297ccce67a19f099b6a6b2ddbdb1970e9 100644
--- a/Source/core/editing/InsertTextCommand.cpp
+++ b/Source/core/editing/InsertTextCommand.cpp
@@ -36,7 +36,7 @@
namespace WebCore {
-InsertTextCommand::InsertTextCommand(Document* document, const String& text, bool selectInsertedText, RebalanceType rebalanceType)
+InsertTextCommand::InsertTextCommand(Document& document, const String& text, bool selectInsertedText, RebalanceType rebalanceType)
: CompositeEditCommand(document)
, m_text(text)
, m_selectInsertedText(selectInsertedText)
@@ -44,7 +44,7 @@ InsertTextCommand::InsertTextCommand(Document* document, const String& text, boo
{
}
-InsertTextCommand::InsertTextCommand(Document* document, const String& text, PassRefPtr<TextInsertionMarkerSupplier> markerSupplier)
+InsertTextCommand::InsertTextCommand(Document& document, const String& text, PassRefPtr<TextInsertionMarkerSupplier> markerSupplier)
: CompositeEditCommand(document)
, m_text(text)
, m_selectInsertedText(false)
@@ -57,7 +57,7 @@ Position InsertTextCommand::positionInsideTextNode(const Position& p)
{
Position pos = p;
if (isTabSpanTextNode(pos.anchorNode())) {
- RefPtr<Node> textNode = document()->createEditingTextNode("");
+ RefPtr<Node> textNode = document().createEditingTextNode("");
insertNodeAtTabSpanPosition(textNode.get(), pos);
return firstPositionInNode(textNode.get());
}
@@ -65,7 +65,7 @@ Position InsertTextCommand::positionInsideTextNode(const Position& p)
// Prepare for text input by looking at the specified position.
// It may be necessary to insert a text node to receive characters.
if (!pos.containerNode()->isTextNode()) {
- RefPtr<Node> textNode = document()->createEditingTextNode("");
+ RefPtr<Node> textNode = document().createEditingTextNode("");
insertNodeAt(textNode.get(), pos);
return firstPositionInNode(textNode.get());
}
@@ -145,7 +145,7 @@ void InsertTextCommand::doApply()
// anything other than NoSelection. The rest of this function requires a real endingSelection, so bail out.
if (endingSelection().isNone())
return;
- } else if (document()->frame()->editor().isOverwriteModeEnabled()) {
+ } else if (document().frame()->editor().isOverwriteModeEnabled()) {
if (performOverwrite(m_text, m_selectInsertedText))
return;
}
@@ -221,7 +221,7 @@ void InsertTextCommand::doApply()
setEndingSelectionWithoutValidation(startPosition, endPosition);
// Handle the case where there is a typing style.
- if (RefPtr<EditingStyle> typingStyle = document()->frame()->selection()->typingStyle()) {
+ if (RefPtr<EditingStyle> typingStyle = document().frame()->selection()->typingStyle()) {
typingStyle->prepareToApplyAt(endPosition, EditingStyle::PreserveWritingDirection);
if (!typingStyle->isEmpty())
applyStyle(typingStyle.get());
@@ -246,7 +246,7 @@ Position InsertTextCommand::insertTab(const Position& pos)
}
// create new tab span
- RefPtr<Element> spanNode = createTabSpanElement(document());
+ RefPtr<Element> spanNode = createTabSpanElement(&document());
// place it
if (!node->isTextNode()) {
« no previous file with comments | « Source/core/editing/InsertTextCommand.h ('k') | Source/core/editing/MergeIdenticalElementsCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698