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

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

Issue 329183002: Removing "using" declarations that import names in the C++ Standard library. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "core/frame/LocalFrame.h" 53 #include "core/frame/LocalFrame.h"
54 #include "core/html/HTMLBodyElement.h" 54 #include "core/html/HTMLBodyElement.h"
55 #include "core/html/HTMLElement.h" 55 #include "core/html/HTMLElement.h"
56 #include "core/html/HTMLTableCellElement.h" 56 #include "core/html/HTMLTableCellElement.h"
57 #include "core/html/HTMLTextFormControlElement.h" 57 #include "core/html/HTMLTextFormControlElement.h"
58 #include "core/rendering/RenderObject.h" 58 #include "core/rendering/RenderObject.h"
59 #include "platform/weborigin/KURL.h" 59 #include "platform/weborigin/KURL.h"
60 #include "wtf/StdLibExtras.h" 60 #include "wtf/StdLibExtras.h"
61 #include "wtf/text/StringBuilder.h" 61 #include "wtf/text/StringBuilder.h"
62 62
63 using namespace std;
64
65 namespace WebCore { 63 namespace WebCore {
66 64
67 using namespace HTMLNames; 65 using namespace HTMLNames;
68 66
69 static bool propertyMissingOrEqualToNone(StylePropertySet*, CSSPropertyID); 67 static bool propertyMissingOrEqualToNone(StylePropertySet*, CSSPropertyID);
70 68
71 class AttributeChange { 69 class AttributeChange {
72 ALLOW_ONLY_INLINE_ALLOCATION(); 70 ALLOW_ONLY_INLINE_ALLOCATION();
73 public: 71 public:
74 AttributeChange() 72 AttributeChange()
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 if (!element->hasAttributes()) 111 if (!element->hasAttributes())
114 continue; 112 continue;
115 AttributeIteratorAccessor attributes = element->attributesIterator(); 113 AttributeIteratorAccessor attributes = element->attributesIterator();
116 AttributeConstIterator end = attributes.end(); 114 AttributeConstIterator end = attributes.end();
117 for (AttributeConstIterator it = attributes.begin(); it != end; ++it) { 115 for (AttributeConstIterator it = attributes.begin(); it != end; ++it) {
118 if (element->isURLAttribute(**it) && !it->value().isEmpty()) 116 if (element->isURLAttribute(**it) && !it->value().isEmpty())
119 changes.append(AttributeChange(element, it->name(), KURL(parsedB aseURL, it->value()).string())); 117 changes.append(AttributeChange(element, it->name(), KURL(parsedB aseURL, it->value()).string()));
120 } 118 }
121 } 119 }
122 120
123 size_t numChanges = changes.size(); 121 std::size_t numChanges = changes.size();
124 for (size_t i = 0; i < numChanges; ++i) 122 for (std::size_t i = 0; i < numChanges; ++i)
125 changes[i].apply(); 123 changes[i].apply();
126 } 124 }
127 125
128 class StyledMarkupAccumulator FINAL : public MarkupAccumulator { 126 class StyledMarkupAccumulator FINAL : public MarkupAccumulator {
129 public: 127 public:
130 enum RangeFullySelectsNode { DoesFullySelectNode, DoesNotFullySelectNode }; 128 enum RangeFullySelectsNode { DoesFullySelectNode, DoesNotFullySelectNode };
131 129
132 StyledMarkupAccumulator(WillBeHeapVector<RawPtrWillBeMember<Node> >* nodes, EAbsoluteURLs, EAnnotateForInterchange, RawPtr<const Range>, Node* highestNodeTo BeSerialized = 0); 130 StyledMarkupAccumulator(WillBeHeapVector<RawPtrWillBeMember<Node> >* nodes, EAbsoluteURLs, EAnnotateForInterchange, RawPtr<const Range>, Node* highestNodeTo BeSerialized = 0);
133 Node* serializeNodes(Node* startNode, Node* pastEnd); 131 Node* serializeNodes(Node* startNode, Node* pastEnd);
134 void appendString(const String& s) { return MarkupAccumulator::appendString( s); } 132 void appendString(const String& s) { return MarkupAccumulator::appendString( s); }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 DEFINE_STATIC_LOCAL(const String, divClose, ("</div>")); 204 DEFINE_STATIC_LOCAL(const String, divClose, ("</div>"));
207 DEFINE_STATIC_LOCAL(const String, styleSpanClose, ("</span>")); 205 DEFINE_STATIC_LOCAL(const String, styleSpanClose, ("</span>"));
208 return isBlock ? divClose : styleSpanClose; 206 return isBlock ? divClose : styleSpanClose;
209 } 207 }
210 208
211 String StyledMarkupAccumulator::takeResults() 209 String StyledMarkupAccumulator::takeResults()
212 { 210 {
213 StringBuilder result; 211 StringBuilder result;
214 result.reserveCapacity(totalLength(m_reversedPrecedingMarkup) + length()); 212 result.reserveCapacity(totalLength(m_reversedPrecedingMarkup) + length());
215 213
216 for (size_t i = m_reversedPrecedingMarkup.size(); i > 0; --i) 214 for (std::size_t i = m_reversedPrecedingMarkup.size(); i > 0; --i)
217 result.append(m_reversedPrecedingMarkup[i - 1]); 215 result.append(m_reversedPrecedingMarkup[i - 1]);
218 216
219 concatenateMarkup(result); 217 concatenateMarkup(result);
220 218
221 // We remove '\0' characters because they are not visibly rendered to the us er. 219 // We remove '\0' characters because they are not visibly rendered to the us er.
222 return result.toString().replace(0, ""); 220 return result.toString().replace(0, "");
223 } 221 }
224 222
225 void StyledMarkupAccumulator::appendText(StringBuilder& out, Text& text) 223 void StyledMarkupAccumulator::appendText(StringBuilder& out, Text& text)
226 { 224 {
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 paragraph->appendChild(createBlockPlaceholderElement(document)); 763 paragraph->appendChild(createBlockPlaceholderElement(document));
766 return; 764 return;
767 } 765 }
768 766
769 ASSERT(string.find('\n') == kNotFound); 767 ASSERT(string.find('\n') == kNotFound);
770 768
771 Vector<String> tabList; 769 Vector<String> tabList;
772 string.split('\t', true, tabList); 770 string.split('\t', true, tabList);
773 StringBuilder tabText; 771 StringBuilder tabText;
774 bool first = true; 772 bool first = true;
775 size_t numEntries = tabList.size(); 773 std::size_t numEntries = tabList.size();
776 for (size_t i = 0; i < numEntries; ++i) { 774 for (std::size_t i = 0; i < numEntries; ++i) {
777 const String& s = tabList[i]; 775 const String& s = tabList[i];
778 776
779 // append the non-tab textual part 777 // append the non-tab textual part
780 if (!s.isEmpty()) { 778 if (!s.isEmpty()) {
781 if (!tabText.isEmpty()) { 779 if (!tabText.isEmpty()) {
782 paragraph->appendChild(createTabSpanElement(document, tabText.to String())); 780 paragraph->appendChild(createTabSpanElement(document, tabText.to String()));
783 tabText.clear(); 781 tabText.clear();
784 } 782 }
785 RefPtrWillBeRawPtr<Node> textNode = document.createTextNode(stringWi thRebalancedWhitespace(s, first, i + 1 == numEntries)); 783 RefPtrWillBeRawPtr<Node> textNode = document.createTextNode(stringWi thRebalancedWhitespace(s, first, i + 1 == numEntries));
786 paragraph->appendChild(textNode.release()); 784 paragraph->appendChild(textNode.release());
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 Element* block = toElement(blockNode); 862 Element* block = toElement(blockNode);
865 bool useClonesOfEnclosingBlock = blockNode 863 bool useClonesOfEnclosingBlock = blockNode
866 && blockNode->isElementNode() 864 && blockNode->isElementNode()
867 && !isHTMLBodyElement(*block) 865 && !isHTMLBodyElement(*block)
868 && !isHTMLHtmlElement(*block) 866 && !isHTMLHtmlElement(*block)
869 && block != editableRootForPosition(context->startPosition()); 867 && block != editableRootForPosition(context->startPosition());
870 bool useLineBreak = enclosingTextFormControl(context->startPosition()); 868 bool useLineBreak = enclosingTextFormControl(context->startPosition());
871 869
872 Vector<String> list; 870 Vector<String> list;
873 string.split('\n', true, list); // true gets us empty strings in the list 871 string.split('\n', true, list); // true gets us empty strings in the list
874 size_t numLines = list.size(); 872 std::size_t numLines = list.size();
875 for (size_t i = 0; i < numLines; ++i) { 873 for (std::size_t i = 0; i < numLines; ++i) {
876 const String& s = list[i]; 874 const String& s = list[i];
877 875
878 RefPtrWillBeRawPtr<Element> element = nullptr; 876 RefPtrWillBeRawPtr<Element> element = nullptr;
879 if (s.isEmpty() && i + 1 == numLines) { 877 if (s.isEmpty() && i + 1 == numLines) {
880 // For last line, use the "magic BR" rather than a P. 878 // For last line, use the "magic BR" rather than a P.
881 element = createBreakElement(document); 879 element = createBreakElement(document);
882 element->setAttribute(classAttr, AppleInterchangeNewline); 880 element->setAttribute(classAttr, AppleInterchangeNewline);
883 } else if (useLineBreak) { 881 } else if (useLineBreak) {
884 element = createBreakElement(document); 882 element = createBreakElement(document);
885 fillContainerFromString(fragment.get(), s); 883 fillContainerFromString(fragment.get(), s);
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 return; 1077 return;
1080 1078
1081 RefPtrWillBeRawPtr<Text> textNode = toText(node.get()); 1079 RefPtrWillBeRawPtr<Text> textNode = toText(node.get());
1082 RefPtrWillBeRawPtr<Text> textNext = toText(next); 1080 RefPtrWillBeRawPtr<Text> textNext = toText(next);
1083 textNode->appendData(textNext->data()); 1081 textNode->appendData(textNext->data());
1084 if (textNext->parentNode()) // Might have been removed by mutation event. 1082 if (textNext->parentNode()) // Might have been removed by mutation event.
1085 textNext->remove(exceptionState); 1083 textNext->remove(exceptionState);
1086 } 1084 }
1087 1085
1088 } 1086 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698