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

Side by Side Diff: third_party/WebKit/Source/core/dom/custom/V0CustomElement.cpp

Issue 2574773002: Migrate WTF::Vector::append() to ::push_back() [part 4 of N] (Closed)
Patch Set: rebase Created 4 years 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google 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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 Vector<AtomicString>& V0CustomElement::embedderCustomElementNames() { 53 Vector<AtomicString>& V0CustomElement::embedderCustomElementNames() {
54 DEFINE_STATIC_LOCAL(Vector<AtomicString>, names, ()); 54 DEFINE_STATIC_LOCAL(Vector<AtomicString>, names, ());
55 return names; 55 return names;
56 } 56 }
57 57
58 void V0CustomElement::addEmbedderCustomElementName(const AtomicString& name) { 58 void V0CustomElement::addEmbedderCustomElementName(const AtomicString& name) {
59 AtomicString lower = name.lower(); 59 AtomicString lower = name.lower();
60 if (isValidName(lower, EmbedderNames)) 60 if (isValidName(lower, EmbedderNames))
61 return; 61 return;
62 embedderCustomElementNames().append(lower); 62 embedderCustomElementNames().push_back(lower);
63 } 63 }
64 64
65 static inline bool isValidNCName(const AtomicString& name) { 65 static inline bool isValidNCName(const AtomicString& name) {
66 if (kNotFound != name.find(':')) 66 if (kNotFound != name.find(':'))
67 return false; 67 return false;
68 68
69 if (!name.getString().is8Bit()) { 69 if (!name.getString().is8Bit()) {
70 const UChar32 c = name.characters16()[0]; 70 const UChar32 c = name.characters16()[0];
71 // These characters comes under CombiningChar in NCName and according to 71 // These characters comes under CombiningChar in NCName and according to
72 // NCName only BaseChar and Ideodgraphic can come as first chars. 72 // NCName only BaseChar and Ideodgraphic can come as first chars.
73 // Also these characters come under Letter_Other in UnicodeData, thats 73 // Also these characters come under Letter_Other in UnicodeData, thats
74 // why they pass as valid document name. 74 // why they pass as valid document name.
75 if (c == 0x0B83 || c == 0x0F88 || c == 0x0F89 || c == 0x0F8A || c == 0x0F8B) 75 if (c == 0x0B83 || c == 0x0F88 || c == 0x0F89 || c == 0x0F8A || c == 0x0F8B)
76 return false; 76 return false;
77 } 77 }
78 78
79 return Document::isValidName(name.getString()); 79 return Document::isValidName(name.getString());
80 } 80 }
81 81
82 bool V0CustomElement::isValidName(const AtomicString& name, 82 bool V0CustomElement::isValidName(const AtomicString& name,
83 NameSet validNames) { 83 NameSet validNames) {
84 if ((validNames & EmbedderNames) && 84 if ((validNames & EmbedderNames) &&
85 kNotFound != embedderCustomElementNames().find(name)) 85 kNotFound != embedderCustomElementNames().find(name))
86 return Document::isValidName(name); 86 return Document::isValidName(name);
87 87
88 if ((validNames & StandardNames) && kNotFound != name.find('-')) { 88 if ((validNames & StandardNames) && kNotFound != name.find('-')) {
89 DEFINE_STATIC_LOCAL(Vector<AtomicString>, reservedNames, ()); 89 DEFINE_STATIC_LOCAL(Vector<AtomicString>, reservedNames, ());
90 if (reservedNames.isEmpty()) { 90 if (reservedNames.isEmpty()) {
91 // FIXME(crbug.com/426605): We should be able to remove this. 91 // FIXME(crbug.com/426605): We should be able to remove this.
92 reservedNames.append(MathMLNames::annotation_xmlTag.localName()); 92 reservedNames.push_back(MathMLNames::annotation_xmlTag.localName());
93 } 93 }
94 94
95 if (kNotFound == reservedNames.find(name)) 95 if (kNotFound == reservedNames.find(name))
96 return isValidNCName(name); 96 return isValidNCName(name);
97 } 97 }
98 98
99 return false; 99 return false;
100 } 100 }
101 101
102 void V0CustomElement::define(Element* element, 102 void V0CustomElement::define(Element* element,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 break; 151 break;
152 152
153 case Element::V0WaitingForUpgrade: 153 case Element::V0WaitingForUpgrade:
154 case Element::V0Upgraded: 154 case Element::V0Upgraded:
155 V0CustomElementObserver::notifyElementWasDestroyed(element); 155 V0CustomElementObserver::notifyElementWasDestroyed(element);
156 break; 156 break;
157 } 157 }
158 } 158 }
159 159
160 } // namespace blink 160 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698