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

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

Issue 443433003: Use tighter typing in editing: SimplifyMarkupCommand & TextIterator (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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/SimplifyMarkupCommand.h ('k') | Source/core/editing/TextInsertionBaseCommand.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/SimplifyMarkupCommand.cpp
diff --git a/Source/core/editing/SimplifyMarkupCommand.cpp b/Source/core/editing/SimplifyMarkupCommand.cpp
index 8379318b300b6c9ac6422cb22f90b4fdb48db01d..5351d5e7154d963f80f51430c3d61c5c1cd70ebc 100644
--- a/Source/core/editing/SimplifyMarkupCommand.cpp
+++ b/Source/core/editing/SimplifyMarkupCommand.cpp
@@ -41,8 +41,8 @@ SimplifyMarkupCommand::SimplifyMarkupCommand(Document& document, Node* firstNode
void SimplifyMarkupCommand::doApply()
{
- Node* rootNode = m_firstNode->parentNode();
- WillBeHeapVector<RefPtrWillBeMember<Node> > nodesToRemove;
+ ContainerNode* rootNode = m_firstNode->parentNode();
+ WillBeHeapVector<RefPtrWillBeMember<ContainerNode> > nodesToRemove;
// Walk through the inserted nodes, to see if there are elements that could be removed
// without affecting the style. The goal is to produce leaner markup even when starting
@@ -52,14 +52,14 @@ void SimplifyMarkupCommand::doApply()
if (node->hasChildren() || (node->isTextNode() && node->nextSibling()))
continue;
- Node* startingNode = node->parentNode();
+ ContainerNode* startingNode = node->parentNode();
if (!startingNode)
continue;
RenderStyle* startingStyle = startingNode->renderStyle();
if (!startingStyle)
continue;
- Node* currentNode = startingNode;
- Node* topNodeWithStartingStyle = 0;
+ ContainerNode* currentNode = startingNode;
+ ContainerNode* topNodeWithStartingStyle = 0;
while (currentNode != rootNode) {
if (currentNode->parentNode() != rootNode && isRemovableBlock(currentNode))
nodesToRemove.append(currentNode);
@@ -81,7 +81,7 @@ void SimplifyMarkupCommand::doApply()
}
if (topNodeWithStartingStyle) {
- for (Node* node = startingNode; node != topNodeWithStartingStyle; node = node->parentNode())
+ for (ContainerNode* node = startingNode; node != topNodeWithStartingStyle; node = node->parentNode())
nodesToRemove.append(node);
}
}
@@ -97,7 +97,7 @@ void SimplifyMarkupCommand::doApply()
}
}
-int SimplifyMarkupCommand::pruneSubsequentAncestorsToRemove(WillBeHeapVector<RefPtrWillBeMember<Node> >& nodesToRemove, size_t startNodeIndex)
+int SimplifyMarkupCommand::pruneSubsequentAncestorsToRemove(WillBeHeapVector<RefPtrWillBeMember<ContainerNode> >& nodesToRemove, size_t startNodeIndex)
{
size_t pastLastNodeToRemove = startNodeIndex + 1;
for (; pastLastNodeToRemove < nodesToRemove.size(); ++pastLastNodeToRemove) {
@@ -106,7 +106,7 @@ int SimplifyMarkupCommand::pruneSubsequentAncestorsToRemove(WillBeHeapVector<Ref
ASSERT(nodesToRemove[pastLastNodeToRemove]->firstChild() == nodesToRemove[pastLastNodeToRemove]->lastChild());
}
- Node* highestAncestorToRemove = nodesToRemove[pastLastNodeToRemove - 1].get();
+ ContainerNode* highestAncestorToRemove = nodesToRemove[pastLastNodeToRemove - 1].get();
RefPtrWillBeRawPtr<ContainerNode> parent = highestAncestorToRemove->parentNode();
if (!parent) // Parent has already been removed.
return -1;
« no previous file with comments | « Source/core/editing/SimplifyMarkupCommand.h ('k') | Source/core/editing/TextInsertionBaseCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698