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

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

Issue 54273007: Use more references in ContainerNode code (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix crashes Created 7 years, 1 month 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
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 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 if (!highestAncestor) 1021 if (!highestAncestor)
1022 return; 1022 return;
1023 1023
1024 // The outer loop is traversing the tree vertically from highestAncestor to targetNode 1024 // The outer loop is traversing the tree vertically from highestAncestor to targetNode
1025 RefPtr<Node> current = highestAncestor; 1025 RefPtr<Node> current = highestAncestor;
1026 // Along the way, styled elements that contain targetNode are removed and ac cumulated into elementsToPushDown. 1026 // Along the way, styled elements that contain targetNode are removed and ac cumulated into elementsToPushDown.
1027 // Each child of the removed element, exclusing ancestors of targetNode, is then wrapped by clones of elements in elementsToPushDown. 1027 // Each child of the removed element, exclusing ancestors of targetNode, is then wrapped by clones of elements in elementsToPushDown.
1028 Vector<RefPtr<Element> > elementsToPushDown; 1028 Vector<RefPtr<Element> > elementsToPushDown;
1029 while (current && current != targetNode && current->contains(targetNode)) { 1029 while (current && current != targetNode && current->contains(targetNode)) {
1030 NodeVector currentChildren; 1030 NodeVector currentChildren;
1031 getChildNodes(current.get(), currentChildren); 1031 getChildNodes(*current, currentChildren);
1032 RefPtr<Element> styledElement; 1032 RefPtr<Element> styledElement;
1033 if (current->isStyledElement() && isStyledInlineElementToRemove(toElemen t(current))) { 1033 if (current->isStyledElement() && isStyledInlineElementToRemove(toElemen t(current))) {
1034 styledElement = toElement(current); 1034 styledElement = toElement(current);
1035 elementsToPushDown.append(styledElement); 1035 elementsToPushDown.append(styledElement);
1036 } 1036 }
1037 1037
1038 RefPtr<EditingStyle> styleToPushDown = EditingStyle::create(); 1038 RefPtr<EditingStyle> styleToPushDown = EditingStyle::create();
1039 if (current->isHTMLElement()) 1039 if (current->isHTMLElement())
1040 removeInlineStyleFromElement(style, toHTMLElement(current), RemoveIf Needed, styleToPushDown.get()); 1040 removeInlineStyleFromElement(style, toHTMLElement(current), RemoveIf Needed, styleToPushDown.get());
1041 1041
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 String textToMove = nextText->data(); 1543 String textToMove = nextText->data();
1544 insertTextIntoNode(childText, childText->length(), textToMove); 1544 insertTextIntoNode(childText, childText->length(), textToMove);
1545 removeNode(next); 1545 removeNode(next);
1546 // don't move child node pointer. it may want to merge with more text no des. 1546 // don't move child node pointer. it may want to merge with more text no des.
1547 } 1547 }
1548 1548
1549 updateStartEnd(newStart, newEnd); 1549 updateStartEnd(newStart, newEnd);
1550 } 1550 }
1551 1551
1552 } 1552 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698