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

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

Issue 423003003: Use tighter typing in editing: InsertParagraphSeparatorCommand / InsertTextCommand (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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
Index: Source/core/editing/InsertParagraphSeparatorCommand.cpp
diff --git a/Source/core/editing/InsertParagraphSeparatorCommand.cpp b/Source/core/editing/InsertParagraphSeparatorCommand.cpp
index f5a1d5b148503d871cd48f5db5a44bcbd4da9ace..bf481651138cd2121922dcc1f29911a941c367d7 100644
--- a/Source/core/editing/InsertParagraphSeparatorCommand.cpp
+++ b/Source/core/editing/InsertParagraphSeparatorCommand.cpp
@@ -60,10 +60,10 @@ static Element* highestVisuallyEquivalentDivBelowRoot(Element* startBlock)
return curBlock;
}
-InsertParagraphSeparatorCommand::InsertParagraphSeparatorCommand(Document& document, bool mustUseDefaultParagraphElement, bool pasteBlockqutoeIntoUnquotedArea)
+InsertParagraphSeparatorCommand::InsertParagraphSeparatorCommand(Document& document, bool mustUseDefaultParagraphElement, bool pasteBlockquoteIntoUnquotedArea)
: CompositeEditCommand(document)
, m_mustUseDefaultParagraphElement(mustUseDefaultParagraphElement)
- , m_pasteBlockqutoeIntoUnquotedArea(pasteBlockqutoeIntoUnquotedArea)
+ , m_pasteBlockquoteIntoUnquotedArea(pasteBlockquoteIntoUnquotedArea)
{
}
@@ -86,7 +86,7 @@ void InsertParagraphSeparatorCommand::calculateStyleBeforeInsertion(const Positi
m_style->mergeTypingStyle(pos.document());
}
-void InsertParagraphSeparatorCommand::applyStyleAfterInsertion(Node* originalEnclosingBlock)
+void InsertParagraphSeparatorCommand::applyStyleAfterInsertion(Element* originalEnclosingBlock)
{
// Not only do we break out of header tags, but we also do not preserve the typing style,
// in order to match other browsers.
@@ -105,7 +105,7 @@ void InsertParagraphSeparatorCommand::applyStyleAfterInsertion(Node* originalEnc
applyStyle(m_style.get());
}
-bool InsertParagraphSeparatorCommand::shouldUseDefaultParagraphElement(Node* enclosingBlock) const
+bool InsertParagraphSeparatorCommand::shouldUseDefaultParagraphElement(Element* enclosingBlock) const
{
if (m_mustUseDefaultParagraphElement)
return true;
@@ -167,7 +167,7 @@ void InsertParagraphSeparatorCommand::doApply()
// FIXME: The parentAnchoredEquivalent conversion needs to be moved into enclosingBlock.
RefPtrWillBeRawPtr<Element> startBlock = enclosingBlock(insertionPosition.parentAnchoredEquivalent().containerNode());
Node* listChildNode = enclosingListChild(insertionPosition.parentAnchoredEquivalent().containerNode());
- RefPtrWillBeRawPtr<Element> listChild = listChildNode && listChildNode->isHTMLElement() ? toHTMLElement(listChildNode) : 0;
+ RefPtrWillBeRawPtr<HTMLElement> listChild = listChildNode && listChildNode->isHTMLElement() ? toHTMLElement(listChildNode) : 0;
Position canonicalPos = VisiblePosition(insertionPosition).deepEquivalent();
if (!startBlock
|| !startBlock->nonShadowBoundaryParentNode()
@@ -221,7 +221,7 @@ void InsertParagraphSeparatorCommand::doApply()
if (isFirstInBlock && !lineBreakExistsAtVisiblePosition(visiblePos)) {
// The block is empty. Create an empty block to
// represent the paragraph that we're leaving.
- RefPtrWillBeRawPtr<Element> extraBlock = createDefaultParagraphElement(document());
+ RefPtrWillBeRawPtr<HTMLElement> extraBlock = createDefaultParagraphElement(document());
appendNode(extraBlock, startBlock);
appendBlockPlaceholder(extraBlock);
}
@@ -229,7 +229,7 @@ void InsertParagraphSeparatorCommand::doApply()
} else {
// We can get here if we pasted a copied portion of a blockquote with a newline at the end and are trying to paste it
// into an unquoted area. We then don't want the newline within the blockquote or else it will also be quoted.
- if (m_pasteBlockqutoeIntoUnquotedArea) {
+ if (m_pasteBlockquoteIntoUnquotedArea) {
if (Node* highestBlockquote = highestEnclosingNodeOfType(canonicalPos, &isMailBlockquote))
startBlock = toElement(highestBlockquote);
}
@@ -241,10 +241,10 @@ void InsertParagraphSeparatorCommand::doApply()
} else {
// Most of the time we want to stay at the nesting level of the startBlock (e.g., when nesting within lists). However,
// for div nodes, this can result in nested div tags that are hard to break out of.
- Element* siblingNode = startBlock.get();
+ Element* siblingElement = startBlock.get();
if (isHTMLDivElement(*blockToInsert))
- siblingNode = highestVisuallyEquivalentDivBelowRoot(startBlock.get());
- insertNodeAfter(blockToInsert, siblingNode);
+ siblingElement = highestVisuallyEquivalentDivBelowRoot(startBlock.get());
+ insertNodeAfter(blockToInsert, siblingElement);
}
}

Powered by Google App Engine
This is Rietveld 408576698