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

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

Issue 124943003: Remove 'String::append' from some of the blink source. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Incorporated review comments Created 6 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved.
4 * Copyright (C) 2011 Igalia S.L. 4 * Copyright (C) 2011 Igalia S.L.
5 * Copyright (C) 2011 Motorola Mobility. All rights reserved. 5 * Copyright (C) 2011 Motorola Mobility. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 750
751 if (string.isEmpty()) { 751 if (string.isEmpty()) {
752 paragraph->appendChild(createBlockPlaceholderElement(document)); 752 paragraph->appendChild(createBlockPlaceholderElement(document));
753 return; 753 return;
754 } 754 }
755 755
756 ASSERT(string.find('\n') == kNotFound); 756 ASSERT(string.find('\n') == kNotFound);
757 757
758 Vector<String> tabList; 758 Vector<String> tabList;
759 string.split('\t', true, tabList); 759 string.split('\t', true, tabList);
760 String tabText = emptyString(); 760 StringBuilder tabText;
761 bool first = true; 761 bool first = true;
762 size_t numEntries = tabList.size(); 762 size_t numEntries = tabList.size();
763 for (size_t i = 0; i < numEntries; ++i) { 763 for (size_t i = 0; i < numEntries; ++i) {
764 const String& s = tabList[i]; 764 const String& s = tabList[i];
765 765
766 // append the non-tab textual part 766 // append the non-tab textual part
767 if (!s.isEmpty()) { 767 if (!s.isEmpty()) {
768 if (!tabText.isEmpty()) { 768 if (!tabText.isEmpty()) {
769 paragraph->appendChild(createTabSpanElement(document, tabText)); 769 paragraph->appendChild(createTabSpanElement(document, tabText.to String()));
770 tabText = emptyString(); 770 tabText.clear();
771 } 771 }
772 RefPtr<Node> textNode = document.createTextNode(stringWithRebalanced Whitespace(s, first, i + 1 == numEntries)); 772 RefPtr<Node> textNode = document.createTextNode(stringWithRebalanced Whitespace(s, first, i + 1 == numEntries));
773 paragraph->appendChild(textNode.release()); 773 paragraph->appendChild(textNode.release());
774 } 774 }
775 775
776 // there is a tab after every entry, except the last entry 776 // there is a tab after every entry, except the last entry
777 // (if the last character is a tab, the list gets an extra empty entry) 777 // (if the last character is a tab, the list gets an extra empty entry)
778 if (i + 1 != numEntries) 778 if (i + 1 != numEntries)
779 tabText.append('\t'); 779 tabText.append('\t');
780 else if (!tabText.isEmpty()) 780 else if (!tabText.isEmpty())
781 paragraph->appendChild(createTabSpanElement(document, tabText)); 781 paragraph->appendChild(createTabSpanElement(document, tabText.toStri ng()));
782 782
783 first = false; 783 first = false;
784 } 784 }
785 } 785 }
786 786
787 bool isPlainTextMarkup(Node *node) 787 bool isPlainTextMarkup(Node *node)
788 { 788 {
789 if (!node->isElementNode() || !node->hasTagName(divTag) || toElement(node)-> hasAttributes()) 789 if (!node->isElementNode() || !node->hasTagName(divTag) || toElement(node)-> hasAttributes())
790 return false; 790 return false;
791 791
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 return; 1080 return;
1081 1081
1082 RefPtr<Text> textNode = toText(node.get()); 1082 RefPtr<Text> textNode = toText(node.get());
1083 RefPtr<Text> textNext = toText(next); 1083 RefPtr<Text> textNext = toText(next);
1084 textNode->appendData(textNext->data()); 1084 textNode->appendData(textNext->data());
1085 if (textNext->parentNode()) // Might have been removed by mutation event. 1085 if (textNext->parentNode()) // Might have been removed by mutation event.
1086 textNext->remove(exceptionState); 1086 textNext->remove(exceptionState);
1087 } 1087 }
1088 1088
1089 } 1089 }
OLDNEW
« no previous file with comments | « no previous file | Source/core/fetch/CSSStyleSheetResource.cpp » ('j') | Source/core/fetch/CSSStyleSheetResource.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698