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

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

Issue 2303793003: CL for perf tryjob on linux (Closed)
Patch Set: Created 4 years, 3 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..6aea9664b0dc7a898f9b2c1da6c2021d3dab0e18 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,28 +44,15 @@ CustomElementDefinition* CustomElement::definitionForElement(const Element* elem
return definitionForElementWithoutCheck(*element);
}
-bool CustomElement::isValidName(const AtomicString& name)
+bool CustomElement::isHyphenatedSpecElementName(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, ({
+ // Even if Blink does not implement one of the related specs, (for
+ // example annotation-xml is from MathML, which Blink does not
+ // implement) we must prohibit using the name because that is
+ // required by the HTML spec which we *do* implement. Don't remove
+ // names from this list without removing them from the HTML spec
+ // first.
+ DEFINE_STATIC_LOCAL(HashSet<AtomicString>, hyphenatedSpecElementNames, ({
"annotation-xml",
"color-profile",
"font-face",
@@ -76,7 +62,7 @@ bool CustomElement::isValidName(const AtomicString& name)
"font-face-name",
"missing-glyph",
}));
- return !hyphenContainingElementNames.contains(name);
+ return hyphenatedSpecElementNames.contains(name);
}
bool CustomElement::shouldCreateCustomElement(const AtomicString& localName)
@@ -107,7 +93,7 @@ HTMLElement* CustomElement::createCustomElementSync(Document& document, const At
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
@@ -121,7 +107,7 @@ HTMLElement* CustomElement::createCustomElementSync(Document& document, const Qu
HTMLElement* CustomElement::createCustomElementSync(Document& document, const QualifiedName& tagName)
{
- CHECK(shouldCreateCustomElement(tagName));
+ DCHECK(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
@@ -136,7 +122,7 @@ HTMLElement* CustomElement::createCustomElementSync(Document& document, const Qu
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