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

Side by Side Diff: Source/core/editing/ApplyStyleCommand.cpp

Issue 23243003: [oilpan] Wrap NodeVector into CollectionRoot for ensure that contained nodes stay alive. (Closed) Base URL: svn://svn.chromium.org/blink/branches/oilpan
Patch Set: Fix infinite looping Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/ContainerNode.cpp ('k') | Source/core/editing/ReplaceNodeWithSpanCommand.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2008, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 if (!highestAncestor) 1040 if (!highestAncestor)
1041 return; 1041 return;
1042 1042
1043 // The outer loop is traversing the tree vertically from highestAncestor to targetNode 1043 // The outer loop is traversing the tree vertically from highestAncestor to targetNode
1044 Handle<Node> current = highestAncestor; 1044 Handle<Node> current = highestAncestor;
1045 // Along the way, styled elements that contain targetNode are removed and ac cumulated into elementsToPushDown. 1045 // Along the way, styled elements that contain targetNode are removed and ac cumulated into elementsToPushDown.
1046 // Each child of the removed element, exclusing ancestors of targetNode, is then wrapped by clones of elements in elementsToPushDown. 1046 // Each child of the removed element, exclusing ancestors of targetNode, is then wrapped by clones of elements in elementsToPushDown.
1047 CollectionRoot<Vector<Member<Element> > > elementsToPushDown; 1047 CollectionRoot<Vector<Member<Element> > > elementsToPushDown;
1048 while (current && current != targetNode && current->contains(adoptRawResult( targetNode))) { 1048 while (current && current != targetNode && current->contains(adoptRawResult( targetNode))) {
1049 HandleScope scope; 1049 HandleScope scope;
1050 CollectionRoot<NodeVector> currentChildren; 1050 NodeVector currentChildren;
1051 getChildNodes(current.raw(), *currentChildren); 1051 getChildNodes(current.raw(), currentChildren);
1052 Handle<StyledElement> styledElement; 1052 Handle<StyledElement> styledElement;
1053 if (current->isStyledElement() && isStyledInlineElementToRemove(toElemen t(current))) { 1053 if (current->isStyledElement() && isStyledInlineElementToRemove(toElemen t(current))) {
1054 styledElement = Handle<StyledElement>::cast(current); 1054 styledElement = Handle<StyledElement>::cast(current);
1055 elementsToPushDown->append(styledElement); 1055 elementsToPushDown->append(styledElement);
1056 } 1056 }
1057 1057
1058 RefPtr<EditingStyle> styleToPushDown = EditingStyle::create(); 1058 RefPtr<EditingStyle> styleToPushDown = EditingStyle::create();
1059 if (current->isHTMLElement()) 1059 if (current->isHTMLElement())
1060 removeInlineStyleFromElement(style, toHTMLElement(current.raw()), Re moveIfNeeded, styleToPushDown.get()); 1060 removeInlineStyleFromElement(style, toHTMLElement(current.raw()), Re moveIfNeeded, styleToPushDown.get());
1061 1061
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
1568 String textToMove = nextText->data(); 1568 String textToMove = nextText->data();
1569 insertTextIntoNode(childText, childText->length(), textToMove); 1569 insertTextIntoNode(childText, childText->length(), textToMove);
1570 removeNode(next.raw()); 1570 removeNode(next.raw());
1571 // don't move child node pointer. it may want to merge with more text no des. 1571 // don't move child node pointer. it may want to merge with more text no des.
1572 } 1572 }
1573 1573
1574 updateStartEnd(newStart, newEnd); 1574 updateStartEnd(newStart, newEnd);
1575 } 1575 }
1576 1576
1577 } 1577 }
OLDNEW
« no previous file with comments | « Source/core/dom/ContainerNode.cpp ('k') | Source/core/editing/ReplaceNodeWithSpanCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698