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

Side by Side Diff: third_party/WebKit/Source/core/dom/custom/CustomElementTestHelpers.h

Issue 2838123002: Count element name validity per DOM versus HTML parsing. (Closed)
Patch Set: Do not need the attribute counting. Created 3 years, 8 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CustomElementTestHelpers_h 5 #ifndef CustomElementTestHelpers_h
6 #define CustomElementTestHelpers_h 6 #define CustomElementTestHelpers_h
7 7
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/dom/Element.h" 10 #include "core/dom/Element.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 CreateElement& WithIsAttribute(const AtomicString& value) { 116 CreateElement& WithIsAttribute(const AtomicString& value) {
117 attributes_.push_back(std::make_pair(HTMLNames::isAttr, value)); 117 attributes_.push_back(std::make_pair(HTMLNames::isAttr, value));
118 return *this; 118 return *this;
119 } 119 }
120 120
121 operator Element*() const { 121 operator Element*() const {
122 Document* document = document_.Get(); 122 Document* document = document_.Get();
123 if (!document) 123 if (!document)
124 document = HTMLDocument::Create(); 124 document = HTMLDocument::Create();
125 NonThrowableExceptionState no_exceptions; 125 NonThrowableExceptionState no_exceptions;
126 Element* element = 126 Element* element = document->createElementNS(nullptr, namespace_uri_,
127 document->createElementNS(namespace_uri_, local_name_, no_exceptions); 127 local_name_, no_exceptions);
128 for (const auto& attribute : attributes_) 128 for (const auto& attribute : attributes_)
129 element->setAttribute(attribute.first, attribute.second); 129 element->setAttribute(attribute.first, attribute.second);
130 return element; 130 return element;
131 } 131 }
132 132
133 private: 133 private:
134 Member<Document> document_; 134 Member<Document> document_;
135 AtomicString namespace_uri_; 135 AtomicString namespace_uri_;
136 AtomicString local_name_; 136 AtomicString local_name_;
137 std::vector<std::pair<QualifiedName, AtomicString>> attributes_; 137 std::vector<std::pair<QualifiedName, AtomicString>> attributes_;
138 }; 138 };
139 139
140 } // namespace blink 140 } // namespace blink
141 141
142 #endif // CustomElementTestHelpers_h 142 #endif // CustomElementTestHelpers_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698