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

Unified Diff: Source/core/editing/DeleteSelectionCommand.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/DeleteSelectionCommand.h ('k') | Source/core/editing/EditCommand.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/DeleteSelectionCommand.cpp
diff --git a/Source/core/editing/DeleteSelectionCommand.cpp b/Source/core/editing/DeleteSelectionCommand.cpp
index 341ae5838bee53d39d3095dfb9ca08bc99d0e76f..39b7546220723b51630ed69e17832ea882a5ac29 100644
--- a/Source/core/editing/DeleteSelectionCommand.cpp
+++ b/Source/core/editing/DeleteSelectionCommand.cpp
@@ -67,7 +67,7 @@ static bool isTableRowEmpty(Node* row)
return true;
}
-DeleteSelectionCommand::DeleteSelectionCommand(Document *document, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements, bool sanitizeMarkup)
+DeleteSelectionCommand::DeleteSelectionCommand(Document& document, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements, bool sanitizeMarkup)
: CompositeEditCommand(document)
, m_hasSelectionToDelete(false)
, m_smartDelete(smartDelete)
@@ -86,7 +86,7 @@ DeleteSelectionCommand::DeleteSelectionCommand(Document *document, bool smartDel
}
DeleteSelectionCommand::DeleteSelectionCommand(const VisibleSelection& selection, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements, bool sanitizeMarkup)
- : CompositeEditCommand(&selection.start().anchorNode()->document())
+ : CompositeEditCommand(selection.start().anchorNode()->document())
, m_hasSelectionToDelete(true)
, m_smartDelete(smartDelete)
, m_mergeBlocksAfterDelete(mergeBlocksAfterDelete)
@@ -379,7 +379,7 @@ void DeleteSelectionCommand::removeNode(PassRefPtr<Node> node, ShouldAssumeConte
}
// Make sure empty cell has some height, if a placeholder can be inserted.
- document()->updateLayoutIgnorePendingStylesheets();
+ document().updateLayoutIgnorePendingStylesheets();
RenderObject *r = node->renderer();
if (r && r->isTableCell() && toRenderTableCell(r)->contentHeight() <= 0) {
Position firstEditablePosition = firstEditablePositionInNode(node.get());
@@ -568,7 +568,7 @@ void DeleteSelectionCommand::handleGeneralDelete()
void DeleteSelectionCommand::fixupWhitespace()
{
- document()->updateLayoutIgnorePendingStylesheets();
+ document().updateLayoutIgnorePendingStylesheets();
// FIXME: isRenderedCharacter should be removed, and we should use VisiblePosition::characterAfter and VisiblePosition::characterBefore
if (m_leadingWhitespace.isNotNull() && !m_leadingWhitespace.isRenderedCharacter() && m_leadingWhitespace.deprecatedNode()->isTextNode()) {
Text* textNode = toText(m_leadingWhitespace.deprecatedNode());
@@ -625,7 +625,7 @@ void DeleteSelectionCommand::mergeParagraphs()
// We need to merge into m_upstreamStart's block, but it's been emptied out and collapsed by deletion.
if (!mergeDestination.deepEquivalent().deprecatedNode() || !mergeDestination.deepEquivalent().deprecatedNode()->isDescendantOf(enclosingBlock(m_upstreamStart.containerNode())) || m_startsAtEmptyLine) {
- insertNodeAt(createBreakElement(document()).get(), m_upstreamStart);
+ insertNodeAt(createBreakElement(&document()).get(), m_upstreamStart);
mergeDestination = VisiblePosition(m_upstreamStart);
}
@@ -725,7 +725,7 @@ void DeleteSelectionCommand::calculateTypingStyleAfterDelete()
// In this case if we start typing, the new characters should have the same style as the just deleted ones,
// but, if we change the selection, come back and start typing that style should be lost. Also see
// preserveTypingStyle() below.
- document()->frame()->selection()->setTypingStyle(m_typingStyle);
+ document().frame()->selection()->setTypingStyle(m_typingStyle);
}
void DeleteSelectionCommand::clearTransientState()
@@ -825,7 +825,7 @@ void DeleteSelectionCommand::doApply()
&& lineBreakBeforeStart;
}
- RefPtr<Node> placeholder = m_needPlaceholder ? createBreakElement(document()).get() : 0;
+ RefPtr<Node> placeholder = m_needPlaceholder ? createBreakElement(&document()).get() : 0;
if (placeholder) {
if (m_sanitizeMarkup)
« no previous file with comments | « Source/core/editing/DeleteSelectionCommand.h ('k') | Source/core/editing/EditCommand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698