| OLD | NEW |
| 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 struct CustomElementDescriptorHash; | 40 struct CustomElementDescriptorHash; |
| 41 | 41 |
| 42 // A Custom Element descriptor is everything necessary to match a | 42 // A Custom Element descriptor is everything necessary to match a |
| 43 // Custom Element instance to a definition. | 43 // Custom Element instance to a definition. |
| 44 class CustomElementDescriptor { | 44 class CustomElementDescriptor { |
| 45 ALLOW_ONLY_INLINE_ALLOCATION(); | 45 ALLOW_ONLY_INLINE_ALLOCATION(); |
| 46 public: | 46 public: |
| 47 CustomElementDescriptor(const AtomicString& type, const AtomicString& localN
ame) | 47 CustomElementDescriptor(const AtomicString& localName) |
| 48 : m_type(type) | 48 : m_localName(localName) |
| 49 , m_localName(localName) | |
| 50 { | 49 { |
| 51 } | 50 } |
| 52 | 51 |
| 53 ~CustomElementDescriptor() { } | 52 ~CustomElementDescriptor() { } |
| 54 | 53 |
| 55 // The tag name. | 54 // The tag name. |
| 56 const AtomicString& localName() const { return m_localName; } | 55 const AtomicString& localName() const { return m_localName; } |
| 57 | 56 |
| 58 // The name of the definition. For custom tags, this is the tag | |
| 59 // name and the same as "localName". For type extensions, this is | |
| 60 // the value of the "is" attribute. | |
| 61 const AtomicString& type() const { return m_type; } | |
| 62 | |
| 63 bool isTypeExtension() const { return m_type != m_localName; } | |
| 64 | |
| 65 // Stuff for hashing. | 57 // Stuff for hashing. |
| 66 | 58 |
| 67 CustomElementDescriptor() { } | 59 CustomElementDescriptor() { } |
| 68 explicit CustomElementDescriptor(WTF::HashTableDeletedValueType value) | 60 explicit CustomElementDescriptor(WTF::HashTableDeletedValueType value) |
| 69 : m_type(value) { } | 61 : m_localName(value) { } |
| 70 bool isHashTableDeletedValue() const { return m_type.isHashTableDeletedValue
(); } | 62 bool isHashTableDeletedValue() const { return m_localName.isHashTableDeleted
Value(); } |
| 71 | 63 |
| 72 bool operator==(const CustomElementDescriptor& other) const | 64 bool operator==(const CustomElementDescriptor& other) const |
| 73 { | 65 { |
| 74 return m_type == other.m_type | 66 return m_localName == other.m_localName; |
| 75 && m_localName == other.m_localName; | |
| 76 } | 67 } |
| 77 | 68 |
| 78 private: | 69 private: |
| 79 AtomicString m_type; | |
| 80 AtomicString m_localName; | 70 AtomicString m_localName; |
| 81 }; | 71 }; |
| 82 | 72 |
| 83 } // namespace blink | 73 } // namespace blink |
| 84 | 74 |
| 85 namespace WTF { | 75 namespace WTF { |
| 86 | 76 |
| 87 template<typename T> struct DefaultHash; | 77 template<typename T> struct DefaultHash; |
| 88 template<> struct DefaultHash<blink::CustomElementDescriptor> { | 78 template<> struct DefaultHash<blink::CustomElementDescriptor> { |
| 89 typedef blink::CustomElementDescriptorHash Hash; | 79 typedef blink::CustomElementDescriptorHash Hash; |
| 90 }; | 80 }; |
| 91 | 81 |
| 92 } // namespace WTF | 82 } // namespace WTF |
| 93 | 83 |
| 94 #endif // SKY_ENGINE_CORE_DOM_CUSTOM_CUSTOMELEMENTDESCRIPTOR_H_ | 84 #endif // SKY_ENGINE_CORE_DOM_CUSTOM_CUSTOMELEMENTDESCRIPTOR_H_ |
| OLD | NEW |