| Index: Source/core/editing/ApplyStyleCommand.cpp
|
| diff --git a/Source/core/editing/ApplyStyleCommand.cpp b/Source/core/editing/ApplyStyleCommand.cpp
|
| index 9cce975b80f19764e88e76b93ffd148f5dc38ce2..d809696167311c30dd9454cb1e7c5325a58bf18d 100644
|
| --- a/Source/core/editing/ApplyStyleCommand.cpp
|
| +++ b/Source/core/editing/ApplyStyleCommand.cpp
|
| @@ -349,7 +349,9 @@ void ApplyStyleCommand::applyRelativeFontStyleChange(EditingStyle* style)
|
| // Calculate loop end point.
|
| // If the end node is before the start node (can only happen if the end node is
|
| // an ancestor of the start node), we gather nodes up to the next sibling of the end node
|
| - Node *beyondEnd;
|
| + Node* beyondEnd;
|
| + ASSERT(start.deprecatedNode());
|
| + ASSERT(end.deprecatedNode());
|
| if (start.deprecatedNode()->isDescendantOf(end.deprecatedNode()))
|
| beyondEnd = NodeTraversal::nextSkippingChildren(*end.deprecatedNode());
|
| else
|
| @@ -358,20 +360,29 @@ void ApplyStyleCommand::applyRelativeFontStyleChange(EditingStyle* style)
|
| start = start.upstream(); // Move upstream to ensure we do not add redundant spans.
|
| Node* startNode = start.deprecatedNode();
|
| ASSERT(startNode);
|
| +
|
| + // Make sure we're not already at the end or the next NodeTraversal::next() will traverse
|
| + // past it.
|
| + if (startNode == beyondEnd)
|
| + return;
|
| +
|
| if (startNode->isTextNode() && start.deprecatedEditingOffset() >= caretMaxOffset(startNode)) // Move out of text node if range does not include its characters.
|
| startNode = NodeTraversal::next(*startNode);
|
|
|
| // Store away font size before making any changes to the document.
|
| // This ensures that changes to one node won't effect another.
|
| HashMap<Node*, float> startingFontSizes;
|
| - for (Node* node = startNode; node != beyondEnd; node = NodeTraversal::next(*node))
|
| + for (Node* node = startNode; node != beyondEnd; node = NodeTraversal::next(*node)) {
|
| + ASSERT(node);
|
| startingFontSizes.set(node, computedFontSize(node));
|
| + }
|
|
|
| // These spans were added by us. If empty after font size changes, they can be removed.
|
| Vector<RefPtr<HTMLElement> > unstyledSpans;
|
|
|
| Node* lastStyledNode = 0;
|
| for (Node* node = startNode; node != beyondEnd; node = NodeTraversal::next(*node)) {
|
| + ASSERT(node);
|
| RefPtr<HTMLElement> element;
|
| if (node->isHTMLElement()) {
|
| // Only work on fully selected nodes.
|
|
|