Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
| 5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 6 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2012 Apple Inc. All rights | 6 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2012 Apple Inc. All rights |
| 7 * reserved. | 7 * reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 // mutates an Element's internal attribute storage may invalidate them. | 46 // mutates an Element's internal attribute storage may invalidate them. |
| 47 const AtomicString& value() const { return m_value; } | 47 const AtomicString& value() const { return m_value; } |
| 48 const AtomicString& prefix() const { return m_name.prefix(); } | 48 const AtomicString& prefix() const { return m_name.prefix(); } |
| 49 const AtomicString& localName() const { return m_name.localName(); } | 49 const AtomicString& localName() const { return m_name.localName(); } |
| 50 const AtomicString& namespaceURI() const { return m_name.namespaceURI(); } | 50 const AtomicString& namespaceURI() const { return m_name.namespaceURI(); } |
| 51 | 51 |
| 52 const QualifiedName& name() const { return m_name; } | 52 const QualifiedName& name() const { return m_name; } |
| 53 | 53 |
| 54 bool isEmpty() const { return m_value.isEmpty(); } | 54 bool isEmpty() const { return m_value.isEmpty(); } |
| 55 bool matches(const QualifiedName&) const; | 55 bool matches(const QualifiedName&) const; |
| 56 bool matchesCaseInsensitive(const QualifiedName&) const; | |
| 56 | 57 |
| 57 void setValue(const AtomicString& value) { m_value = value; } | 58 void setValue(const AtomicString& value) { m_value = value; } |
| 58 | 59 |
| 59 // Note: This API is only for HTMLTreeBuilder. It is not safe to change the | 60 // Note: This API is only for HTMLTreeBuilder. It is not safe to change the |
| 60 // name of an attribute once parseAttribute has been called as DOM | 61 // name of an attribute once parseAttribute has been called as DOM |
| 61 // elements may have placed the Attribute in a hash by name. | 62 // elements may have placed the Attribute in a hash by name. |
| 62 void parserSetName(const QualifiedName& name) { m_name = name; } | 63 void parserSetName(const QualifiedName& name) { m_name = name; } |
| 63 | 64 |
| 64 #if COMPILER(MSVC) | 65 #if COMPILER(MSVC) |
| 65 // NOTE: This constructor is not actually implemented, it's just defined so | 66 // NOTE: This constructor is not actually implemented, it's just defined so |
| 66 // MSVC will let us use a zero-length array of Attributes. | 67 // MSVC will let us use a zero-length array of Attributes. |
| 67 Attribute(); | 68 Attribute(); |
| 68 #endif | 69 #endif |
| 69 | 70 |
| 70 private: | 71 private: |
| 71 QualifiedName m_name; | 72 QualifiedName m_name; |
| 72 AtomicString m_value; | 73 AtomicString m_value; |
| 73 }; | 74 }; |
| 74 | 75 |
| 75 inline bool Attribute::matches(const QualifiedName& qualifiedName) const { | 76 inline bool Attribute::matches(const QualifiedName& qualifiedName) const { |
| 76 if (qualifiedName.localName() != localName()) | 77 if (qualifiedName.localName() != localName()) |
| 77 return false; | 78 return false; |
| 78 return qualifiedName.prefix() == starAtom || | 79 return qualifiedName.prefix() == starAtom || |
| 79 qualifiedName.namespaceURI() == namespaceURI(); | 80 qualifiedName.namespaceURI() == namespaceURI(); |
| 80 } | 81 } |
| 81 | 82 |
| 83 inline bool Attribute::matchesCaseInsensitive( | |
| 84 const QualifiedName& qualifiedName) const { | |
| 85 if (qualifiedName.localNameUpper() != m_name.localNameUpper()) | |
|
sashab
2016/11/11 00:16:52
You could move this into the return statement :)
rune
2016/11/11 09:49:23
Done.
| |
| 86 return false; | |
| 87 return qualifiedName.prefix() == starAtom || | |
| 88 qualifiedName.namespaceURI() == namespaceURI(); | |
| 89 } | |
| 90 | |
| 82 } // namespace blink | 91 } // namespace blink |
| 83 | 92 |
| 84 #endif // Attribute_h | 93 #endif // Attribute_h |
| OLD | NEW |