| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2014 Apple Inc. All rights reserved. | 3 * Copyright (C) 2014 Apple Inc. All rights reserved. |
| 4 * Copyright (C) 2014 Samsung Electronics. All rights reserved. | 4 * Copyright (C) 2014 Samsung Electronics. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions are | 7 * modification, are permitted provided that the following conditions are |
| 8 * met: | 8 * met: |
| 9 * | 9 * |
| 10 * * Redistributions of source code must retain the above copyright | 10 * * Redistributions of source code must retain the above copyright |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 */ | 31 */ |
| 32 | 32 |
| 33 #ifndef AttributeCollection_h | 33 #ifndef AttributeCollection_h |
| 34 #define AttributeCollection_h | 34 #define AttributeCollection_h |
| 35 | 35 |
| 36 #include "core/dom/Attr.h" | 36 #include "core/dom/Attr.h" |
| 37 #include "core/dom/Attribute.h" | 37 #include "core/dom/Attribute.h" |
| 38 #include "wtf/Allocator.h" |
| 38 #include "wtf/Vector.h" | 39 #include "wtf/Vector.h" |
| 39 | 40 |
| 40 namespace blink { | 41 namespace blink { |
| 41 | 42 |
| 42 template <typename Container, typename ContainerMemberType = Container> | 43 template <typename Container, typename ContainerMemberType = Container> |
| 43 class AttributeCollectionGeneric { | 44 class AttributeCollectionGeneric { |
| 45 STACK_ALLOCATED(); |
| 44 public: | 46 public: |
| 45 using ValueType = typename Container::ValueType; | 47 using ValueType = typename Container::ValueType; |
| 46 using iterator = ValueType*; | 48 using iterator = ValueType*; |
| 47 | 49 |
| 48 AttributeCollectionGeneric(Container& attributes) | 50 AttributeCollectionGeneric(Container& attributes) |
| 49 : m_attributes(attributes) | 51 : m_attributes(attributes) |
| 50 { } | 52 { } |
| 51 | 53 |
| 52 ValueType& operator[](unsigned index) const { return at(index); } | 54 ValueType& operator[](unsigned index) const { return at(index); } |
| 53 ValueType& at(unsigned index) const | 55 ValueType& at(unsigned index) const |
| (...skipping 14 matching lines...) Expand all Loading... |
| 68 size_t findIndex(const AtomicString& name, bool shouldIgnoreCase) const; | 70 size_t findIndex(const AtomicString& name, bool shouldIgnoreCase) const; |
| 69 size_t findIndex(Attr*) const; | 71 size_t findIndex(Attr*) const; |
| 70 | 72 |
| 71 protected: | 73 protected: |
| 72 size_t findSlowCase(const AtomicString& name, bool shouldIgnoreAttributeCase
) const; | 74 size_t findSlowCase(const AtomicString& name, bool shouldIgnoreAttributeCase
) const; |
| 73 | 75 |
| 74 ContainerMemberType m_attributes; | 76 ContainerMemberType m_attributes; |
| 75 }; | 77 }; |
| 76 | 78 |
| 77 class AttributeArray { | 79 class AttributeArray { |
| 80 DISALLOW_ALLOCATION(); |
| 78 public: | 81 public: |
| 79 using ValueType = const Attribute; | 82 using ValueType = const Attribute; |
| 80 | 83 |
| 81 AttributeArray(const Attribute* array, unsigned size) | 84 AttributeArray(const Attribute* array, unsigned size) |
| 82 : m_array(array) | 85 : m_array(array) |
| 83 , m_size(size) | 86 , m_size(size) |
| 84 { } | 87 { } |
| 85 | 88 |
| 86 const Attribute* data() const { return m_array; } | 89 const Attribute* data() const { return m_array; } |
| 87 unsigned size() const { return m_size; } | 90 unsigned size() const { return m_size; } |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 if (equalPossiblyIgnoringCase(name, it->name().toString(), shouldIgn
oreAttributeCase)) | 215 if (equalPossiblyIgnoringCase(name, it->name().toString(), shouldIgn
oreAttributeCase)) |
| 213 return index; | 216 return index; |
| 214 } | 217 } |
| 215 } | 218 } |
| 216 return kNotFound; | 219 return kNotFound; |
| 217 } | 220 } |
| 218 | 221 |
| 219 } // namespace blink | 222 } // namespace blink |
| 220 | 223 |
| 221 #endif // AttributeCollection_h | 224 #endif // AttributeCollection_h |
| OLD | NEW |