Title: [137670] branches/chromium/1312/Source/WebCore/editing/ApplyStyleCommand.cpp
Revision
137670
Author
[email protected]
Date
2012-12-13 15:37:52 -0800 (Thu, 13 Dec 2012)

Log Message

Merge 136619
BUG=163110
Review URL: https://codereview.chromium.org/11577012

Modified Paths

Diff

Modified: branches/chromium/1312/Source/WebCore/editing/ApplyStyleCommand.cpp (137669 => 137670)


--- branches/chromium/1312/Source/WebCore/editing/ApplyStyleCommand.cpp	2012-12-13 23:34:31 UTC (rev 137669)
+++ branches/chromium/1312/Source/WebCore/editing/ApplyStyleCommand.cpp	2012-12-13 23:37:52 UTC (rev 137670)
@@ -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.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to