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

Unified Diff: third_party/WebKit/Source/core/dom/custom/CustomElement.cpp

Issue 2292433002: CL for perf tryjob on linux (Closed)
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/custom/CustomElement.cpp
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp
index 83ea081e5c28ee8f238f89efccea556ac7a1932e..e0bfe457b025a5007a4e57795cf52939558868a8 100644
--- a/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp
+++ b/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp
@@ -15,7 +15,6 @@
#include "core/frame/LocalDOMWindow.h"
#include "core/html/HTMLElement.h"
#include "core/html/HTMLUnknownElement.h"
-#include "platform/text/Character.h"
#include "wtf/text/AtomicStringHash.h"
namespace blink {
@@ -45,26 +44,8 @@ CustomElementDefinition* CustomElement::definitionForElement(const Element* elem
return definitionForElementWithoutCheck(*element);
}
-bool CustomElement::isValidName(const AtomicString& name)
+bool CustomElement::isHyphenContainingElementName(const AtomicString& name)
{
- if (!name.length() || name[0] < 'a' || name[0] > 'z')
- return false;
-
- bool hasHyphens = false;
- for (size_t i = 1; i < name.length(); ) {
- UChar32 ch;
- if (name.is8Bit())
- ch = name[i++];
- else
- U16_NEXT(name.characters16(), i, name.length(), ch);
- if (ch == '-')
- hasHyphens = true;
- else if (!Character::isPotentialCustomElementNameChar(ch))
- return false;
- }
- if (!hasHyphens)
- return false;
-
// https://html.spec.whatwg.org/multipage/scripting.html#valid-custom-element-name
DEFINE_STATIC_LOCAL(HashSet<AtomicString>, hyphenContainingElementNames, ({
"annotation-xml",
@@ -76,13 +57,7 @@ bool CustomElement::isValidName(const AtomicString& name)
"font-face-name",
"missing-glyph",
}));
- return !hyphenContainingElementNames.contains(name);
-}
-
-bool CustomElement::shouldCreateCustomElement(const AtomicString& localName)
-{
- return RuntimeEnabledFeatures::customElementsV1Enabled()
- && isValidName(localName);
+ return hyphenContainingElementNames.contains(name);
}
bool CustomElement::shouldCreateCustomElement(const QualifiedName& tagName)
@@ -98,45 +73,37 @@ static CustomElementDefinition* definitionForName(const Document& document, cons
return nullptr;
}
-HTMLElement* CustomElement::createCustomElementSync(Document& document, const AtomicString& localName, ExceptionState& exceptionState)
+HTMLElement* CustomElement::createCustomElementSync(Document& document, const AtomicString& localName, ExceptionState* exceptionState)
{
return createCustomElementSync(document,
QualifiedName(nullAtom, localName, HTMLNames::xhtmlNamespaceURI),
exceptionState);
}
-HTMLElement* CustomElement::createCustomElementSync(Document& document, const QualifiedName& tagName, ExceptionState& exceptionState)
+HTMLElement* CustomElement::createCustomElementSync(Document& document, const QualifiedName& tagName, ExceptionState* exceptionState)
{
- CHECK(shouldCreateCustomElement(tagName));
+ DCHECK(shouldCreateCustomElement(tagName));
// To create an element:
// https://dom.spec.whatwg.org/#concept-create-element
// 6. If definition is non-null, then:
// 6.1. If the synchronous custom elements flag is set:
- if (CustomElementDefinition* definition = definitionForName(document, tagName))
- return definition->createElementSync(document, tagName, exceptionState);
-
- return createUndefinedElement(document, tagName);
-}
-
-HTMLElement* CustomElement::createCustomElementSync(Document& document, const QualifiedName& tagName)
-{
- CHECK(shouldCreateCustomElement(tagName));
// When invoked from "create an element for a token":
// https://html.spec.whatwg.org/multipage/syntax.html#create-an-element-for-the-token
// 7. If this step throws an exception, then report the exception,
// and let element be instead a new element that implements
// HTMLUnknownElement.
+
if (CustomElementDefinition* definition = definitionForName(document, tagName))
- return definition->createElementSync(document, tagName);
+ return definition->createElementSync(document, tagName, exceptionState);
return createUndefinedElement(document, tagName);
}
HTMLElement* CustomElement::createCustomElementAsync(Document& document, const QualifiedName& tagName)
{
- CHECK(shouldCreateCustomElement(tagName));
+ DCHECK(shouldCreateCustomElement(tagName));
// To create an element:
// https://dom.spec.whatwg.org/#concept-create-element

Powered by Google App Engine
This is Rietveld 408576698