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

Unified Diff: Source/WebCore/editing/ApplyStyleCommand.cpp

Issue 11577012: Merge 136619 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1312/
Patch Set: Created 8 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/editing/ApplyStyleCommand.cpp
===================================================================
--- Source/WebCore/editing/ApplyStyleCommand.cpp (revision 137669)
+++ Source/WebCore/editing/ApplyStyleCommand.cpp (working copy)
@@ -974,24 +974,22 @@
return;
// The outer loop is traversing the tree vertically from highestAncestor to targetNode
- Node* current = highestAncestor;
+ RefPtr<Node> current = highestAncestor;
// Along the way, styled elements that contain targetNode are removed and accumulated into elementsToPushDown.
// Each child of the removed element, exclusing ancestors of targetNode, is then wrapped by clones of elements in elementsToPushDown.
Vector<RefPtr<Element> > elementsToPushDown;
- while (current != targetNode) {
- ASSERT(current);
- ASSERT(current->contains(targetNode));
+ while (current && current != targetNode && current->contains(targetNode)) {
NodeVector currentChildren;
- getChildNodes(current, currentChildren);
+ getChildNodes(current.get(), currentChildren);
RefPtr<StyledElement> styledElement;
- if (current->isStyledElement() && isStyledInlineElementToRemove(static_cast<Element*>(current))) {
- styledElement = static_cast<StyledElement*>(current);
+ if (current->isStyledElement() && isStyledInlineElementToRemove(static_cast<Element*>(current.get()))) {
+ styledElement = static_cast<StyledElement*>(current.get());
elementsToPushDown.append(styledElement);
}
RefPtr<EditingStyle> styleToPushDown = EditingStyle::create();
if (current->isHTMLElement())
- removeInlineStyleFromElement(style, toHTMLElement(current), RemoveIfNeeded, styleToPushDown.get());
+ removeInlineStyleFromElement(style, toHTMLElement(current.get()), RemoveIfNeeded, styleToPushDown.get());
// The inner loop will go through children on each level
// FIXME: we should aggregate inline child elements together so that we don't wrap each child separately.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698