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

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

Issue 1996213002: Add a tuple of name, local name for hashing custom element definitions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Bring patch to head. Created 4 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CustomElementDescriptor_h
6 #define CustomElementDescriptor_h
7
8 #include "core/CoreExport.h"
9 #include "wtf/Allocator.h"
10 #include "wtf/HashTableDeletedValueType.h"
11 #include "wtf/text/AtomicString.h"
12
13 namespace blink {
14
15 // Describes what elements a custom element definition applies to.
16 //
17 // There are two kinds of definitions: The first has its own tag name;
18 // in this case the "name" (definition name) and local name (tag name)
19 // are the same. The second kind customizes a built-in element; in
20 // that case, the descriptor's local name will be a built-in element
21 // name, or an unknown element name that is *not* a valid custom
22 // element name.
23 //
24 // This type is used when the kind of custom element definition is
25 // known, and generally the difference is important. For example, a
26 // definition for "my-element", "my-element" must not be applied to an
27 // element <button is="my-element">.
28 class CORE_EXPORT CustomElementDescriptor final {
29 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
30 public:
31 CustomElementDescriptor()
32 {
33 }
34
35 CustomElementDescriptor(
36 const AtomicString& name,
37 const AtomicString& localName)
38 : m_name(name)
39 , m_localName(localName)
40 {
41 }
42
43 explicit CustomElementDescriptor(WTF::HashTableDeletedValueType value)
44 : m_name(value)
45 {
46 }
47
48 bool isHashTableDeletedValue() const
49 {
50 return m_name.isHashTableDeletedValue();
51 }
52
53 bool operator==(const CustomElementDescriptor& other) const
54 {
55 return m_name == other.m_name && m_localName == other.m_localName;
56 }
57
58 const AtomicString& name() const { return m_name; }
59 const AtomicString& localName() const { return m_localName; }
60
61 private:
62 AtomicString m_name;
63 AtomicString m_localName;
64 };
65
66 } // namespace blink
67
68 #endif // CustomElementDescriptor_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698