Index: Source/WebCore/editing/ApplyStyleCommand.cpp |
=================================================================== |
--- Source/WebCore/editing/ApplyStyleCommand.cpp (revision 112629) |
+++ Source/WebCore/editing/ApplyStyleCommand.cpp (working copy) |
@@ -707,12 +707,13 @@ |
return false; |
} |
-void ApplyStyleCommand::applyInlineStyleToNodeRange(EditingStyle* style, Node* node, Node* pastEndNode) |
+void ApplyStyleCommand::applyInlineStyleToNodeRange(EditingStyle* style, PassRefPtr<Node> startNode, PassRefPtr<Node> pastEndNode) |
{ |
if (m_removeOnly) |
return; |
- for (RefPtr<Node> next; node && node != pastEndNode; node = next.get()) { |
+ RefPtr<Node> node = startNode; |
+ for (RefPtr<Node> next; node && node != pastEndNode; node = next) { |
next = node->traverseNextNode(); |
if (!node->renderer() || !node->rendererIsEditable()) |
@@ -722,10 +723,10 @@ |
// This is a plaintext-only region. Only proceed if it's fully selected. |
// pastEndNode is the node after the last fully selected node, so if it's inside node then |
// node isn't fully selected. |
- if (pastEndNode && pastEndNode->isDescendantOf(node)) |
+ if (pastEndNode && pastEndNode->isDescendantOf(node.get())) |
break; |
// Add to this element's inline style and skip over its contents. |
- HTMLElement* element = toHTMLElement(node); |
+ HTMLElement* element = toHTMLElement(node.get()); |
RefPtr<CSSMutableStyleDeclaration> inlineStyle = element->ensureInlineStyleDecl()->copy(); |
inlineStyle->merge(style->style()); |
setNodeAttribute(element, styleAttr, inlineStyle->asText()); |
@@ -733,13 +734,13 @@ |
continue; |
} |
- if (isBlock(node)) |
+ if (isBlock(node.get())) |
continue; |
if (node->childNodeCount()) { |
- if (node->contains(pastEndNode) || containsNonEditableRegion(node) || !node->parentNode()->rendererIsEditable()) |
+ if (node->contains(pastEndNode.get()) || containsNonEditableRegion(node.get()) || !node->parentNode()->rendererIsEditable()) |
continue; |
- if (editingIgnoresContent(node)) { |
+ if (editingIgnoresContent(node.get())) { |
next = node->traverseNextSibling(); |
continue; |
} |
@@ -748,7 +749,7 @@ |
RefPtr<Node> runStart = node; |
RefPtr<Node> runEnd = node; |
Node* sibling = node->nextSibling(); |
- while (sibling && sibling != pastEndNode && !sibling->contains(pastEndNode) |
+ while (sibling && sibling != pastEndNode && !sibling->contains(pastEndNode.get()) |
&& (!isBlock(sibling) || sibling->hasTagName(brTag)) |
&& !containsNonEditableRegion(sibling)) { |
runEnd = sibling; |